Exemple #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, toolStripComboBox2.Text);
                isOpen = false;
            }
            return(true);
        }
Exemple #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, toolStripComboBox2.Text);
         Console.WriteLine(ex.StackTrace);
         MessageBox.Show("Open Failed:" + ex.Message);
     }
 }
Exemple #3
0
        private void OpenFile(string path_in)
        {
            try
            {
                if (isOpen)
                {
                    CloseFile();
                }
                path     = path_in;
                pathTemp = Utility.CopyTrophyDirToTemp(path_in);
                Utility.decryptTrophy(pathTemp);
                tconf = new TROPCONF(pathTemp);
                tpsn  = new TROPTRNS(pathTemp);
                tusr  = new TROPUSR(pathTemp);

                lastSyncTrophyTime = tusr.LastSyncTime;
                if (DateTime.Compare(tpsn.LastSyncTime, tusr.LastSyncTime) > 0)
                {
                    lastSyncTrophyTime = tpsn.LastSyncTime;
                }

                ps3Time        = lastSyncTrophyTime;
                dtpForm        = new DateTimePickForm(ps3Time);
                dtpfForInstant = new DateTimePickForm(ps3Time);
                copyFrom       = new CopyFrom(ps3Time);

                RefreshComponents();
                isOpen = true;
                重新整理ToolStripMenuItem.Enabled = true;
                進階ToolStripMenuItem.Enabled   = true;
            }
            catch (FileNotFoundException ex)
            {
                tconf = null;
                tpsn  = null;
                tusr  = null;
                GC.Collect();
                MessageBox.Show(string.Format(Properties.strings.FileNotFoundMsg, Path.GetFileName(ex.FileName)));
            }
            catch (Exception ex)
            {
                tconf = null;
                tpsn  = null;
                tusr  = null;
                GC.Collect();
                Console.WriteLine(ex.StackTrace);
                MessageBox.Show(ex.Message);
            }
        }
Exemple #4
0
        public bool CloseFile()
        {
            if (listViewEx1.IsEditing)
            {
                listViewEx1.EndEditing(true);
            }
            if (haveBeenEdited)
            {
                DialogResult dr = MessageBox.Show(Properties.strings.CloseConfirm, Properties.strings.Close, MessageBoxButtons.YesNoCancel);
                if (dr == DialogResult.Yes)
                {
                    SaveFile();
                }
                else if (dr == DialogResult.No)
                {
                }
                else
                {
                    return(false);
                }
            }

            tpsn           = null;
            tusr           = null;
            tconf          = null;
            path           = string.Empty;
            pathTemp       = string.Empty;
            haveBeenEdited = false;
            重新整理ToolStripMenuItem.Enabled = false;
            進階ToolStripMenuItem.Enabled   = false;
            isOpen = false;
            EmptyAllComponents();
            if (!string.IsNullOrEmpty(pathTemp))
            {
                Utility.DeleteDirectory(new DirectoryInfo(pathTemp).Parent.FullName);
            }
            return(true);
        }