コード例 #1
0
        private static List <CLogContent> ConvertToList(List <string> lst)
        {
            var vList     = new List <CLogContent>();
            int nMaxCount = lst.Count / 2;
            int nIndex    = 0;

            while (lst.Count >= 2)
            {
                var LogContent = new CLogContent();
                try
                {
                    LogContent.ListStack = GetStackList_By_StrText(lst[0]);
                    if (GetLogContentByText(lst[1], ref LogContent))
                    {
                        vList.Add(LogContent);
                    }

                    lst.RemoveAt(0);
                    lst.RemoveAt(0);
                }
                catch (Exception)
                {
                    lst.RemoveAt(0);
                }


                Code.CConfigValue.nProgressValue = (int)(((float)(float)(nIndex++) / (float)nMaxCount) * 100);
            }
            Code.CConfigValue.nProgressValue = 100;
            return(vList);
        }
コード例 #2
0
        private static bool GetLogContentByText(string strText, ref CLogContent LogContent)
        {
            //#Time:11:11:11 111	#Level:1	#File:PlayerTransaction.cpp:3658	#FunName:CLoginPlayerExtend::SetLoginPlayerIndex	#Content:我是仓库号:asdasdasd存在合适的小号:basdqweqwe! 准备交易!
            LogContent.strTime = GetLogContentByTextType(ref strText, "#Time:");
            if (LogContent.strTime.Length == 0)
            {
                return(false);
            }


            LogContent.strClientName = GetLogContentByTextType(ref strText, "#Client");
            if (LogContent.strClientName.Length != 0 && LogContent.strClientName[0] == ':')
            {
                LogContent.strClientName.Remove(0, 1);
            }

            Code.CConfigValue.AddClientName(LogContent.strClientName);

            int    nValue     = 0;
            string strLogType = GetLogContentByTextType(ref strText, "#Level:");

            if (int.TryParse(strLogType, out nValue))
            {
                LogContent.emLogType = (em_Log_Type)nValue;
            }
            else
            {
                switch (strLogType)
                {
                case "普通":
                    LogContent.emLogType = em_Log_Type.em_Log_Type_Debug;
                    break;

                case "函数":
                    LogContent.emLogType = em_Log_Type.em_Log_Type_Custome;
                    break;

                case "异常":
                    LogContent.emLogType = em_Log_Type.em_Log_Type_Exception;
                    break;

                default:
                    LogContent.emLogType = em_Log_Type.em_Log_Type_Debug;
                    break;
                }
            }

            LogContent.strFileName   = GetLogContentByTextType(ref strText, "#File:");
            LogContent.strFunName    = GetLogContentByTextType(ref strText, "#FunName:");
            LogContent.strLogContent = GetLogContentByTextType(ref strText, "#Content:");
            return(true);
        }