diff --git a/.gitignore b/.gitignore index 1518643da..d191d4144 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ Config/bin/ Config/obj/ +Decode/bin/ +Decode/obj/ DeviceTest/bin/ DeviceTest/obj/ Dirichlet.Numerics/bin diff --git a/Decode/Decode.csproj b/Decode/Decode.csproj new file mode 100644 index 000000000..cd170fc7b --- /dev/null +++ b/Decode/Decode.csproj @@ -0,0 +1,64 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {D476ABBE-A455-4476-8A8D-3F6151217B51} + Exe + Properties + Decode + Decode + v4.0 + + + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + Decode.Program + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Decode/Decode.csproj.user b/Decode/Decode.csproj.user new file mode 100644 index 000000000..65b29562a --- /dev/null +++ b/Decode/Decode.csproj.user @@ -0,0 +1,9 @@ + + + + config.xml + + + config.xml + + \ No newline at end of file diff --git a/Decode/Program.cs b/Decode/Program.cs new file mode 100644 index 000000000..49c9e0d04 --- /dev/null +++ b/Decode/Program.cs @@ -0,0 +1,107 @@ +using System; +using System.IO; +using System.Security.Cryptography; + +namespace Decode +{ + class Program + { + static byte[] cryptoKey = new byte[] { 235, 7, 236, 58, 24, 225, 97, 102, 231, 1, 121, 12, 177, 145, 87, 200, + 102, 85, 152, 73, 230, 203, 101, 169, 242, 213, 228, 219, 239, 157, 245, 156 }; + + static byte[] cryptoIV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 }; + + static void Main(string[] args) + { + if ((args.Length < 1) || !File.Exists(args[0])) + { + Console.WriteLine("Usage: Decode "); + Console.ReadKey(); + return; + } + + string fileName = args[0]; + + try + { + using (StreamReader reader = new StreamReader(fileName)) + { + if (reader.ReadLine().StartsWith(" rotate files + if (File.Exists(fileName + ".bak")) File.Delete(fileName + ".bak"); + File.Move(fileName, fileName + ".bak"); + File.Move(fileName + ".plain", fileName); + return; + } + else + { + Failed(fileName); + return; + } + } + catch (Exception) + { + Failed(fileName); + return; + } + } + + static void Failed(string fileName) + { + if (File.Exists(fileName + ".plain")) + { + File.Delete(fileName + ".plain"); + } + Console.WriteLine(string.Format("Decoding file {0} failed.", fileName)); + Console.ReadKey(); + } + } +} diff --git a/Decode/Properties/AssemblyInfo.cs b/Decode/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..7b1ec09bf --- /dev/null +++ b/Decode/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Decode")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Decode")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c17ec788-0e12-4f9c-aadf-ea4e83a9f373")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Decode/app.config b/Decode/app.config new file mode 100644 index 000000000..e36560333 --- /dev/null +++ b/Decode/app.config @@ -0,0 +1,3 @@ + + + diff --git a/TBF.sln b/TBF.sln index 138a654b2..1bb3a95a7 100644 --- a/TBF.sln +++ b/TBF.sln @@ -48,6 +48,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GemCard", "GemCard\GemCard. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Statistics", "Statistics\Statistics.csproj", "{36755E1D-6FC3-4D9C-8DD3-0250D51532E0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Decode", "Decode\Decode.csproj", "{D476ABBE-A455-4476-8A8D-3F6151217B51}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -186,6 +188,16 @@ Global {36755E1D-6FC3-4D9C-8DD3-0250D51532E0}.Release|Mixed Platforms.Build.0 = Release|x86 {36755E1D-6FC3-4D9C-8DD3-0250D51532E0}.Release|x86.ActiveCfg = Release|x86 {36755E1D-6FC3-4D9C-8DD3-0250D51532E0}.Release|x86.Build.0 = Release|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Debug|Any CPU.ActiveCfg = Debug|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Debug|x86.ActiveCfg = Debug|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Debug|x86.Build.0 = Debug|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Release|Any CPU.ActiveCfg = Release|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Release|Mixed Platforms.Build.0 = Release|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Release|x86.ActiveCfg = Release|x86 + {D476ABBE-A455-4476-8A8D-3F6151217B51}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/clean.bat b/clean.bat index 697ba63cf..3a369e50d 100644 --- a/clean.bat +++ b/clean.bat @@ -1,5 +1,7 @@ rmdir /s /q Config\bin rmdir /s /q Config\obj +rmdir /s /q Decode\bin +rmdir /s /q Decode\obj rmdir /s /q DeviceTest\bin rmdir /s /q DeviceTest\obj rmdir /s /q Dirichlet.Numerics\bin