示例#1
0
 private void saveFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
     dialog.Description = "Please select the scn2ks folder";
     System.Windows.Forms.FolderBrowserDialog dialog1 = new System.Windows.Forms.FolderBrowserDialog();
     dialog1.Description = "Please select the scn folder";
     if ((dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) & (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK))
     {
         DialogResult dr    = MessageBox.Show("Would you like to compress the script? (Recommended)\n\nDoes not work with old games.", "ScnEditorGUI", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         string       path  = dialog.SelectedPath;
         string       path1 = dialog1.SelectedPath;
         path  = "G:\\e\\e3(scn2ks)";
         path1 = "G:\\e\\e3";
         string des = path + "(ks2scn)\\";
         if (Directory.Exists(des) == false)
         {
             Directory.CreateDirectory(des);
         }
         List <string> fl  = GetFiles(path, ".scn2ks");
         List <string> fl1 = GetFiles(path1, ".scn");
         foreach (string s in fl)
         {
             string name = Path.GetFileNameWithoutExtension(s);
             string ss   = "";
             foreach (string sss in fl1)
             {
                 if (Path.GetFileNameWithoutExtension(s).Equals(Path.GetFileNameWithoutExtension(sss)))
                 {
                     ss = sss;
                     break;
                 }
             }
             SCN = new PSBAnalyzer(File.ReadAllBytes(ss));
             SCN.Import();
             SCN.CompressPackget = dr == DialogResult.Yes;
             List <String> ppp = new List <string>()
             {
             };
             StreamReader sr = new StreamReader(s, Encoding.Unicode);
             while (!sr.EndOfStream)
             {
                 ppp.Add(sr.ReadLine());
             }
             sr.Close();
             string[] Strings = ppp.ToArray();
             foreach (string o in Strings)
             {
                 Console.WriteLine(o);
             }
             PSBStrMan.CompressionLevel = CompressionLevel.Z_BEST_COMPRESSION; //opitional
             byte[] outfile = SCN.Export(Strings);
             //System.IO.File.WriteAllBytes(des + name + ".scn", outfile);
         }
         MessageBox.Show("File Saved.");
     }
 }
示例#2
0
        private void saveFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ResourceMode)
            {
                SaveFileDialog save = new SaveFileDialog();
                save.FileName = "";
                save.Filter   = "Pack of Resources | *.pimg";
                DialogResult dr = save.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    FileEntry[] Images = new FileEntry[PRM.EntryCount];
                    for (int i = 0; i < Images.Length; i++)
                    {
                        Images[i]      = new FileEntry();
                        Images[i].Data = System.IO.File.ReadAllBytes(AppDomain.CurrentDomain.BaseDirectory + i + ".res");
                    }
                    byte[] result = PRM.Export(Images);
                    System.IO.File.WriteAllBytes(save.FileName, result);
                }
            }
            else
            {
                SaveFileDialog save = new SaveFileDialog();
                save.FileName = "";
                save.Filter   = "KiriKiri Compiled Files | *.scn; *.psb|Pack of Resources | *.pimg";
                DialogResult dr = save.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    //狸猫换太子

                    string[] AimString = System.IO.File.ReadAllLines(@"H:\YUZUSOFT\scn.txt");
                    string[] Strings   = new string[listBox1.Items.Count];
                    for (int i = 0; i < Strings.Length; i++)
                    {
                        //Strings[i] = listBox1.Items[i].ToString();
                        Strings[i] = AimString[i].ToString();
                    }
                    dr = MessageBox.Show("Would you like to compress the script? (Recommended)\n\nDoes not work with old games.", "ScnEditorGUI", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    SCN.CompressPackget        = dr == DialogResult.Yes;
                    PSBStrMan.CompressionLevel = CompressionLevel.Z_BEST_COMPRESSION; //opitional
                    byte[] outfile = SCN.Export(Strings);
                    System.IO.File.WriteAllBytes(save.FileName, outfile);
                }
            }
            MessageBox.Show("File Saved.");
        }