private bool isValidSource(FileInfo NextFile) { bool fvalid = true; List <jsonData> fileIgData = App_Config.file_configData.jsonData; for (int i = 0; i < fileIgData.Count; i++) { jsonData fdata = fileIgData[i]; if (fdata.cEnabled.ToLower() == "false") { continue; } //".Designer.cs" if (NextFile.Name.IndexOf(fdata.cName) >= 0) { fvalid = false; break; } } return(fvalid); }
private bool isValidFolder(DirectoryInfo NextFolder) { bool fvalid = true; List <jsonData> IgData = App_Config.folder_configData.jsonData; for (int i = 0; i < IgData.Count; i++) { jsonData fdata = IgData[i]; if (fdata.cEnabled.ToLower() == "false") { continue; } if (NextFolder.Name.ToLower() == fdata.cName.ToLower()) { fvalid = false; break; } if (NextFolder.FullName.IndexOf(@"\" + fdata.cName + @"\") >= 0) { fvalid = false; break; } } return(fvalid); }
private void show_config() { for (int i = 0; i < app_options.folder_configData.jsonData.Count; i++) { jsonData jData = app_options.folder_configData.jsonData[i]; int index = dataGridView1_Folder.Rows.Add(); dataGridView1_Folder.Rows[index].Cells[0].Value = jData.cEnabled; dataGridView1_Folder.Rows[index].Cells[1].Value = jData.cName; dataGridView1_Folder.Rows[index].Cells[2].Value = jData.cDesc; } for (int i = 0; i < app_options.file_configData.jsonData.Count; i++) { jsonData jData = app_options.file_configData.jsonData[i]; int index = dataGridView1_File.Rows.Add(); dataGridView1_File.Rows[index].Cells[0].Value = jData.cEnabled; dataGridView1_File.Rows[index].Cells[1].Value = jData.cName; dataGridView1_File.Rows[index].Cells[2].Value = jData.cDesc; } for (int i = 0; i < app_options.comment_regexConfig.jsonData.Count; i++) { jsonData jData = app_options.comment_regexConfig.jsonData[i]; int index = dataGridView1_CommentRegex.Rows.Add(); dataGridView1_CommentRegex.Rows[index].Cells[0].Value = jData.cEnabled; dataGridView1_CommentRegex.Rows[index].Cells[1].Value = jData.cName; dataGridView1_CommentRegex.Rows[index].Cells[2].Value = jData.cDesc; } for (int i = 0; i < app_options.comment_findConfig.jsonData.Count; i++) { jsonData jData = app_options.comment_findConfig.jsonData[i]; int index = dataGridView1_CommentFind.Rows.Add(); dataGridView1_CommentFind.Rows[index].Cells[0].Value = jData.cEnabled; dataGridView1_CommentFind.Rows[index].Cells[1].Value = jData.cName; dataGridView1_CommentFind.Rows[index].Cells[2].Value = jData.cDesc; } }
private bool checkCommentConfig(string comment) { bool bret1 = false; bool bret2 = false; for (int i = 0; i < app_Config.comment_regexConfig.jsonData.Count; i++) { jsonData regex_cfg = app_Config.comment_regexConfig.jsonData[i]; if (regex_cfg.cEnabled.ToLower() == "false") { continue; } Regex regex = new Regex(regex_cfg.cName, RegexOptions.IgnoreCase); bret1 = regex.IsMatch(comment); if (bret1) { break; } } for (int i = 0; i < app_Config.comment_findConfig.jsonData.Count; i++) { jsonData find_cfg = app_Config.comment_findConfig.jsonData[i]; if (find_cfg.cEnabled.ToLower() == "false") { continue; } bret2 = (comment.IndexOf(find_cfg.cName) > 0); if (bret2) { break; } } return(bret1 || bret2); }
private void reset_ignore() { jsonData jdata = new jsonData(@".git", "git resp folder", "true"); folder_configData.jsonData.Add(jdata); jdata = new jsonData(@"comment_backup", "default backup folder", "true"); folder_configData.jsonData.Add(jdata); jdata = new jsonData(@".Designer.cs", "C# Form Designer files", "true"); file_configData.jsonData.Add(jdata); jdata = new jsonData(@"[^(\x00-\x7f)]", "search not-ASCII comment", "true"); comment_regexConfig.jsonData.Add(jdata); jdata = new jsonData(@"comment", "search comment test", "false"); comment_findConfig.jsonData.Add(jdata); }
private void update_config() { app_options.folder_configData.jsonData.Clear(); for (int i = 0; i < dataGridView1_Folder.Rows.Count; i++) { DataGridViewRow row = dataGridView1_Folder.Rows[i]; jsonData jData = new jsonData("", "", ""); if (row.Cells[0].Value == null) { continue; } jData.cEnabled = row.Cells[0].Value.ToString(); jData.cName = (string)row.Cells[1].Value; jData.cDesc = (string)row.Cells[2].Value; app_options.folder_configData.jsonData.Add(jData); } app_options.file_configData.jsonData.Clear(); for (int i = 0; i < dataGridView1_File.Rows.Count; i++) { DataGridViewRow row = dataGridView1_File.Rows[i]; if (row.Cells[0].Value == null) { continue; } jsonData jData = new jsonData("", "", ""); jData.cEnabled = row.Cells[0].Value.ToString(); jData.cName = (string)row.Cells[1].Value; jData.cDesc = (string)row.Cells[2].Value; app_options.file_configData.jsonData.Add(jData); } app_options.comment_regexConfig.jsonData.Clear(); for (int i = 0; i < dataGridView1_CommentRegex.Rows.Count; i++) { DataGridViewRow row = dataGridView1_CommentRegex.Rows[i]; if (row.Cells[0].Value == null) { continue; } jsonData jData = new jsonData("", "", ""); jData.cEnabled = row.Cells[0].Value.ToString(); jData.cName = (string)row.Cells[1].Value; jData.cDesc = (string)row.Cells[2].Value; app_options.comment_regexConfig.jsonData.Add(jData); } app_options.comment_findConfig.jsonData.Clear(); for (int i = 0; i < dataGridView1_CommentFind.Rows.Count; i++) { DataGridViewRow row = dataGridView1_CommentFind.Rows[i]; if (row.Cells[0].Value == null) { continue; } jsonData jData = new jsonData("", "", ""); jData.cEnabled = row.Cells[0].Value.ToString(); jData.cName = (string)row.Cells[1].Value; jData.cDesc = (string)row.Cells[2].Value; app_options.comment_findConfig.jsonData.Add(jData); } }