Exemple #1
0
        public async Task ImportAsync(string path)
        {
            if (scores == null)
            {
                //we want to contact a remote osu! to handle the import.
                await SendMessageAsync(new ScoreImportMessage { Path = path });

                return;
            }

            scores.ReadReplayFile(path);
        }
        private void fileDrop(object sender, FileDropEventArgs e)
        {
            var filePaths = new [] { e.FileName };

            if (filePaths.All(f => Path.GetExtension(f) == @".osz"))
            {
                Task.Factory.StartNew(() => BeatmapManager.Import(filePaths), TaskCreationOptions.LongRunning);
            }
            else if (filePaths.All(f => Path.GetExtension(f) == @".osr"))
            {
                Task.Run(() =>
                {
                    var score = ScoreStore.ReadReplayFile(filePaths.First());
                    Schedule(() => LoadScore(score));
                });
            }
        }
Exemple #3
0
        private void dragDrop(DragEventArgs e)
        {
            // this method will only be executed if e.Effect in dragEnter gets set to something other that None.
            var dropData  = (object[])e.Data.GetData(DataFormats.FileDrop);
            var filePaths = dropData.Select(f => f.ToString()).ToArray();

            if (filePaths.All(f => Path.GetExtension(f) == @".osz"))
            {
                Task.Run(() => BeatmapManager.Import(filePaths));
            }
            else if (filePaths.All(f => Path.GetExtension(f) == @".osr"))
            {
                Task.Run(() =>
                {
                    var score = ScoreStore.ReadReplayFile(filePaths.First());
                    Schedule(() => LoadScore(score));
                });
            }
        }