public Options() { folder_configData = new FolderJsonData(); file_configData = new FileJsonData(); comment_regexConfig = new RegexJsonData(); comment_findConfig = new FileJsonData(); }
public void load_config() { FileExt = ConfigHelper.GetAppConfig("FileExt", "*.c;*.cpp;*.h;*.java;*.php;*.asp;*.aspx;*.cs;*.js;*.go;*txt;*.ini;*.txt;*.py"); DiffTool = ConfigHelper.GetAppConfig("DiffTool", "0"); DiffToolPath = ConfigHelper.GetAppConfig("DiffToolPath", ""); BackupType = ConfigHelper.GetAppConfig("BackupType", "0"); BackupPath = ConfigHelper.GetAppConfig("BackupPath", "."); string igfolder = ConfigHelper.GetAppConfig("IgnoreFolder", ""); string igfile = ConfigHelper.GetAppConfig("IgnoreFile", ""); string regex = ConfigHelper.GetAppConfig("Comment_Regex", ""); string cFind = ConfigHelper.GetAppConfig("Comment_Find", ""); try { if ((igfolder.Length == 0) && (igfile.Length == 0) && (regex.Length == 0)) { config_inited = true; reset_ignore(); } else { config_inited = true; } if (igfolder.Length > 0) { folder_configData = COptionsHelper.getFolderOptions(igfolder); } if (igfile.Length > 0) { file_configData = COptionsHelper.getFileOptions(igfile); } if (regex.Length > 0) { comment_regexConfig = COptionsHelper.getRegexOptions(regex); } if (cFind.Length > 0) { comment_findConfig = COptionsHelper.getFileOptions(cFind); } int dindex = Convert.ToInt32(DiffTool); if ((dindex < 0) || (dindex > 3)) { dindex = 0; } } catch (Exception ex) { throw ex; } }
public static string getFileOptionsString(FileJsonData jsonData) { string ls = JsonHelper.ObjectToJson(jsonData); ls = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(ls)); return(ls); }
public static FileJsonData getFileOptions(string opstr) { byte[] bdata = Convert.FromBase64String(opstr); string str = System.Text.Encoding.Default.GetString(bdata); FileJsonData jsdata = new FileJsonData(); jsdata = (FileJsonData)JsonHelper.JsonToObject(str, (object)jsdata); return(jsdata); }