예제 #1
0
 public void ListViewPageText(int _iCnt = 0)
 {
     for (int i = 1; i < tabControl1.TabPages.Count; i++)
     {
         tabControl1.TabPages[i].Text = OM.GetTag(i);
     }
 }
예제 #2
0
파일: LogOption.cs 프로젝트: zoro-008/Works
        private void btSave_Click(object sender, EventArgs e)
        {
            UpdateOption(false);
            OM.SaveLogInfo();

            LM.ListViewPageText();
            LM.ListViewDispInit(OM.LogInfo.iTagCnt);
        }
예제 #3
0
파일: LogOption.cs 프로젝트: zoro-008/Works
        public void UpdateOption(bool _bToTable)
        {
            int iRet;

            if (_bToTable == true)
            {
                tbLogPath.Text         = OM.LogInfo.sLogPath;
                tbIgnrSameMsgLine.Text = OM.LogInfo.iIgnrSameMsgLine.ToString();
                tbSaveMaxDate.Text     = OM.LogInfo.iSaveMaxMonths.ToString();
                textBoxCnt.Text        = OM.LogInfo.iTagCnt.ToString();
                tbLogBuPath.Text       = OM.LogInfo.sLogBuPath;

                textBox1.Text  = OM.GetTag(1); CConfig.ValToCon(checkBox1, ref OM.LogInfo.bWithAll1);
                textBox2.Text  = OM.GetTag(2); CConfig.ValToCon(checkBox2, ref OM.LogInfo.bWithAll2);
                textBox3.Text  = OM.GetTag(3); CConfig.ValToCon(checkBox3, ref OM.LogInfo.bWithAll3);
                textBox4.Text  = OM.GetTag(4); CConfig.ValToCon(checkBox4, ref OM.LogInfo.bWithAll4);
                textBox5.Text  = OM.GetTag(5); CConfig.ValToCon(checkBox5, ref OM.LogInfo.bWithAll5);
                textBox6.Text  = OM.GetTag(6); CConfig.ValToCon(checkBox6, ref OM.LogInfo.bWithAll6);
                textBox7.Text  = OM.GetTag(7); CConfig.ValToCon(checkBox7, ref OM.LogInfo.bWithAll7);
                textBox8.Text  = OM.GetTag(8); CConfig.ValToCon(checkBox8, ref OM.LogInfo.bWithAll8);
                textBox9.Text  = OM.GetTag(9); CConfig.ValToCon(checkBox9, ref OM.LogInfo.bWithAll9);
                textBox10.Text = OM.GetTag(10); CConfig.ValToCon(checkBox10, ref OM.LogInfo.bWithAll10);
                textBox11.Text = OM.GetTag(11); CConfig.ValToCon(checkBox11, ref OM.LogInfo.bWithAll11);
                textBox12.Text = OM.GetTag(12); CConfig.ValToCon(checkBox12, ref OM.LogInfo.bWithAll12);
                textBox13.Text = OM.GetTag(13); CConfig.ValToCon(checkBox13, ref OM.LogInfo.bWithAll13);
                textBox14.Text = OM.GetTag(14); CConfig.ValToCon(checkBox14, ref OM.LogInfo.bWithAll14);
                textBox15.Text = OM.GetTag(15); CConfig.ValToCon(checkBox15, ref OM.LogInfo.bWithAll15);
                //textBox16.Text = OM.LogInfo.sTag9; CConfig.ValToCon(checkBox16, ref OM.LogInfo.bWithAll16);
            }
            else
            {
                OM.LogInfo.sLogPath         = tbLogPath.Text;
                OM.LogInfo.iIgnrSameMsgLine = int.TryParse(tbIgnrSameMsgLine.Text, out iRet) ? iRet : 0;
                OM.LogInfo.iSaveMaxMonths   = int.TryParse(tbSaveMaxDate.Text, out iRet) ? iRet : 0;
                OM.LogInfo.iTagCnt          = int.TryParse(textBoxCnt.Text, out iRet) ? iRet : 0;
                OM.LogInfo.sLogBuPath       = tbLogBuPath.Text;

                OM.LogInfo.sTag1  = textBox1.Text;  CConfig.ConToVal(checkBox1, ref OM.LogInfo.bWithAll1);
                OM.LogInfo.sTag2  = textBox2.Text;  CConfig.ConToVal(checkBox2, ref OM.LogInfo.bWithAll2);
                OM.LogInfo.sTag3  = textBox3.Text;  CConfig.ConToVal(checkBox3, ref OM.LogInfo.bWithAll3);
                OM.LogInfo.sTag4  = textBox4.Text;  CConfig.ConToVal(checkBox4, ref OM.LogInfo.bWithAll4);
                OM.LogInfo.sTag5  = textBox5.Text;  CConfig.ConToVal(checkBox5, ref OM.LogInfo.bWithAll5);
                OM.LogInfo.sTag6  = textBox6.Text;  CConfig.ConToVal(checkBox6, ref OM.LogInfo.bWithAll6);
                OM.LogInfo.sTag7  = textBox7.Text;  CConfig.ConToVal(checkBox7, ref OM.LogInfo.bWithAll7);
                OM.LogInfo.sTag8  = textBox8.Text;  CConfig.ConToVal(checkBox8, ref OM.LogInfo.bWithAll8);
                OM.LogInfo.sTag9  = textBox9.Text;  CConfig.ConToVal(checkBox9, ref OM.LogInfo.bWithAll9);
                OM.LogInfo.sTag10 = textBox10.Text; CConfig.ConToVal(checkBox10, ref OM.LogInfo.bWithAll10);
                OM.LogInfo.sTag11 = textBox11.Text; CConfig.ConToVal(checkBox11, ref OM.LogInfo.bWithAll11);
                OM.LogInfo.sTag12 = textBox12.Text; CConfig.ConToVal(checkBox12, ref OM.LogInfo.bWithAll12);
                OM.LogInfo.sTag13 = textBox13.Text; CConfig.ConToVal(checkBox13, ref OM.LogInfo.bWithAll13);
                OM.LogInfo.sTag14 = textBox14.Text; CConfig.ConToVal(checkBox14, ref OM.LogInfo.bWithAll14);
                OM.LogInfo.sTag15 = textBox15.Text; CConfig.ConToVal(checkBox15, ref OM.LogInfo.bWithAll15);
                //OM.LogInfo.sTag16 = textBox16.Text; CConfig.ConToVal(checkBox16, ref OM.LogInfo.bWithAll16);

                UpdateOption(true);
            }
        }
