Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Add index of audio files
Browse files Browse the repository at this point in the history
  • Loading branch information
hexstr committed Apr 11, 2020
1 parent 2b98233 commit 3679a11
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 16 deletions.
6 changes: 3 additions & 3 deletions FGOAssetsModifyTool/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
</configuration>
16 changes: 16 additions & 0 deletions FGOAssetsModifyTool/CatAndMouseGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@

public class CatAndMouseGame
{
static string salt = "pN6ds2Bg";
public static string GetMD5String(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.UTF8.GetBytes(input + salt);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}

private static byte[] BattleIV = new byte[32];
private static byte[] BattleKey = new byte[32];
public static void CN()
Expand Down
10 changes: 4 additions & 6 deletions FGOAssetsModifyTool/FGOAssetsModifyTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FGOAssetsModifyTool</RootNamespace>
<AssemblyName>FGOAssetsModifyTool</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -34,11 +35,11 @@
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.1.0.145, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\ICSharpCode.SharpZipLib.dll</HintPath>
<HintPath>..\..\..\..\VS Projects\NetLib\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\..\..\VS Projects\NetLib\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -47,9 +48,6 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\UnityHack\UnityHack\bin\Debug\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CatAndMouseGame.cs" />
Expand Down
41 changes: 34 additions & 7 deletions FGOAssetsModifyTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static void displayMenu()
"69: 切换为美服密钥\n" +
"67: 切换为国服密钥");
int arg = Convert.ToInt32(Console.ReadLine());
string path = System.IO.Directory.GetCurrentDirectory();
string path = Directory.GetCurrentDirectory();
DirectoryInfo folder = new DirectoryInfo(path + @"\Android\");
DirectoryInfo decrypt = new DirectoryInfo(path + @"\Decrypt\");
DirectoryInfo encrypt = new DirectoryInfo(path + @"\Encrypt\");
Expand Down Expand Up @@ -223,17 +223,44 @@ static void displayMenu()
{
string[] assetStore = File.ReadAllLines(folder.FullName + "AssetStorage_dec.txt");
Console.WriteLine("Parsing json...");
JArray jarray = new JArray();
JArray AudioArray = new JArray();
//JArray MovieArray = new JArray();
JArray AssetArray = new JArray();
for (int i = 2; i < assetStore.Length; ++i)
{
string[] tmp = assetStore[i].Split(',');
string assetName = tmp[tmp.Length - 1].Replace('/', '@') + ".unity3d";
string fileName = CatAndMouseGame.getShaName(assetName);
jarray.Add(new JObject(new JProperty("assetName", assetName), new JProperty("fileName", fileName)));
string assetName;
string fileName;

if (tmp[4].Contains("Audio"))
{
assetName = tmp[tmp.Length - 1].Replace('/', '@');
fileName = CatAndMouseGame.GetMD5String(assetName);
AudioArray.Add(new JObject(new JProperty("audioName", assetName), new JProperty("fileName", fileName)));
}
//else if (tmp[4].Contains("Movie"))
//{
// assetName = tmp[tmp.Length - 1].Replace('/', '@');
// fileName = CatAndMouseGame.GetMD5String(assetName);
// MovieArray.Add(new JObject(new JProperty("movieName", assetName), new JProperty("fileName", fileName)));
//}
else if(!tmp[4].Contains("Movie"))
{
assetName = tmp[tmp.Length - 1].Replace('/', '@');
fileName = CatAndMouseGame.GetMD5String(assetName);
AssetArray.Add(new JObject(new JProperty("assetName", assetName), new JProperty("fileName", fileName)));
}
}
JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
String jsonWithConverter = JsonConvert.SerializeObject(jarray, serializerSettings);
File.WriteAllText(folder.FullName + "AssetStorageName.json", jsonWithConverter.ToString());
String AudioArrayConverter = JsonConvert.SerializeObject(AudioArray, serializerSettings);
//String MovieArrayConverter = JsonConvert.SerializeObject(MovieArray, serializerSettings);
String AssetArrayConverter = JsonConvert.SerializeObject(AssetArray, serializerSettings);
Console.WriteLine("Writing file to: AudioName.json");
File.WriteAllText(folder.FullName + "AudioName.json", AudioArrayConverter.ToString());
//Console.WriteLine("Writing file to: MovieName.json");
//File.WriteAllText(folder.FullName + "MovieName.json", MovieArrayConverter.ToString());
Console.WriteLine("Writing file to: AssetName.json");
File.WriteAllText(folder.FullName + "AssetName.json", AssetArrayConverter.ToString());
break;
}
case 11:
Expand Down

0 comments on commit 3679a11

Please sign in to comment.