Example #1
0
        private static void Main()
        {
            if (Environment.OSVersion.Version.Major >= 6)
            {
                NativeMethods.SetProcessDPIAware();
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            StartMessageLog();
            StartReporting();
            MainWindow         mainWindow = new MainWindow();
            IntroLoadingWindow intro      = new IntroLoadingWindow();

            intro.InitializeIntroDisplay();
            while (!mainWindow.LoadFinished || mainWindow.ErrorLoadingSettings)
            {
                intro.Continue();
            }
            if (!mainWindow.ErrorLoadingSettings)
            {
                Application.Run(mainWindow);
            }
            if (ReportPipe != null)
            {
                ReportPipe.SendPackage("INACxCOM", "close", "closeserver");
            }
            MessageLogManager.LogMessage("close");
        }
Example #2
0
 public GameConsole(GameConsoleSetup settings)
 {
     try
     {
         splayer = new System.Media.SoundPlayer(PlayBoxMonitor.Properties.Resources.Ring01);
         settings.Properties.EndTime = new DateTime();
         timeControl   = new Timer();
         this.settings = settings;
         if (settings.ReportProperties.COSExR_Name == null)
         {
             settings.ReportProperties.COSExR_Name = " ";
         }
         if (settings.ReportProperties.CLINxR_Name == null)
         {
             settings.ReportProperties.CLINxR_Name = MainWindow.SetupConfiguration.CLINReportName;
         }
         InitializeComponent();
         InitializeControls();
         InitializeTimeControl();
         InitializePrePaidControl();
         InitializeCOSEReport();
         AddControls();
         DisplayExtraControls();
         DisplayConsumption();
         DisplayTime();
         ResumeStatus();
         Click += _GameConsoleControl_Click;
     } catch (Exception e)
     { MessageLogManager.LogMessage("PBM - GCC ::::> Error GC failed to build: " + e.Message); }
 }
Example #3
0
        public uint LoadSetup()
        {
            uint flag = 0;

            try
            {
                SettingsManager sm = new SettingsManager(true);
                setupConfiguration = sm.LoadSetup();
                if (setupConfiguration != null)
                {
                    flag = RestoreConsoles();
                }
                else
                {
                    setupConfiguration = new Setup();
                    flag = 1;
                }
                if (setupConfiguration.AvailableNumberIDs.Count <= 0 && setupConfiguration.ConsolesSetup.Count <= 0)
                {
                    InitializeIDs();
                }
            } catch (Exception e)
            {
                MessageLogManager.LogMessage("PBM  - MW ::::> Error failed to restore setup: " + e.Message);
            }
            return(flag);
        }
 public void CopySettings(GameConsoleSetup outputSettings)//via output
 {
     try
     {
         outputSettings.Name        = Name;
         outputSettings.ColorID     = ColorID;
         outputSettings.NumberID    = NumberID;
         outputSettings.EditEnabled = EditEnabled;
         outputSettings.ClientData  = ClientData.Copy();
     } catch (Exception e)
     { MessageLogManager.LogMessage("PBM  - CS ::::> Error copy failed: " + e.Message); }
 }
Example #5
0
        public void CommandListener()
        {
            bool   stop    = false;
            string package = "";

            string[] response;
            try
            {
                using (NamedPipeClientStream client = new NamedPipeClientStream(".", "ReportGenerator", PipeDirection.InOut, PipeOptions.Asynchronous))
                {
                    client.Connect(5000);
                    using (sw = new StreamWriter(client))
                        using (sr = new StreamReader(client))
                        {
                            while (!stop)
                            {
                                if (commands.Count > 0)
                                {
                                    package = GeneratePackege(commands[0].Type, commands[0].Action, commands[0].Properties);
                                    sw.WriteLine(package);
                                    sw.Flush();
                                    response = sr.ReadLine().Split('$');
                                    if (response[0] == "closingserver")
                                    {
                                        stop = true;
                                    }
                                    else if (response[0] != "Error")
                                    {
                                        InterpretResponse(response, commands[0].Type, commands[0].Action, commands[0].Properties);
                                    }
                                    commands.Remove(commands[0]);
                                }
                                else
                                {
                                    wait.WaitOne();
                                }
                            }
                        }
                    client.Close();
                }
            } catch (Exception e)
            {
                Program.Reporting = false;
                MessageLogManager.LogMessage("PBM - PP ::::> Error Command Listener Failed: " + e.Message + "\n" + e.Source);
            }
        }
Example #6
0
 public void Copy(GameConsoleProperties inputSettings)//Via input
 {
     try
     {
         EndTime              = inputSettings.EndTime;
         ExtraControls        = inputSettings.ExtraControls;
         LastTimeElapsed      = inputSettings.LastTimeElapsed;
         LastTotalConsumption = inputSettings.LastTotalConsumption;
         PrePaid              = inputSettings.PrePaid;
         PrePaidTime          = inputSettings.PrePaidTime;
         StartTime            = inputSettings.StartTime;
         Status           = inputSettings.Status;
         TimeElapsed      = inputSettings.TimeElapsed;
         TotalConsumption = inputSettings.TotalConsumption;
     } catch (Exception e)
     { MessageLogManager.LogMessage("PBM  - CP ::::> Error copy failed: " + e.Message); }
 }
Example #7
0
 public void AddConsoles(int count, GameConsoleSetup cs) //Check if if statement really needed!!!!!!
 {
     try
     {
         if (setupConfiguration.AvailableNumberIDs.Count >= count)
         {
             CreateConsoles(count, cs);
             MessageBox.Show("\nAvailable Number IDs: " + setupConfiguration.AvailableNumberIDs.Count + "\nNumber Of Console To Create: " + count);
         }
         else if (setupConfiguration.AvailableNumberIDs.Count < count)
         {
             MessageBox.Show("You've reached the limit amount of Consoles");
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("PBM  - MW ::::> Error failed to add console: " + e.Message);
     }
 }
Example #8
0
 public uint LoadSettings()
 {
     try
     {
         SettingsManager sm = new SettingsManager();
         settingsConfiguration = sm.LoadSettings();
         if (settingsConfiguration == null)
         {
             settingsConfiguration = new Settings();
         }
         sm.SaveSettings(settingsConfiguration);
         return(1);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("PBM  - MW ::::> Error failed to load settings: " + e.Message);
         return(2);
     }
 }
Example #9
0
 public Setup LoadSetup()
 {
     try
     {
         using (fStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
         {
             Stream   stream       = fStream;
             FileInfo settingsFile = new FileInfo(fileName);
             if (settingsFile.Length > 0)
             {
                 return((Setup)bFormatter.Deserialize(stream));
             }
         }
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("PBM - SM ::::> Error failed to load setup: " + e.Message + e.Source);
     }
     return(null);
 }
Example #10
0
 private uint RestoreConsoles()
 {
     try
     {
         foreach (GameConsoleSetup consoleSetup in setupConfiguration.ConsolesSetup)
         {
             GameConsole gc = new GameConsole(consoleSetup);
             _consolesContainer.Controls.Add(gc);
         }
         _consolesContainer.Update();
         _consolesContainer.Refresh();
         _consolesContainer.PerformLayout();
         return(1);
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("PBM  - MW ::::> Error failed to restore console: " + e.Message);
         return(0);
     }
 }
Example #11
0
 private static void StartReporting()
 {
     try
     {
         //System.Diagnostics.Process.Start(@"Extensions\PlayBoxReportGenerator.exe");
         System.Diagnostics.ProcessStartInfo start = new System.Diagnostics.ProcessStartInfo();
         start.FileName    = @"Extensions\PlayBoxReportGenerator.exe";
         start.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
         System.Diagnostics.Process.Start(start);
         ReportPipe     = new Pipe();
         reportPipeProc = new Thread(ReportPipe.CommandListener);
         reportPipeProc.Start();
         reportPipeProc.Name = "PlayBox Monitor - PPRep Manager";
         Reporting           = true;
         //ADD CLIENTS REPORT COMMAND!
     } catch (Exception e)
     {
         MessageLogManager.LogMessage("PBM - PGM ::::> Error Report Process failed to start: " + e.Message);
     }
 }
        private void ConfirmationWindow_Load(object sender, EventArgs e)
        {
            switch (type)
            {
            case "#delete":
                _textToDisplayTxtBox.Text = "Are you sure you want to DELETE this console?";
                _submit.ForeColor         = System.Drawing.Color.Crimson;
                _submit.Text = "DELETE";
                break;

            case "#deleteAll":
                _textToDisplayTxtBox.Text = "Are you sure you want to DELETE ALL consoles?";
                _submit.ForeColor         = System.Drawing.Color.Crimson;
                _submit.Text = "DELETE";
                break;

            default:
                MessageLogManager.LogMessage("PBM  - CW ::::> Error invalid argument.");
                break;
            }
        }
Example #13
0
 private void _addConsole_Click(object sender, EventArgs e)
 {
     try
     {
         if (setupConfiguration.NumberOfConsoles < 10)
         {
             CreateConsoleParameters ccp = new CreateConsoleParameters();
             ccp.Count = setupConfiguration.AvailableNumberIDs.Count;
             using (CreateConsoleWindow ccw = new CreateConsoleWindow(ccp))
             {
                 if (ccw.ShowDialog() == DialogResult.OK)
                 {
                     AddConsoles(ccp.Count, ccp.Setup);
                 }
             }
         }
         else
         {
             MessageBox.Show("You've reached the limit amount of Consoles");
         }
     } catch (Exception ex)
     { MessageLogManager.LogMessage("PBM  - MW ::::> Error failed to start Add Console:" + ex.Message); }
 }
Example #14
0
 private void CreateConsoles(int count, GameConsoleSetup consoleSettings)
 {
     try
     {
         for (int i = 0; i < count; i++)
         {
             GameConsoleSetup cs = new GameConsoleSetup();
             consoleSettings.CopySettings(cs);
             cs.NumberID = setupConfiguration.AvailableNumberIDs[0];
             setupConfiguration.ConsolesSetup.Add(cs);
             GameConsole gc = new GameConsole(cs);
             _consolesContainer.Controls.Add(gc);
             setupConfiguration.AvailableNumberIDs.Remove(setupConfiguration.AvailableNumberIDs[0]);
             setupConfiguration.NumberOfConsoles++;
         }
         MessageBox.Show(_consolesContainer.Controls.Count.ToString());
         _consolesContainer.Update();
         _consolesContainer.Refresh();
         _consolesContainer.PerformLayout();
         SaveSetup();
     } catch (Exception e)
     { MessageLogManager.LogMessage("PBM  - MW ::::> Error failed to create console: " + e.Message); }
 }
Example #15
0
        private void InterpretResponse(string[] response, string type, string action, object data)
        {
            switch (type)
            {
            case "CLINxR":
                CLINReportInterpreter(response, action, data);
                break;

            case "DACOxR":
                break;

            case "MOCOxR":
                break;

            case "YECOxR":
                break;

            case "COSExR":
                COSEReportInterpreter(response, action, data);
                break;

            case "COSExS":
                COSESessionInterpreter(response, action, data);
                break;

            case "COSExL":
                COSESessionLogInterpreter(response, action, data);
                break;

            default:
                foreach (string arg in response)
                {
                    MessageLogManager.LogMessage("PBM - PP ::::> Error interpreting response (UNKNOWN)" + arg);
                }
                break;
            }
        }