Exemplo n.º 1
0
        public void DownloadAllTracks()
        {
            string[] serverTracks = null;
            lock (m_trackLocker)
            {
                serverTracks = m_tracks.Select(t => t.TrackName.Trim()).ToArray();
            }

            var localTracks = GetTrackFilesOnDisk();
            var newTracks   = serverTracks.Except(localTracks).ToArray();

            if (newTracks.Length > 0)
            {
                Console.WriteLine($"Detected {newTracks.Length} tracks that aren't downloaded.");
                Console.WriteLine("Beginning to download tracks...");
                for (int i = 0; i < newTracks.Length; ++i)
                {
                    string trackName = newTracks[i];
                    Console.WriteLine($"Downloading track {i + 1}/{newTracks.Length}: {trackName}");
                    TrackInstaller.DownloadTrack(trackName);
                }
                Console.WriteLine("Track installation complete!");
            }
            else
            {
                Console.WriteLine("No new tracks to download. Re-run TrackManager.exe without the '-downloadalltracks' flag.");
            }
        }
Exemplo n.º 2
0
 public void Process()
 {
     ProcessOverlayInjection();
     TrackInstaller.ProcessDownloadQueue();
     Sharing.Process();
     PollTracks();
 }
Exemplo n.º 3
0
        public void DownloadImages()
        {
            lock (m_trackLocker)
            {
                var serverTracks = m_tracks.Select(t => t.TrackName.Trim()).ToArray();
                var localImages  = GetImageFilesOnDisk();
                var newImages    = serverTracks.Except(localImages).ToArray();

                if (newImages.Length > 0)
                {
                    Console.WriteLine(string.Format("Preparing to download {0} new preview images...", newImages.Length));
                }

                foreach (var image in newImages)
                {
                    Console.WriteLine(string.Format("Downloading preview image \"{0}\"", image));
                    TrackInstaller.DownloadImage(image);
                }

                if (newImages.Length > 0)
                {
                    Console.WriteLine("Preview image downloads complete.");
                }
            }
        }
Exemplo n.º 4
0
        public void InstallRandomTracksOnFirstRun()
        {
            if (LocalSettings.TrackSettingsExist() == false)
            {
                Console.WriteLine("First time run detected. Preparing to install an initial set of random tracks.");

                var trackSets = new string[] { TrackType.National, TrackType.Supercross, TrackType.FreeRide };
                foreach (var set in trackSets)
                {
                    TrackInstaller.EnqueueRandomRandomTracks(set);

                    //Cant install multiple sets at once so block until each one is complete.
                    while (TrackInstaller.InstallQueueIsEmpty == false)
                    {
                        TrackInstaller.ProcessDownloadQueue();
                    }
                }
            }
        }
 public override Task <Trackmanagement.Empty> InstallSharedTracks(Trackmanagement.InstallTrackRequest request, ServerCallContext context)
 {
     TrackInstaller.EnqueueSharedTracks(request.TrackName);
     return(Task.FromResult(new Trackmanagement.Empty()));
 }
 public override Task <Trackmanagement.Empty> InstallSelectedTrack(Trackmanagement.InstallTrackRequest request, ServerCallContext context)
 {
     TrackInstaller.AddTrackToInstallQueue(request.TrackName);
     return(Task.FromResult(new Trackmanagement.Empty()));
 }
 public override Task <Trackmanagement.Empty> InstallRandomFreeRides(Trackmanagement.Empty request, ServerCallContext context)
 {
     TrackInstaller.EnqueueRandomRandomTracks(TrackType.FreeRide);
     return(Task.FromResult(new Trackmanagement.Empty()));
 }