示例#1
0
文件: frmMain.cs 项目: shod/Uniterm
        /// <summary>
        /// Save Log file
        /// </summary>
        /// <param name="arrLine"></param>
        private void LogErrorFileSave(ArrayList arrLine)
        {
            string strYear  = DateTime.Now.Year.ToString();
            string strMonth = DateTime.Now.Month.ToString();
            string strDay   = DateTime.Now.Day.ToString();

            if (arrLine.Count == 0)
            {
                return;
            }

            Config cConf    = new Config();
            CFile  cLogFile = new CFile();
            string DirPath  = cConf.getappSettings(Config.SettingField.DataSyncDir.ToString());

            cLogFile.fileName = DirPath + "/errorTerminal.log";

            string sLine;

            foreach (string Line in arrLine)
            {
                sLine = "[" + DateTime.Now.ToUniversalTime().ToString() + "]" + Line;
                cLogFile.AddLine(sLine);
            }
            cLogFile.Write();
        }
示例#2
0
文件: frmMain.cs 项目: shod/Uniterm
        /// <summary>
        /// Save Report file
        /// </summary>
        /// <param name="arrLine"></param>
        private void ReportFileSave(String[] arrLine, string RepName)
        {
            Config cConf       = new Config();
            CFile  cLogFile    = new CFile();
            string DirPath     = cConf.getappSettings(Config.SettingField.DataSyncDir.ToString());
            string strFilePath = DirPath + "/rep_" + RepName + ".csv";

            cLogFile.fileName = strFilePath;

            System.IO.File.Delete(@strFilePath);

            foreach (string Line in arrLine)
            {
                cLogFile.AddLine(Line);
            }
            cLogFile.Write();
        }
示例#3
0
文件: frmMain.cs 项目: shod/Uniterm
        /// <summary>
        /// Save Log file
        /// </summary>
        /// <param name="arrLine"></param>
        private void LogFileSave(ArrayList arrLine)
        {
            string strYear  = DateTime.Now.Year.ToString();
            string strMonth = DateTime.Now.Month.ToString();
            string strDay   = DateTime.Now.Day.ToString();

            Config cConf    = new Config();
            CFile  cLogFile = new CFile();
            string DirPath  = cConf.getappSettings(Config.SettingField.DataSyncDir.ToString());

            cLogFile.fileName = DirPath + "/log_" + strYear + strMonth + strDay + ".txt";

            string sLine;

            foreach (string Line in arrLine)
            {
                sLine = "[" + DateTime.Now.ToUniversalTime().ToString() + "]" + Line;
                cLogFile.AddLine(sLine);
            }
            cLogFile.Write();
        }
示例#4
0
文件: frmMain.cs 项目: shod/Uniterm
        /// <summary>
        /// Demo regime
        /// </summary>
        private void TerminalRefreshDemo()
        {
            Config cConf = new Config();

            arrInfoLine = new ArrayList();
            String strLine;

            String[] arrLine;
            string   DirPath     = cConf.getappSettings(Config.SettingField.DataSyncDir.ToString());
            CFile    FileDemo    = new CFile(DirPath + "/demo_act.txt");
            CFile    FileDemoNew = new CFile(DirPath + "/demo_act.txt");

            arrLineDemo = FileDemo.Read();

            /* Прогресс */
            statusProgress.Visible = true;
            statusProgress.Value   = 0;

            TermFile cFileObj = new TermFile();

            int    c_count = arrLineDemo.Count;
            int    c_Rand;
            Random fixRand = new Random();

            c_Rand = fixRand.Next(1, 7);
            for (int i = 0; i < c_count; i++)
            {
                Thread.Sleep(1000);
                statusProgress.Step = (80 / c_count);
                statusProgress.PerformStep();
                //arrInfoLine.Add(arrLineDemo[i]);
                strLine = arrLineDemo[i];
                //strLine = strLine.Replace(".", ",");
                arrLine = strLine.Split(';');
                strLine = "";

                double dd;
                int    idd;

                int l_count = arrLine.Length;
                for (int a = 0; a < l_count; a++)
                {
                    if (a == 2)
                    {
                        arrLine[a] = DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;
                    }

                    //if (a == 13 || a==14 ||a==15)
                    if (a > 10 && Char.IsDigit(Convert.ToChar(arrLine[a].Substring(0, 1))))
                    {
                        try
                        {
                            dd         = Convert.ToDouble(arrLine[a]);
                            dd         = dd + (dd / 100 * 0.5);
                            arrLine[a] = dd.ToString();
                        }
                        catch
                        {
                            idd        = Convert.ToInt16(arrLine[a]);
                            idd        = idd + (idd / 100 * l_count);
                            arrLine[a] = idd.ToString();
                        }
                    }
                }
                strLine = String.Join(";", arrLine);
                strLine = strLine.Replace(",", ".");

                if (i <= c_Rand - 1)
                {
                    cFileObj.AddLine(strLine);
                }

                FileDemoNew.AddLine(strLine);
            }
            cFileObj.Write();
            FileDemoNew.Write(false);

            _tCount++;
            LogFileSave(arrInfoLine);
            statusProgress.Visible = false;
            lblTCount.Text         = _tCount.ToString();
            lblError.Text          = _tError.ToString();
        }