Ejemplo n.º 1
0
        public bool CloseFile()
        {
            if (haveBeenEdited) {
                DialogResult dr = MessageBox.Show(Properties.strings.CloseConfirm, Properties.strings.Close, MessageBoxButtons.YesNoCancel);
                if (dr == DialogResult.Yes) {
                    // tpsn.PrintState();
                    // tusr.PrintState();
                    tpsn.Save();
                    tusr.Save();
                } else if (dr == DialogResult.No) {
                } else {
                    return false;
                }
            }

            tpsn = null;
            tusr = null;
            tconf = null;
            EmptyAllCompoment();
            haveBeenEdited = false;
            重新整理ToolStripMenuItem.Enabled = false;
            進階ToolStripMenuItem.Enabled = false;
            if (isOpen) {
                Utility.encryptTrophy(path);
                isOpen = false;
            }
            return true;
        }
Ejemplo n.º 2
0
 private void OpenFile(string path_in)
 {
     try {
         if (isOpen) {
             CloseFile();
         }
         path = path_in;
         Utility.decryptTrophy(path);
         tconf = new TROPCONF(path);
         tpsn = new TROPTRNS(path);
         tusr = new TROPUSR(path);
         //tpsn.PrintState();
         // tusr.PrintState();
         RefreashCompoment();
         isOpen = true;
         重新整理ToolStripMenuItem.Enabled = true;
         進階ToolStripMenuItem.Enabled = true;
     } catch (Exception ex) {
         tconf = null;
         tpsn = null;
         tusr = null;
         GC.Collect();
         Utility.encryptTrophy(path);
         Console.WriteLine(ex.StackTrace);
         MessageBox.Show("Open Failed:" + ex.Message);
     }
 }