Example #1
0
        private string InternalActions(string action, string[] args)//USE PAYLOAD AS SECURITY MEASURE
        {
            switch (action)
            {
            case "close":
                MessageLogManager.LogMessage("CLOSING!!!");
                if (args[0] == "closeserver")
                {
                    return("closingserver");
                }
                else
                {
                    return("Error");
                }

            case "deletereport":
                return(ra.DeleteReport(args[0]));

            case "deleteall":
                return(ra.DeleteAllReports(args[0]));

            default:
                return("Error");
            }
        }
Example #2
0
 private bool AddMOCOLogs()
 {
     try
     {
         foreach (YECOReport report in yecoReports)
         {
             foreach (KeyValuePair <string, MOCOLog> log in report.MOCOLogs)
             {
                 TreeNode logNode = new TreeNode();
                 logNode.Text               = log.Value.Date.ToString("MMMM");
                 logNode.Name               = log.Value.Type + "$" + report.Id + "$" + log.Key;
                 logNode.ImageIndex         = 7;
                 logNode.SelectedImageIndex = 7;
                 _explorer.Nodes["COxN"].Nodes["YECOxN"].Nodes[report.Type + "$" + report.Id].ImageIndex         = 6;
                 _explorer.Nodes["COxN"].Nodes["YECOxN"].Nodes[report.Type + "$" + report.Id].SelectedImageIndex = 6;
                 _explorer.Nodes["COxN"].Nodes["YECOxN"].Nodes[report.Type + "$" + report.Id].Nodes.Add(logNode);
             }
         }
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error retireving MOCO Logs: " + e.Message);
         return(false);
     }
 }
