Beispiel #1
0
        private void CheckAutoLoad()
        {
            string[] files = Directory.GetFiles(this.SourceDic);
            string   str   = Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.System)) + "\\Fonts\\";

            string[] array = files;
            for (int i = 0; i < array.Length; i++)
            {
                string text  = array[i];
                string value = Path.GetExtension(text).ToLower();
                if (".ttf.ttc.otf.otc".IndexOf(value) != -1)
                {
                    string fileName = Path.GetFileName(text);
                    string text2    = str + fileName;
                    if (File.Exists(text2))
                    {
                        TaskInfo     taskInfo     = new TaskInfo(text2, fileName.ToLower(), text, true);
                        ListViewItem listViewItem = LogView.CreateItemStatic(taskInfo.ActionType ? LogView.RowType.Add : LogView.RowType.Remove, taskInfo.FileKey);
                        listViewItem.SubItems.Add(taskInfo.ActionType ? taskInfo.NewFile : "删除这个字体");
                        listViewItem.SubItems.Add("");
                        listViewItem.Tag = taskInfo;
                        this.taskList.Items.Add(listViewItem);
                        listViewItem.EnsureVisible();
                    }
                }
            }
            this.btnRun.Enabled = (this.taskList.Items.Count > 0);
        }
Beispiel #2
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);
        }