예제 #4
0
        public void ListViewDispInit(int _iCnt = 0)
        {
            int iNow = tabControl1.TabCount;

            if (_iCnt == 0)
            {
                for (int i = 1; i < iNow; i++)
                {
                    tabControl1.TabPages.RemoveAt(1);
                }
                return;
            }
            if (_iCnt == iNow - 1)
            {
                return;
            }
            if (_iCnt > iNow - 1)
            {
                for (int i = iNow; i < _iCnt + 1; i++)
                {
                    lst[i].Lsv.BeginUpdate();
                    TabPage tp = new TabPage(OM.GetTag(i));
                    //tp.Text = OM.GetTag(i);
                    tabControl1.TabPages.Add(tp);
                    lst[i].Lsv.Parent = tp;
                    lst[i].Lsv.Dock   = DockStyle.Fill;
                    lst[i].Lsv.EndUpdate();
                }
            }
            else
            {
                for (int i = iNow - 1; i > _iCnt; i--)
                {
                    tabControl1.TabPages.RemoveAt(i);
                }
            }
        }
예제 #5
0
        private bool OnMakeNewLog()
        {
            string sTime = DateTime.Now.ToString("yyyyMMdd");
            string sDir  = OM.LogInfo.sLogPath + @"\" + sTime + @"\";

            string[] sFile = new string[m_iMaxArray];

            if (!CIniFile.MakeFilePathFolder(sDir))
            {
                return(false);
            }

            sFile[0] = sDir + sTime + ".log";
            for (int i = 1; i < m_iMaxArray; i++)
            {
                sFile[i] = sDir + sTime + "_" + OM.GetTag(i) + ".log";
            }
            //if (!File.Exists(sFile)) File.Create(sFile);

            for (int i = 0; i < m_iMaxArray; i++)
            {
                if (sw[i] != null)
                {
                    sw[i].Close();
                }
                if (fs[i] != null)
                {
                    fs[i].Close();
                }
            }

            fs = new FileStream[m_iMaxArray];
            sw = new StreamWriter[m_iMaxArray];

            for (int i = 0; i < m_iMaxArray; i++)
            {
                if (i < OM.LogInfo.iTagCnt + 1)
                {
                    fs[i] = new FileStream(sFile[i], FileMode.Append, FileAccess.Write);
                    sw[i] = new StreamWriter(fs[i]);
                }
                else
                {
                    fs[i] = null;
                    sw[i] = null;
                }
            }

            //BackUp
            //string sbuName = "BackUp";//Path.GetFileName(OM.LogInfo.sLogBuPath);

            string sZip = DateTime.Now.ToString("yyyyMMdd") + "_BackUp.zip";

            double d1, d2, d3;

            d1 = CTimer.GetTime();
            CreateSample(sDir + sZip, "", OM.LogInfo.sLogBuPath);
            d2 = CTimer.GetTime();
            d3 = d2 - d1;
            Debug.WriteLine(d3);

            //기존에 있던것들 지우기. 디렉토리 삭제
            DirectoryInfo di = new DirectoryInfo(OM.LogInfo.sLogPath);

            if (!di.Exists)
            {
                di.Create();
            }

            foreach (DirectoryInfo dir in di.GetDirectories())
            {
                if (dir.CreationTime <= DateTime.Now.AddMonths(-OM.LogInfo.iSaveMaxMonths))
                {
                    try
                    {
                        dir.Delete(true);
                    }
                    catch (Exception e)
                    {
                        //Debug.WriteLine(e.Message);
                    }
                }
            }
            //foreach (FileInfo file in di.GetFiles()) //파일 삭제
            //{
            //    file.Delete();
            //}

            return(true);
        }
