예제 #1
0
        private async void btnYaz0Encode_Click(object sender, EventArgs e)
        {
            loadingBar.Visible = true;
            OpenFileDialog oFile = new OpenFileDialog();

            if (tbxFolderRoot.Text != "")
            {
                oFile.InitialDirectory = tbxFolderRoot.Text;
            }
            if (!(oFile.ShowDialog() == DialogResult.Cancel))
            {
                if (!SARC.IsYaz0File(oFile.FileName))
                {
                    string outFile = Yaz0.EncodeOutputFileRename(oFile.FileName);
                    if (File.Exists(outFile))
                    {
                        if (MessageBox.Show(Path.GetFileName(outFile) + " already exists!" + "\n\n" + "Proceed anyway?", "Overwrite?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            await Encode(oFile.FileName, outFile);
                        }
                    }
                    else
                    {
                        await Encode(oFile.FileName, outFile);
                    }
                }
                else
                {
                    MessageBox.Show("Encode error:" + "\n\n" + "File is already Yaz0 encoded!");
                }
            }
            oFile.Dispose();
            loadingBar.Visible = false;
        }
예제 #2
0
 static private void ConsoleEncode(string[] args) //Console Encode
 {
     if (args.Length == 2 && File.Exists(args[1]))
     {
         if (Yaz0.Encode(args[1], Yaz0.EncodeOutputFileRename(args[1])))
         {
             Console.WriteLine("Encode Successful");
         }
         else
         {
             Console.WriteLine("Encode error: " + Yaz0.lerror);
         }
     }
     else if (args.Length == 3 && File.Exists(args[1]))
     {
         if (Yaz0.Encode(args[1], args[2]))
         {
             Console.WriteLine("Encode Successful");
         }
         else
         {
             Console.WriteLine("Encode error: " + Yaz0.lerror);
         }
     }
     else
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Error: Incorrect use of Decode command.");
         Console.WriteLine("/e <Input File> [Output File]");
         Console.ForegroundColor = ConsoleColor.White;
     }
 }