示例#1
0
        static void DIVAFILEEncDec(int I, string file, int code)
        {
            if (File.Exists(file))
            {
                KKtIO  reader = KKtIO.OpenReader(file);
                string header = reader.ReadString(8);
                reader.Close();
                Console.Clear();
                switch (function)
                {
                case "3":
                    if (header.ToUpper() == "DIVAFILE")
                    {
                        DIVAFILE.Decrypt(I, file);
                    }
                    else if (code == 1)
                    {
                        Console.WriteLine("This file isn't DIVAFILE, FARC Archive or F2nd/X DSC.");
                    }
                    else
                    {
                        ReturnCode = 81;
                    }
                    break;

                case "4":
                    if (code != 1)
                    {
                        DIVAFILE.Encrypt(I, file);
                    }
                    break;
                }
            }
            else
            {
                Console.WriteLine("File {0} doesn't exist!", file);
            }
        }