Ejemplo n.º 1
0
        public void Run()
        {
            Window = new NativeWindow(640, 400, Program.AppName, 0,
                                      GraphicsMode.Default, DisplayDevice.Default);
            Window.Visible = true;
            Drawer         = new GdiPlusDrawer2D(null);
            Init();
            TryLoadTexturePack();
            platformDrawer.Init(Window.WindowInfo);

            fetcher = new ResourceFetcher();
            fetcher.CheckResourceExistence();
            checkTask = new UpdateCheckTask();
            checkTask.CheckForUpdatesAsync();
            if (!fetcher.AllResourcesExist)
            {
                SetScreen(new ResourcesScreen(this));
            }
            else
            {
                SetScreen(new MainScreen(this));
            }

            while (true)
            {
                Window.ProcessEvents();
                if (!Window.Exists)
                {
                    break;
                }
                if (ShouldExit)
                {
                    if (Screen != null)
                    {
                        Screen.Dispose();
                    }
                    break;
                }

                Screen.Tick();
                if (Dirty || Screen.Dirty)
                {
                    Display();
                }
                Thread.Sleep(1);
            }

            if (Options.Load())
            {
                LauncherSkin.SaveToOptions();
                Options.Save();
            }
            if (ShouldUpdate)
            {
                Updater.Patcher.LaunchUpdateScript();
            }
            Window.Close();
        }
 public override void Init()
 {
     if( game.checkTask != null && game.checkTask.Done )
         SuccessfulUpdateCheck( game.checkTask );
     checkTask = new UpdateCheckTask();
     checkTask.CheckForUpdatesAsync();
     game.Window.Keyboard.KeyDown += KeyDown;
     game.Window.Keyboard.KeyUp += KeyUp;
     Resize();
 }
Ejemplo n.º 3
0
 public override void Init()
 {
     if (game.checkTask != null && game.checkTask.Done)
     {
         SuccessfulUpdateCheck(game.checkTask);
     }
     checkTask = new UpdateCheckTask();
     checkTask.CheckForUpdatesAsync();
     game.Window.Keyboard.KeyDown += KeyDown;
     game.Window.Keyboard.KeyUp   += KeyUp;
     Resize();
 }
Ejemplo n.º 4
0
        void SuccessfulUpdateCheck(UpdateCheckTask task)
        {
            if (updateDone)
            {
                return;
            }
            string latestVer  = game.checkTask.LatestStable.Version.Substring(1);
            int    spaceIndex = Program.AppName.LastIndexOf(' ');
            string currentVer = Program.AppName.Substring(spaceIndex + 1);
            bool   update     = new Version(latestVer) > new Version(currentVer);

            updateText = update ? "&aNew release available" : "&eUp to date     ";
            updateDone = true;
            game.MakeBackground();
            Resize();
            SelectWidget(selectedWidget);
        }
        public void Run()
        {
            Window = new NativeWindow( 640, 400, Program.AppName, 0,
                                      GraphicsMode.Default, DisplayDevice.Default );
            Window.Visible = true;
            Drawer = new GdiPlusDrawer2D( null );
            Init();
            TryLoadTexturePack();
            platformDrawer.Init( Window.WindowInfo );

            string audioPath = Path.Combine( Program.AppDirectory, "audio" );
            BinUnpacker.Unpack( audioPath, "dig" );
            BinUnpacker.Unpack( audioPath, "step" );

            fetcher = new ResourceFetcher();
            fetcher.CheckResourceExistence();
            checkTask = new UpdateCheckTask();
            checkTask.CheckForUpdatesAsync();
            if( !fetcher.AllResourcesExist )
                SetScreen( new ResourcesScreen( this ) );
            else
                SetScreen( new MainScreen( this ) );

            while( true ) {
                Window.ProcessEvents();
                if( !Window.Exists ) break;
                if( ShouldExit ) {
                    if( Screen != null )
                        Screen.Dispose();
                    break;
                }

                Screen.Tick();
                if( Dirty || Screen.Dirty )
                    Display();
                Thread.Sleep( 1 );
            }

            if( Options.Load() ) {
                LauncherSkin.SaveToOptions();
                Options.Save();
            }

            if( ShouldUpdate )
                Updater.Patcher.LaunchUpdateScript();
            if( Window.Exists )
                Window.Close();
        }
        public void Run()
        {
            Window = new NativeWindow(640, 400, Program.AppName, 0,
                                      GraphicsMode.Default, DisplayDevice.Default);
            Window.Visible = true;
            Drawer         = new GdiPlusDrawer2D(null);
            Init();
            TryLoadTexturePack();
            platformDrawer.info = Window.WindowInfo;
            platformDrawer.Init();

            string audioPath = Path.Combine(Program.AppDirectory, "audio");

            BinUnpacker.Unpack(audioPath, "dig");
            BinUnpacker.Unpack(audioPath, "step");

            fetcher = new ResourceFetcher();
            fetcher.CheckResourceExistence();
            checkTask = new UpdateCheckTask();
            checkTask.CheckForUpdatesAsync();

            if (!fetcher.AllResourcesExist)
            {
                SetScreen(new ResourcesScreen(this));
            }
            else
            {
                SetScreen(new MainScreen(this));
            }

            while (true)
            {
                Window.ProcessEvents();
                if (!Window.Exists)
                {
                    break;
                }
                if (ShouldExit)
                {
                    if (Screen != null)
                    {
                        Screen.Dispose();
                    }
                    break;
                }

                Screen.Tick();
                if (Dirty)
                {
                    Display();
                }
                Thread.Sleep(10);
            }

            if (Options.Load())
            {
                LauncherSkin.SaveToOptions();
                Options.Save();
            }

            if (ShouldUpdate)
            {
                Updater.Applier.ApplyUpdate();
            }
            if (Window.Exists)
            {
                Window.Close();
            }
        }
