From f18be6efe1a69487220d24b22135d5fe7051bb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 02:03:34 +0300 Subject: [PATCH 1/9] =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0?= =?UTF-8?q?=D1=82=D0=B8=D0=B2=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20infoLabel.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/MainForm.cs | 11 ++++++----- fileFinder/ProgressReportModel.cs | 4 +++- fileFinder/TaskController.cs | 32 +++++++++++++++++++------------ 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index a0fa060..e637fb1 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -78,7 +78,7 @@ namespace fileFinder switch (mainController.state) { case TaskState.Work: - updateInfoLabel(report.currentFileUrl, report.progress); + updateInfoLabel(report.currentFileUrl, report); break; case TaskState.Pause: updateResultViewer(report.currentTreeNode); @@ -142,16 +142,17 @@ namespace fileFinder } } - public void updateInfoLabel (string fileUrl, int counter) + private void updateInfoLabel(string fileUrl, ProgressReportModel rpm) { TimeSpan tS = mainController.elapsedTime(); + string fileNumCounters = rpm.matchingFiles + "/" + rpm.processedFiles + "/" + rpm.totalNumOfFiles; string time = String.Format("{0:00}:{1:00}:{2:00}", tS.Hours, tS.Minutes, tS.Seconds); - infoLabel.Text = "Time: " + time + " " + "| Processed files: " + counter + + infoLabel.Text = "Time: " + time + " " + "| Processed files: " + fileNumCounters + " | Current file: " + fileUrl; } - public void updateResultViewer(TreeNode tN) + private void updateResultViewer(TreeNode tN) { if (tN != null) { @@ -160,7 +161,7 @@ namespace fileFinder } } - public void refreshInfoByTimer (object sender, ElapsedEventArgs e) + private void refreshInfoByTimer (object sender, ElapsedEventArgs e) { Action refresh = () => { diff --git a/fileFinder/ProgressReportModel.cs b/fileFinder/ProgressReportModel.cs index b459a40..a36cbfa 100644 --- a/fileFinder/ProgressReportModel.cs +++ b/fileFinder/ProgressReportModel.cs @@ -4,7 +4,9 @@ namespace fileFinder { class ProgressReportModel { - public int progress { get; set; } + public int matchingFiles { get; set; } + public int processedFiles { get; set; } + public int totalNumOfFiles { get; set; } public string currentFileUrl { get; set; } public TreeNode currentTreeNode { get; set; } } diff --git a/fileFinder/TaskController.cs b/fileFinder/TaskController.cs index 22988ec..c362e54 100644 --- a/fileFinder/TaskController.cs +++ b/fileFinder/TaskController.cs @@ -54,42 +54,50 @@ namespace fileFinder { TaskController controller = this; TreeNode itemsNode = new TreeNode(); - ProgressReportModel _report = new ProgressReportModel(); List foundFiles = getFileList(query.fileUrl, query.fileNameQuery); + report.Report(createReport(null, null, 0, 0, foundFiles.Count)); - int counter = 0; + int matchingFiles = 0, processedFiles = 0; foreach (string item in foundFiles) { switch (state) { case TaskState.Finished: return null; - case TaskState.Pause: - _report.progress = counter; - _report.currentFileUrl = item; - _report.currentTreeNode = (TreeNode)itemsNode.Clone(); - report.Report(_report); + case TaskState.Pause: + report.Report(createReport((TreeNode)itemsNode.Clone(), + item, matchingFiles, processedFiles, foundFiles.Count)); while (state == TaskState.Pause) Thread.Sleep(100); goto case TaskState.Work; case TaskState.Work: string[] fileLines = getFileContents(item); - _report.progress = counter; - _report.currentFileUrl = item; - report.Report(_report); - + report.Report(createReport(null, item, matchingFiles, processedFiles, foundFiles.Count)); if ((fileLines.Length > 0) && (isFileContainQuery(fileLines, query.fileInnerQuery))) { - counter++; await fillChildNode(itemsNode, item.Replace(query.fileUrl, "")); + matchingFiles++; } + processedFiles++; break; } } + report.Report(createReport(null, "none", matchingFiles, processedFiles, foundFiles.Count)); controller.stopTask(); return itemsNode; } + private ProgressReportModel createReport(TreeNode treeNode, string fileUrl, int matchingFiles, int processedFiles, int totalNumOfFiles) + { + ProgressReportModel prm = new ProgressReportModel(); + prm.currentTreeNode = treeNode; + prm.currentFileUrl = fileUrl; + prm.matchingFiles = matchingFiles; + prm.processedFiles = processedFiles; + prm.totalNumOfFiles = totalNumOfFiles; + return prm; + } + private List getFileList(string directory, string nameQuery) { From af86789c95c0e416063750aa0942306d8689ebb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 02:11:34 +0300 Subject: [PATCH 2/9] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3:=20curDirTextBox=20->=20fileUrlTextBox?= =?UTF-8?q?,=20querytextBox=20->=20nameQueryTextBox,=20changeTaskBtnState?= =?UTF-8?q?=20->=20prepareToNewTask?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/MainForm.Designer.cs | 40 ++++++++++++++++----------------- fileFinder/MainForm.cs | 27 +++++++++++----------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/fileFinder/MainForm.Designer.cs b/fileFinder/MainForm.Designer.cs index 840c860..ed605bb 100644 --- a/fileFinder/MainForm.Designer.cs +++ b/fileFinder/MainForm.Designer.cs @@ -31,11 +31,11 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.resultViewer = new System.Windows.Forms.TreeView(); this.dirSelectBtn = new System.Windows.Forms.Button(); - this.curDirTextBox = new System.Windows.Forms.TextBox(); + this.fileUrlTextBox = new System.Windows.Forms.TextBox(); this.splitContainer = new System.Windows.Forms.SplitContainer(); this.handleSearchBtn = new System.Windows.Forms.Button(); this.innerQueryTextBox = new System.Windows.Forms.TextBox(); - this.queryTextBox = new System.Windows.Forms.TextBox(); + this.nameQueryTextBox = new System.Windows.Forms.TextBox(); this.waitOrPauseLabel = new System.Windows.Forms.Label(); this.bottomPanel = new System.Windows.Forms.Panel(); this.infoLabel = new System.Windows.Forms.Label(); @@ -67,13 +67,13 @@ // // curDirTextBox // - this.curDirTextBox.Location = new System.Drawing.Point(12, 10); - this.curDirTextBox.Name = "curDirTextBox"; - this.curDirTextBox.Size = new System.Drawing.Size(650, 20); - this.curDirTextBox.TabIndex = 1; - this.curDirTextBox.Text = "C:\\Users\\itsmy_000\\Desktop\\a\\"; - this.curDirTextBox.TextChanged += new System.EventHandler(this.curDirTextBox_TextChanged); - this.curDirTextBox.Enter += new System.EventHandler(this.curDirTextBox_Enter); + this.fileUrlTextBox.Location = new System.Drawing.Point(12, 10); + this.fileUrlTextBox.Name = "curDirTextBox"; + this.fileUrlTextBox.Size = new System.Drawing.Size(650, 20); + this.fileUrlTextBox.TabIndex = 1; + this.fileUrlTextBox.Text = "C:\\Users\\itsmy_000\\Desktop\\a\\"; + this.fileUrlTextBox.TextChanged += new System.EventHandler(this.fileUrlTextBox_TextChanged); + this.fileUrlTextBox.Enter += new System.EventHandler(this.curDirTextBox_Enter); // // splitContainer // @@ -88,8 +88,8 @@ this.splitContainer.Panel1.Controls.Add(this.handleSearchBtn); this.splitContainer.Panel1.Controls.Add(this.dirSelectBtn); this.splitContainer.Panel1.Controls.Add(this.innerQueryTextBox); - this.splitContainer.Panel1.Controls.Add(this.queryTextBox); - this.splitContainer.Panel1.Controls.Add(this.curDirTextBox); + this.splitContainer.Panel1.Controls.Add(this.nameQueryTextBox); + this.splitContainer.Panel1.Controls.Add(this.fileUrlTextBox); // // splitContainer.Panel2 // @@ -121,13 +121,13 @@ // // queryTextBox // - this.queryTextBox.Location = new System.Drawing.Point(12, 36); - this.queryTextBox.Name = "queryTextBox"; - this.queryTextBox.Size = new System.Drawing.Size(776, 20); - this.queryTextBox.TabIndex = 3; - this.queryTextBox.Tag = ""; - this.queryTextBox.Text = "*.txt"; - this.queryTextBox.TextChanged += new System.EventHandler(this.queryTextBox_TextChanged); + this.nameQueryTextBox.Location = new System.Drawing.Point(12, 36); + this.nameQueryTextBox.Name = "queryTextBox"; + this.nameQueryTextBox.Size = new System.Drawing.Size(776, 20); + this.nameQueryTextBox.TabIndex = 3; + this.nameQueryTextBox.Tag = ""; + this.nameQueryTextBox.Text = "*.txt"; + this.nameQueryTextBox.TextChanged += new System.EventHandler(this.nameQueryTextBox_TextChanged); // // waitOrPauseLabel // @@ -188,12 +188,12 @@ private System.Windows.Forms.TreeView resultViewer; private System.Windows.Forms.Button dirSelectBtn; - private System.Windows.Forms.TextBox curDirTextBox; + private System.Windows.Forms.TextBox fileUrlTextBox; private System.Windows.Forms.SplitContainer splitContainer; private System.Windows.Forms.Button handleSearchBtn; private System.Windows.Forms.Panel bottomPanel; private System.Windows.Forms.Label infoLabel; - private System.Windows.Forms.TextBox queryTextBox; + private System.Windows.Forms.TextBox nameQueryTextBox; private System.Windows.Forms.TextBox innerQueryTextBox; private System.Windows.Forms.Label waitOrPauseLabel; } diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index e637fb1..e3022cd 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -27,9 +27,9 @@ namespace fileFinder private void restoreLastSession() { MainSettings sets = MainSettings.Default; - curDirTextBox.Text = sets.fileUrl; + fileUrlTextBox.Text = sets.fileUrl; innerQueryTextBox.Text = sets.fileInnerQuery; - queryTextBox.Text = sets.fileNameQuery; + nameQueryTextBox.Text = sets.fileNameQuery; searchQueryModel = mainController.updateSearchQueryModel(sets.fileUrl, sets.fileInnerQuery, sets.fileNameQuery); isFieldsChanged = false; @@ -58,7 +58,7 @@ namespace fileFinder DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrWhiteSpace(dialog.SelectedPath)) { - curDirTextBox.Text = dialog.SelectedPath; + fileUrlTextBox.Text = dialog.SelectedPath; hints.isDirectoryHintActive = false; } } @@ -90,6 +90,7 @@ namespace fileFinder { Progress progress = new Progress(); progress.ProgressChanged += reportProgress; + if (isFieldsChanged) // если в форме изменился запрос mainController.stopTask(); // то принудительно завершаем задание @@ -98,8 +99,8 @@ namespace fileFinder switch (mainController.state) { case TaskState.Created: - searchQueryModel = mainController.updateSearchQueryModel(curDirTextBox.Text, - queryTextBox.Text, innerQueryTextBox.Text); + searchQueryModel = mainController.updateSearchQueryModel(fileUrlTextBox.Text, + nameQueryTextBox.Text, innerQueryTextBox.Text); handleSearchBtn.Text = "Pause Task"; mainController.beginTask(); changeVisibilityResultViewer(); @@ -175,28 +176,28 @@ namespace fileFinder private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { - MainSettings.Default.fileUrl = curDirTextBox.Text; - MainSettings.Default.fileNameQuery = queryTextBox.Text; + MainSettings.Default.fileUrl = fileUrlTextBox.Text; + MainSettings.Default.fileNameQuery = nameQueryTextBox.Text; MainSettings.Default.fileInnerQuery = innerQueryTextBox.Text; MainSettings.Default.Save(); } - private void curDirTextBox_TextChanged(object sender, EventArgs e) + private void fileUrlTextBox_TextChanged(object sender, EventArgs e) { - changeTaskBtnStatus(); + prepareToNewTask(); } - private void queryTextBox_TextChanged(object sender, EventArgs e) + private void nameQueryTextBox_TextChanged(object sender, EventArgs e) { - changeTaskBtnStatus(); + prepareToNewTask(); } private void innerQueryTextBox_TextChanged(object sender, EventArgs e) { - changeTaskBtnStatus(); + prepareToNewTask(); } - private void changeTaskBtnStatus() + private void prepareToNewTask() { if (!isFieldsChanged) { From 494bbf63b4047e9d941ad07ca36919ed20a10494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 02:19:10 +0300 Subject: [PATCH 3/9] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20=D0=BF=D1=83=D1=81=D1=82=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=BE=D0=BC=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D1=87=D0=B8=20=D0=B2=20handleSearchBtn=5FClick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/MainForm.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index e3022cd..8980279 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -90,8 +90,13 @@ namespace fileFinder { Progress progress = new Progress(); progress.ProgressChanged += reportProgress; - + if (fileUrlTextBox.Text.Equals("") || nameQueryTextBox.Text.Equals("") || innerQueryTextBox.Text.Equals("")) + { + MessageBox.Show("Вы не заполнили одно из полей. Проверьте все и повторно нажмите \"Запуск задания\"!"); + return; + } + if (isFieldsChanged) // если в форме изменился запрос mainController.stopTask(); // то принудительно завершаем задание isFieldsChanged = false; @@ -134,7 +139,7 @@ namespace fileFinder waitOrPauseLabel.Visible = true; resultViewer.Enabled = false; break; - case TaskState.Pause: // если задание на паузе, то показываем промеж. результат + case TaskState.Pause: // если задание на паузе, то показываем промеж. результат waitOrPauseLabel.Visible = false; resultViewer.Enabled = true; break; From 152eaea6ded1559f88b39e586a0e51e4111edb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 02:37:15 +0300 Subject: [PATCH 4/9] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20fileUrlLabel,=20fileNameQueryLabel,=20fileInnerQ?= =?UTF-8?q?ueryLabel=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20=D1=85=D0=B8?= =?UTF-8?q?=D0=BD=D1=82=D0=BE=D0=B2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/MainForm.Designer.cs | 62 ++++++++++++++++++++++++++------- fileFinder/MainForm.cs | 2 +- 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/fileFinder/MainForm.Designer.cs b/fileFinder/MainForm.Designer.cs index ed605bb..774c5f5 100644 --- a/fileFinder/MainForm.Designer.cs +++ b/fileFinder/MainForm.Designer.cs @@ -39,6 +39,9 @@ this.waitOrPauseLabel = new System.Windows.Forms.Label(); this.bottomPanel = new System.Windows.Forms.Panel(); this.infoLabel = new System.Windows.Forms.Label(); + this.fileUrlLabel = new System.Windows.Forms.Label(); + this.fileNameQueryLabel = new System.Windows.Forms.Label(); + this.fileInnerQueryLabel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -65,11 +68,11 @@ this.dirSelectBtn.UseVisualStyleBackColor = true; this.dirSelectBtn.Click += new System.EventHandler(this.dirSelectBtn_Click); // - // curDirTextBox + // fileUrlTextBox // - this.fileUrlTextBox.Location = new System.Drawing.Point(12, 10); - this.fileUrlTextBox.Name = "curDirTextBox"; - this.fileUrlTextBox.Size = new System.Drawing.Size(650, 20); + this.fileUrlTextBox.Location = new System.Drawing.Point(151, 10); + this.fileUrlTextBox.Name = "fileUrlTextBox"; + this.fileUrlTextBox.Size = new System.Drawing.Size(511, 20); this.fileUrlTextBox.TabIndex = 1; this.fileUrlTextBox.Text = "C:\\Users\\itsmy_000\\Desktop\\a\\"; this.fileUrlTextBox.TextChanged += new System.EventHandler(this.fileUrlTextBox_TextChanged); @@ -85,6 +88,9 @@ // // splitContainer.Panel1 // + this.splitContainer.Panel1.Controls.Add(this.fileInnerQueryLabel); + this.splitContainer.Panel1.Controls.Add(this.fileNameQueryLabel); + this.splitContainer.Panel1.Controls.Add(this.fileUrlLabel); this.splitContainer.Panel1.Controls.Add(this.handleSearchBtn); this.splitContainer.Panel1.Controls.Add(this.dirSelectBtn); this.splitContainer.Panel1.Controls.Add(this.innerQueryTextBox); @@ -102,7 +108,7 @@ // // handleSearchBtn // - this.handleSearchBtn.Location = new System.Drawing.Point(668, 62); + this.handleSearchBtn.Location = new System.Drawing.Point(668, 61); this.handleSearchBtn.Name = "handleSearchBtn"; this.handleSearchBtn.Size = new System.Drawing.Size(120, 21); this.handleSearchBtn.TabIndex = 5; @@ -112,18 +118,18 @@ // // innerQueryTextBox // - this.innerQueryTextBox.Location = new System.Drawing.Point(12, 62); + this.innerQueryTextBox.Location = new System.Drawing.Point(151, 62); this.innerQueryTextBox.Name = "innerQueryTextBox"; - this.innerQueryTextBox.Size = new System.Drawing.Size(650, 20); + this.innerQueryTextBox.Size = new System.Drawing.Size(511, 20); this.innerQueryTextBox.TabIndex = 4; this.innerQueryTextBox.Tag = ""; this.innerQueryTextBox.TextChanged += new System.EventHandler(this.innerQueryTextBox_TextChanged); // - // queryTextBox + // nameQueryTextBox // - this.nameQueryTextBox.Location = new System.Drawing.Point(12, 36); - this.nameQueryTextBox.Name = "queryTextBox"; - this.nameQueryTextBox.Size = new System.Drawing.Size(776, 20); + this.nameQueryTextBox.Location = new System.Drawing.Point(151, 36); + this.nameQueryTextBox.Name = "nameQueryTextBox"; + this.nameQueryTextBox.Size = new System.Drawing.Size(511, 20); this.nameQueryTextBox.TabIndex = 3; this.nameQueryTextBox.Tag = ""; this.nameQueryTextBox.Text = "*.txt"; @@ -156,9 +162,36 @@ this.infoLabel.AutoSize = true; this.infoLabel.Location = new System.Drawing.Point(0, 0); this.infoLabel.Name = "infoLabel"; - this.infoLabel.Size = new System.Drawing.Size(263, 13); + this.infoLabel.Size = new System.Drawing.Size(278, 13); this.infoLabel.TabIndex = 0; - this.infoLabel.Text = "Time: 00:00:00 | Processed files: 0 | Current item: none"; + this.infoLabel.Text = "Time: 00:00:00 | Number of files: 0/0/0 | Current file: none"; + // + // fileUrlLabel + // + this.fileUrlLabel.AutoSize = true; + this.fileUrlLabel.Location = new System.Drawing.Point(12, 13); + this.fileUrlLabel.Name = "fileUrlLabel"; + this.fileUrlLabel.Size = new System.Drawing.Size(76, 13); + this.fileUrlLabel.TabIndex = 6; + this.fileUrlLabel.Text = "Путь к папке:"; + // + // fileNameQueryLabel + // + this.fileNameQueryLabel.AutoSize = true; + this.fileNameQueryLabel.Location = new System.Drawing.Point(12, 39); + this.fileNameQueryLabel.Name = "fileNameQueryLabel"; + this.fileNameQueryLabel.Size = new System.Drawing.Size(119, 13); + this.fileNameQueryLabel.TabIndex = 6; + this.fileNameQueryLabel.Text = "Шаблон имени файла:"; + // + // fileInnerQueryLabel + // + this.fileInnerQueryLabel.AutoSize = true; + this.fileInnerQueryLabel.Location = new System.Drawing.Point(12, 65); + this.fileInnerQueryLabel.Name = "fileInnerQueryLabel"; + this.fileInnerQueryLabel.Size = new System.Drawing.Size(133, 13); + this.fileInnerQueryLabel.TabIndex = 6; + this.fileInnerQueryLabel.Text = "Искомый текст в файле:"; // // MainForm // @@ -196,6 +229,9 @@ private System.Windows.Forms.TextBox nameQueryTextBox; private System.Windows.Forms.TextBox innerQueryTextBox; private System.Windows.Forms.Label waitOrPauseLabel; + private System.Windows.Forms.Label fileInnerQueryLabel; + private System.Windows.Forms.Label fileNameQueryLabel; + private System.Windows.Forms.Label fileUrlLabel; } } diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index 8980279..534519e 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -153,7 +153,7 @@ namespace fileFinder TimeSpan tS = mainController.elapsedTime(); string fileNumCounters = rpm.matchingFiles + "/" + rpm.processedFiles + "/" + rpm.totalNumOfFiles; string time = String.Format("{0:00}:{1:00}:{2:00}", tS.Hours, tS.Minutes, tS.Seconds); - infoLabel.Text = "Time: " + time + " " + "| Processed files: " + fileNumCounters + + infoLabel.Text = "Time: " + time + " " + "| Number of files: " + fileNumCounters + " | Current file: " + fileUrl; } From 7acbce9b81b6d9a7f884d5fc8c16f64bb5029c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 02:47:29 +0300 Subject: [PATCH 5/9] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D1=8B?= =?UTF-8?q?=20=D1=85=D0=B8=D0=BD=D1=82=D1=8B,=20=D0=BF=D0=BE=D1=84=D0=B8?= =?UTF-8?q?=D0=BA=D1=81=D0=B8=D0=BB=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20infoLabel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/HintModel.cs | 22 ---------------------- fileFinder/MainForm.Designer.cs | 1 - fileFinder/MainForm.cs | 17 +++-------------- fileFinder/fileFinder.csproj | 1 - 4 files changed, 3 insertions(+), 38 deletions(-) delete mode 100644 fileFinder/HintModel.cs diff --git a/fileFinder/HintModel.cs b/fileFinder/HintModel.cs deleted file mode 100644 index 8374935..0000000 --- a/fileFinder/HintModel.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace fileFinder -{ - class HintModel - { - public HintModel () - { - isDirectoryHintActive = true; - isNameQueryHintActive = true; - isInnerQueryHintActive = true; - } - - public bool isDirectoryHintActive { get; set; } - public bool isNameQueryHintActive { get; set; } - public bool isInnerQueryHintActive { get; set; } - } -} diff --git a/fileFinder/MainForm.Designer.cs b/fileFinder/MainForm.Designer.cs index 774c5f5..222c7ad 100644 --- a/fileFinder/MainForm.Designer.cs +++ b/fileFinder/MainForm.Designer.cs @@ -76,7 +76,6 @@ this.fileUrlTextBox.TabIndex = 1; this.fileUrlTextBox.Text = "C:\\Users\\itsmy_000\\Desktop\\a\\"; this.fileUrlTextBox.TextChanged += new System.EventHandler(this.fileUrlTextBox_TextChanged); - this.fileUrlTextBox.Enter += new System.EventHandler(this.curDirTextBox_Enter); // // splitContainer // diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index 534519e..60615b1 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -8,7 +8,6 @@ namespace fileFinder { public partial class MainForm : Form { - HintModel hints = new HintModel(); TaskController mainController = new TaskController(); SearchQueryModel searchQueryModel; System.Timers.Timer updateInfoTimer = new System.Timers.Timer(1000); @@ -59,30 +58,20 @@ namespace fileFinder if (result == DialogResult.OK && !String.IsNullOrWhiteSpace(dialog.SelectedPath)) { fileUrlTextBox.Text = dialog.SelectedPath; - hints.isDirectoryHintActive = false; } } } - - private void curDirTextBox_Enter(object sender, EventArgs e) - { - //if (hints.isDirectoryHintActive) - //{ - // hints.isDirectoryHintActive = false; - // curDirTextBox.Text = ""; - //} - } private void reportProgress(object sender, ProgressReportModel report) { switch (mainController.state) { - case TaskState.Work: - updateInfoLabel(report.currentFileUrl, report); - break; case TaskState.Pause: updateResultViewer(report.currentTreeNode); break; + default: + updateInfoLabel(report.currentFileUrl, report); + break; } } diff --git a/fileFinder/fileFinder.csproj b/fileFinder/fileFinder.csproj index 015a164..74b3702 100644 --- a/fileFinder/fileFinder.csproj +++ b/fileFinder/fileFinder.csproj @@ -45,7 +45,6 @@ - Form From a4a1745bdb622277494ec863785c1ce771681c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 02:59:02 +0300 Subject: [PATCH 6/9] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B8=D0=BA=D0=BE=D0=BD=D0=BA=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=20TreeView=20=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA?= =?UTF-8?q?=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/MainForm.cs | 8 +- fileFinder/Properties/Resources.Designer.cs | 108 +++++++++++++------- fileFinder/Properties/Resources.resx | 26 ++++- fileFinder/Resources/File.png | Bin 0 -> 596 bytes fileFinder/Resources/Folder.png | Bin 0 -> 476 bytes fileFinder/Resources/OpenedFolder.png | Bin 0 -> 647 bytes fileFinder/Resources/Search.png | Bin 0 -> 700 bytes fileFinder/fileFinder.csproj | 13 +++ 8 files changed, 108 insertions(+), 47 deletions(-) create mode 100644 fileFinder/Resources/File.png create mode 100644 fileFinder/Resources/Folder.png create mode 100644 fileFinder/Resources/OpenedFolder.png create mode 100644 fileFinder/Resources/Search.png diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index 60615b1..a416777 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -39,10 +39,10 @@ namespace fileFinder try { ImageList iconList = new ImageList(); - iconList.Images.Add(Image.FromFile("Folder.png")); // 0 - iconList.Images.Add(Image.FromFile("OpenedFolder.png")); // 1 - iconList.Images.Add(Image.FromFile("File.png")); // 2 - iconList.Images.Add(Image.FromFile("Search.png")); // 3 + iconList.Images.Add(Properties.Resources.Folder); // 0 + iconList.Images.Add(Properties.Resources.OpenedFolder); // 1 + iconList.Images.Add(Properties.Resources.File); // 2 + iconList.Images.Add(Properties.Resources.Search); // 3 resultViewer.ImageList = iconList; resultViewer.ImageIndex = 3; resultViewer.SelectedImageIndex = 3; diff --git a/fileFinder/Properties/Resources.Designer.cs b/fileFinder/Properties/Resources.Designer.cs index 5f07002..9779f1d 100644 --- a/fileFinder/Properties/Resources.Designer.cs +++ b/fileFinder/Properties/Resources.Designer.cs @@ -1,71 +1,103 @@ //------------------------------------------------------------------------------ // -// Этот код создан программным средством. -// Версия среды выполнения: 4.0.30319.42000 +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 // -// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если -// код создан повторно. +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. // //------------------------------------------------------------------------------ -namespace fileFinder.Properties -{ - - +namespace fileFinder.Properties { + using System; + + /// - /// Класс ресурсов со строгим типом для поиска локализованных строк и пр. + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. /// - // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder - // класс с помощью таких средств, как ResGen или Visual Studio. - // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen - // с параметром /str или заново постройте свой VS-проект. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// - /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("fileFinder.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// - /// Переопределяет свойство CurrentUICulture текущего потока для всех - /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap File { + get { + object obj = ResourceManager.GetObject("File", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Folder { + get { + object obj = ResourceManager.GetObject("Folder", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap OpenedFolder { + get { + object obj = ResourceManager.GetObject("OpenedFolder", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Search { + get { + object obj = ResourceManager.GetObject("Search", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/fileFinder/Properties/Resources.resx b/fileFinder/Properties/Resources.resx index af7dbeb..ca468e3 100644 --- a/fileFinder/Properties/Resources.resx +++ b/fileFinder/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,22 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\File.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\OpenedFolder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Search.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/fileFinder/Resources/File.png b/fileFinder/Resources/File.png new file mode 100644 index 0000000000000000000000000000000000000000..34f6b38c9c839b55083d92cd2e06587d277f2faf GIT binary patch literal 596 zcmV-a0;~OrP)5Oil2$1#%gh>C=4Yh8u;TeJkNvcx^Nr^!{HEL_xBHIf1B#o z69Jta-N&@jH+fM%UNS&yJ2@HX1ONmh^VlmID5x&bxNz?q>5xA4Tb+tfB^vbiHeZvkMwh38t{} zfrW*Y_yZQUenT3?Cinv)B7&vZSXwJ6Sl9@DK@bEjl%NC^3n376jho$hc<*jr#N8wV zmpi+2&zW=2%sAx(#KQrKl%_G-s9NBJC$6>0A4)UJrORz-Js2t_%13K^?avMY4FMIw zM$tgL<9Q&A=n!brB`~zR9iqSy0)*)jn63h8M<4(Z5JsjdV6f3@2)<824}ml~f>y&k zaG5}|>-HakA_Xd2fj6GR`(q^`0G7ziTfqdaAP-dBLRttqzPG1JJYU&0C8{s7e|-uf zn2Z(-_5NM2V}5Y~jWBGhfU9&bfg%r7hIx|iSkj^&1R$JDF_GnFD9{p0CGGq)n;iw> z{%3FT<#Pjhr4r%)FC%^z%g%kdo SOD@0w0000^@RCwBqQ_pJ?K^T2Iv(|3?(UNFE z=pkyWrCx-Hr=GkC3SK8iM;6ETjMX3Ko@mx>{c<~^`qYwnO)*n@BThmqxp~jGG zvO6>D_f2LuSx|7;$IQ-t@9lfv?s(M&*x`AYqp5`d8yiW2$Gq?pw?iAJX0AWF*Q$Mj zM>iwKP9hkafRICZs_&z^c=KU)YfSb?96COQk>Y7Y%{{bsKV$pDD@>KI<@jC@fH)!} zX|muTj8-sF7yiLfjGdW9rxT&s>Od1CAy*c(=Gv4eG&yjPiPp%VNK8d&G(+s}HTnVs zu1$G9)uzJ=unTKV2(-g43NE8@v!EKfWYX&!eAVxPG&+V>u?y!RRyrf5GdF-Zl2&CB zcs&@wH%zeB85)WmV0F^&@C$9dPE}XLd6QG{TU?t&3a)auCC~ z2!?u~=%I1MG=fL-e!I;veEXtzn_xAo$kw$3ua(w+jc{wdXzQ6L?k@o>5-SYZ|9~3V zgR%~6s|P+I3)JgvThBcHqk;!dQ1~6s_YP)RpX(gF%<-hsT33u0tE}|wXKJq?NulUy=lRVDD@B!=|RwgAA~|7P#aAt zy`&L?CaE#WZZ^B?ypUqEZoz>c?}Pu$o0<0>5s5^QnNbvl5eR}9fMpxN0VN=#>v}>} z)jWV`bg*^W?EJ;^qmkY-gXenML}zPNmUHoV{Og-nFT0AnxwoL%ro3J+f{0Ck37pe4 zHgS74*nRSp-+ja>(j-B%4CC;0ba-03`W(r`Dk)3lZ4#$pq*kj92Eq}aLpbaaIF=;| zMC_%7=k627dWJ7w>%%&_TCJL;-|qDfx$z{EuSgi9z&CKVb9w1eJFO^+SpeQ*wYI2Q zy&Tkg-03t5(zyx)zWhNMlr=>vBI*!t=3FmDtro$zOvuVo(u#OZ20r5PK91aJv+wF+sIK;B-X6*S=nyLL(s;bs}GD%RoKfh-mFD@iYrP3;C zj1Jf6VHjro-krPiQ#Y^1S7I+xx+0aWEM*~7xv~;l{&Ic%%7=~5>#rqA`ay)lVWer= z9zL6mo0y)y{~#K@HJ{JtovFmNzC<|rf+!x1%*@QqMWZ(! zg7Z_@-UK$xnh0+IWwTj?LZJ`}27_ahlT!|0}viUZ(2v@}M& ifo6hg80)$}0t^7#XCuWh+DDfF0000 True Resources.resx + True SettingsSingleFileGenerator @@ -91,5 +92,17 @@ + + + + + + + + + + + + \ No newline at end of file From d21371cfd625b8c4fa5a1103dbad8d0913e95712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 03:06:22 +0300 Subject: [PATCH 7/9] =?UTF-8?q?=D0=9D=D0=B0=D0=BA=D0=BE=D0=BD=D0=B5=D1=86-?= =?UTF-8?q?=D1=82=D0=BE=20=D1=83=D0=B2=D0=B8=D0=B4=D0=B5=D0=BB=20=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=B3=D0=B8=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20settings=20=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D1=81=20=D0=B2=D1=81=D0=B5=20=D1=82=D1=83=D0=B4=D0=B0=20?= =?UTF-8?q?-=5F-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/App.config | 12 ++++ fileFinder/MainForm.cs | 10 ++-- fileFinder/MainSettings.Designer.cs | 62 -------------------- fileFinder/MainSettings.cs | 28 --------- fileFinder/MainSettings.settings | 15 ----- fileFinder/Properties/Settings.Designer.cs | 66 ++++++++++++++++------ fileFinder/Properties/Settings.settings | 20 +++++-- fileFinder/fileFinder.csproj | 10 ---- 8 files changed, 80 insertions(+), 143 deletions(-) delete mode 100644 fileFinder/MainSettings.Designer.cs delete mode 100644 fileFinder/MainSettings.cs delete mode 100644 fileFinder/MainSettings.settings diff --git a/fileFinder/App.config b/fileFinder/App.config index 1260fc0..d4733c8 100644 --- a/fileFinder/App.config +++ b/fileFinder/App.config @@ -2,6 +2,7 @@ +
@@ -9,6 +10,17 @@ + + + C:\nextcloud\ + + + * + + + sh + + C:\nextcloud\ diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index a416777..5a761e0 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -25,7 +25,7 @@ namespace fileFinder private void restoreLastSession() { - MainSettings sets = MainSettings.Default; + var sets = Properties.Settings.Default; fileUrlTextBox.Text = sets.fileUrl; innerQueryTextBox.Text = sets.fileInnerQuery; nameQueryTextBox.Text = sets.fileNameQuery; @@ -170,10 +170,10 @@ namespace fileFinder private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { - MainSettings.Default.fileUrl = fileUrlTextBox.Text; - MainSettings.Default.fileNameQuery = nameQueryTextBox.Text; - MainSettings.Default.fileInnerQuery = innerQueryTextBox.Text; - MainSettings.Default.Save(); + Properties.Settings.Default.fileUrl = fileUrlTextBox.Text; + Properties.Settings.Default.fileNameQuery = nameQueryTextBox.Text; + Properties.Settings.Default.fileInnerQuery = innerQueryTextBox.Text; + Properties.Settings.Default.Save(); } private void fileUrlTextBox_TextChanged(object sender, EventArgs e) diff --git a/fileFinder/MainSettings.Designer.cs b/fileFinder/MainSettings.Designer.cs deleted file mode 100644 index 020f0e1..0000000 --- a/fileFinder/MainSettings.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Этот код создан программой. -// Исполняемая версия:4.0.30319.42000 -// -// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае -// повторной генерации кода. -// -//------------------------------------------------------------------------------ - -namespace fileFinder { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] - internal sealed partial class MainSettings : global::System.Configuration.ApplicationSettingsBase { - - private static MainSettings defaultInstance = ((MainSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new MainSettings()))); - - public static MainSettings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("C:\\nextcloud\\")] - public string fileUrl { - get { - return ((string)(this["fileUrl"])); - } - set { - this["fileUrl"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("*")] - public string fileNameQuery { - get { - return ((string)(this["fileNameQuery"])); - } - set { - this["fileNameQuery"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("sh")] - public string fileInnerQuery { - get { - return ((string)(this["fileInnerQuery"])); - } - set { - this["fileInnerQuery"] = value; - } - } - } -} diff --git a/fileFinder/MainSettings.cs b/fileFinder/MainSettings.cs deleted file mode 100644 index 88d1e7c..0000000 --- a/fileFinder/MainSettings.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace fileFinder { - - - // Этот класс позволяет обрабатывать определенные события в классе параметров: - // Событие SettingChanging возникает перед изменением значения параметра. - // Событие PropertyChanged возникает после изменения значения параметра. - // Событие SettingsLoaded возникает после загрузки значений параметров. - // Событие SettingsSaving возникает перед сохранением значений параметров. - internal sealed partial class MainSettings { - - public MainSettings() { - // // Для добавления обработчиков событий для сохранения и изменения параметров раскомментируйте приведенные ниже строки: - // - // this.SettingChanging += this.SettingChangingEventHandler; - // - // this.SettingsSaving += this.SettingsSavingEventHandler; - // - } - - private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { - // Добавьте здесь код для обработки события SettingChangingEvent. - } - - private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { - // Добавьте здесь код для обработки события SettingsSaving. - } - } -} diff --git a/fileFinder/MainSettings.settings b/fileFinder/MainSettings.settings deleted file mode 100644 index f9232cd..0000000 --- a/fileFinder/MainSettings.settings +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - C:\nextcloud\ - - - * - - - sh - - - \ No newline at end of file diff --git a/fileFinder/Properties/Settings.Designer.cs b/fileFinder/Properties/Settings.Designer.cs index 560fc82..a7cc4c6 100644 --- a/fileFinder/Properties/Settings.Designer.cs +++ b/fileFinder/Properties/Settings.Designer.cs @@ -1,30 +1,62 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. // //------------------------------------------------------------------------------ -namespace fileFinder.Properties -{ - - +namespace fileFinder.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\nextcloud\\")] + public string fileUrl { + get { + return ((string)(this["fileUrl"])); + } + set { + this["fileUrl"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("*")] + public string fileNameQuery { + get { + return ((string)(this["fileNameQuery"])); + } + set { + this["fileNameQuery"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("sh")] + public string fileInnerQuery { + get { + return ((string)(this["fileInnerQuery"])); + } + set { + this["fileInnerQuery"] = value; + } + } } } diff --git a/fileFinder/Properties/Settings.settings b/fileFinder/Properties/Settings.settings index 3964565..d4c995d 100644 --- a/fileFinder/Properties/Settings.settings +++ b/fileFinder/Properties/Settings.settings @@ -1,7 +1,15 @@  - - - - - - + + + + + C:\nextcloud\ + + + * + + + sh + + + \ No newline at end of file diff --git a/fileFinder/fileFinder.csproj b/fileFinder/fileFinder.csproj index 0ec3958..e225be6 100644 --- a/fileFinder/fileFinder.csproj +++ b/fileFinder/fileFinder.csproj @@ -51,12 +51,6 @@ MainForm.cs - - - True - True - MainSettings.settings - @@ -75,10 +69,6 @@ Resources.resx True - - SettingsSingleFileGenerator - MainSettings.Designer.cs - SettingsSingleFileGenerator Settings.Designer.cs From 8b0f4df7bf79300ec2e1ae6be7f803977008a4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 03:18:34 +0300 Subject: [PATCH 8/9] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=80=D1=83=D1=81=D1=81=D0=BA=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=D0=B3=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/MainForm.Designer.cs | 68 ++++++++++++++++----------------- fileFinder/MainForm.cs | 16 ++++---- fileFinder/TaskController.cs | 1 + 3 files changed, 43 insertions(+), 42 deletions(-) diff --git a/fileFinder/MainForm.Designer.cs b/fileFinder/MainForm.Designer.cs index 222c7ad..a7745b4 100644 --- a/fileFinder/MainForm.Designer.cs +++ b/fileFinder/MainForm.Designer.cs @@ -33,15 +33,15 @@ this.dirSelectBtn = new System.Windows.Forms.Button(); this.fileUrlTextBox = new System.Windows.Forms.TextBox(); this.splitContainer = new System.Windows.Forms.SplitContainer(); + this.fileInnerQueryLabel = new System.Windows.Forms.Label(); + this.fileNameQueryLabel = new System.Windows.Forms.Label(); + this.fileUrlLabel = new System.Windows.Forms.Label(); this.handleSearchBtn = new System.Windows.Forms.Button(); this.innerQueryTextBox = new System.Windows.Forms.TextBox(); this.nameQueryTextBox = new System.Windows.Forms.TextBox(); this.waitOrPauseLabel = new System.Windows.Forms.Label(); this.bottomPanel = new System.Windows.Forms.Panel(); this.infoLabel = new System.Windows.Forms.Label(); - this.fileUrlLabel = new System.Windows.Forms.Label(); - this.fileNameQueryLabel = new System.Windows.Forms.Label(); - this.fileInnerQueryLabel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -64,7 +64,7 @@ this.dirSelectBtn.Name = "dirSelectBtn"; this.dirSelectBtn.Size = new System.Drawing.Size(120, 21); this.dirSelectBtn.TabIndex = 2; - this.dirSelectBtn.Text = "Select Directory"; + this.dirSelectBtn.Text = "Выбрать путь"; this.dirSelectBtn.UseVisualStyleBackColor = true; this.dirSelectBtn.Click += new System.EventHandler(this.dirSelectBtn_Click); // @@ -105,13 +105,40 @@ this.splitContainer.SplitterDistance = 88; this.splitContainer.TabIndex = 4; // + // fileInnerQueryLabel + // + this.fileInnerQueryLabel.AutoSize = true; + this.fileInnerQueryLabel.Location = new System.Drawing.Point(12, 65); + this.fileInnerQueryLabel.Name = "fileInnerQueryLabel"; + this.fileInnerQueryLabel.Size = new System.Drawing.Size(133, 13); + this.fileInnerQueryLabel.TabIndex = 6; + this.fileInnerQueryLabel.Text = "Искомый текст в файле:"; + // + // fileNameQueryLabel + // + this.fileNameQueryLabel.AutoSize = true; + this.fileNameQueryLabel.Location = new System.Drawing.Point(12, 39); + this.fileNameQueryLabel.Name = "fileNameQueryLabel"; + this.fileNameQueryLabel.Size = new System.Drawing.Size(119, 13); + this.fileNameQueryLabel.TabIndex = 6; + this.fileNameQueryLabel.Text = "Шаблон имени файла:"; + // + // fileUrlLabel + // + this.fileUrlLabel.AutoSize = true; + this.fileUrlLabel.Location = new System.Drawing.Point(12, 13); + this.fileUrlLabel.Name = "fileUrlLabel"; + this.fileUrlLabel.Size = new System.Drawing.Size(76, 13); + this.fileUrlLabel.TabIndex = 6; + this.fileUrlLabel.Text = "Путь к папке:"; + // // handleSearchBtn // this.handleSearchBtn.Location = new System.Drawing.Point(668, 61); this.handleSearchBtn.Name = "handleSearchBtn"; this.handleSearchBtn.Size = new System.Drawing.Size(120, 21); this.handleSearchBtn.TabIndex = 5; - this.handleSearchBtn.Text = "Start Task"; + this.handleSearchBtn.Text = "Запустить поиск"; this.handleSearchBtn.UseVisualStyleBackColor = true; this.handleSearchBtn.Click += new System.EventHandler(this.handleSearchBtn_Click); // @@ -161,36 +188,9 @@ this.infoLabel.AutoSize = true; this.infoLabel.Location = new System.Drawing.Point(0, 0); this.infoLabel.Name = "infoLabel"; - this.infoLabel.Size = new System.Drawing.Size(278, 13); + this.infoLabel.Size = new System.Drawing.Size(301, 13); this.infoLabel.TabIndex = 0; - this.infoLabel.Text = "Time: 00:00:00 | Number of files: 0/0/0 | Current file: none"; - // - // fileUrlLabel - // - this.fileUrlLabel.AutoSize = true; - this.fileUrlLabel.Location = new System.Drawing.Point(12, 13); - this.fileUrlLabel.Name = "fileUrlLabel"; - this.fileUrlLabel.Size = new System.Drawing.Size(76, 13); - this.fileUrlLabel.TabIndex = 6; - this.fileUrlLabel.Text = "Путь к папке:"; - // - // fileNameQueryLabel - // - this.fileNameQueryLabel.AutoSize = true; - this.fileNameQueryLabel.Location = new System.Drawing.Point(12, 39); - this.fileNameQueryLabel.Name = "fileNameQueryLabel"; - this.fileNameQueryLabel.Size = new System.Drawing.Size(119, 13); - this.fileNameQueryLabel.TabIndex = 6; - this.fileNameQueryLabel.Text = "Шаблон имени файла:"; - // - // fileInnerQueryLabel - // - this.fileInnerQueryLabel.AutoSize = true; - this.fileInnerQueryLabel.Location = new System.Drawing.Point(12, 65); - this.fileInnerQueryLabel.Name = "fileInnerQueryLabel"; - this.fileInnerQueryLabel.Size = new System.Drawing.Size(133, 13); - this.fileInnerQueryLabel.TabIndex = 6; - this.fileInnerQueryLabel.Text = "Искомый текст в файле:"; + this.infoLabel.Text = "Время: 00:00:00 | Кол-во файлов: 0/0/0 | Состояние: готов"; // // MainForm // diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index 5a761e0..f6492b4 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -95,22 +95,22 @@ namespace fileFinder case TaskState.Created: searchQueryModel = mainController.updateSearchQueryModel(fileUrlTextBox.Text, nameQueryTextBox.Text, innerQueryTextBox.Text); - handleSearchBtn.Text = "Pause Task"; + handleSearchBtn.Text = "Поставить на паузу"; mainController.beginTask(); changeVisibilityResultViewer(); TreeNode tN = await Task.Run(() => mainController.buildResultTree(searchQueryModel, progress)); if (tN != null) { updateResultViewer(tN); - handleSearchBtn.Text = "Start Task"; + handleSearchBtn.Text = "Запустить поиск"; } break; case TaskState.Work: - handleSearchBtn.Text = "Resume Task"; + handleSearchBtn.Text = "Продолжить"; mainController.pauseTask(); break; case TaskState.Pause: - handleSearchBtn.Text = "Pause Task"; + handleSearchBtn.Text = "Поставить на паузу"; mainController.resumeTask(); break; case TaskState.Finished: @@ -142,8 +142,8 @@ namespace fileFinder TimeSpan tS = mainController.elapsedTime(); string fileNumCounters = rpm.matchingFiles + "/" + rpm.processedFiles + "/" + rpm.totalNumOfFiles; string time = String.Format("{0:00}:{1:00}:{2:00}", tS.Hours, tS.Minutes, tS.Seconds); - infoLabel.Text = "Time: " + time + " " + "| Number of files: " + fileNumCounters + - " | Current file: " + fileUrl; + infoLabel.Text = "Время: " + time + " " + "| Кол-во файлов: " + fileNumCounters + + " | Статус: " + fileUrl; } @@ -162,7 +162,7 @@ namespace fileFinder { TimeSpan tS = mainController.elapsedTime(); string time = String.Format("{0:00}:{1:00}:{2:00}", tS.Hours, tS.Minutes, tS.Seconds); - infoLabel.Text = "Time: " + time + " |" + + infoLabel.Text = "Время: " + time + " |" + infoLabel.Text.Substring(infoLabel.Text.IndexOf("|") + 1); }; try { this.Invoke(refresh); } catch { } @@ -196,7 +196,7 @@ namespace fileFinder if (!isFieldsChanged) { isFieldsChanged = true; - handleSearchBtn.Text = "Start New Task"; + handleSearchBtn.Text = "Начать поиск"; } } } diff --git a/fileFinder/TaskController.cs b/fileFinder/TaskController.cs index c362e54..48a7b96 100644 --- a/fileFinder/TaskController.cs +++ b/fileFinder/TaskController.cs @@ -54,6 +54,7 @@ namespace fileFinder { TaskController controller = this; TreeNode itemsNode = new TreeNode(); + report.Report(createReport(null, "Индексирование заданного пути", 0, 0, 0)); List foundFiles = getFileList(query.fileUrl, query.fileNameQuery); report.Report(createReport(null, null, 0, 0, foundFiles.Count)); From 1f6aff4ce3b39b5100d09f594ca47c000d3fba22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 4 Oct 2018 03:30:07 +0300 Subject: [PATCH 9/9] =?UTF-8?q?=D0=9D=D0=B5=D0=B7=D0=BD=D0=B0=D1=87=D0=B8?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fileFinder/MainForm.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index f6492b4..72f8aaa 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -82,7 +82,8 @@ namespace fileFinder if (fileUrlTextBox.Text.Equals("") || nameQueryTextBox.Text.Equals("") || innerQueryTextBox.Text.Equals("")) { - MessageBox.Show("Вы не заполнили одно из полей. Проверьте все и повторно нажмите \"Запуск задания\"!"); + MessageBox.Show("Вы не заполнили одно из полей. Проверьте все и повторно нажмите \"Запуск задания\"!", + "Сообщение"); return; } @@ -156,7 +157,7 @@ namespace fileFinder } } - private void refreshInfoByTimer (object sender, ElapsedEventArgs e) + private void refreshInfoByTimer(object sender, ElapsedEventArgs e) { Action refresh = () => {