예제 #6
0
        private void OnAddNewLog(String _sLog)
        {
            bool   bSameMsg = false;
            string sLog1    = _sLog;
            string sLog2    = "";
            //string sTemp = "";
            //Add Time
            string sTime = DateTime.Now.ToString("MM-dd hh:mm:ss:fff,");

            sLog2 = sTime + sLog1;

            //if (sLog2.Contains("<EXIT>"))
            //{
            //    FormExit();
            //}

            //중복 삭제.
            int iIgnrSameMsgLine = OM.LogInfo.iIgnrSameMsgLine;

            while (_pIgnrList.Count > iIgnrSameMsgLine)
            {
                _pIgnrList.RemoveAt(0);
            }
            int iListCount = _pIgnrList.Count;

            if (iIgnrSameMsgLine > 0)
            {
                for (int j = 0; j < iListCount; j++)
                {
                    bSameMsg |= (string)_pIgnrList[j] == sLog1;
                }
            }
            if (bSameMsg)
            {
                return;
            }
            _pIgnrList.Add(sLog1);
            //

            lock (lockObject)
            {
                String[] sSplit = sLog2.Split(',');
                int      iNo    = int.TryParse(sSplit[1], out iNo) ? iNo : 0;
                if (iNo >= 0 && iNo < m_iMaxArray)
                {
                    lst[iNo].Ary.Add(sLog2);
                    if (iNo != 0 && OM.GetWithAll(iNo))
                    {
                        lst[0].Ary.Add(sLog2);
                        if (sw[0] != null)
                        {
                            sw[0].WriteLine(sLog2);
                            sw[0].Flush(); //이거 음...
                        }
                        while (lst[0].Ary.Count > m_iMaxListCnt)
                        {
                            lst[0].Ary.RemoveAt(0);
                        }
                    }
                    if (sw[iNo] != null)
                    {
                        sw[iNo].WriteLine(sLog2);
                        sw[iNo].Flush(); //이거 음...
                    }
                    while (lst[iNo].Ary.Count > m_iMaxListCnt)
                    {
                        lst[iNo].Ary.RemoveAt(0);
                    }

                    if (sSplit[2].Contains("<EXIT>"))
                    {
                        FormExit();
                    }
                }
                //m_iAddCount++;
            }

            //// Max count 초과 Log 삭제
            //for (int i = 0; i < m_iMaxArray; i++)
            //{
            //    while (lst[i].Ary.Count > m_iMaxListCnt) {
            //        //lst[i].Ary.RemoveAt(lst[i].Ary.Count-1);
            //        lst[i].Ary.RemoveAt(0);
            //    }
            //}

            ////sTemp = (string)lst[0].Ary[i];
            //string[] sText = sLog2.Split(',');
            //int iText = int.TryParse(sText[1], out iText) ? iText : 0;

            //if (iText == 0 || OM.GetWithAll(iText))
            //{
            //    if (sw[0] != null)
            //    {
            //        sw[0].WriteLine(sLog2);
            //        sw[0].Flush(); //이거 음...
            //    }
            //}


            //for (int j = 1; j < m_iMaxArray; j++)
            //{
            //    if (j == iText)
            //    {
            //        if (sw[j] != null)
            //        {
            //            sw[j].WriteLine(sLog2);
            //            sw[j].Flush();
            //        }
            //    }
            //}


            // 파일 저장
            //sLog3 = sLog2 + "\r\n";
            //sw[0].WriteLine(sLog2);
            //for (int i = 0; i < m_iMaxArray; i++)
            //sw[i].WriteLine(sLog2);
            //sw.Flush();
            //sw.Close();
        }