示例#1
0
    void SaveToolStripMenuItemClick(object sender, EventArgs e)
    {
        using (var sfd = new SaveFileDialog())
        {
            sfd.Filter      = "ROBLOX Diogenes filter v2 (diogenes.fnt)|diogenes.fnt|ROBLOX Diogenes filter v1 (diogenes.fnt)|diogenes.fnt";
            sfd.FilterIndex = 1;
            sfd.FileName    = "diogenes.fnt";
            sfd.Title       = "Save diogenes.fnt";

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                StringBuilder builder = new StringBuilder();

                foreach (string s in richTextBox1.Lines)
                {
                    if (sfd.FilterIndex == 1)
                    {
                        builder.Append(GlobalFuncs.CryptStringWithByte(s, diogenesFlag) + Environment.NewLine);
                        label2.Text = "v2";
                    }
                    else
                    {
                        builder.Append(s + Environment.NewLine);
                        label2.Text = "v1";
                    }
                }

                using (StreamWriter sw = File.CreateText(sfd.FileName))
                {
                    sw.Write(builder.ToString());
                }
            }
        }
    }
示例#2
0
    void LoadToolStripMenuItemClick(object sender, EventArgs e)
    {
        using (var ofd = new OpenFileDialog())
        {
            ofd.Filter      = "ROBLOX Diogenes filter (diogenes.fnt)|diogenes.fnt";
            ofd.FilterIndex = 1;
            ofd.FileName    = "diogenes.fnt";
            ofd.Title       = "Load diogenes.fnt";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                StringBuilder builder = new StringBuilder();

                using (StreamReader reader = new StreamReader(ofd.FileName))
                {
                    if (reader.EndOfStream)
                    {
                        label2.Text = "Empty";
                    }
                    else
                    {
                        while (!reader.EndOfStream)
                        {
                            string line = reader.ReadLine();

                            try
                            {
                                line        = GlobalFuncs.CryptStringWithByte(line, diogenesFlag);
                                label2.Text = "v2";
                            }
                            catch (Exception)
                            {
                                label2.Text = "v1";
                                continue;
                            }

                            builder.Append(line + Environment.NewLine);
                        }
                    }
                }

                richTextBox1.Text = builder.ToString();
            }
        }
    }