Example #3
0
 private void AddDACOLogs()
 {
     try
     {
         foreach (YECOReport report in yecoReports)
         {
             foreach (KeyValuePair <string, MOCOLog> mocolog in report.MOCOLogs)
             {
                 foreach (KeyValuePair <string, DACOLog> log in mocolog.Value.DACOLogs)
                 {
                     TreeNode logNode = new TreeNode();
                     logNode.Text               = log.Value.Date.ToLongDateString();
                     logNode.Name               = log.Value.Type + "$" + report.Id + "$" + mocolog.Key + "$" + log.Key;
                     logNode.ImageIndex         = 7;
                     logNode.SelectedImageIndex = 7;
                     _explorer.Nodes["COxN"].Nodes["YECOxN"].Nodes[report.Type + "$" + report.Id].Nodes[mocolog.Value.Type + "$" + report.Id + "$" + mocolog.Key].ImageIndex         = 6;
                     _explorer.Nodes["COxN"].Nodes["YECOxN"].Nodes[report.Type + "$" + report.Id].Nodes[mocolog.Value.Type + "$" + report.Id + "$" + mocolog.Key].SelectedImageIndex = 6;
                     _explorer.Nodes["COxN"].Nodes["YECOxN"].Nodes[report.Type + "$" + report.Id].Nodes[mocolog.Value.Type + "$" + report.Id + "$" + mocolog.Key].Nodes.Add(logNode);
                 }
             }
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error retireving DACO Logs: " + e.Message);
     }
 }
Example #4
0
        public string DeleteAllReports(string type)
        {
            try
            {
                switch (type)
                {
                case "all":
                    return((coselm.DeleteAll() & clinlm.DeleteAll() & clcolm.DeleteAll() & colm.DeleteAll()).ToString());

                case "cosexr":
                    return(coselm.DeleteAll().ToString());

                case "clinxr":
                    return(clinlm.DeleteAll().ToString());

                case "clcoxr":
                    return(clcolm.DeleteAll().ToString());

                case "clsexr":
                    return(false.ToString());

                case "dacoxr":
                    return(false.ToString());

                case "mocoxr":
                    return(false.ToString());
                }
            } catch (Exception e)
            {
                MessageLogManager.LogMessage("Error deleting reports(s): " + type + "\n" + e.Message);
            }
            return("Error");
        }
Example #5
0
 public string StartCOSEReport(string reportFullName, uint consoleId, string consoleName)
 {
     MessageLogManager.LogMessage("Initializeing COSE Report...");
     try
     {
         MessageLogManager.LogMessage("COSE Report initialized succesfully.");
         return(coselm.Load(reportFullName, consoleId, consoleName) + "$" + coselm.Report.Id + "$" + true.ToString());
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("COSE Report failed to initialize: " + e.Message);
         return("Error");
     }
 }
 private bool ShowReportsByName(string reportName)
 {
     try
     {
         if (reportName.Contains("CLINxR"))
         {
             if (OpenCLINReport(reportName))
             {
                 if (LoadCLINReport(clinrm.Report))
                 {
                     return(true);
                 }
             }
         }
         else if (reportName.Contains("CLCOxR"))
         {
             if (OpenCLCOReport(reportName))
             {
                 if (LoadCLCOReport(clcorm.Report))
                 {
                     return(true);
                 }
             }
         }
         else if (reportName.Contains("COSExR"))
         {
             if (OpenCOSEReport(reportName))
             {
                 if (LoadCOSEReportByLogs(coserm.Report))
                 {
                     return(true);
                 }
             }
         }
         else if (reportName.Contains("YECOxR"))
         {
             if (OpenYECOReport(reportName))
             {
                 if (LoadYECOReport(yecorm.Report))
                 {
                     return(true);
                 }
             }
         }
     } catch (Exception e)
     {
         MessageBox.Show(e.Message);
         MessageLogManager.LogMessage(e.Message + e.Data + "\n" + e.InnerException + "\n" + e.Source);
     }
     return(false);
 }
Example #7
0
        public string InterpreteData(string data)
        {
            string[] args;
            string   message = null;

            if (data != null)
            {
                ReportActions.VerifyDirectories();
                MessageLogManager.LogMessage("\n\n\n\n+______________________________________________________________________ R G    P A C K E T ______________________________________________________________________________________+");
                MessageLogManager.LogMessage("INPUT DATA:: " + data);
                args = data.Split('$');
                string type = args[0], action = args[1], payload = args[2];
                args = payload.Split('#');
                switch (type)
                {
                case "CLINxR":
                    message = CLINReportActions(action, args);
                    break;

                case "COSExR":
                    message = COSEReportActions(action, args);
                    break;

                case "COSExS":
                    message = COSESessionActions(action, args);
                    break;

                case "COSExL":
                    message = COSESessionLogActions(action, args);
                    break;

                case "INACxCOM":
                    message = InternalActions(action, args);
                    break;

                default:
                    message = "Error";
                    break;
                }
                ReportActions.VerifyDirectories();
                MessageLogManager.LogMessage("+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+");
                MessageLogManager.LogMessage("O U T P U T    D A T A::> ");
                foreach (string str in message.Split('$'))
                {
                    MessageLogManager.LogMessage("\t- " + str);
                }
                MessageLogManager.LogMessage("---------------------------------------------------------------------------------------------------------------------------------------------");
            }
            return(message);
        }
Example #8
0
 public string EndCOSESession(uint reportId, DateTime endTime, TimeSpan totalTime, double totalConsumption, string clinReportFullName)
 {
     try
     {
         if (coselm.Load(reportId) && coselm.EndSession(endTime, totalTime, totalConsumption))
         {
             UpdateCLCOLog(clinReportFullName, coselm.Report.Sessions[coselm.Report.Sessions.Count - 1]);
             colm.AddSession(coselm.Report.Sessions[coselm.Report.Sessions.Count - 1]);
             return(true.ToString());
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("OUTPUT::Error Ending COSE Session:\n" + e.Message + "\n" + e.Source + "\n" + e.StackTrace + "\n" + e.TargetSite);
     }
     return("Error");
 }
Example #9
0
 public string DeleteLastCOSESession(uint reportId)
 {
     MessageLogManager.LogMessage("Deleting COSE Session...");
     try
     {
         if (coselm.Load(reportId))
         {
             coselm.DeleteLastSession();
             MessageLogManager.LogMessage("COSE Session deleted.");
             return("Session Deleted");
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("OUTPUT::Error Deleting COSE Session:\n" + e.Message + "\n" + e.Source + "\n" + e.StackTrace + "\n" + e.TargetSite);
     }
     return("Error");
 }
Example #10
0
 public string CopyCOSESession(uint reportId, uint inputReportId)
 {
     MessageLogManager.LogMessage("Copying COSE Session...");
     try
     {
         if (coselm.Load(reportId))
         {
             coselm.CopySession(reportId, inputReportId);
             MessageLogManager.LogMessage("COSE Session copied.");
             return("Session Copied");
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("OUTPUT::Error Copying COSE Session:\n" + e.Message + "\n" + e.Source + "\n" + e.StackTrace + "\n" + e.TargetSite);
     }
     return("Error");
 }
 public bool LoadCOSEReportByLogs(COSEReport report)
 {
     try
     {
         Visible = false;
         InitializeComunColumns();
         InitializeCOSELogReportDGVComponents();
         AddCOSELogReportColumns();
         int count = 0;
         _propertyfield1.Text  = report.Name;
         _propertyfield2.Text  = report.Id.ToString();
         _propertyfield3.Text  = report.Type;
         _propertyfield4.Text  = report.Date.ToLongDateString();
         _propertyfield5.Text  = report.Date.ToLongTimeString();
         _propertyfield6.Text  = "";
         _propertyfield7.Text  = "";
         _propertyfield8.Text  = "";
         _propertyfield9.Text  = report.FileName;
         _propertyfield10.Text = report.PathName;
         _propertyfield11.Text = "";
         _propertyfield12.Text = "";
         _propertyfield13.Text = "";
         InitializeLBL(new int[] { 0, 1, 2, 3, 4, 8, 9 },
                       new string[] { "Name:", "ID:", "Type:",
                                      "Date Created:", "Time Created:", "File Name:",
                                      "File Location:" });
         PadLabels(15);
         foreach (COSELog session in report.Sessions)
         {
             count = 0;
             foreach (COACLog log in session.Logs)
             {
                 _reportDataGrid.Rows.Add(log.Id.ToString(), log.EventName, log.ExtraControls.ToString(), log.StartTime.ToLongTimeString(), log.EndTime.ToLongTimeString(), log.TotalTime.ToString(), log.TotalConsumption.ToString());
                 count++;
             }
             _reportDataGrid.Rows[_reportDataGrid.Rows.Count - count].DefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(150, 200, 160);
         }
         Visible = true;
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage(e.Message + e.Data + "\n" + e.InnerException + "\n" + e.Source);
         return(false);
     }
 }
Example #12
0
 public string StartCOSESessionLog(uint reportId, uint status, uint extraControls, DateTime startTime)
 {
     try
     {
         if (coselm.Load(reportId))
         {
             uint logId = coselm.AddLog();
             if (coselm.StartLog(ReportManager.DetermineStatus(status), extraControls, startTime))
             {
                 return(logId.ToString() + "$true");
             }
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("OUTPUT::Error Starting COSE Session Log:\n" + e.Message + "\n" + e.Source + "\n" + e.StackTrace + "\n" + e.TargetSite);
     }
     return("Error");
 }
Example #13
0
 public string StartCLINReport(string reportFullName)
 {
     MessageLogManager.LogMessage("OUTPUT::Initializeing CLIN Report...");
     try
     {
         if (clinlm.Load(reportFullName))
         {
             MessageLogManager.LogMessage("OUTPUT::CLIN Report initialized succesfully.");
             if (((clinlm.Report.CLCOReportName = clcolm.Load(clinlm.Report.CLCOReportName)) != "Error") && clinlm.Save())
             {
                 return(clinlm.Report.FullFileName + "$" + true.ToString());
             }
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("OUTPUT::Error CLIN Report did not initialize: " + e.Message);
     }
     return("Error");
 }
Example #14
0
 private string UpdateCLCOLog(string clinReportFullName, COSELog session)
 {
     try
     {
         if ((clinReportFullName = StartCLINReport(clinReportFullName).Split('$')[0]) != "Error")
         {
             MessageLogManager.LogMessage("OUTPUT::Updating CLCO log...");
             clinlm.Report.CLCOReportName = clcolm.Load(clinlm.Report.CLCOReportName).Split('$')[0];
             if (clinlm.Report.CLCOReportName != "Error")
             {
                 return(clcolm.UpdateLog(session).ToString());
             }
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("OUTPUT::Error Updating CLCO client consumption log:\n" + e.Message);
     }
     return("Error");
 }
Example #15
0
        private void LoadAndShowNode(string[] elements)
        {
            try
            {
                switch (elements[0])
                {
                case "YECOxR":
                    rpvd.LoadYECOReport(yecoReports[int.Parse(elements[1])]);
                    break;

                case "MOCOxL":
                    rpvd.LoadMOCOLog(yecoReports[int.Parse(elements[1])].MOCOLogs[elements[2]]);
                    break;

                case "DACOxL":
                    rpvd.LoadDACOLog(yecoReports[int.Parse(elements[1])].MOCOLogs[elements[2]].DACOLogs[elements[3]]);
                    break;

                case "CLCOxR":
                    rpvd.LoadCLCOReport(clcoReports[int.Parse(elements[1])]);
                    break;

                case "CLCOxL":
                    rpvd.LoadCLCOLog(clcoReports[int.Parse(elements[1])].Clients[uint.Parse(elements[2])]);
                    break;

                case "CLINxR":
                    rpvd.LoadCLINReport(clinReports[int.Parse(elements[1])]);
                    break;

                case "COSExR":
                    rpvd.LoadCOSEReportBySession(coseReports[int.Parse(elements[1])]);
                    break;

                case "COSExS":
                    rpvd.LoadCOSESession(coseReports[int.Parse(elements[1])].Sessions[int.Parse(elements[2])]);
                    break;
                }
            } catch (Exception e)
            {
                MessageLogManager.LogMessage("LASN error: " + e.Message + "\n" + e.InnerException + "\n" + e.Source + "\n" + e.TargetSite);
            }
        }
Example #16
0
 private void AddCLINReports()
 {
     try
     {
         foreach (CLINReport report in clinReports)
         {
             TreeNode clinReportNode = new TreeNode();
             clinReportNode.Text               = report.Name + " (" + report.Id.ToString() + ")";
             clinReportNode.Name               = report.Type + "$" + report.Id;
             clinReportNode.Tag                = report.FileName;
             clinReportNode.ImageIndex         = 4;
             clinReportNode.SelectedImageIndex = 4;
             _explorer.Nodes["CLxN"].Nodes["CLINxN"].Nodes.Add(clinReportNode);
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error Adding CLIN Reports: " + e.Message);
     }
 }
Example #17
0
 public string StartCOSESession(uint reportId, uint clientId, DateTime startTime)
 {
     MessageLogManager.LogMessage("Initializing COSE Session...");
     try
     {
         if (coselm.Load(reportId))
         {
             uint sessionId = coselm.AddSession();
             if (coselm.StartSession(clientId, startTime))
             {
                 MessageLogManager.LogMessage("COSE Session initialized.");
                 return("true");
             }
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("OUTPUT::Error Starting COSE Session:\n" + e.Message + "\n" + e.Source + "\n" + e.StackTrace + "\n" + e.TargetSite);
     }
     return("Error");
 }
Example #18
0
 public string EndCOSESessionLog(uint reportId, DateTime endTime, double totalConsumption)
 {
     MessageLogManager.LogMessage("Ending COSE Session Log...");
     try
     {
         if (coselm.Load(reportId) && coselm.Report.Sessions[coselm.Report.Sessions.Count - 1].Logs.Count > 0)
         {
             double totalTime = Math.Round(endTime.Subtract(coselm.Report.Sessions[coselm.Report.Sessions.Count - 1].Logs[coselm.Report.Sessions[coselm.Report.Sessions.Count - 1].Logs.Count - 1].StartTime).TotalSeconds, 0);
             if (coselm.EndLog(endTime, TimeSpan.FromSeconds(totalTime), totalConsumption))
             {
                 MessageLogManager.LogMessage("COSE Session Log ended.");
                 return(true.ToString());
             }
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("OUTPUT::Error Ending COSE Session Log:\n" + e.Message + "\n" + e.Source + "\n" + e.StackTrace + "\n" + e.TargetSite);
     }
     return("Error");
 }
Example #19
0
 private bool GetCLINReports()
 {
     try
     {
         string[]          reportFiles = Directory.GetFiles(ReportManager.CLINDirectory);
         CLINReportManager clinrm      = new CLINReportManager();
         clinReports = new List <CLINReport> {
         };
         foreach (string file in reportFiles)
         {
             clinrm.Load(file);
             clinReports.Add(clinrm.Report);
         }
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error Retrieving CLIN Reports: " + e.Message);
         return(false);
     }
 }
Example #20
0
 private bool AddYECOReports()
 {
     try
     {
         foreach (YECOReport report in yecoReports)
         {
             TreeNode reportNode = new TreeNode();
             reportNode.Text               = report.Date.Year.ToString();
             reportNode.Name               = report.Type + "$" + report.Id;
             reportNode.Tag                = report.FileName;
             reportNode.ImageIndex         = 5;
             reportNode.SelectedImageIndex = 5;
             _explorer.Nodes["COxN"].Nodes["YECOxN"].Nodes.Add(reportNode);
         }
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error Adding CO Reports: " + e.Message);
         return(false);
     }
 }
Example #21
0
 private bool AddCOSEReports()
 {
     try
     {
         foreach (COSEReport report in coseReports)
         {
             TreeNode coseReportNode = new TreeNode();
             coseReportNode.Text               = report.ConsoleName + " (" + report.ConsoleId.ToString() + ") - " + report.Name + " " + report.Id.ToString();
             coseReportNode.Name               = report.Type + "$" + report.Id;
             coseReportNode.Tag                = report.FileName;
             coseReportNode.ImageIndex         = 6;
             coseReportNode.SelectedImageIndex = 6;
             _explorer.Nodes["CNxN"].Nodes["COSExN"].Nodes.Add(coseReportNode);
         }
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error Adding COSE Reports: " + e.Message);
         return(false);
     }
 }
Example #22
0
 private bool AddCLCOReports()
 {
     try
     {
         foreach (CLCOReport report in clcoReports)
         {
             TreeNode clcoReportNode = new TreeNode();
             clcoReportNode.Text               = report.Name + " (" + report.Id.ToString() + ")";
             clcoReportNode.Name               = report.Type + "$" + report.Id;
             clcoReportNode.Tag                = report.FileName;
             clcoReportNode.ImageIndex         = 5;
             clcoReportNode.SelectedImageIndex = 5;
             _explorer.Nodes["CLxN"].Nodes["CLCOxN"].Nodes.Add(clcoReportNode);
         }
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error Adding CLCO Reports: " + e.Message);
         return(false);
     }
 }
        public bool LoadCOSESession(COSELog session)
        {
            try
            {
                Visible = false;
                InitializeComunColumns();
                InitializeCOSELogReportDGVComponents();
                AddCOSELogReportColumns();
                _propertyfield1.Text  = session.Name;
                _propertyfield2.Text  = session.Id.ToString();
                _propertyfield3.Text  = session.Type;
                _propertyfield4.Text  = session.Date.ToLongDateString();
                _propertyfield5.Text  = session.ClientId.ToString();
                _propertyfield6.Text  = session.Logs.Count.ToString();
                _propertyfield7.Text  = session.StartTime.ToLongTimeString();
                _propertyfield8.Text  = session.EndTime.ToLongTimeString();
                _propertyfield9.Text  = session.TotalTime.ToString();
                _propertyfield10.Text = session.TotalConsumption.ToString();
                _propertyfield11.Text = "";
                _propertyfield12.Text = "";
                _propertyfield13.Text = "";
                InitializeLBL(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
                              new string[] { "Name:", "ID:", "Type:",
                                             "Date Created:", "Client ID:", "Log Count:",
                                             "Start Time:", "End Time:", "Total Time:",
                                             "Total Consumption:" });
                PadLabels(19);
                foreach (COACLog log in session.Logs)
                {
                    _reportDataGrid.Rows.Add(log.Id.ToString(), log.EventName, log.ExtraControls.ToString(), log.StartTime.ToLongTimeString(), log.EndTime.ToLongTimeString(), log.TotalTime.ToString(), log.TotalConsumption.ToString());
                }

                Visible = true;
                return(true);
            } catch (Exception e)
            {
                MessageLogManager.LogMessage(e.Message + e.Data + "\n" + e.InnerException + "\n" + e.Source);
                return(false);
            }
        }
Example #24
0
 private bool GetYECOReports()
 {
     try
     {
         string[]          reportFiles = Directory.GetFiles(ReportManager.CODirectory);
         YECOReportManager corm        = new YECOReportManager();
         yecoReports = new List <YECOReport> {
         };
         foreach (string file in reportFiles)
         {
             if (corm.Load(file) != "Error")
             {
                 yecoReports.Add(corm.Report);
             }
         }
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error Retrieving CLSE Reports: " + e.Message);
         return(false);
     }
 }
 public bool LoadMOCOLog(MOCOLog log)
 {
     try
     {
         Visible = false;
         InitializeComunColumns();
         InitializeMOCOReportDVGComponents();
         AddYECOReportColumns();
         _propertyfield1.Text  = log.Name;
         _propertyfield2.Text  = log.Id.ToString();
         _propertyfield3.Text  = log.Type;
         _propertyfield4.Text  = log.Date.ToLongDateString();
         _propertyfield5.Text  = log.Date.ToLongTimeString();
         _propertyfield6.Text  = log.DACOLogs.Count.ToString();
         _propertyfield7.Text  = log.StartTime.ToLongTimeString();
         _propertyfield8.Text  = log.EndTime.ToLongTimeString();
         _propertyfield9.Text  = log.TotalTime.ToString();
         _propertyfield10.Text = log.TotalConsumption.ToString();
         _propertyfield11.Text = "";
         _propertyfield12.Text = "";
         _propertyfield13.Text = "";
         InitializeLBL(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
                       new string[] { "Name:", "ID:", "Type:",
                                      "Date Created:", "Time Created:", "Log Count:",
                                      "Start Time:", "End Time:", "Total Time:",
                                      "Total Consumption:" });
         PadLabels(19);
         foreach (KeyValuePair <string, DACOLog> session in log.DACOLogs)
         {
             _reportDataGrid.Rows.Add(session.Value.Id, session.Key, session.Value.Sessions.Count, session.Value.StartTime.ToString(), session.Value.EndTime.ToString(), session.Value.TotalTime.ToString(), session.Value.TotalConsumption.ToString());
         }
         Visible = true;
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage(e.Message + e.Data + "\n" + e.InnerException + "\n" + e.Source);
         return(false);
     }
 }
Example #26
0
 private bool GetCOSEReports()
 {
     try
     {
         string[]          reportFiles = Directory.GetFiles(ReportManager.COSEDirectory);
         COSEReportManager coserm      = new COSEReportManager();
         coseReports = new List <COSEReport> {
         };
         foreach (string file in reportFiles)
         {
             if (coserm.Load(file))
             {
                 coseReports.Add(coserm.Report);
             }
         }
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error retireving COSE Reports: " + e.Message);
         return(false);
     }
 }
Example #27
0
        private static void StartListening()
        {
            bool        close   = false;
            string      message = "";
            Interpreter ittp    = new Interpreter();

            using (NamedPipeServerStream reportGeneratorServer = new NamedPipeServerStream("ReportGenerator", PipeDirection.InOut))
            {
                MessageLogManager.LogMessage("Waiting for connection with PlayBoxMonitor");
                reportGeneratorServer.WaitForConnection();
                MessageLogManager.LogMessage("Connection stablished with PlayBoxMonitor");
                using (StreamReader reciever = new StreamReader(reportGeneratorServer))
                    using (StreamWriter sender = new StreamWriter(reportGeneratorServer))
                    {
                        while (!close)
                        {
                            message = ittp.InterpreteData(reciever.ReadLine());
                            if (message != null)
                            {
                                sender.WriteLine(message);
                                if (message != "closingserver")
                                {
                                    sender.Flush();
                                }
                                else
                                {
                                    close = true;
                                }
                                MessageLogManager.LogMessage("\n\n\nWaiting for packet...\n\n");
                            }
                            if (reciever.BaseStream == null || !reportGeneratorServer.IsConnected)
                            {
                                close = true;
                            }
                        }
                    }
                reportGeneratorServer.Close();
            }
        }
 public bool LoadCOSEReportBySession(COSEReport report)
 {
     try
     {
         Visible = false;
         InitializeComunColumns();
         InitializeCOSESessionReportDGVComponents();
         AddCOSESessionReportColumns();
         _propertyfield1.Text  = report.Name;
         _propertyfield2.Text  = report.Id.ToString();
         _propertyfield3.Text  = report.Type;
         _propertyfield4.Text  = report.Date.ToLongDateString();
         _propertyfield5.Text  = report.Date.ToLongTimeString();
         _propertyfield6.Text  = "";
         _propertyfield7.Text  = "";
         _propertyfield8.Text  = "";
         _propertyfield9.Text  = report.FileName;
         _propertyfield10.Text = report.PathName;
         _propertyfield11.Text = "";
         _propertyfield12.Text = "";
         _propertyfield13.Text = "";
         InitializeLBL(new int[] { 0, 1, 2, 3, 4, 8, 9 },
                       new string[] { "Name:", "ID:", "Type:",
                                      "Date Created:", "Time Created:", "File Name:",
                                      "File Location:" });
         PadLabels(15);
         foreach (COSELog session in report.Sessions)
         {
             _reportDataGrid.Rows.Add(session.Id.ToString(), session.ClientId.ToString(), session.StartTime.ToString(), session.EndTime.ToString(), session.TotalTime.ToString(), session.TotalConsumption.ToString());
         }
         Visible = true;
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage(e.Message + e.Data + "\n" + e.InnerException + "\n" + e.Source);
         return(false);
     }
 }
Example #29
0
 private void AddCLCOSessions()
 {
     try
     {
         foreach (CLCOReport report in clcoReports)
         {
             foreach (KeyValuePair <uint, CLCOLog> log in report.Clients)
             {
                 TreeNode coseSessionNode = new TreeNode();
                 coseSessionNode.Text               = log.Value.ClientName + " (" + log.Value.Id.ToString() + ") - " + log.Value.Name;
                 coseSessionNode.Name               = log.Value.Type + "$" + report.Id + "$" + log.Key;
                 coseSessionNode.ImageIndex         = 7;
                 coseSessionNode.SelectedImageIndex = 7;
                 _explorer.Nodes["CLxN"].Nodes["CLCOxN"].Nodes[report.Type + "$" + report.Id].ImageIndex         = 6;
                 _explorer.Nodes["CLxN"].Nodes["CLCOxN"].Nodes[report.Type + "$" + report.Id].SelectedImageIndex = 6;
                 _explorer.Nodes["CLxN"].Nodes["CLCOxN"].Nodes[report.Type + "$" + report.Id].Nodes.Add(coseSessionNode);
             }
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("Error retireving COSE Sessions: " + e.Message);
     }
 }
 public bool LoadCLINReport(CLINReport report)
 {
     try
     {
         Visible = false;
         InitializeCLINReportDVGComponents();
         AddCLINReportColumns();
         _propertyfield1.Text  = report.Name;
         _propertyfield2.Text  = report.Id.ToString();
         _propertyfield3.Text  = report.Type;
         _propertyfield4.Text  = report.Date.ToLongDateString();
         _propertyfield5.Text  = report.Date.ToLongTimeString();
         _propertyfield6.Text  = "";
         _propertyfield7.Text  = "";
         _propertyfield8.Text  = "";
         _propertyfield9.Text  = report.FileName;
         _propertyfield10.Text = report.PathName;
         _propertyfield11.Text = "";
         _propertyfield12.Text = "";
         _propertyfield13.Text = "";
         InitializeLBL(new int[] { 0, 1, 2, 3, 4, 8, 9 },
                       new string[] { "Name:", "ID:", "Type:",
                                      "Date Created:", "Time Created:", "File Name:",
                                      "File Location:" });
         PadLabels(15);
         foreach (KeyValuePair <string, CLINLog> log in report.Clients)
         {
             _reportDataGrid.Rows.Add(log.Value.Id.ToString(), log.Value.ClientName, log.Value.DocId, log.Value.PhoneNumber, log.Value.DateOfBirth);
         }
         Visible = true;
         return(true);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage(e.Message + e.Data + "\n" + e.InnerException + "\n" + e.Source);
         return(false);
     }
 }