예제 #1
0
파일: UI.cs 프로젝트: fragmer/fCraft
        void StartUp( object sender, EventArgs a ) {
            world = new World( "" );

            world.OnLog += Log;
            world.OnURLChange += SetURL;
            world.OnPlayerListChange += UpdatePlayerList;


            if( world.Init() ) {
                Text = "fCraft " + Updater.GetVersionString() + " - " + world.config.GetString( "ServerName" );

                UpdaterResult update = Updater.CheckForUpdates( world );
                if( update.UpdateAvailable ) {
                    if( world.config.GetString( "AutomaticUpdates" ) == "Notify" ) {
                        Log( String.Format( Environment.NewLine +
                                            "*** A new version of fCraft is available: v{0:0.000}, released {1:0} day(s) ago. ***"+
                                            Environment.NewLine,
                                            Decimal.Divide( update.NewVersionNumber, 1000 ),
                                            DateTime.Now.Subtract( update.ReleaseDate ).TotalDays ), LogType.ConsoleOutput );
                        StartServer();
                    } else {
                        UpdateWindow updateWindow = new UpdateWindow( update, this, world.config.GetString( "AutomaticUpdates" ) == "Auto" );
                        updateWindow.StartPosition = FormStartPosition.CenterParent;
                        updateWindow.ShowDialog();
                    }
                } else {
                    StartServer();
                }
            } else {
                world.log.Log( "---- Could Not Initialize World ----", LogType.FatalError );
                world = null;
            }
        }
예제 #2
0
        void StartUp(object sender, EventArgs a)
        {
            world = new World("");

            world.OnLog              += Log;
            world.OnURLChange        += SetURL;
            world.OnPlayerListChange += UpdatePlayerList;


            if (world.Init())
            {
                Text = "fCraft " + Updater.GetVersionString() + " - " + world.config.GetString("ServerName");

                UpdaterResult update = Updater.CheckForUpdates(world);
                if (update.UpdateAvailable)
                {
                    if (world.config.GetString("AutomaticUpdates") == "Notify")
                    {
                        Log(String.Format(Environment.NewLine +
                                          "*** A new version of fCraft is available: v{0:0.000}, released {1:0} day(s) ago. ***" +
                                          Environment.NewLine,
                                          Decimal.Divide(update.NewVersionNumber, 1000),
                                          DateTime.Now.Subtract(update.ReleaseDate).TotalDays), LogType.ConsoleOutput);
                        StartServer();
                    }
                    else
                    {
                        UpdateWindow updateWindow = new UpdateWindow(update, this, world.config.GetString("AutomaticUpdates") == "Auto");
                        updateWindow.StartPosition = FormStartPosition.CenterParent;
                        updateWindow.ShowDialog();
                    }
                }
                else
                {
                    StartServer();
                }
            }
            else
            {
                world.log.Log("---- Could Not Initialize World ----", LogType.FatalError);
                world = null;
            }
        }