private void ExecutedScriptCommand(FunctionListObject functionObj, Window frmParent) { //string funcName = System.Reflection.MethodBase.GetCurrentMethod().Name; //Lấy tên function hiện tại string strScript = GetScriptCommandByFuncName(functionObj.FuncName); strScript = GenerateScriptWithParameters(functionObj, strScript, frmParent); if (string.IsNullOrEmpty(strScript)) { ShowMessengeInfo("Không có mã thực thi"); return; } SQLAppWaitingDialog.ShowDialog(); string sourceUrl = GetSourceCodePath(); string output = SQLApp.ExecutedPowerShell(string.Format("cd {0} {1} {2}", sourceUrl, Environment.NewLine, strScript)); string strType = SQLApp.GetIniFile(strFileCfgScript, strDynPara, functionObj.Name + "Show"); if (!string.IsNullOrEmpty(strType)) { ShowScriptCommand(output, strType); SQLAppWaitingDialog.HideDialog(); return; } SQLAppWaitingDialog.HideDialog(); ShowMessengeInfo(output); }
public int GetAnimateWindowTime() { int dwTime = 5000; dwTime = Convert.ToInt32(SQLApp.GetIniFile(strFileName, "AnimateWindow", "AnimateTime")); return(dwTime); }
public string GetItemConfig(string keySection, string keyPrefix, int idx) { if (string.IsNullOrEmpty(keySection)) { keySection = section; } return(SQLApp.GetIniFile(strFileName, keySection, keyPrefix + (idx + 1))); }
public string GetThemeName() { string _themeName = SQLApp.GetIniFile(StrFileName, StrThemeApp, StrThemeName); if (string.IsNullOrEmpty(_themeName)) { _themeName = Properties.Resources.ThemeName; } return(_themeName); }
public void ShowFunctionList(string strFuncName, Window frmParent) { string sourceUrl = SQLApp.GetIniFile(strFileName, "SourceCode", "SourceUrl"); bool isReturn = false; if (string.IsNullOrEmpty(sourceUrl) || !Directory.Exists(sourceUrl)) { isReturn = true; FolderBrowserDialog folder = new FolderBrowserDialog(); if (folder.ShowDialog() == DialogResult.OK) { SQLApp.SetIniFile(strFileName, "SourceCode", "SourceUrl", folder.SelectedPath); isReturn = false; } } if (isReturn) { return; } List <string> lstFuncs = SQLApp.GetKeysIniFile(strCfgScriptName, strFuncName, 3000); List <FunctionListObject> lstObjectFuncs = new List <FunctionListObject>(); lstFuncs.ForEach(x => { string caption = SQLApp.GetIniFile(strCfgScriptName, "Captions", x); if (string.IsNullOrEmpty(caption)) { caption = string.Join(" ", x.ToUpper().Split('_')); } lstObjectFuncs.Add(new FunctionListObject { Name = x, Text = caption }); }); PromptForm._frmParent = frmParent; string value = string.Empty; MessageBoxResult messageResult = PromptForm.ShowCombobox("Function List In Source", "Function Name", lstObjectFuncs.Select(x => x.Text).ToArray(), ref value); if (messageResult == MessageBoxResult.OK) { FunctionListObject functionObj = lstObjectFuncs.Find(x => x.Text.Equals(value)); string strKey = (functionObj != null) ? functionObj.Name : string.Empty; string functionName = SQLApp.GetIniFile(strCfgScriptName, strFuncName, strKey); if (functionName.StartsWith("Cmd")) { functionObj.FuncName = functionName; ExecutedScriptCommand(functionObj, frmParent); } else { CallMethodName(functionName, frmParent); } } }
public List <string> LoadConfigInitToList(string keySection = null) { List <string> lst = new List <string>(); if (string.IsNullOrEmpty(keySection)) { keySection = section; } string count = SQLApp.GetIniFile(strFileName, keySection, serverCnt); if (!string.IsNullOrEmpty(count)) { for (int i = 0; i < Convert.ToInt32(count); i++) { lst.Add(SQLApp.GetIniFile(strFileName, keySection, ServerDesc + (i + 1))); } } return(lst); }
public void MoveFileFolder(Window frmParent) { string sourceUrl = GetSourceCodePath(); SQLAppWaitingDialog.ShowDialog(); List <string> funcKeysIni = SQLApp.GetKeysIniFile(strPath, "FileToFolder"); foreach (string item in funcKeysIni) { string strText = SQLApp.GetIniFile(strPath, "FileToFolder", item); string[] arr = item.Split('.'); DirectoryInfo directory = Directory.CreateDirectory(sourceUrl + "/" + string.Join("/", arr)); foreach (string file in strText.Split('|')) { string[] lstFile = Directory.GetFiles(sourceUrl + "/" + arr.FirstOrDefault(), file, SearchOption.AllDirectories); foreach (var filePath in lstFile) { string[] lines = File.ReadAllLines(filePath); for (int i = 0; i < lines.Length - 1; i++) { foreach (string item1 in funcKeysIni) { string[] arr1 = item1.Split('.'); if (lines[i].Contains("App\\" + arr1.FirstOrDefault())) { lines[i].Replace("App\\" + arr1.FirstOrDefault(), "App\\" + string.Join("\\", arr1)); } } } File.WriteAllLines(filePath, lines); File.Move(filePath, directory.FullName); } } } SQLAppWaitingDialog.HideDialog(); }
public void GetAllLanguage(Window frmParent) { try { string sourceUrl = SQLApp.GetIniFile(strFileName, "SourceCode", "SourceUrl"); string[] listFiles = Directory.GetFiles(string.Format("{0}\\database\\seeds\\lang", sourceUrl), "*_lang.php", SearchOption.AllDirectories); DataTable dtLang = new DataTable("Language"); DataColumn col = new DataColumn("Group"); dtLang.Columns.Add(col); col = new DataColumn("Key"); dtLang.Columns.Add(col); col = new DataColumn("Text_vi"); dtLang.Columns.Add(col); col = new DataColumn("Text_en"); dtLang.Columns.Add(col); col = new DataColumn("Text_ja"); dtLang.Columns.Add(col); foreach (string item in listFiles) { string strContent = SQLApp.ExecutedPowerShell(string.Format("php -r \"echo json_encode(require '{0}');\"", item)); object obj = JsonConvert.DeserializeObject(strContent); string objGroup = (obj as Newtonsoft.Json.Linq.JObject).GetValue("group").ToString(); Newtonsoft.Json.Linq.JArray objLang = (obj as Newtonsoft.Json.Linq.JObject).GetValue("lang") as Newtonsoft.Json.Linq.JArray; foreach (object objItem in objLang) { DataRow dr = dtLang.NewRow(); dr["Group"] = objGroup; dr["Key"] = (objItem as Newtonsoft.Json.Linq.JObject).GetValue("key").ToString(); dr["Text_vi"] = (objItem as Newtonsoft.Json.Linq.JObject).SelectToken("text.vi").ToString(); dr["Text_en"] = (objItem as Newtonsoft.Json.Linq.JObject).SelectToken("text.en").ToString(); dr["Text_ja"] = (objItem as Newtonsoft.Json.Linq.JObject).SelectToken("text.ja").ToString(); dtLang.Rows.Add(dr); } } ShowResultData(frmParent, dtLang); } catch (Exception ex) { } }
public string GetServerHistoryConfig() { return(SQLApp.GetIniFile(strFileName, "LoginHistory", "ServerOld")); }
public string GetDBHistoryConfig(int idx) { return(SQLApp.GetIniFile(strFileName, section, ServerDBOld + (idx + 1))); }
public string GetDescriptionConfig(int idx) { return(SQLApp.GetIniFile(strFileName, section, ServerDesc + (idx + 1))); }
public string GetPassWordConfig(int idx) { return(SQLApp.GetIniFile(strFileName, section, ServerPWD + (idx + 1))); }
public string GetUserNameConfig(int idx) { return(SQLApp.GetIniFile(strFileName, section, ServerUID + (idx + 1))); }
public void GetConfigConnectSQL(string status, int idx = 0) { string cnt = SQLApp.GetIniFile(strFileName, section, serverCnt); int index = Convert.ToInt32(cnt); switch (status) { case "Add": case "Edit": string strDesc = SQLApp.GetIniFile(strFileName, section, ServerDesc + idx); MessageBoxResult result = PromptForm.ShowText("Description", "Description", ref strDesc); if (result == MessageBoxResult.Cancel) { return; } string strServer = SQLApp.GetIniFile(strFileName, section, ServerName + idx); result = PromptForm.ShowText("Server", "Server", ref strServer); if (result == MessageBoxResult.Cancel) { return; } string strUser = SQLApp.GetIniFile(strFileName, section, ServerUID + idx); result = PromptForm.ShowText("User", "User", ref strUser); if (result == MessageBoxResult.Cancel) { return; } string strPass = SQLApp.GetIniFile(strFileName, section, ServerPWD + idx); result = PromptForm.ShowText("Pass", "Pass", ref strPass); if (result == MessageBoxResult.Cancel) { return; } if (!string.IsNullOrEmpty(strDesc) && !string.IsNullOrEmpty(strServer) && !string.IsNullOrEmpty(strUser)) { if (status == "Add") { index += 1; SQLApp.SetIniFile(strFileName, section, serverCnt, index.ToString()); } else { index = idx; } SQLApp.SetIniFile(strFileName, section, ServerDesc + index, strDesc); SQLApp.SetIniFile(strFileName, section, ServerName + index, strServer); SQLApp.SetIniFile(strFileName, section, ServerUID + index, strUser); SQLApp.SetIniFile(strFileName, section, ServerPWD + index, strPass); SQLApp.SetIniFile(strFileName, section, ServerDBOld + index, ""); } break; case "Del": SQLApp.SetIniFile(strFileName, section, serverCnt, (index - 1).ToString()); SQLApp.SetIniFile(strFileName, section, ServerDesc + idx, null); SQLApp.SetIniFile(strFileName, section, ServerName + idx, null); SQLApp.SetIniFile(strFileName, section, ServerUID + idx, null); SQLApp.SetIniFile(strFileName, section, ServerPWD + idx, null); SQLApp.SetIniFile(strFileName, section, ServerDBOld + idx, null); break; } }
public string GetScriptCommandByFuncName(string strFuncName) { return(SQLApp.GetIniFile(string.Concat(strPath, "ScriptCommand.ini"), "Laravel", strFuncName)); }