示例#1
0
        private static void CompileFile(string path)
        {
            var    fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
            string outFileName = Path.Combine(Path.GetDirectoryName(path), fileNameWithoutExtension);

            using (FileStream input = new FileStream(path, FileMode.Open))
                using (FileStream output = new FileStream(outFileName, FileMode.Create))
                {
                    try
                    {
                        Console.WriteLine("Compiling {0}", path);
                        FoxConverter.CompileFox(input, output);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error compiling {0}: {1}", path, e);
                    }
                }
        }
示例#2
0
        private static void DecompileFile(FileInfo file)
        {
            string fileName   = string.Format("{0}.xml", Path.GetFileName(file.Name));
            string outputName = Path.Combine(file.DirectoryName, fileName);

            using (FileStream input = new FileStream(file.FullName, FileMode.Open))
                using (FileStream output = new FileStream(outputName, FileMode.Create))
                {
                    try
                    {
                        FoxLookupTable lookupTable = new FoxLookupTable(GlobalHashNameDictionary);
                        var            foxFile     = FoxFile.ReadFoxFile(input, lookupTable);
                        FoxConverter.DecompileFox(foxFile, output);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error decompiling {0}: {1}", file.FullName, e);
                    }
                }
        }