コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to LEET!\nLibellus Event Editing Tool");
            if (args.Length < 1)
            {
                Console.WriteLine("Not Enough args!");
                return;
            }
            foreach (string file in args)
            {
                string ext = Path.GetExtension(file).ToLower();
                if (ext == ".pm1" || ext == ".pm2" || ext == ".pm3")
                {
                    Console.WriteLine("Coverting to Json: ", file);
                    PmdFile pmdFile = new(file);
                    pmdFile.ExtractPmd(new FileInfo(file).Directory.FullName + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file));
                    continue;
                }

                if (ext == ".json")
                {
                    Console.WriteLine("Coverting to PMD: ", file);
                    PmdFile pmdFile = PmdFile.FromJson(file);
                    string  pmdext  = "PM" + pmdFile.MagicCode[3];
                    pmdFile.Save(file + "." + pmdext);
                    //pmdFile2.Save("./output/" + name + ".lib.json" + Path.GetExtension(filePath));
                }
            }
            Console.WriteLine("Press Any Button To Exit.");
            Console.ReadKey();
            return;
        }
コード例 #2
0
        static void TestConversion(string filePath)
        {
            Console.WriteLine("Testing: {0}", filePath);
            PmdFile pmdFile = new(filePath);
            string  name    = Path.GetFileName(filePath);

            File.Copy(filePath, "./output/" + name);

            pmdFile.Save("./output/" + name + ".lib" + Path.GetExtension(filePath));
            string json = pmdFile.ToJson();

            using (BinaryWriter writer = new BinaryWriter(File.Create("./output/" + name + Path.GetExtension(filePath) + ".json")))
            {
                writer.Write(json);
            }
            PmdFile pmdFile2 = PmdFile.FromJson(json);

            pmdFile2.Save("./output/" + name + ".lib.json" + Path.GetExtension(filePath));
        }