Пример #1
0
        static void Main()
        {
            Logger.SetupLogfile("output.log");
            Logger.Info("[DEBUG] Command Line Args: " + string.Join(" ", Environment.GetCommandLineArgs()));
            Application.ApplicationExit += Application_ApplicationExit;

            if (!Environment.GetCommandLineArgs().Contains("-debug") && SentryKey.Length > 10)
            {
                SharpRaven.RavenClient ravenClient = new RavenClient("https://" + SentryKey + "@sentry.io/227668");
                ravenClient.Release = Application.ProductVersion.ToString();
                AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
                {
                    try
                    {
                        ravenClient.Capture(new SharpRaven.Data.SentryEvent((Exception)e.ExceptionObject));
                    }
                    finally
                    {
                        Application.Exit();
                    }
                };

                Logger.Info("Sentry Reporting is Enabled");
            }

            Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            SteamManager.Init();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ConfigUtility.Load();

            _addonManager = new AddonManager();
            _addonManager.StartAsync();

            VRUBApplicationContext context = new VRUBApplicationContext();

            Application.Run(context);
        }
Пример #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        private static bool Initialize()
        {
            // TODO: Add your initialization logic here
            SteamManager.Init();

#if  DEBUG
            return(true);
#endif
            if (SteamManager.RestartNeeded(369040))  //this
            {
                //this.Exit();
                return(false);
            }


            if (SteamManager.isValidApp(369040)) //TODO: ADD YOUR APP ID HERE<<<<<<<<<<<<<<<<<<
            {
                Console.WriteLine("isValidApp = true");
            }
            else
            {
                Console.WriteLine("isValidApp = false");
                Console.WriteLine("Please make sure Steam is running or Re-install Steam / Yargis. http://store.steampowered.com/about/");
                //DialogResult dialogResult = MessageBox.Show("Error with Steam. Try re-installing Steam / Yargis. Do you want to download now?", "Some Title", MessageBoxButtons.YesNo);
                //if (dialogResult == DialogResult.Yes)
                //{
                //    http://store.steampowered.com/about/
                //}

                //this.Exit();
                return(false);
            }



            return(true);
            // base.Initialize();
        }
Пример #3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            _log.Debug("Initialize();");
            _log.Info("Sharpcraft is initializing!");

            base.Initialize();

            /* /!\ Steam hardcore loading action /!\ */
            _log.Info("Loading Steam components...");
            if (SteamManager.Init())
            {
                //SteamManager.FriendList.LoadFriends(); // Should load automatically now
                //Application.EnableVisualStyles();
                _log.Info("Creating Steam GUI.");
                // TODO: Find a way to set the start location of SteamGUI to be next to Game Window.
                var steamGUI = new SteamGUI();
                if (!steamGUI.Visible)
                {
                    steamGUI.Show();
                }
                _log.Info("Steam components loaded!");
            }
            else
            {
                _log.Info("Steam not installed or not running, Steam functionality will NOT be available.");
            }

            // /!\ WARNING /!\
            // Ugly debug code ahead!
            _log.Debug("Starting debug connection...");
            _server = new Server("F16Gaming Test", "localhost", 25565, "The test server", 0, 0, 0, true);
            Client  = new Client(_server, new Player(0, "Sharpcraft"));
            Client.Connect();
            _log.Debug("Reached end of debug connection!");

            Exiting += (s, e) => Client.Exit();
        }