Skip to content

Commit

Permalink
Fix config test failing
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Jan 14, 2019
1 parent 4e34ddf commit 1dbc93b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
16 changes: 12 additions & 4 deletions HelperLib/HelperLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using RGiesecke.DllExport;

Expand Down Expand Up @@ -146,10 +147,10 @@ public static void FixConfig([MarshalAs(UnmanagedType.LPWStr)] string path)
|| !s.Contains(h.ToString(CultureInfo.InvariantCulture)))
throw new Exception();

var _ = float.Parse(r.Element("FullScreen").Value);
_ = int.Parse(r.Element("Quality").Value);
_ = int.Parse(r.Element("Display").Value);
_ = int.Parse(r.Element("Language").Value);
var _ = bool.Parse(r.Element("FullScreen").Value);
CheckRange(r.Element("Quality").Value, 0, 2);
CheckRange(r.Element("Display").Value, 0, Screen.AllScreens.Length);
CheckRange(r.Element("Language").Value, 0, 2);
}
catch (Exception e)
{
Expand All @@ -158,6 +159,13 @@ public static void FixConfig([MarshalAs(UnmanagedType.LPWStr)] string path)
}
}

private static void CheckRange(string instr, int min, int max)
{
var val = int.Parse(instr);
if(min > val || val > max)
throw new Exception();
}

[DllExport("RemoveJapaneseCards", CallingConvention = CallingConvention.StdCall)]
public static void RemoveJapaneseCards([MarshalAs(UnmanagedType.LPWStr)] string path)
{
Expand Down
1 change: 1 addition & 0 deletions HelperLib/HelperLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions HelperLibTests/HelperLibTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ public void RemoveSideloaderDuplicatesTest()
{
HelperLib.RemoveSideloaderDuplicates(@"D:\_Koikatu\_koikatu hf patch test");
}

[TestMethod()]
public void FixConfigTest()
{
HelperLib.FixConfig(@"D:\_Koikatu\_koikatu hf patch test");
}
}
}
6 changes: 3 additions & 3 deletions patch.iss
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Name: "FIX"; Description: "{cm:CompFIX}"; Types: extra
Name: "FIX\MoreAccessories"; Description: "MoreAccessories 1.0.3 by Joan6694 (Needed to use and edit some characters)"; Types: full_en full extra
Name: "FIX\KKABMX"; Description: "KKABMX v2.2 (More sliders in maker, needed to use and edit some characters)"; Types: full_en full extra
Name: "FIX\KSOX"; Description: "KSOX v2.2 (Add overlays to maker, needed to use and edit some characters)"; Types: full_en full extra
Name: "FIX\KSOX\KK_SkinEffects"; Description: "Additional Skin Effects v1 (Add simple effects for sweating, shower, bukkake and deflowering)"; Types: extra
Name: "FIX\KSOX\KK_SkinEffects"; Description: "Additional Skin Effects v1 (Add simple effects for sweating, shower, bukkake and deflowering)"; Types: full_en full extra
Name: "FIX\KKPE"; Description: "KKPE 1.1.0 by Joan6694 (Advanced studio controls)"; Types: full_en full extra
Name: "FIX\KK_GUIDMigration"; Description: "KK_GUIDMigration v1.2.2 (Improves card and scene compatibility)"; Types: full_en full extra
Name: "FIX\KK_CutsceneLockupFix"; Description: "KK_CutsceneLockupFix v1.0 (Fixes some mods crashing story)"; Types: full_en full extra
Expand All @@ -100,7 +100,7 @@ Name: "FIX\Bra"; Description: "Bra Push-Up Mod / KK_Kiyase 0.2.0 (Bras affect br
Name: "FIX\Collider"; Description: "Atari 2.1 by Stinger722 (Breast and hair collisions)"; Types: extra
Name: "FIX\SkirtFix"; Description: "Vanilla Skirt Fix by Stinger722 (Less clipping)"; Types: extra
Name: "FIX\Pupils"; Description: "Smaller Heart Pupil v1.1 (Better-looking ahegao eyes)"; Types: full_en full extra
;Name: "FIX\KK_Ahegao"; Description: "KK_Ahegao v1.6 (Make girl cum 3 times for ahegao)"; Types: extra
Name: "FIX\KK_Ahegao"; Description: "KK_Ahegao v1.8 (Make girl cum 3 times for ahegao)"; Types: full_en full extra
Name: "FIX\GraphicsSettings"; Description: "GraphicsSettings 2018-11-04 (More game settings, allows better quality)"; Types: extra
Name: "FIX\KK_ForceHighPoly"; Description: "KK_ForceHighPoly v1.1 (Full-quality characters in school, very resource-heavy)"; Types: extra
Name: "FIX\KK_BetterColorPicker"; Description: "KK_BetterColorPicker v1.0 (Select color from anywhere on screen in maker, useful for copying colors from reference images)"; Types: full_en full extra
Expand Down Expand Up @@ -202,7 +202,7 @@ Source: "Input\_Fix\KK_Kiyase\*"; DestDir: "{app}"; Flags: ignoreversion recurse
Source: "Input\_Fix\atari2.1 (normal bust).zipmod"; DestDir: "{app}\mods"; Flags: ignoreversion; Components: FIX\Collider
Source: "Input\_Fix\[Stinger722]Vanilla Skirt Fix.zipmod"; DestDir: "{app}\mods"; Flags: ignoreversion; Components: FIX\SkirtFix
Source: "Input\_Fix\[DeathWeasel]Smaller Heart Pupil v1.1.zipmod"; DestDir: "{app}\mods"; Flags: ignoreversion; Components: FIX\Pupils
;Source: "Input\_Fix\KK_Ahegao.dll"; DestDir: "{app}\BepInEx"; Flags: ignoreversion; Components: FIX\KK_Ahegao
Source: "Input\_Fix\KK_Ahegao.dll"; DestDir: "{app}\BepInEx"; Flags: ignoreversion; Components: FIX\KK_Ahegao
Source: "Input\_Fix\KK_ForceHighPoly.dll"; DestDir: "{app}\BepInEx"; Flags: ignoreversion; Components: FIX\KK_ForceHighPoly
Source: "Input\_Fix\GraphicsSettings.dll"; DestDir: "{app}\BepInEx"; Flags: ignoreversion; Components: FIX\GraphicsSettings
Source: "Input\_Fix\KK_BetterColorPicker\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: FIX\KK_BetterColorPicker
Expand Down

0 comments on commit 1dbc93b

Please sign in to comment.