예제 #1
0
        void DownloadResources(int mouseX, int mouseY)
        {
            if (game.Downloader == null)
            {
                game.Downloader = new AsyncDownloader("null");
            }
            if (fetcher != null)
            {
                return;
            }

            fetcher = game.fetcher;
            fetcher.DownloadItems(game.Downloader, SetStatus);
            selectedWidget = null;
            Resize();
        }
예제 #2
0
        public void AJson_GeneralParsing_FileParsing_CanParseLargeFile()
        {
            // Currently 771,347 characters - 81,312 words - 38,306 lines
            string jsonText = ResourceFetcher.GetText("_TestData/Large.json");

            Json json = JsonHelper.ParseText(jsonText);

            Assert.IsNotNull(json);
            Assert.IsFalse(json.HasErrors, "Json parse errors:\n" + String.Join("\n\t", json.Errors));

            JsonArray arr = json.Data as JsonArray;

            Assert.IsNotNull(arr);
            Assert.AreEqual(6384, arr.Count);

            json.AssertSourceIsValid();
        }
예제 #3
0
        void DownloadResources(int mouseX, int mouseY)
        {
            if (fetcher != null)
            {
                return;
            }

            fetcher = game.fetcher;
            fetcher.DownloadItems(game.Downloader, SetStatus);
            selectedWidget = null;

            widgets[view.yesIndex].Visible    = false;
            widgets[view.noIndex].Visible     = false;
            widgets[view.textIndex].Visible   = false;
            widgets[view.cancelIndex].Visible = true;
            widgets[view.sliderIndex].Visible = true;
            Resize();
        }
예제 #4
0
		public override void Tick() {
			if (fetcher == null || failed) return;
			CheckCurrentProgress();
			
			if (!fetcher.Check(SetStatus))
				failed = true;
			
			if (!fetcher.Done) return;
			if (ResourceList.GetFetchFlags() != 0) {
				ResourcePatcher patcher = new ResourcePatcher(fetcher, drawer);
				patcher.Run();
			}
			
			fetcher = null;
			GC.Collect();
			game.TryLoadTexturePack();
			GotoNextMenu(0, 0);
		}
예제 #5
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 );

            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.Applier.ApplyUpdate();
            if( Window.Exists )
                Window.Close();
        }
예제 #6
0
 /**
  * This method adds a new fetcher portcol to the manager
  */
 public void addProtocol(String protocolId, ResourceFetcher protocol)
 {
     if (protocolId == null || protocol == null) throw new NullReferenceException();
     if (resourceFetchers.ContainsKey(protocolId) == true) throw new InvalidOperationException();
     resourceFetchers.Add(protocolId, protocol);
 }