Example #1
0
        private void button4_Click_1(object sender, EventArgs e)
        {
            List <spLogBuff[]> spLogLines = new List <spLogBuff[]>();
            List <cashUnit.updateCashUnitInfo> cashUnitInfoListList = new List <cashUnit.updateCashUnitInfo>();
            List <cashUnit.lppCashIn>          lppCashInEndList     = new List <cashUnit.lppCashIn>();
            List <List <cashUnit.lppCashIn> >  lppCashInEndListList = new List <List <cashUnit.lppCashIn> >();

            foreach (string spLogFileNameStr in spLogFileNames)
            {
                //FileStream spLogFile = File.OpenRead(spLogFileNameStr);
                //tagLogHead logHeader = returnLogHeader(spLogFile);
                spLogBuff[] spLogLinesArray = createFileStreamHeaderSpLogLineArray(spLogFileNameStr);
                spLogLines.Add(spLogLinesArray);
            }

            foreach (spLogBuff[] spLogBuffArray in spLogLines)
            {
                foreach (spLogBuff spLogBuff in spLogBuffArray)
                {
                    if (spLogBuff.csType == "MessageSuccess" && spLogBuff.csInfo.Contains("WFS_CMD_CIM_CASH_IN_END"))
                    {
                        lppCashInEndList = parseOperations.parseStringCashInEnd(spLogBuff);
                        lppCashInEndListList.Add(lppCashInEndList);
                    }
                    else if (spLogBuff.csSubSystem == "CallDevExeSuccess" && !spLogBuff.csInfo.Contains("iStoreMoney Start") && spLogBuff.csInfo.Contains("iStoreMoney"))
                    {
                    }

                    else if (spLogBuff.csSubSystem == "CashUnit" && spLogBuff.csInfo.StartsWith("Update"))
                    {
                        cashUnit.updateCashUnitInfo cashUnitInfoList = parseOperations.parseUpdateCashUnitInfo(spLogBuff.csInfo);
                        if (cashUnitInfoList.updatedCassettesList.Count == 0)
                        {
                        }
                        else if (cashUnitInfoList.updatedCassettesList.Count != 0)
                        {
                            cashUnitInfoListList.Add(cashUnitInfoList);
                        }
                    }
                }
            }
        }
        public static cashUnit.updateCashUnitInfo parseUpdateCashUnitInfo(string spLogLineCsInfo)
        {
            cashUnit.updateCashUnitInfo cashUnitInfo = new cashUnit.updateCashUnitInfo();

            string[] stringSeparators = new string[] { "\r\n" };

            string[] cuParsedArray = spLogLineCsInfo.Split(stringSeparators, StringSplitOptions.None);
            Array.Resize(ref cuParsedArray, cuParsedArray.Length - 1);


            char[] charSeperators = new char[] { ':', '\t' };


            List <string> modifiedCuParsedArrayList = new List <string>();

            foreach (string cuLine in cuParsedArray)
            {
                if (!cuLine.StartsWith("-"))
                {
                    if (cuLine.StartsWith("Update"))
                    {
                    }
                    else if (cuLine.StartsWith("\tSlot"))
                    {
                    }

                    else
                    {
                        modifiedCuParsedArrayList.Add(cuLine);
                    }
                }

                else if (cuLine.StartsWith("-"))
                {
                    break;
                }
            }


            List <cashUnit.updatedCassettes> updatedCassettesList = new List <cashUnit.updatedCassettes>();

            foreach (string modifiedCuLine in modifiedCuParsedArrayList)
            {
                cashUnit.updatedCassettes updatedCassette = new cashUnit.updatedCassettes();
                updatedCassette.updateSlot  = modifiedCuLine.Split(charSeperators)[1];
                updatedCassette.updateIndex = modifiedCuLine.Split(charSeperators)[2];
                updatedCassette.updateCount = modifiedCuLine.Split(charSeperators)[3];
                updatedCassettesList.Add(updatedCassette);
            }

            cashUnitInfo.updatedCassettesList = updatedCassettesList;
            //cashUnitInfo
            modifiedCuParsedArrayList.Clear();


            foreach (string cuLine in cuParsedArray)
            {
                if (cuLine.StartsWith("-"))
                {
                }
                if (cuLine.StartsWith("Update"))
                {
                }
                else if (cuLine.StartsWith("\tSlot"))
                {
                }
                else if (cuLine.StartsWith("Slot"))
                {
                }
                else if (cuLine.StartsWith("\t"))
                {
                }
                else if (cuLine.StartsWith("-"))
                {
                }

                else
                {
                    modifiedCuParsedArrayList.Add(cuLine);
                }
            }


            List <cashUnit.cashUnitInfoCounters> updatedCashUnitCounterList = new List <cashUnit.cashUnitInfoCounters>();

            foreach (string modifiedCuLine in modifiedCuParsedArrayList)
            {
                string[] strArr = modifiedCuLine.Split(charSeperators);
                cashUnit.cashUnitInfoCounters updatedSlot = new cashUnit.cashUnitInfoCounters();
                updatedSlot.cassetteSlot      = modifiedCuLine.Split(charSeperators)[0];
                updatedSlot.cassetteIndex     = modifiedCuLine.Split(charSeperators)[1];
                updatedSlot.CassetteCount     = modifiedCuLine.Split(charSeperators)[2];
                updatedSlot.cassetteCashIn    = modifiedCuLine.Split(charSeperators)[3];
                updatedSlot.cassetteReject    = modifiedCuLine.Split(charSeperators)[4];
                updatedSlot.cassetteLogStatus = modifiedCuLine.Split(charSeperators)[5];
                updatedSlot.cassettePhyStatus = modifiedCuLine.Split(charSeperators)[7];


                updatedCashUnitCounterList.Add(updatedSlot);
            }

            cashUnitInfo.cashUnitInfoCounterList = updatedCashUnitCounterList;

            return(cashUnitInfo);
        }