private void readConfigToHash(string configFilePath) { IniHelper helper = new IniHelper(configFilePath); List <string> sections = helper.GetSections(); List <string> list2 = new List <string>(); char[] trimChars = new char[] { '\n', '\r', '\t', '\0' }; foreach (string str in sections) { foreach (string str2 in helper.GetKeys(str)) { if (!str2.Contains("#")) { string str3 = helper.GetIniFileString(str, str2, "").TrimEnd(trimChars); if (!clsGlobal.AutomationParamsHash.ContainsKey(str2)) { if ((str2 != "BASE_TEST_LOG") && (str2 != "SIM_FILE")) { clsGlobal.AutomationParamsHash.Add(str2, str3.Replace(" ", "")); } else { clsGlobal.AutomationParamsHash.Add(str2, str3); } } } } } }
private void btWeight_Click(object sender, EventArgs e) { IniHelper.Write("WeightPort_Setting", "串口", cBWeightComm.Text, iniHelper.FileName); IniHelper.Write("WeightPort_Setting", "波特率", cBWeightBaund.Text, iniHelper.FileName); IniHelper.Write("WeightPort_Setting", "称台号", cbWorkSole.Text, iniHelper.FileName); MessageBox.Show("保存成功!!"); }
private bool TryParseArgs(string[] args, out string errorMessage) { if (args.Length < 2) { errorMessage = "Missing required parameters."; return(false); } string configPath = args[1].Trim(); CoinControlIni ini; if (!IniHelper.TryReadIniFromFile <CoinControlIni>(configPath, out ini, out errorMessage)) { errorMessage = string.Format( "Failed to read coin control config: {0}\r\n{1}", new FileInfo(configPath).FullName, errorMessage); return(false); } m_config = ini; m_dataConnector = new LindaDataConnector( m_config.RpcUser, m_config.RpcPassword); errorMessage = null; return(true); }
public void ConfigureServices(IServiceCollection services) { services.AddSingleton <IDistributedCache>(new RedisCache(new RedisCacheOptions { Configuration = IniHelper.LoadIni("../web.config")["connectionStrings"]["cnodejsRedisConnectionString"], InstanceName = "Session_cnodejs" })); services.AddSession(a => { a.IdleTimeout = TimeSpan.FromMinutes(30); a.CookieName = "Session_cnodejs"; }).AddMvc(); //services.Configure<Microsoft.AspNetCore.Server.Kestrel.KestrelServerOptions>(option => { // option.UseHttps(new System.Security.Cryptography.X509Certificates.X509Certificate2()); //}); services.ConfigureSwaggerGen(options => { options.SingleApiVersion(new Info { Version = "v1", Title = "cnodejs API", Description = "cnodejs 项目webapi接口说明", TermsOfService = "None", Contact = new Contact { Name = "duoyi", Email = "", Url = "http://duoyi.com" }, License = new License { Name = "duoyi", Url = "http://duoyi.com" } }); options.IncludeXmlComments(AppContext.BaseDirectory + @"/Admin.xml"); }); services.AddSwaggerGen(); services.AddSingleton <IConfigurationRoot>(Configuration); }
private int saveConfigToHash(string configFilePath) { if (File.Exists(configFilePath) && ((File.GetAttributes(configFilePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)) { MessageBox.Show(configFilePath + "\nFile is read only! Please change property and retry.", "Error"); this.Cursor = Cursors.Default; return(1); } this.Cursor = Cursors.WaitCursor; IniHelper helper = new IniHelper(configFilePath); List <string> sections = helper.GetSections(); List <string> list2 = new List <string>(); foreach (string str in sections) { foreach (string str2 in helper.GetKeys(str)) { if (!str2.Contains("#") && clsGlobal.AutomationParamsHash.ContainsKey(str2)) { helper.IniWriteValue(str, str2, (string)clsGlobal.AutomationParamsHash[str2]); } } } int num = helper.IniSiRFLiveRxSetupErrorCheck(configFilePath); this.Cursor = Cursors.Default; return(num); }
public void SaveWinSize(Form form) { IniHelper.FilePath = AppDomain.CurrentDomain.BaseDirectory + Common.SettingsFile; int iWidth = form.Size.Width; if (iWidth < 100) { iWidth = 900; } int iHeight = form.Size.Height; if (iHeight < 100) { iHeight = 700; } int iLeft = form.Location.X; if (iLeft < 0) { iLeft = 0; } int iTop = form.Location.Y; if (iTop < 0) { iTop = 0; } IniHelper.WriteIniKey("Size", "width", iWidth.ToString()); IniHelper.WriteIniKey("Size", "height", iHeight.ToString()); IniHelper.WriteIniKey("Size", "left", iLeft.ToString()); IniHelper.WriteIniKey("Size", "top", iTop.ToString()); }
private void ButtonApiTest_Click(object sender, EventArgs e) { try { //string url = "https://aip.baidubce.com/oauth/2.0/token"; //string data = string.Format("grant_type=client_credentials&client_id={0}&client_secret={1}", TextBoxApiKey.Text, TextBoxSecretKey.Text); //string result = HttpClient.Post(data, url); //BaiduToken token = JsonConvert.DeserializeObject<BaiduToken>(result); string token = OCRHelper.GetBaiduToken(TextBoxApiKey.Text, TextBoxSecretKey.Text); if (token.Contains("错误")) { MessageBox.Show(this, token, "错误"); } else { TextBoxToken.Text = token; IniHelper.SetValue("百度接口", "API Key", TextBoxApiKey.Text.Trim()); IniHelper.SetValue("百度接口", "Secret Key", TextBoxSecretKey.Text.Trim()); IniHelper.SetValue("百度接口", "Access Token", TextBoxToken.Text.Trim()); IniHelper.SetValue("百度接口", "Date Token", DateTime.Now.ToString("yyyy-MM-dd")); MessageBox.Show(this, "已生成并保存密钥,有效期30天!", "提示"); } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "错误"); } }
private void LoadIni() { bool result = true; string resultStr = ""; resultStr = IniHelper.ReadValue(Parameter._iniSectionSetting, Parameter._iniKeyTimeZoneId, Parameter._setting_Path); if (resultStr.Equals("")) { result = IniHelper.WriteValue(Parameter._iniSectionSetting, Parameter._iniKeyTimeZoneId, Parameter._timezoneIdSpain, Parameter._setting_Path); GlobalVar._timezoneId = Parameter._timezoneIdSpain; } else { GlobalVar._timezoneId = resultStr; } resultStr = IniHelper.ReadValue(Parameter._iniSectionSetting, Parameter._iniKeyDebugMode, Parameter._setting_Path); if (resultStr.Equals("")) { result = IniHelper.WriteValue(Parameter._iniSectionSetting, Parameter._iniKeyDebugMode, "N", Parameter._setting_Path); GlobalVar._debugmode = false; } else { GlobalVar._debugmode = resultStr.Equals("Y", StringComparison.OrdinalIgnoreCase); } }
public void LoadIni() { bool result = true; string resultStr = ""; string[] valueStr; resultStr = IniHelper.ReadValue(Parameter._iniSectionCommonLink, Parameter._iniKeyNumberOfItem, Parameter._setting_Path); if (resultStr.Equals("")) { result = IniHelper.WriteValue(Parameter._iniSectionCommonLink, Parameter._iniKeyNumberOfItem, "0", Parameter._setting_Path); resultStr = "0"; } int count = 0; Int32.TryParse(resultStr, out count); if (count > 0) { string key = ""; for (int i = 0; i < count; i++) { key = Parameter._iniKeyUrl + (i + 1); resultStr = IniHelper.ReadValue(Parameter._iniSectionCommonLink, key, Parameter._setting_Path); resultStr = resultStr.Replace("\"", ""); valueStr = resultStr.Split(new string[] { "," }, StringSplitOptions.None); if (valueStr.Length == 3) { AddKey(valueStr[0], valueStr[1], valueStr[2]); } } } }
public int GetCodeList(out Dictionary <int, string> codeList) { codeList = new Dictionary <int, string>(); try { string fileName = _modelDir + "\\DefectCodeList.ini"; IniHelper iniHelper = new IniHelper(); int i = 1; while (true) { iniHelper.ReadValue("Info", "Name" + i.ToString(), fileName, out string valueOfName); iniHelper.ReadValue("Info", "CodeID" + i.ToString(), fileName, out string valueOfID); i++; if (default(string) == valueOfName || default(string) == valueOfID || "" == valueOfName || "" == valueOfID) { break; } var id = Convert.ToInt32(valueOfID); codeList.Add(id, valueOfName); } } catch (Exception ex) { codeList.Clear(); MessageBox.Show(ex.Message); return(0); } return(codeList.Count); }
protected internal override void Write() { try { var ScriptVer = IniHelper.GetScriptVersion(); if (ScriptVer < this.CurrentProfile.FullMinVersion) { this.ExitReason = ExitCodeEnum.MinVersionError; return; } w.WriteLine(AppCommon.Instance.CodeAutoGenMsg); w.WriteLine(AppCommon.Instance.CodeLicenseHeader); if (this.CurrentProfile.profileEndChars != null && this.CurrentProfile.profileEndChars.Length > 0) { EndCharsSelectedOptions EndingChars = (EndCharsSelectedOptions)EndCharsSelectedOptions.FromArray(this.CurrentProfile.profileEndChars); if (EndingChars.Count > 0) { w.Write("#Hotstring EndChars "); w.WriteLine(EndingChars.ToAutoHotkeyString()); } } this.ExitReason = ExitCodeEnum.NoError; } catch (Exception) { if (this.ExitReason == ExitCodeEnum.NotSet || this.ExitReason == ExitCodeEnum.NoError) { this.ExitReason = ExitCodeEnum.EndCharsGeneralError; } return; } }
private void FormMain_Load(object sender, EventArgs e) { // RichTextBox 段落缩进 RichTextBoxValue.SelectionIndent = 40; RichTextBoxValue.SelectionHangingIndent = -35; // RichTextBox 拖放事件绑定 RichTextBoxValue.AllowDrop = true; RichTextBoxValue.DragEnter += new DragEventHandler(FormMain_DragEnter); RichTextBoxValue.DragDrop += new DragEventHandler(FormMain_DragDrop); // 读取 ini 配置 IniHelper.IniLoad("Setting.ini"); OCRHelper.ApiKey = IniHelper.GetValue("百度接口", "API Key"); OCRHelper.SecretKey = IniHelper.GetValue("百度接口", "Secret Key"); OCRHelper.AccessToken = IniHelper.GetValue("百度接口", "Access Token"); // 注册热键 string value = IniHelper.GetValue("热键", "截图识别"); if (value != "") { HotKey.SetHotkey(Handle, "None", "F4", value, 200); } }
private Dictionary <string, string> GetDefectPositionInfoOfShot(string productName, string batchName, string boardName, string sideName, string shotName, string shotResultFileName) { Dictionary <string, string> defectPositionOfShot = new Dictionary <string, string>(); IniHelper iniHelper = new IniHelper(); if (!GetShotPathInfo(productName, batchName, boardName, sideName).TryGetValue(shotName, out var shotPath)) { return(defectPositionOfShot); } FolderHelper.GetInstance().SetFileExtension(_shotResultFileExtent); if (!FolderHelper.GetInstance().TryGetChildrenFileMap(shotPath, out var shotResultFile)) { return(defectPositionOfShot); } if (1 != shotResultFile.Count) { return(defectPositionOfShot); } if (!shotResultFile.TryGetValue(shotResultFileName, out var shotResultFilePath)) { return(defectPositionOfShot); } var encodingType = EncodingHelper.GetInstance().GetEncodingType(shotResultFilePath); foreach (var defect in GetDefectPathInfo(productName, batchName, boardName, sideName, shotName)) { iniHelper.ReadValue(defect.Key, @"SD_0000", shotResultFilePath, out var position); defectPositionOfShot.Add(defect.Key, position); } return(defectPositionOfShot); }
private void CreateDefaultIniFile() { bool result = true; result = IniHelper.WriteValue(Parameter._iniSectionSetting, Parameter._iniKeyTimeZoneId, Parameter._timezoneIdSpain, Parameter._setting_Path); result = IniHelper.WriteValue(Parameter._iniSectionSetting, Parameter._iniKeyDebugMode, "N", Parameter._setting_Path); }
private void button1_Click(object sender, EventArgs e) { IniHelper iniHelper = new IniHelper(Path.Combine(Environment.CurrentDirectory, "test.ini")); iniHelper.WriteValue("sec", "key1", "value1"); MessageBox.Show("ok"); }
private void FmSetting_Load(object sender, EventArgs e) { TextBoxApiKey.Text = OCRHelper.ApiKey; TextBoxSecretKey.Text = OCRHelper.SecretKey; TextBoxToken.Text = OCRHelper.AccessToken; TextBoxHotkey.Text = IniHelper.GetValue("热键", "截图识别"); }
// 保存按钮 private void ButtonSave_Click(object sender, EventArgs e) { // 保存 ini 配置 IniHelper.SetValue("百度接口", "API Key", TextBoxApiKey.Text.Trim()); IniHelper.SetValue("百度接口", "Secret Key", TextBoxSecretKey.Text.Trim()); IniHelper.SetValue("百度接口", "Access Token", TextBoxToken.Text.Trim()); IniHelper.SetValue("百度接口", "使用高精度接口", cbAccurate.Checked.ToString()); IniHelper.SetValue("热键", "截图识别", tbHotkeyCut.Text.Trim()); IniHelper.SetValue("热键", "显示/隐藏", tbHotkeyShow.Text.Trim()); IniHelper.SetValue("常规", "识别后文本累加", CheckBoxPlus.Checked.ToString()); IniHelper.SetValue("常规", "识别后自动复制", CheckBoxCopy.Checked.ToString()); IniHelper.SetValue("常规", "截图时隐藏窗体", CheckBoxHide.Checked.ToString()); IniHelper.SetValue("常规", "右下角显示托盘", CheckBoxTray.Checked.ToString()); IniHelper.SetValue("常规", "开机自启", CheckBoxStar.Checked.ToString()); IniHelper.SetValue("常规", "使用离线版", checkBoxOffline.Checked.ToString()); IniHelper.SetValue("翻译", "默认网址", ComboBoxTranList.SelectedIndex.ToString()); IniHelper.SetValue("翻译", "翻译选项", ComboBoxTranOption.SelectedIndex.ToString()); // 刷新变量 OCRHelper.ApiKey = TextBoxApiKey.Text.Trim(); OCRHelper.SecretKey = TextBoxSecretKey.Text.Trim(); OCRHelper.AccessToken = TextBoxToken.Text.Trim(); OCRHelper.Accurate = cbAccurate.Checked; Setting.TextPlus = CheckBoxPlus.Checked; Setting.TextCopy = CheckBoxCopy.Checked; Setting.FormHide = CheckBoxHide.Checked; Setting.FormTray = CheckBoxTray.Checked; Setting.SelfStart = CheckBoxStar.Checked; Setting.IsOffline = checkBoxOffline.Checked; Setting.HotkeyCut = tbHotkeyCut.Text.Trim(); Setting.HotkeyShow = tbHotkeyShow.Text.Trim(); Setting.TranItem = ComboBoxTranList.SelectedIndex; Setting.TranOption = ComboBoxTranOption.SelectedIndex; if (Setting.SelfStart) { string FilePath = Environment.GetFolderPath(Environment.SpecialFolder.Startup);//返回用户的“启动”程序组的目录 if (File.Exists(FilePath + "\\煎鱼OCR.lnk") == false) { CreateShortcut(FilePath + "\\煎鱼OCR.lnk");// 创建快捷方式 } } else { string FilePath = Environment.GetFolderPath(Environment.SpecialFolder.Startup); if (File.Exists(FilePath + "\\煎鱼OCR.lnk")) { File.Delete(FilePath + "\\煎鱼OCR.lnk"); } } //MessageBox.Show(this, "配置已保存!", "提示"); this.Close(); }
private void LoadWinSize(Form form) { IniHelper.FilePath = AppDomain.CurrentDomain.BaseDirectory + Common.SettingsFile; int iWidth = int.Parse(IniHelper.GetIniKeyValue("Size", "width", "984")); int iHeight = int.Parse(IniHelper.GetIniKeyValue("Size", "height", "612")); int iLeft = int.Parse(IniHelper.GetIniKeyValue("Size", "left", "0")); int iTop = int.Parse(IniHelper.GetIniKeyValue("Size", "top", "0")); if (iWidth < 500) { iWidth = 900; } if (iHeight < 100) { iHeight = 700; } if (iLeft < 0) { iLeft = 0; } if (iTop < 0) { iTop = 0; } //设置窗体状态 form.Size = new Size(iWidth, iHeight); form.Location = new Point(iLeft, iTop); }
private void writeAutoReplyData() { this.Cursor = Cursors.WaitCursor; IniHelper helper = new IniHelper(clsGlobal.InstalledDirectory + @"\scripts\SiRFLiveAutomationSetupAutoReply.cfg"); string section = string.Empty; string key = string.Empty; section = "TTB_TIME_AIDING"; key = "ENABLE"; if (this.comm.AutoReplyCtrl.TTBTimeAidingParams.Enable) { helper.IniWriteValue(section, key, "1"); } else { helper.IniWriteValue(section, key, "0"); } key = "TYPE"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Type.ToString()); key = "TIME_ACC"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Accuracy.ToString()); key = "TIME_SKEW"; helper.IniWriteValue(section, key, this.comm.AutoReplyCtrl.TTBTimeAidingParams.Skew.ToString()); this.Cursor = Cursors.Default; }
private void frmMain_Load(object sender, EventArgs e) { IniHelper.IniWriteValue("System", paths.MainHandle, this.Handle.ToInt32().ToString(), paths.HandlePath); /* xp系统 * */ //string pVerson = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //MessageBox.Show(pVerson); InspectorsLab.getInstance().DbHelper = m_pDbHelper; InspectorsLab.getInstance().ReadInSpectorRecords(); m_pRainfallsToolbar.DbHelper = m_pDbHelper; m_pRainfallsToolbar.SiteRainCalc = m_pSiteRainCalc; this.m_pDockPanel.DocumentStyle = DocumentStyle.DockingMdi; if (System.IO.File.Exists(paths.LayoutPath)) { this.m_pDockPanel.LoadFromXml(paths.LayoutPath, m_pDDC); } else { NewLayout(); } FormUnicomm(); string v = CINIFile.IniReadValue("基本信息", "软件版本", paths.baseInfoPath); m_pDbHelper.WriteRunLogInfoDB("start" + v, "软件启动"); CSoftInfo.getInstance().SetDefaultSiteName(m_pDefaultSiteName); m_bIsLoaded = true; }
private static void RegisterVars() { RegisterVar("toggleconsole", Keys.T, true); RegisterVar("enableconsole", IniHelper.GetValue("Other", "EnableConsole", false)); RegisterVar("notifications", IniHelper.GetValue("Other", "Notifications", true)); RegisterVar("spawninstorm", IniHelper.GetValue("Other", "SpawnInStorm", true)); RegisterVar("togglescript", IniHelper.GetValue("KeyBinds", "ToggleScript", Keys.F6), true); RegisterVar("enablekeybinds", IniHelper.GetValue("KeyBinds", "KeybindsEnabled", true)); RegisterVar("multiVortex", IniHelper.GetValue("VortexAdvanced", "MultiVortexEnabled", true)); RegisterVar("vortexMovementEnabled", IniHelper.GetValue("Vortex", "MovementEnabled", true)); RegisterVar("vortexMoveSpeedScale", IniHelper.GetValue("Vortex", "MoveSpeedScale", 1.0f)); RegisterVar("vortexTopEntitySpeed", IniHelper.GetValue("Vortex", "MaxEntitySpeed", 40.0f)); RegisterVar("vortexMaxEntityDist", IniHelper.GetValue("Vortex", "MaxEntityDistance", 57.0f)); RegisterVar("vortexHorizontalPullForce", IniHelper.GetValue("Vortex", "HorizontalForceScale", 1.7f)); RegisterVar("vortexVerticalPullForce", IniHelper.GetValue("Vortex", "VerticalForceScale", 2.29f)); RegisterVar("vortexRotationSpeed", IniHelper.GetValue("Vortex", "RotationSpeed", 2.4f)); RegisterVar("vortexRadius", IniHelper.GetValue("Vortex", "VortexRadius", 9.40f)); RegisterVar("vortexReverseRotation", IniHelper.GetValue("Vortex", "ReverseRotation", false)); RegisterVar("vortexMaxParticleLayers", IniHelper.GetValue("VortexAdvanced", "MaxParticleLayers", 47)); RegisterVar("vortexParticleCount", IniHelper.GetValue("VortexAdvanced", "ParticlesPerLayer", 9)); RegisterVar("vortexLayerSeperationScale", IniHelper.GetValue("VortexAdvanced", "LayerSeperationAmount", 22.0f)); RegisterVar("vortexParticleName", IniHelper.GetValue("VortexAdvanced", "ParticleName", "ent_amb_smoke_foundry")); RegisterVar("vortexParticleAsset", IniHelper.GetValue("VortexAdvanced", "ParticleAsset", "core")); RegisterVar("vortexParticleMod", IniHelper.GetValue("VortexAdvanced", "ParticleMod", true)); }
private void frmMain_Load(object sender, EventArgs e) { m_pUpLoad = CDataUpload.getInstance(); IniHelper.IniWriteValue("System", paths.MainHandle, this.Handle.ToInt32().ToString(), paths.HandlePath); string ip = CINIFile.IniReadValue("基本信息", "MTUP_IP", paths.baseInfoPath); //SQLite操作对象 m_pDbHelper = rainfallsDBHelper.getInstance(new SQLiteDbHelper(), m_pUpLoad); //报警算法 m_pDbHelper.InitQueueR(); InitializationRainfalls(); m_pInitCtrlThread = new Thread(new ThreadStart(InitializeCtrl)); m_pInitCtrlThread.Start(); //InitSiteCtrlThread = new Thread(new ThreadStart(initializeSiteObj)); //InitSiteCtrlThread.Start(); m_pInitRainMapEventThread = new Thread(new ThreadStart(UnicomInterface)); m_pInitRainMapEventThread.Start(); NetWorkCls.onNotify += new Notity(NetWorkCls_onNotify); // System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(timer_Elapsed), null, 0, 1000); Thread NetWorkThread = new Thread(new ThreadStart(timer_Elapsed)); NetWorkThread.Start(); Sysinfo(); }
private void ucBtnExtCheck_BtnClick(object sender, EventArgs e) { //AvUrlLink.JavDbUrl = IniHelper.Read("URL", "javdb", "https://javdb4.com/"); //AvUrlLink.JavLibraryUrl = IniHelper.Read("URL", "javlibrary", "http://www.n43a.com/cn/"); //AvUrlLink.AvMooUrl = IniHelper.Read("URL", "avmoo", "https://avmask.com/cn/"); //AvUrlLink.AvSoxUrl = IniHelper.Read("URL", "avsox", "https://avsox.host/cn/"); //AvUrlLink.JavBusUrl = IniHelper.Read("URL", "javbus", "https://www.seedmm.zone/"); if (!AvUrlLink.JavDbUrl.Equals(ucTextBoxExJavDb.InputText)) { AvUrlLink.JavDbUrl = ucTextBoxExJavDb.InputText; IniHelper.Write("URL", "javdb", ucTextBoxExJavDb.InputText); } if (!AvUrlLink.JavBusUrl.Equals(ucTextBoxExJavBus.InputText)) { AvUrlLink.JavBusUrl = ucTextBoxExJavBus.InputText; IniHelper.Write("URL", "javbus", ucTextBoxExJavBus.InputText); } if (!AvUrlLink.JavLibraryUrl.Equals(ucTextBoxExJavLib.InputText)) { AvUrlLink.JavLibraryUrl = ucTextBoxExJavLib.InputText; IniHelper.Write("URL", "javlibrary", ucTextBoxExJavLib.InputText); } if (!AvUrlLink.AvMooUrl.Equals(ucTextBoxExAvMoo.InputText)) { AvUrlLink.AvMooUrl = ucTextBoxExAvMoo.InputText; IniHelper.Write("URL", "avmoo", ucTextBoxExAvMoo.InputText); } if (!AvUrlLink.AvSoxUrl.Equals(ucTextBoxExAvSox.InputText)) { AvUrlLink.AvSoxUrl = ucTextBoxExAvSox.InputText; IniHelper.Write("URL", "avsox", ucTextBoxExAvSox.InputText); } }
public HeroesTextHelper() { IniHelper helper = new IniHelper(Program.INT_FILE); string val = helper.ReadValue("data", "forceZhCN"); if (val != null) { val = val.ToLower(); } TW2CN = "开" == val || "true" == val; PrefixNames = new Dictionary <string, string>(); SuffixNames = new Dictionary <string, string>(); EnchantDescs = new Dictionary <string, string>(); EnchantEffects = new Dictionary <string, string>(); EnchantEffectIfs = new Dictionary <string, string>(); ItemNames = new Dictionary <string, string>(); ItemDescs = new Dictionary <string, string>(); TitleNames = new Dictionary <string, string>(); TitleDescs = new Dictionary <string, string>(); MailTitles = new Dictionary <string, string>(); ItemStatNames = new Dictionary <string, string>(); SynSkillBonuds = new Dictionary <string, string>(); Regexs.Add(new Regex("HEROES_ATTRIBUTE_PREFIX_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), PrefixNames); Regexs.Add(new Regex("HEROES_ATTRIBUTE_SUFFIX_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), SuffixNames); Regexs.Add(new Regex("HEROES_ITEMCONSTRAINT_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), EnchantDescs); Regexs.Add(new Regex("HEROES_ENCHANTSTAT_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), EnchantEffects); Regexs.Add(new Regex("HEROES_ENCHANTCONDITION_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), EnchantEffectIfs); Regexs.Add(new Regex("HEROES_ITEM_NAME_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), ItemNames); Regexs.Add(new Regex("HEROES_ITEM_DESC_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), ItemDescs); Regexs.Add(new Regex("(HEROES_TITLE_NAME_\\S+?)\"\\s+\"([\\s\\S]+?)\""), TitleNames); Regexs.Add(new Regex("(HEROES_TITLE_GOAL_NAME_\\S+?)\"\\s+\"([\\s\\S]+?)\""), TitleDescs); Regexs.Add(new Regex("\"(\\S+?MAIL_TITLE)\"\\s+\"([\\s\\S]+?)\""), MailTitles); Regexs.Add(new Regex("HEROES_ITEMSTAT_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), ItemStatNames); Regexs.Add(new Regex("HEROES_DESC_AVATAR_SKILL_BONUS_(\\S+?)\"\\s+\"([\\s\\S]+?)\""), SynSkillBonuds); }
internal WriterBase() { baseTextWriter = new System.IO.StringWriter(); w = new IndentedTextWriter(baseTextWriter); this.ScriptMinVersion = IniHelper.GetScriptVersion(); this.HashBuilder = new StringBuilder(); }
public static void WriteFile(string s) { try { DeleteFile(true, true); File.WriteAllText($"{AppHelper.AppSetting.ShareFilePath}DevStart.txt", s, Encoding.GetEncoding("GB2312")); IniHelper.WriteIni("FILE_STATUS", "STATUS", "1", AppHelper.AppSetting.ShareFilePath + "DevStart.txt"); WaitResult = true; Live0xUtils.LogUtils.TxtLog.Append(AppHelper.LogFolder + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", $"开始测试[{JCLSH}]……"); Live0xUtils.LogUtils.TxtLog.Append(AppHelper.LogFolder + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", s.Replace("\r\n", " ")); string resultFilePath = Path.Combine(AppHelper.AppSetting.ShareFilePath, "DevResult.txt"); while (WaitResult && !File.Exists(resultFilePath) && !"1".Equals(IniHelper.ReadIni("FILE_STATUS", "STATUS", resultFilePath))) { Thread.Sleep(50); } if (WaitResult) { ReadResult(); } else { Live0xUtils.LogUtils.TxtLog.Append(AppHelper.LogFolder + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", $"取消读取结果[{JCLSH}]"); } } catch (Exception ex) { Live0xUtils.LogUtils.TxtLog.Append(AppHelper.LogFolder + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", ex.Message); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { cbbConnType.Items.Add("OleDb"); cbbConnType.Items.Add("MsSql"); cbbConnType.Items.Add("MySql"); cbbConnType.Items.Add("PgSql"); cbbConnType.Items.Add("SQLite"); cbbConnType.SelectedIndex = 0; cbbPageParamPos.Items.Add("POST"); cbbPageParamPos.Items.Add("GET"); IniHelper ini = new IniHelper(AppDomain.CurrentDomain.BaseDirectory + "config.ini"); string connType = ini.Read("Database", "ConnType"); cbbConnType.SelectedItem = connType; txtConnStr.Text = ini.Read("Database", connType + "ConnStr"); txtTableName.Text = ini.Read("Database", "TableName"); txtUrl.Text = ini.Read("Connector", "Url"); txtPageParamName.Text = ini.Read("Connector", "PageParamName"); cbbPageParamPos.SelectedItem = ini.Read("Connector", "PageParamPos"); txtFirstPageIndex.Text = ini.Read("Connector", "FirstPageIndex"); txtDetailUrl.Text = ini.Read("Connector", "DetailUrl"); txtGET.Text = ini.Read("Connector", "GET"); txtPOST.Text = ini.Read("Connector", "POST"); txtKey.Text = ini.Read("Connector", "Key"); txtHeaderRegEx.Text = ini.Read("Connector", "HeaderRegEx"); txtAppendHeader.Text = ini.Read("Connector", "AppendHeader"); txtBodyRegEx.Text = ini.Read("Connector", "BodyRegEx"); txtAppendBodyRegEx.Text = ini.Read("Connector", "AppendBodyRegEx"); txtMaxPageRegEx.Text = ini.Read("Connector", "MaxPageRegEx"); }
public override void Activate(ProxyEntry proxy, Guid networkId) { IniHelper helper = new IniHelper(GetOperaIniFile()); if (proxy.IsAutoConf) { helper.SetValue("Proxy", "Automatic Proxy Configuration URL", proxy.Url.FirstEntry()); helper.SetValue("Proxy", "Use Automatic Proxy Configuration", "1"); } else { if (proxy.Url.IsAllSet) { helper.SetValue("Proxy", "HTTP server", proxy.Url[ProxyScheme.All] + ":" + proxy.Port[ProxyScheme.All].ToString()); helper.SetValue("Proxy", "HTTPS server", proxy.Url[ProxyScheme.All] + ":" + proxy.Port[ProxyScheme.All].ToString()); helper.SetValue("Proxy", "Use HTTP", "1"); helper.SetValue("Proxy", "Use HTTPS", "1"); } else { if (proxy.Url.ContainsKey(ProxyScheme.HTTP)) { helper.SetValue("Proxy", "HTTP server", proxy.Url[ProxyScheme.HTTP] + ":" + proxy.Port[ProxyScheme.HTTP].ToString()); helper.SetValue("Proxy", "Use HTTP", "1"); } if (proxy.Url.ContainsKey(ProxyScheme.HTTPS)) { helper.SetValue("Proxy", "HTTPS server", proxy.Url[ProxyScheme.HTTPS] + ":" + proxy.Port[ProxyScheme.HTTPS].ToString()); helper.SetValue("Proxy", "Use HTTPS", "1"); } if (proxy.Url.ContainsKey(ProxyScheme.FTP)) { helper.SetValue("Proxy", "FTP server", proxy.Url[ProxyScheme.FTP] + ":" + proxy.Port[ProxyScheme.FTP].ToString()); helper.SetValue("Proxy", "Use FTP", "1"); } } if (String.IsNullOrEmpty(proxy.Exceptions)) { helper.SetValue("Proxy", "No Proxy Servers Check", "0"); } else { helper.SetValue("Proxy", "No Proxy Servers", proxy.Exceptions); helper.SetValue("Proxy", "No Proxy Servers Check", "1"); } if (proxy.ByPassLocal) { helper.SetValue("Proxy", "Use Proxy On Local Names Check", "0"); } else { helper.SetValue("Proxy", "Use Proxy On Local Names Check", "1"); } } helper.Save(); }
/// <summary> /// 获取总线路名称和ID /// </summary> /// <returns></returns> public string GetTotalLineNameAndID() { string name = IniHelper.ReadIniData("DJXT", "ZxlName", null); string parentId = IniHelper.ReadIniData("DJXT", "ZxlParentID", null); string nodeId = IniHelper.ReadIniData("DJXT", "ZxlNodeID", null); return(parentId + ',' + nodeId + ',' + "东风电厂总线路"); }
private void Replace_MouseHover(object sender, EventArgs e) { string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini"); IniHelper inihelp = new IniHelper(path); string value = inihelp.IniReadValue("excel", "replace"); rtb_brief.Text = value; }
private void init() { if (!inited) { string inifile = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "config.ini"); if (System.IO.File.Exists("config.ini")) { IniHelper ih = new IniHelper(inifile); clientpath = ih.ReadValue("Path", "QyClient"); string strstart = ih.ReadValue("Config", "WaitStart"); waitstart = int.Parse(strstart); waitexit = int.Parse(ih.ReadValue("Config", "WaitExit")); } else { IniHelper ih = new IniHelper(inifile); ih.WriteValue("Path", "QyClient", clientpath); ih.WriteValue("Config", "WaitStart", waitstart.ToString()); ih.WriteValue("Config", "WaitExit", waitexit.ToString()); } inited = true; } }