Ejemplo n.º 7
0
        public void Run()
        {
            Window = Factory.CreateWindow(640, 400, Program.AppName,
                                          GraphicsMode.Default, DisplayDevice.Default);
            Window.Visible = true;
            Drawer         = new GdiPlusDrawer2D();
            UpdateClientSize();

            Init();
            TryLoadTexturePack();
            platformDrawer.window = Window;
            platformDrawer.Init();

            Downloader = new AsyncDownloader(Drawer);
            Downloader.Init("");
            Downloader.Cookies   = new CookieContainer();
            Downloader.KeepAlive = true;

            fetcher = new ResourceFetcher();
            fetcher.CheckResourceExistence();
            checkTask = new UpdateCheckTask();
            checkTask.RunAsync(this);

            if (!fetcher.AllResourcesExist)
            {
                SetScreen(new ResourcesScreen(this));
            }
            else
            {
                SetScreen(new MainScreen(this));
            }

            while (true)
            {
                Window.ProcessEvents();
                if (!Window.Exists)
                {
                    break;
                }
                if (ShouldExit)
                {
                    if (Screen != null)
                    {
                        Screen.Dispose();
                        Screen = null;
                    }
                    break;
                }

                checkTask.Tick();
                Screen.Tick();
                if (Dirty)
                {
                    Display();
                }
                Thread.Sleep(10);
            }

            if (Options.Load())
            {
                LauncherSkin.SaveToOptions();
                Options.Save();
            }

            if (ShouldUpdate)
            {
                Updater.Applier.ApplyUpdate();
            }
            if (Window.Exists)
            {
                Window.Close();
            }
        }
Ejemplo n.º 8
0
        void SuccessfulUpdateCheck( UpdateCheckTask task )
        {
            if( updateDone ) return;
            string latestVer = game.checkTask.LatestStable.Version.Substring( 1 );
            int spaceIndex = Program.AppName.LastIndexOf( ' ' );
            string currentVer = Program.AppName.Substring( spaceIndex + 1 );
            bool update = new Version( latestVer ) > new Version( currentVer );

            updateText = update ? "&aNew release available" : "&eUp to date     ";
            updateDone = true;
            game.MakeBackground();
            Resize();
            SelectWidget( selectedWidget );
        }
 void SuccessfulUpdateCheck( UpdateCheckTask task )
 {
     if( task.LatestDev == null || task.LatestStable == null ) return;
     dev = task.LatestDev; lastDev = dev.TimeBuilt;
     stable = task.LatestStable; lastStable = stable.TimeBuilt;
 }
Ejemplo n.º 10
0
 void SuccessfulUpdateCheck(UpdateCheckTask task)
 {
     dev    = task.LatestDev; lastDev = dev.TimeBuilt;
     stable = task.LatestStable; lastStable = stable.TimeBuilt;
 }