Exemplo n.º 1
0
        private void PickupRestoreGroup_Load(object sender, EventArgs e)
        {
            string path = Path.Combine(Application.StartupPath, "backup");

            if (!Directory.Exists(path))
            {
                FunctionalForm.Infomation(SR.NoBackup);
                base.DialogResult = DialogResult.Cancel;
                base.Close();
                return;
            }
            string[] directories = Directory.GetDirectories(path);
            string[] array       = directories;
            for (int i = 0; i < array.Length; i++)
            {
                string path2 = array[i];
                if (Directory.GetFiles(path2).Length == 0)
                {
                    Directory.Delete(path2);
                }
                else
                {
                    this.lstBackupList.Items.Add(Path.GetFileName(path2));
                }
            }
        }
Exemplo n.º 2
0
 private static void Main(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Program.SetCulture();
     ThreadException.SettingUpForm();
     if (Program.CFG.GetConfig("FirstRun", true))
     {
         FunctionalForm.Infomation(SR.NotGreenWareWarning);
         Program.CFG.SetConfig("FirstRun", false);
     }
     if (args != null && args.Length == 3)
     {
         if (args[0] == "-replace")
         {
             RunReplaceTask mainForm = new RunReplaceTask
             {
                 ForceKillAllNonSysProcess = (args[1] == "1"),
                 ParentProcessID           = int.Parse(args[2])
             };
             Application.Run(mainForm);
             return;
         }
     }
     else
     {
         MainForm mainForm2 = new MainForm();
         string   text      = Application.StartupPath + "\\source";
         if (Directory.Exists(text))
         {
             mainForm2.SourceDic = text;
         }
         Application.Run(mainForm2);
     }
 }
Exemplo n.º 3
0
        private void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.WriteLogFile();
            ProcessStartInfo startInfo = new ProcessStartInfo("explorer.exe");

            Process.Start(startInfo);
            if (e.Error != null)
            {
                FunctionalForm.Infomation(e.Error.ToString());
            }
            string text = string.Format(SR.Log_RunTaskFinished, this.succCount, this.failCount);

            if (this.failCount > 0)
            {
                text = text + Environment.NewLine + SR.Log_FailedNote;
            }
            if (this.succCount > 0)
            {
                text = text + Environment.NewLine + SR.AutoReboot;
                if (FunctionalForm.Question(text, true))
                {
                    RunReplaceTask.Reboot();
                }
            }
            else
            {
                FunctionalForm.Infomation(text);
            }
            Process.Start(this.logFile);
            base.Close();
        }
Exemplo n.º 4
0
 private void Uninstall()
 {
     this._supressClosing = true;
     if (!FunctionalForm.Question(SR.ConfirmToDeleteSettings, true))
     {
         this._supressClosing = false;
         return;
     }
     Program.CFG.Uninstall();
     FunctionalForm.Infomation(SR.UninstallSuccessfully);
     Environment.Exit(0);
 }
Exemplo n.º 5
0
        private void RunWork()
        {
            string content = string.Empty;

            if (this.chkKillAll.Checked)
            {
                content = SR.KillWarning;
            }
            else
            {
                content = SR.ExplorerWillBeKilled;
            }
            if (!FunctionalForm.Question(content, true))
            {
                return;
            }
            string text = Path.Combine(Application.StartupPath, "working");

            Directory.CreateDirectory(text);
            foreach (ListViewItem listViewItem in this.taskList.Items)
            {
                TaskInfo taskInfo = listViewItem.Tag as TaskInfo;
                this.SetStateInfo(listViewItem, SR.Copying);
                Application.DoEvents();
                if (taskInfo.ActionType)
                {
                    File.Copy(taskInfo.NewFile, Path.Combine(text, Path.GetFileName(taskInfo.FilePath)), true);
                }
                else
                {
                    File.WriteAllText(Path.Combine(text, Path.GetFileName(taskInfo.FilePath) + ".del"), "");
                }
                Application.DoEvents();
                this.SetStateInfo(listViewItem, SR.Ready);
            }
            string           arguments        = "-replace " + (this.chkKillAll.Checked ? "1" : "0") + " " + Process.GetCurrentProcess().Id.ToString();
            ProcessStartInfo processStartInfo = new ProcessStartInfo(Application.ExecutablePath, arguments);

            if (OS.OSMajorVersion > 5)
            {
                processStartInfo.Verb = "runas";
            }
            try
            {
                Process.Start(processStartInfo);
            }
            catch (Win32Exception ex)
            {
                FunctionalForm.Infomation(string.Format(SR.OperationFailed, ex.Message));
                return;
            }
            base.Close();
        }
Exemplo n.º 6
0
        private void AddTaskAuto(string path)
        {
            string fileName = Path.GetFileName(path);
            string text     = fileName.ToLower();

            if (!this.fonts.ContainsKey(text))
            {
                FunctionalForm.Infomation(string.Format(SR.FontNotInstalled, fileName));
                return;
            }
            this.AddTask(new TaskInfo(this.fonts[text], text, path, true));
        }
Exemplo n.º 7
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Loading loading = new Loading();

            loading.ShowDialog();
            this.fps.InitializeList(loading.SystemFonts);
            this.fonts = loading.SystemFonts;
            if (Environment.OSVersion.Version.Major == 6)
            {
                FunctionalForm.Infomation(SR.Win7Detected);
            }
            base.Shown += new EventHandler(this.MainForm_Shown);
        }
Exemplo n.º 8
0
        private void AddTask(TaskInfo t)
        {
            foreach (ListViewItem listViewItem in this.taskList.Items)
            {
                TaskInfo taskInfo = listViewItem.Tag as TaskInfo;
                if (taskInfo.FileKey == t.FileKey)
                {
                    FunctionalForm.Infomation(SR.OperationAlreadyAdded);
                    this.taskList.SelectedIndices.Clear();
                    listViewItem.Selected = true;
                    listViewItem.EnsureVisible();
                    return;
                }
            }
            ListViewItem listViewItem2 = LogView.CreateItemStatic(t.ActionType ? LogView.RowType.Add : LogView.RowType.Remove, t.FileKey);

            listViewItem2.SubItems.Add(t.ActionType ? t.NewFile : SR.DeleteFont);
            listViewItem2.SubItems.Add("");
            listViewItem2.Tag = t;
            this.taskList.Items.Add(listViewItem2);
            listViewItem2.EnsureVisible();
            this.btnRun.Enabled = (this.taskList.Items.Count > 0);
        }
Exemplo n.º 9
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     this.fontCombo.Text = this.fontCombo.Text.ToLower();
     if (string.IsNullOrEmpty(this.fontCombo.Text) || !this.list.ContainsKey(this.fontCombo.Text))
     {
         FunctionalForm.Infomation(SR.NoFontSelected);
         return;
     }
     if (this.Mode == 0 && !File.Exists(this.fontFile.SelectedFile))
     {
         FunctionalForm.Infomation(SR.NoNewFileSelected);
         return;
     }
     if (this.Mode == 1)
     {
         this.Task = new TaskInfo(this.list[this.fontCombo.Text], this.fontCombo.Text, "", false);
     }
     else
     {
         this.Task = new TaskInfo(this.list[this.fontCombo.Text], this.fontCombo.Text, this.fontFile.SelectedFile, true);
     }
     base.DialogResult = DialogResult.OK;
     base.Close();
 }