Exemplo n.º 1
0
        /// <summary>
        /// Process a file for operatorships
        /// </summary>
        /// <param name="OutDictionary"></param>
        /// <param name="FileName"></param>
        /// <param name="CountLabel"></param>
        /// <param name="DataType"></param>
        private void ProcessFile(SortedDictionary <String, String[]> OutDictionary, String FileName, Label CountLabel, String DataType)
        {
            String InLine;

            OutDictionary.Clear();
            using (StreamReader sRd = new StreamReader(FileName))
                while ((InLine = sRd.ReadLine()) != null)
                {
                    if (InLine.Contains(','))
                    {
                        String        Key    = InLine.Substring(0, InLine.IndexOf(','));
                        List <String> Values = new List <String>(InLine.Substring(InLine.IndexOf(',') + 1).Split(','));
                        Values.Sort(StringComparer.CurrentCultureIgnoreCase);
                        OutDictionary.Add(Key, Values.ToArray());
                    }
                }
            CountLabel.Text = OutDictionary.Count.ToString("#,##0") + " " + DataType;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Process our command log
        /// </summary>
        /// <param name="state"></param>
        private void ProcessCommandLog(object state)
        {
            List <MM_EMS_Command> NewCommands = new List <MM_EMS_Command>();
            String InLine;

            using (FileStream fS = new FileStream((string)state, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                using (StreamReader sRd = new StreamReader(fS))
                    while ((InLine = sRd.ReadLine()) != null)
                    {
                        if (InLine.Contains("Sent") && InLine.Contains("TEDE"))
                        {
                            InLine = InLine.Substring(InLine.IndexOf('>') + 1);
                            InLine = InLine.Substring(0, InLine.IndexOf('<'));
                            String[] splStr     = InLine.Split(' ');
                            String[] splCommand = splStr[5].Split(',');
                            NewCommands.Add(new MM_EMS_Command()
                            {
                                UserName    = splStr[1],
                                CommandType = splCommand[0],
                                Application = splCommand[1],
                                Family      = splCommand[2],
                                CommandName = splCommand[3],
                                Database    = splCommand[4],
                                Record      = splCommand[5],
                                Field       = splCommand[6],
                                TEID        = Convert.ToInt32(splCommand[7]),
                                Value       = splCommand[8],
                                IssuedOn    = DateTime.Parse(splStr[7] + " " + splStr[8] + " " + splStr[9])
                            });
                        }
                    }
            Invoke((MethodInvoker) delegate
            {
                EMSCommands.Clear();
                AddCommands(NewCommands.ToArray(), Servers[cmbServer.SelectedItem.ToString()]);
            });
        }