Пример #1
0
        public static void Processor(bool Extract)
        {
            KKdFARC FARC = new KKdFARC();

            Console.Clear();
            if (Extract)
            {
                Console.Title = "FARC Extractor";
                Main.Choose(1, "farc", out string[] FileNames);
                foreach (string FileName in FileNames)
                {
                    if (FileName != "" && File.Exists(FileName))
                    {
                        FARC.UnPack(FileName);
                    }
                }
            }
            else
            {
                string file = Main.Choose(2, "", out string[] FileNames);
                Console.Clear();
                Console.Title = "FARC Creator";
                if (file != "")
                {
                    Main.ConsoleDesign(true);
                    Main.ConsoleDesign("         Choose type of created FARC:");
                    Main.ConsoleDesign(false);
                    Main.ConsoleDesign("1. FArc [DT/DT2nd/DTex/F/F2nd/X]");
                    Main.ConsoleDesign("2. FArC [DT/DT2nd/DTex/F/F2nd/X] (Compressed)");
                    Main.ConsoleDesign("3. FARC [F/F2nd/X] (Compressed)");
                    Main.ConsoleDesign("4. FARC [FT] (Compressed)");
                    Main.ConsoleDesign(false);
                    Main.ConsoleDesign("Note: Creating FT FARCs currently not supported.");
                    Main.ConsoleDesign(false);
                    Main.ConsoleDesign(true);
                    Console.WriteLine();
                    Console.WriteLine("Choosed folder: {0}", file);
                    Console.WriteLine();
                    int.TryParse(Console.ReadLine(), out int type);
                    if (type == 1)
                    {
                        FARC.Signature = KKdFARC.Farc.FArc;
                    }
                    else if (type == 3)
                    {
                        FARC.Signature = KKdFARC.Farc.FARC;
                    }
                    else
                    {
                        FARC.Signature = KKdFARC.Farc.FArC;
                    }
                    Console.Clear();
                    Console.Title = "FARC Creator - Directory: " + Path.GetDirectoryName(file);
                    FARC.Pack(file);
                }
            }
        }
Пример #2
0
        public static void Main(string[] args)
        {
            SetProcessDPIAware();

            Console.InputEncoding  = System.Text.Encoding.Unicode;
            Console.OutputEncoding = System.Text.Encoding.Unicode;

            Console.Title = "PD_Tool";
            if (args.Length == 0)
            {
                while (choose != "Q")
                {
                    MainMenu();
                }
                Exit();
            }

            long   header;
            Stream reader;

            foreach (string arg in args)
            {
                GC.Collect();
                if (Directory.Exists(arg))
                {
                    using (KKdFARC FARC = new KKdFARC(arg, true)
                    {
                        CompressionLevel = 9
                    }) FARC.Pack();
                }
                else if (File.Exists(arg) && Path.GetExtension(arg) == ".farc")
                {
                    using (KKdFARC farc = new KKdFARC(arg)) farc.Unpack(true);
                }
                else if (File.Exists(arg))
                {
                    using (reader = File.OpenReader(arg))
                        header = reader.RI64();
                    if (header == 0x454C494641564944)
                    {
                        KKdMainLib.DIVAFILE.Decrypt(arg);
                    }
                }
            }
            Exit();
        }
Пример #3
0
        public static void Processor(bool Extract)
        {
            KKdFARC FARC = new KKdFARC();

            Console.Clear();
            if (Extract)
            {
                Console.Title = "FARC Extractor";
                Main.Choose(1, "farc", out string[] FileNames);
                foreach (string FileName in FileNames)
                {
                    if (FileName != "" && File.Exists(FileName))
                    {
                        new KKdFARC(FileName).UnPack();
                    }
                }
            }
            else
            {
                string file = Main.Choose(2, "", out string[] FileNames);
                Console.Clear();
                Console.Title = "FARC Creator";
                if (file != "")
                {
                    FARC = new KKdFARC();
                    Main.ConsoleDesign(true);
                    Main.ConsoleDesign("         Choose type of created FARC:");
                    Main.ConsoleDesign(false);
                    Main.ConsoleDesign("1. FArc [DT/DT2nd/DTex/F/F2nd/X]");
                    Main.ConsoleDesign("2. FArC [DT/DT2nd/DTex/F/F2nd/X] (Compressed)");
                    Main.ConsoleDesign("3. FARC [F/F2nd/X]");
                    Main.ConsoleDesign(false);
                    Main.ConsoleDesign("R. Return to Main Menu");
                    Main.ConsoleDesign(false);
                    Main.ConsoleDesign(true);
                    Console.WriteLine();
                    Console.WriteLine("Choosed folder: {0}", file);
                    Console.WriteLine();
                    string type = Console.ReadLine().ToUpper();
                    if (type == "1")
                    {
                        FARC.Signature = KKdFARC.Farc.FArc;
                    }
                    else if (type == "3" || type == "4")
                    {
                        FARC.Signature = KKdFARC.Farc.FARC;

                        Console.WriteLine();
                        Main.ConsoleDesign(true);
                        Main.ConsoleDesign("             Choose type of FARC:");
                        Main.ConsoleDesign(false);
                        Main.ConsoleDesign("1. FARC");
                        Main.ConsoleDesign("2. FARC (Compressed)");
                        Main.ConsoleDesign("3. FARC (Encrypted)");
                        Main.ConsoleDesign("4. FARC (Compressed & Encrypted)");
                        Main.ConsoleDesign(false);
                        Main.ConsoleDesign(true);
                        Console.WriteLine();
                        type = Console.ReadLine();
                        if (type == "2" || type == "4")
                        {
                            FARC.FARCType |= KKdFARC.Type.GZip;
                        }
                        if (type == "3" || type == "4")
                        {
                            FARC.FARCType |= KKdFARC.Type.ECB;
                        }
                    }
                    else if (type == "R")
                    {
                        return;
                    }
                    else
                    {
                        FARC.Signature = KKdFARC.Farc.FArC;
                    }
                    Console.Title      = "FARC Creator - Directory: " + Path.GetDirectoryName(file);
                    FARC.DirectoryPath = file;
                    FARC.Pack();
                }
            }
        }