diff --git a/SoG_SGreader.Test/DataReaderTests.cs b/SoG_SGreader.Test/DataReaderTests.cs index 281e31f..04545fd 100644 --- a/SoG_SGreader.Test/DataReaderTests.cs +++ b/SoG_SGreader.Test/DataReaderTests.cs @@ -22,7 +22,11 @@ private static Player GetSaveGame(int saveGameNumber) if (Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null) { projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE"); } - + else + { + projectDirectory = Path.Combine(projectDirectory, "SoG_SGreader"); + } + string filePath = Path.Combine(projectDirectory, "SoG_SGreader.Test", "SaveGames", saveGameNumber + ".cha"); return DataReader.ReadFromFile(filePath, fakeTextBox); diff --git a/SoG_SGreader.Test/IntegrationTests.cs b/SoG_SGreader.Test/IntegrationTests.cs index 30923e8..6e15d01 100644 --- a/SoG_SGreader.Test/IntegrationTests.cs +++ b/SoG_SGreader.Test/IntegrationTests.cs @@ -16,7 +16,11 @@ private static string GetExePath() projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE"); return Path.Combine(projectDirectory, "SoG_SGreader", "bin", "Release", "SoG_SGreader.exe"); } - + else + { + projectDirectory = Path.Combine(projectDirectory, "SoG_SGreader"); + } + return Path.Combine(projectDirectory, "SoG_SGreader", "bin", "Debug", "SoG_SGreader.exe"); } @@ -27,6 +31,10 @@ private static string GetSaveGamePath(string saveGameNumber) // Exception for GitHub Actions Test Runner if (Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null) { projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE"); + } + else + { + projectDirectory = Path.Combine(projectDirectory,"SoG_SGreader"); } return Path.Combine(projectDirectory, "SoG_SGreader.Test", "SaveGames", saveGameNumber + ".cha"); @@ -54,7 +62,7 @@ public void TestBadPath() string output = process.StandardOutput.ReadToEnd(); process.WaitForExit(); - Assert.Contains("Could not find file", output); + Assert.Contains("Could not read savegame", output); Assert.Contains(Path.Combine("SaveGames", "doesntexist.cha"), output); } diff --git a/SoG_SGreader/DataWriter.cs b/SoG_SGreader/DataWriter.cs index 21011ab..f67dc92 100644 --- a/SoG_SGreader/DataWriter.cs +++ b/SoG_SGreader/DataWriter.cs @@ -116,8 +116,8 @@ public void WriteToFile(string fileName) writeBinary.Write(playerObject.SkillGoldPoints); writeBinary.Write(playerObject.Cash); - writeBinary.Write(playerObject.PetsCount); - for (var i = 0; i != playerObject.PetsCount; i++) + writeBinary.Write(playerObject.Pets.Count); + for (var i = 0; i != playerObject.Pets.Count; i++) { var currentPet = playerObject.Pets[i]; diff --git a/SoG_SGreader/Forms/FrmMain.Designer.cs b/SoG_SGreader/Forms/FrmMain.Designer.cs index b531987..2974914 100644 --- a/SoG_SGreader/Forms/FrmMain.Designer.cs +++ b/SoG_SGreader/Forms/FrmMain.Designer.cs @@ -151,7 +151,7 @@ private void InitializeComponent() this.cblstCards = new System.Windows.Forms.CheckedListBox(); this.tabQuickslots = new System.Windows.Forms.TabPage(); this.label57 = new System.Windows.Forms.Label(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.grpQuickslots = new System.Windows.Forms.GroupBox(); this.label22 = new System.Windows.Forms.Label(); this.label21 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); @@ -296,7 +296,7 @@ private void InitializeComponent() this.tabCards.SuspendLayout(); this.grpCards.SuspendLayout(); this.tabQuickslots.SuspendLayout(); - this.groupBox3.SuspendLayout(); + this.grpQuickslots.SuspendLayout(); this.tabSkills.SuspendLayout(); this.tabControl1.SuspendLayout(); this.tabSkillsMelee.SuspendLayout(); @@ -1641,7 +1641,7 @@ private void InitializeComponent() // tabQuickslots // this.tabQuickslots.Controls.Add(this.label57); - this.tabQuickslots.Controls.Add(this.groupBox3); + this.tabQuickslots.Controls.Add(this.grpQuickslots); this.tabQuickslots.Location = new System.Drawing.Point(4, 22); this.tabQuickslots.Name = "tabQuickslots"; this.tabQuickslots.Padding = new System.Windows.Forms.Padding(3); @@ -1662,24 +1662,24 @@ private void InitializeComponent() this.label57.Text = "* = support for this function was removed due to the risk of losing your save gam" + "e"; // - // groupBox3 - // - this.groupBox3.Controls.Add(this.label22); - this.groupBox3.Controls.Add(this.label21); - this.groupBox3.Controls.Add(this.label18); - this.groupBox3.Controls.Add(this.label19); - this.groupBox3.Controls.Add(this.label20); - this.groupBox3.Controls.Add(this.label23); - this.groupBox3.Controls.Add(this.label24); - this.groupBox3.Controls.Add(this.label25); - this.groupBox3.Controls.Add(this.label26); - this.groupBox3.Controls.Add(this.label27); - this.groupBox3.Location = new System.Drawing.Point(6, 6); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(341, 294); - this.groupBox3.TabIndex = 29; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "Quckslots"; + // grpQuickslots + // + this.grpQuickslots.Controls.Add(this.label22); + this.grpQuickslots.Controls.Add(this.label21); + this.grpQuickslots.Controls.Add(this.label18); + this.grpQuickslots.Controls.Add(this.label19); + this.grpQuickslots.Controls.Add(this.label20); + this.grpQuickslots.Controls.Add(this.label23); + this.grpQuickslots.Controls.Add(this.label24); + this.grpQuickslots.Controls.Add(this.label25); + this.grpQuickslots.Controls.Add(this.label26); + this.grpQuickslots.Controls.Add(this.label27); + this.grpQuickslots.Location = new System.Drawing.Point(6, 6); + this.grpQuickslots.Name = "grpQuickslots"; + this.grpQuickslots.Size = new System.Drawing.Size(341, 294); + this.grpQuickslots.TabIndex = 29; + this.grpQuickslots.TabStop = false; + this.grpQuickslots.Text = "Quckslots"; // // label22 // @@ -2898,8 +2898,8 @@ private void InitializeComponent() this.grpCards.ResumeLayout(false); this.tabQuickslots.ResumeLayout(false); this.tabQuickslots.PerformLayout(); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); + this.grpQuickslots.ResumeLayout(false); + this.grpQuickslots.PerformLayout(); this.tabSkills.ResumeLayout(false); this.tabControl1.ResumeLayout(false); this.tabSkillsMelee.ResumeLayout(false); @@ -3011,7 +3011,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem jSONToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; - private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox grpQuickslots; diff --git a/SoG_SGreader/Forms/FrmMain.cs b/SoG_SGreader/Forms/FrmMain.cs index f1f6f6b..6112387 100644 --- a/SoG_SGreader/Forms/FrmMain.cs +++ b/SoG_SGreader/Forms/FrmMain.cs @@ -90,9 +90,8 @@ private void InitElements() // Designer Items Size = new Size(79, 21), Enabled = false }; - groupBox3.Controls.Add(cbQuickslotType[i]); - groupBox3.Controls.Add(cbQuickslot[i]); - cbQuickslotType[i].SelectedIndexChanged += new System.EventHandler(QuickslotType_SelectedIndexChanged); + grpQuickslots.Controls.Add(cbQuickslotType[i]); + grpQuickslots.Controls.Add(cbQuickslot[i]); iQuickslotYpos -= 27; } @@ -309,6 +308,7 @@ private void GetDataFromFields() playerObject.Style.Weapon = (int)Enum.Parse(typeof(SogItems), cbStyleWeapon.Text); playerObject.Style.Shield = (int)Enum.Parse(typeof(SogItems), cbStyleShield.Text); + /* TODO: Quickslots are not being saved correctly, we need to fix this for (int i = 0; i < 10; i++) { if (cbQuickslotType[i].Text == nameof(SogItems)) @@ -323,9 +323,10 @@ private void GetDataFromFields() } else { - playerObject.Quickslots[i] = (int)0; - } + //playerObject.Quickslots[i] = 0; + playerObject.Quickslots[i] = playerObject.Quickslots[i]; } + }*/ playerObject.ItemsCount = lstInventory.Items.Count; playerObject.Inventory.Clear();