Skip to content

Commit

Permalink
Obsidian 2.1.2 (#35)
Browse files Browse the repository at this point in the history
* Update checks to support "tiers" in long bin paths (#29)

* Replace the bad folderdialog with the good one (#30)

* Replace the bad folderdialog with the good one

* working nuget packages

* moved project to .net 4.8

* Better config

* better map hash generation

* Update Fantome.Libraries.League.dll

* Update AssemblyInfo.cs
  • Loading branch information
Crauzer authored Dec 14, 2019
1 parent 58fe88f commit dc90d6d
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 139 deletions.
8 changes: 4 additions & 4 deletions Obsidian/App.config
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
Binary file modified Obsidian/Fantome.Libraries.League.dll
Binary file not shown.
259 changes: 133 additions & 126 deletions Obsidian/MainWindow.xaml.cs

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion Obsidian/Obsidian.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Obsidian</RootNamespace>
<AssemblyName>Obsidian</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -56,6 +56,12 @@
<Reference Include="MaterialDesignThemes.Wpf, Version=2.6.0.325, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.2.6.0\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.3.3, Culture=neutral, PublicKeyToken=8985beaab7ea3f04, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft-WindowsAPICodePack-Core.1.1.3.3\lib\net452\Microsoft.WindowsAPICodePack.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack.Shell, Version=1.1.3.3, Culture=neutral, PublicKeyToken=8985beaab7ea3f04, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft-WindowsAPICodePack-Shell.1.1.3.3\lib\net452\Microsoft.WindowsAPICodePack.Shell.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
Expand All @@ -81,6 +87,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Utils\Config.cs" />
<Compile Include="Utils\ConfigUtilities.cs" />
<Compile Include="Utils\Logging.cs" />
<Compile Include="Utils\WADHashGenerator.cs" />
Expand Down
4 changes: 2 additions & 2 deletions Obsidian/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1.2")]
[assembly: AssemblyFileVersion("2.1.1.2")]
[assembly: AssemblyVersion("2.1.2")]
[assembly: AssemblyFileVersion("2.1.2")]
2 changes: 1 addition & 1 deletion Obsidian/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Obsidian/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Obsidian/Utils/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.IO;

namespace Obsidian.Utils
{
public static class Config
{
private static Dictionary<string, object> _config;

public static void SetConfig(Dictionary<string, object> config)
{
_config = config;
}

public static object Get(string key)
{
return _config[key];
}
}
}
7 changes: 6 additions & 1 deletion Obsidian/Utils/ConfigUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ public static class ConfigUtilities
{ "WadSaveMajorVersion", 3L },
{ "WadSaveMinorVersion", 0L },
{ "GenerateWadDictionary", true },
{ "ParallelExtraction", true }
{ "ParallelExtraction", true },
{ "BinLongNameRegex", @"^DATA/.*_(Skins_Skin|Tiers_Tier|(Skins|Tiers)_Root).*\.bin$" },
{ "BinPackedKeywords", new string[]{"Skins", "Tiers" }},
{ "WadOpenDialogStartPath", ""},
{ "WadExtractDialogStartPath", "" },
{ "HashtableOpenDialogStartPath", "" }
};

public static Dictionary<string, object> ReadConfig()
Expand Down
36 changes: 34 additions & 2 deletions Obsidian/Utils/WADHashGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Fantome.Libraries.League.IO.BIN;
using Fantome.Libraries.League.IO.WAD;
using log4net;
using Newtonsoft.Json.Linq;

namespace Obsidian.Utils
{
Expand Down Expand Up @@ -100,6 +101,12 @@ private static IEnumerable<string> ProcessBINValue(BINValue value)
strings.Add(valueString.Insert(index + 1, "2x_"));
strings.Add(valueString.Insert(index + 1, "4x_"));
}

if(value.Property == Cryptography.FNV32Hash("mapPath"))
{
strings.Add("DATA/" + valueString + ".materials.bin");
strings.Add("DATA/" + valueString + ".mapgeo");
}
}
else if (value.Type == BINValueType.Optional)
{
Expand Down Expand Up @@ -177,7 +184,20 @@ private static IEnumerable<string> ProcessBINLinkedFiles(IEnumerable<string> lin
foreach (string fetchedString in linkedFiles)
{
strings.Add(fetchedString);
if (fetchedString.Contains("_Skins_Skin"))

bool containsKeyword = false;
string[] packedKeywords = (Config.Get("BinPackedKeywords") as JArray).ToObject<string[]>();
for (int i = 0; i < packedKeywords.Length; i++)
{
if(fetchedString.Contains("_" + packedKeywords[i] + "_"))
{
containsKeyword = true;
break;
}
}


if (containsKeyword)
{
strings.AddRange(ProcessBINPackedLinkedFile(fetchedString));
}
Expand All @@ -197,7 +217,7 @@ private static IEnumerable<string> ProcessBINPackedLinkedFile(string linkedStrin
for (int i = 0; i < unpacked.Length; i++)
{
string splitStringComponent = unpacked[i];
if (splitStringComponent != "Skins" && splitStringComponent != "Tiers")
if (!DetectPackedKeyword(splitStringComponent))
{
characterName += splitStringComponent + "_";
}
Expand All @@ -216,5 +236,17 @@ private static IEnumerable<string> ProcessBINPackedLinkedFile(string linkedStrin

return strings;
}

private static bool DetectPackedKeyword(string packed)
{
string[] keywords = (Config.Get("BinPackedKeywords") as JArray).ToObject<string[]>();

if (keywords.Contains(packed))
{
return true;
}

return false;
}
}
}
4 changes: 3 additions & 1 deletion Obsidian/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.8" targetFramework="net47" />
<package id="log4net" version="2.0.8" targetFramework="net462" />
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net462" />
<package id="MaterialDesignThemes" version="2.6.0" targetFramework="net462" />
<package id="Microsoft-WindowsAPICodePack-Core" version="1.1.3.3" targetFramework="net462" />
<package id="Microsoft-WindowsAPICodePack-Shell" version="1.1.3.3" targetFramework="net462" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net462" />
</packages>

0 comments on commit dc90d6d

Please sign in to comment.