Beispiel #1
0
        public static void InstallTrack(Track track)
        {
            string trackPath = string.Format("{0}\\{1}.zip", Reflex.LocalTrackPath, track.TrackName);

            if (File.Exists(trackPath))
            {
                using (Stream fileStream = File.OpenRead(trackPath))
                {
                    using (ZipArchive archive = new ZipArchive(fileStream, ZipArchiveMode.Read))
                    {
                        WriteTrackFiles(archive);
                    }
                }

                //increment install count on the server
                HttpUtility.Post("https://spptqssmj8.execute-api.us-east-1.amazonaws.com/test/incrementinstall", track);

                //increment install count locally, this will be overwritten the next time the track list is pulled
                ++track.RatingVoteCount;
                LocalSettings.HandleTrackInstall(track, trackPath);
                LocalSettings.SaveTracks();
            }
            else
            {
                Log.Add(Trackmanagement.LogMessageType.LogError, string.Format("Installation Failed. The track file does not exist {0}", trackPath));
            }
        }