Пример #1
0
        //public static void fLog_Thread()
        //{
        //    try
        //    {

        //            while (true)
        //            {
        //                if (Global.flg_fastlog == true)
        //                {
        //                    Thread.Sleep(Global.Dly_cnt);
        //                    LogfData();
        //                }
        //            }

        //    }
        //    catch (Exception ex)
        //    {
        //        return;
        //    }
        //}
        ////**********************
        //public static void LogfData()
        //{
        //    try
        //    {
        //        int i = 0;
        //        Global.Capture_fData();
        //        String strData = null;
        //        for (i = 0; i <= 55; i++)
        //        {
        //            if (Global.fData[i] == null) Global.fData[i] = "0.0";
        //            strData = strData + Global.fData[i] + ", ";
        //        }
        //        strData = strData + Global.fData[56] + "\n";

        //        var filePath = Global.DataPath + "FastLog_Data\\" + Global.Eng_fData_FileNm + ".csv";
        //        using (var wr = new StreamWriter(filePath, true))
        //        {
        //            var row = new List<string> { strData.Substring(0, strData.Length - 1) };
        //            var sb = new StringBuilder();
        //            foreach (string value in row)
        //            {
        //                if (sb.Length > 0)
        //                    sb.Append(",");
        //                sb.Append(value);
        //            }
        //            wr.WriteLine(sb.ToString());
        //        }
        //        //*****************************
        //    }
        //    catch (Exception ex)
        //    {
        //        Global.Create_OnLog("Data fast Log Problem... ", "Alart");
        //        Global.flg_SFCStart = false;
        //    }
        //}
        //************************
        //public static void LogfData()
        //{
        //    try
        //    {
        //        int i = 0;
        //        Global.Capture_fData();
        //        String strData = null;
        //        for (i = 0; i <= 40; i++)
        //        {
        //            if (Global.fData[i] == null) Global.fData[i] = "0.0";
        //            strData = strData + Global.fData[i] + ", ";
        //        }
        //        strData = strData + Global.fData[40] + "\n";

        //        var filePath = Global.DataPath + "FastLog_Data\\" + Global.Eng_fData_FileNm + ".csv";
        //        using (var wr = new StreamWriter(filePath, true))
        //        {
        //            var row = new List<string> { strData.Substring(0, strData.Length - 1) };
        //            var sb = new StringBuilder();
        //            foreach (string value in row)
        //            {
        //                if (sb.Length > 0)
        //                    sb.Append(",");
        //                sb.Append(value);
        //            }
        //            wr.WriteLine(sb.ToString());
        //        }
        //        //*****************************
        //    }
        //    catch (Exception ex)
        //    {
        //        Global.Create_OnLog("Data fast Log Problem... ", "Alart");
        //        Global.flg_SFCStart = false;
        //    }
        //}
        ////***************************

        /// <summary>
//        /// /********************************************
        public static void LogfData()      //Only For Gantner
        {
            try
            {
                int i = 0;
                Global.Capture_fData();
                String strData = System.DateTime.Now.ToString("hh.mm.ss tt") + ", ";
                for (i = 1; i <= 22; i++)
                {
                    if (Global.fData[i] == null)
                    {
                        Global.fData[i] = "0.0";
                    }
                    strData = strData + Global.fData[i] + ", ";
                }
                strData = strData + Global.Data[22] + "\n";

                var filePath = Global.DataPath + "FastLog_Data\\" + Global.Eng_fData_FileNm + ".csv";
                using (var wr = new StreamWriter(filePath, true))
                {
                    var row = new List <string> {
                        strData.Substring(0, strData.Length - 1)
                    };
                    var sb = new StringBuilder();
                    foreach (string value in row)
                    {
                        if (sb.Length > 0)
                        {
                            sb.Append(",");
                        }
                        sb.Append(value);
                    }
                    wr.WriteLine(sb.ToString());
                }
                //*****************************
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("Data fast Log Problem... ", "Alart");
                Global.flg_SFCStart = false;
            }
        }