private void GetRenderers()
        {
            renderers = new List <DirectDrawWrapper>();

            var renderersIni = new IniFile(ProgramConstants.GetBaseResourcePath() + RENDERERS_INI);

            var keys = renderersIni.GetSectionKeys("Renderers");

            if (keys == null)
            {
                throw new Exception("[Renderers] not found from Renderers.ini!");
            }

            foreach (string key in keys)
            {
                string internalName = renderersIni.GetStringValue("Renderers", key, string.Empty);

                var ddWrapper = new DirectDrawWrapper(internalName, renderersIni);
                renderers.Add(ddWrapper);
            }

            OSVersion osVersion = ClientConfiguration.Instance.GetOperatingSystemVersion();

            defaultRenderer = renderersIni.GetStringValue("DefaultRenderer", osVersion.ToString(), string.Empty);

            if (defaultRenderer == null)
            {
                throw new Exception("Invalid or missing default renderer for operating system: " + osVersion);
            }
        }
        void TestStringParser(int major, int minor, int point)
        {
            var version       = new OSVersion(major, minor, point);
            var versionString = version.ToString();

            Assert.That(OSVersion.Parse(versionString).Equals(version));

            // Add unicode characters
            Assert.That(OSVersion.Parse("iPhone version 中文" + versionString + "عربى -/@!@#$23").Equals(version));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Do analyze
        /// </summary>
        /// <returns>environment info as name=>value collection</returns>
        protected internal virtual IEnumerable <KeyValuePair <string, string> > GetSummary()
        {
            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

            list.Add(new KeyValuePair <string, string>(HeaderCaption, HeaderCaptionLine));
            list.Add(new KeyValuePair <string, string>("Is64BitOperatingSystem", Is64BitOperatingSystem.ToString()));
            list.Add(new KeyValuePair <string, string>("Is64BitProcess", Is64BitProcess.ToString()));
            list.Add(new KeyValuePair <string, string>("OSVersion", OSVersion.ToString()));
            list.Add(new KeyValuePair <string, string>("UserInteractive", UserInteractive.ToString()));
            list.Add(new KeyValuePair <string, string>("HasShutdownStarted", Environment.HasShutdownStarted.ToString()));

            return(list);
        }
Exemplo n.º 4
0
        public static string SystemVersion()
        {
            ulong version = ulong.Parse(AnalyticsInfo.VersionInfo.DeviceFamilyVersion);
            var   OperatingSystemVersion = new OSVersion
            {
                Major    = (ushort)((version & 0xFFFF000000000000L) >> 48),
                Minor    = (ushort)((version & 0x0000FFFF00000000L) >> 32),
                Build    = (ushort)((version & 0x00000000FFFF0000L) >> 16),
                Revision = (ushort)(version & 0x000000000000FFFFL)
            };

            return(OperatingSystemVersion.ToString());
        }
Exemplo n.º 5
0
        private static void LogProgramStats()
        {
            var thisProcess = Process.GetCurrentProcess();
            var stats       = new
            {
                Platform = OSVersion.ToString(),
                ProcessorCount,
                ExecutionTime  = (DateTime.Now - thisProcess.StartTime).TotalSeconds,
                PeakWorkingSet = thisProcess.PeakWorkingSet64,
            };

            var statsString = "Programs stats:\n" + Json.SerializeToString(stats, prettyPrint: true);

            NoConsole.Log.Info(statsString);
        }
        private void GetRenderers()
        {
            renderers = new List <DirectDrawWrapper>();

            var renderersIni = new IniFile(ProgramConstants.GetBaseResourcePath() + RENDERERS_INI);

            var keys = renderersIni.GetSectionKeys("Renderers");

            if (keys == null)
            {
                throw new Exception("[Renderers] not found from Renderers.ini!");
            }

            foreach (string key in keys)
            {
                string internalName = renderersIni.GetStringValue("Renderers", key, string.Empty);

                var ddWrapper = new DirectDrawWrapper(internalName, renderersIni);
                renderers.Add(ddWrapper);
            }

            OSVersion osVersion = ClientConfiguration.Instance.GetOperatingSystemVersion();

            defaultRenderer = renderersIni.GetStringValue("DefaultRenderer", osVersion.ToString(), string.Empty);

            if (defaultRenderer == null)
            {
                throw new Exception("Invalid or missing default renderer for operating system: " + osVersion);
            }


            string renderer = UserINISettings.Instance.Renderer;

            selectedRenderer = renderers.Find(r => r.InternalName == renderer);

            if (selectedRenderer == null)
            {
                selectedRenderer = renderers.Find(r => r.InternalName == defaultRenderer);
            }

            if (selectedRenderer == null)
            {
                throw new Exception("Missing renderer: " + renderer);
            }

            GameProcessLogic.UseQres            = selectedRenderer.UseQres;
            GameProcessLogic.SingleCoreAffinity = selectedRenderer.SingleCoreAffinity;
        }
Exemplo n.º 7
0
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException       += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(MainWnd_UIThreadException);

            Event clsEvent = new Event();

            clsEvent.AddEvent("starting.... loading splash screen...");
            SplashWnd appsplash = new SplashWnd();

            clsEvent.AddEventLn("Done!");

            appsplash.prgBar.Maximum = 100;
            appsplash.lblStatus.Text = "Checking OS Version... ";
            appsplash.prgBar.Value   = 10;
            appsplash.Show();
            appsplash.Refresh();

            // get the windows version
            clsEvent.AddEvent("Checking windows current version");
            OSVersion osVersion = OSInformation.getOSVersion();

            switch (osVersion)
            {
            case OSVersion.Windows95:
            case OSVersion.WindowsMe:
                clsEvent.AddEventLn(": " + osVersion.ToString("G"));
                clsEvent.AddEventLn("This OS platform is not supported. Application will now close.");
                MessageBox.Show("FATAL ERROR Level 1.!!! The Operating System : '" + osVersion.ToString("G") + "' is not supported. Application will now close.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit(); return;

            case OSVersion.Windows98:
            case OSVersion.Windows98SecondEdition:
            case OSVersion.WindowsNT351:
            case OSVersion.WindowsNT4:
            case OSVersion.Windows2000:
            case OSVersion.WindowsXP:
            case OSVersion.WindowsVista:
            case OSVersion.Windows7:
                clsEvent.AddEventLn(": " + osVersion.ToString("G"));
                break;

            case OSVersion.Unknown:
                System.OperatingSystem osInfo = System.Environment.OSVersion;
                clsEvent.AddEventLn(": Unidentified: Platform=" + osInfo.Platform.ToString() + " Major Version=" + osInfo.VersionString);
                clsEvent.AddEventLn("This OS platform is not supported. Application will now close.");
                MessageBox.Show("FATAL ERROR Level 1.!!! The Operating System is unidentified by Retailplus Application. System will now close. Platform=" + osInfo.Platform.ToString() + " Version=" + osInfo.VersionString, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit(); return;
            }


            // get the running version
            appsplash.lblStatus.Text = "Checking application Version... ";
            appsplash.prgBar.Value   = 20;
            appsplash.Show();
            appsplash.Refresh();
            clsEvent.AddEvent("Checking application current version");
            Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            clsEvent.AddEventLn(":" + curVersion.ToString());

            #region CopySubGroupsImages

            // this should be available only for resto
            appsplash.lblStatus.Text = "Copying subgroup images from server... ";
            appsplash.prgBar.Value   = 25;
            getSubGroupImages();

            #endregion

            Version verNewVersion = GetLatestVersion();
            clsEvent.AddEventLn("latest version is " + verNewVersion.ToString(), true);
            // compare the versions
            if (curVersion.CompareTo(verNewVersion) < 0)
            {
                clsEvent.AddEventLn("system will now exit then download the latest version.", true);
                System.Diagnostics.Process.Start("RetailPlus.VersionChecker.exe", "RestoPlus.exe");
                Application.Exit();
                return;
            }
            clsEvent.AddEventLn("This application version is updated.", true);

            appsplash.lblStatus.Text = "Checking connections to database... ";
            appsplash.prgBar.Value   = 30;
            appsplash.Refresh();
            if (!IsDBAlive())
            {
                MessageBox.Show("FATAL ERROR Level 1.!!! Cannot connect to database. Please consult your system administrator immediately...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();

            appsplash.lblStatus.Text = "Checking Last Initialization of ZREAD... ";
            appsplash.prgBar.Value   = 50;
            appsplash.Show();
            appsplash.Refresh();
            if (!IsDateLastInitializationOK())
            {
                MessageBox.Show("FATAL ERROR Level 2.!!! System date is behind ZREAD last initialization date. Please adjust SYSTEM DATE!!!", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();

            appsplash.prgBar.Value   = 70;
            appsplash.lblStatus.Text = "Checking terminal if exist in the database... ";
            appsplash.Refresh();
            string ErrorMessage;
            if (!IsTerminalExist(out ErrorMessage))
            {
                MessageBox.Show(ErrorMessage, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();
            appsplash.prgBar.Value   = 100;
            appsplash.lblStatus.Text = "Checking terminal if demo is expired... ";
            appsplash.Refresh();
            if (IsDemoExpired())
            {
                string stHDSeriano = Key.GetHDSerialNo();
                MessageBox.Show(
                    "This copy has been expired. Please contact your nearest software distributor" + Environment.NewLine +
                    "Or call RBS Sales @: " + Environment.NewLine +
                    "          Philippines: +63.947.3215979" + Environment.NewLine +
                    "          Philippines: +63.918.9390926" + Environment.NewLine +
                    "          Philippines: +632.998.7722" + Environment.NewLine +
                    "          Singapore: +658.6519601" + Environment.NewLine +
                    "Or email [email protected]" + Environment.NewLine +
                    "Your HD Serial No. is: " + stHDSeriano, "RetailPlus™ Demo Version", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                Application.Exit();
                return;
            }

            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();
            appsplash.Dispose();
            appsplash.Close();

            Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();
            clsAuditDetails.BranchID     = Constants.TerminalBranchID;
            clsAuditDetails.TerminalNo   = CompanyDetails.TerminalNo;
            clsAuditDetails.ActivityDate = DateTime.Now;
            clsAuditDetails.User         = "******";
            clsAuditDetails.IPAddress    = System.Net.Dns.GetHostName();
            clsAuditDetails.Activity     = "Open Terminal";
            clsAuditDetails.Remarks      = "FE:" + "Open terminal no.:'" + CompanyDetails.TerminalNo + "' @ Branch:" + Constants.TerminalBranchID.ToString();

            Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
            clsAuditTrail.Insert(clsAuditDetails);

            Data.Terminal        clsTerminal        = new Data.Terminal(clsAuditTrail.Connection, clsAuditTrail.Transaction);
            Data.TerminalDetails clsTerminalDetails = clsTerminal.Details(Constants.TerminalBranchID, CompanyDetails.TerminalNo);

            //overwrite the companydetails from the database
            Data.SysConfig        clsSysConfig        = new Data.SysConfig(clsAuditTrail.Connection, clsAuditTrail.Transaction);
            Data.SysConfigDetails clsSysConfigDetails = clsSysConfig.get_SysConfigDetails();
            clsAuditTrail.CommitAndDispose();

            CompanyDetails.CompanyCode = string.IsNullOrEmpty(clsSysConfigDetails.CompanyCode) ? CompanyDetails.CompanyCode : clsSysConfigDetails.CompanyCode;
            CompanyDetails.CompanyName = string.IsNullOrEmpty(clsSysConfigDetails.CompanyName) ? CompanyDetails.CompanyName : clsSysConfigDetails.CompanyName;
            CompanyDetails.Currency    = string.IsNullOrEmpty(clsSysConfigDetails.Currency) ? CompanyDetails.Currency : clsSysConfigDetails.Currency;
            CompanyDetails.TIN         = string.IsNullOrEmpty(clsSysConfigDetails.TIN) ? CompanyDetails.TIN : clsSysConfigDetails.TIN;

            CompanyDetails.Address1     = string.IsNullOrEmpty(clsSysConfigDetails.Address1) ? CompanyDetails.Address1 : clsSysConfigDetails.Address1;
            CompanyDetails.Address2     = string.IsNullOrEmpty(clsSysConfigDetails.Address2) ? CompanyDetails.Address2 : clsSysConfigDetails.Address2;
            CompanyDetails.City         = string.IsNullOrEmpty(clsSysConfigDetails.City) ? CompanyDetails.City : clsSysConfigDetails.City;
            CompanyDetails.State        = string.IsNullOrEmpty(clsSysConfigDetails.State) ? CompanyDetails.State : clsSysConfigDetails.State;
            CompanyDetails.Zip          = string.IsNullOrEmpty(clsSysConfigDetails.Zip) ? CompanyDetails.Zip : clsSysConfigDetails.Zip;
            CompanyDetails.Country      = string.IsNullOrEmpty(clsSysConfigDetails.Country) ? CompanyDetails.Country : clsSysConfigDetails.Country;
            CompanyDetails.OfficePhone  = string.IsNullOrEmpty(clsSysConfigDetails.OfficePhone) ? CompanyDetails.OfficePhone : clsSysConfigDetails.OfficePhone;
            CompanyDetails.DirectPhone  = string.IsNullOrEmpty(clsSysConfigDetails.DirectPhone) ? CompanyDetails.DirectPhone : clsSysConfigDetails.DirectPhone;
            CompanyDetails.FaxPhone     = string.IsNullOrEmpty(clsSysConfigDetails.FaxPhone) ? CompanyDetails.FaxPhone : clsSysConfigDetails.FaxPhone;
            CompanyDetails.MobilePhone  = string.IsNullOrEmpty(clsSysConfigDetails.MobilePhone) ? CompanyDetails.MobilePhone : clsSysConfigDetails.MobilePhone;
            CompanyDetails.EmailAddress = string.IsNullOrEmpty(clsSysConfigDetails.EmailAddress) ? CompanyDetails.EmailAddress : clsSysConfigDetails.EmailAddress;
            CompanyDetails.WebSite      = string.IsNullOrEmpty(clsSysConfigDetails.WebSite) ? CompanyDetails.WebSite : clsSysConfigDetails.WebSite;

            try
            {
                clsEvent.AddEventLn("Running Main Window.", true);

                MainRestoWnd appmain = new MainRestoWnd();
                appmain.Text = " RestoPlus ™";

                /********************************
                 * Added December 21, 2008
                 * Enable 2 windows in one computer
                 * *****************************/
                try
                {
                    if (clsTerminalDetails.MultiInstanceEnabled)
                    {
                        Application.Run(appmain);
                    }
                    else
                    {
                        SingleInstance.Run(appmain);
                    }
                }
                catch (Exception exMain)
                {
                    clsEvent.AddEventLn("System has excountered an error while loading main screen!" + Environment.NewLine + exMain.ToString(), true);
                    clsEvent.AddEventLn("System has been exited!", true);
                    throw (exMain);
                }

                clsEvent.AddEventLn("System has been exited!", true);

                clsAuditDetails              = new Security.AuditTrailDetails();
                clsAuditDetails.BranchID     = Constants.TerminalBranchID;
                clsAuditDetails.TerminalNo   = CompanyDetails.TerminalNo;
                clsAuditDetails.ActivityDate = DateTime.Now;
                clsAuditDetails.User         = "******";
                clsAuditDetails.IPAddress    = System.Net.Dns.GetHostName();
                clsAuditDetails.Activity     = "Close Terminal";
                clsAuditDetails.Remarks      = "FE:" + "Close terminal no.:'" + CompanyDetails.TerminalNo + "' @ Branch:" + Constants.TerminalBranchID.ToString() + ".";

                clsAuditTrail = new Security.AuditTrail();
                clsAuditTrail.Insert(clsAuditDetails);
                clsAuditTrail.CommitAndDispose();
            }
            catch (Exception ex)
            {
                clsEvent.AddErrorEventLn(ex);

                MessageBox.Show("FATAL ERROR Level 1.!!! An internal error has occurred in the system. Please consult your system administrator immediately...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }