public static void tInitIniToday(string tmpnameToday) { try { //var tmpnameToday = DateTime.Now.ToString("yyyyMMdd"); var tmpfilePath = AppDomain.CurrentDomain.BaseDirectory + "\\TableUploadNum"; var tmpfile = tmpfilePath + "\\TableUploadNum" + tmpnameToday + ".ini"; if (!Directory.Exists(tmpfilePath)) { Directory.CreateDirectory(tmpfilePath); } if (!File.Exists(tmpfile)) { File.WriteAllText(tmpfile, "********************Set for today Upload Num for each Table******************:" + tmpnameToday, System.Text.Encoding.UTF8); _iniToday = new INIFile(tmpfile); foreach (var item in _tableList.Keys) { var tmpkey = item; if (item.IndexOf('|') > 0) { var dd = item.Split('|'); tmpkey = dd[0]; } _iniToday.IniWriteValue("TableTakeDataNum", tmpkey, "0"); } } else { _iniToday = new INIFile(tmpfile); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static void tInitIniToday(string tmpnameToday) { try { //var tmpnameToday = DateTime.Now.ToString("yyyyMMdd"); var tmpfilePath = AppDomain.CurrentDomain.BaseDirectory + "\\TableUploadNum"; var tmpfile = tmpfilePath + "\\TableUploadNum" + tmpnameToday + ".ini"; if (!Directory.Exists(tmpfilePath)) { Directory.CreateDirectory(tmpfilePath); } if (!File.Exists(tmpfile)) { File.WriteAllText(tmpfile, "********************Set for today Upload Num for each Table******************:" + tmpnameToday, System.Text.Encoding.UTF8); _iniToday = new INIFile(tmpfile); foreach (var item in _tableList.Keys) { var tmpkey = item; if (item.IndexOf('|') > 0) { var dd = item.Split('|'); tmpkey = dd[0]; } _iniToday.IniWriteValue("TableTakeDataNum", tmpkey, "0"); } } else { _iniToday = new INIFile(tmpfile); } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// ture: write,false:read /// </summary> /// <param name="isWriteOrRead"></param> public void tInitIni(bool isWriteOrRead) { try { var tmpfile = AppDomain.CurrentDomain.BaseDirectory + "\\Set.ini"; if (!File.Exists(tmpfile)) { File.WriteAllText(tmpfile, "[Set]", System.Text.Encoding.UTF8); _ini = new INIFile(tmpfile); } else { _ini = new INIFile(tmpfile); } _ini.IniWriteValue("Tables", "table1", System.Configuration.ConfigurationManager.AppSettings["Tables.table1"]); //delete then add _ini.IniWriteValue("Tables", "table2", System.Configuration.ConfigurationManager.AppSettings["Tables.table2"]); //追加累积更新,id //CONTRACT,N_SHOP_LIST_ID,PART_NO,LOT_BATCH_NO //CONTRACT,N_TRANSPORT_ORDER_NO _ini.IniWriteValue("Tables", "table3", System.Configuration.ConfigurationManager.AppSettings["Tables.table3"]); //追加累积更新,time table|where|order by //P|where|order by|C get key _ini.IniWriteValue("Tables", "table4", System.Configuration.ConfigurationManager.AppSettings["Tables.table4"]); //父子表更新 //init key of tables _ini.IniWriteValue("TablesKey", "tableKeys1", System.Configuration.ConfigurationManager.AppSettings["TablesKey.tableKeys1"]); //delete then add _ini.IniWriteValue("TablesKey", "tableKeys2", System.Configuration.ConfigurationManager.AppSettings["TablesKey.tableKeys2"]); //追加累积更新,id _ini.IniWriteValue("TablesKey", "tableKeys3", System.Configuration.ConfigurationManager.AppSettings["TablesKey.tableKeys3"]); //追加累积更新,time table|where|order by _ini.IniWriteValue("TablesKey", "tableKeys4", System.Configuration.ConfigurationManager.AppSettings["TablesKey.tableKeys4"]); //父子表更新 //ini.IniWriteValue("Tables", "CONTRACT", "sh");//sh:上海,tai:泰国,jp:日本 _ini.IniWriteValue("Common", "retime", _txt0Rtime.ToString()); _ini.IniWriteValue("Common", "batchNum", _txt1batchNum.ToString()); //1-删除后再追加 2-直接更新 _ini.IniWriteValue("Common", "updateWay", _updatemode);//2-Direct Update //init first //_ini.IniWriteValue("InitFirst", "FristDownload", "0");//System.Configuration.ConfigurationManager.AppSettings["InitFirst.FristDownload"]);//0:没有首次导入,1:已首次导入。 //_ini.IniWriteValue("InitFirst", "FristDownloadtime", System.Configuration.ConfigurationManager.AppSettings["InitFirst.FristDownloadtime"]); if (isWriteOrRead) { _ini.IniWriteValue("Common", "retime", txt0Rtime.Text); _ini.IniWriteValue("Common", "batchNum", txt1batchNum.Text); _ini.IniWriteValue("Common", "updateWay", cbox0updateWay.Text); } else { txt0Rtime.Text = _ini.IniReadValue("Common", "retime"); txt1batchNum.Text = _ini.IniReadValue("Common", "batchNum"); cbox0updateWay.Text = _ini.IniReadValue("Common", "updateWay"); getTables(_ini); } //init falg //_getInitFlag = _ini.IniReadValue("InitFirst", "FristDownload"); //_getInitFlagTime = _ini.IniReadValue("InitFirst", "FristDownloadtime"); } catch (Exception ex) { logger.Error(ex); MessageBox.Show(ex.Message); btn0Save.Enabled = true; } }