示例#1
0
 private void addASongToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.Hide();
     using (SongForm frm = new SongForm())
     {
         frm.ShowDialog();
     }
 }
示例#2
0
        internal static void Show()
        {
            Form = new SongForm();

            Form.Timer.Tick       += Timer_Tick;
            Form.PlayButton.Click += PlayButton_Click;
            Form.StopButton.Click += StopButton_Click;
            Form.FormClosed       += Form_FormClosed;

            Form.Show();
        }
示例#3
0
        private static void Form_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
        {
            Form.PlayButton.Click -= PlayButton_Click;
            Form.StopButton.Click -= StopButton_Click;
            Form.FormClosed       -= Form_FormClosed;

            Form.Timer.Stop();
            Timer.Change(Timeout.Infinite, 10);

            SongPlayer.Stop();
            MidiPlayer.Stop();

            Form = null;
        }
示例#4
0
        private static void Main(string[] args)
        {
            using (SentrySdk.Init(o =>
            {
                o.Dsn = "https://[email protected]/6137970";
                // When configuring for the first time, to see what the SDK is doing:
                o.Debug = true;
                // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
                // We recommend adjusting this value in production.
                o.TracesSampleRate = 1.0;
            }))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                var customDirectory = DirProvider.getCustomDirectory(); //on force la creation du dossier.
                //var customBkpDirectory = new DirProvider().RagnarockSongBkpDirectory; //on force la creation du dossier.
                var songProvider         = new SongProvider();
                var downloadingView      = new DownloadingForm();
                var downloadingPresenter = new DownloadingPresenter(downloadingView, songProvider);
                var configuration        = new Configuration();

                Thread.CurrentThread.CurrentUICulture = new CultureInfo(configuration.Lang ?? "en", true);
                Thread.CurrentThread.CurrentCulture   = Thread.CurrentThread.CurrentUICulture;
                if (args.Contains("--install"))
                {
                    var uri = args.ElementAtOrDefault(1);
                    if (uri.StartsWith(RagnacInstallCommand))
                    {
                        var songIdStr = uri.Replace(RagnacInstallCommand, string.Empty);

                        var songsId = songIdStr.Split('-');
                        foreach (var id in songsId)
                        {
                            var songId = int.Parse(id);
                            downloadingView      = new DownloadingForm();
                            downloadingPresenter = new DownloadingPresenter(downloadingView, songProvider);
                            downloadingPresenter.Download(songId,
                                                          songsId.Count() < 2 || configuration.AutoCloseDownload);
                            Application.Run(downloadingView);
                        }
                    }
                    else if (uri.StartsWith(RagnacListCommand))
                    {
                        var songIdStr = uri.Replace(RagnacListCommand, string.Empty);


                        var songListId = int.Parse(songIdStr);
                        downloadingView      = new DownloadingForm();
                        downloadingPresenter = new DownloadingPresenter(downloadingView, songProvider);
                        downloadingPresenter.DownloadList(songListId, configuration.AutoCloseDownload);
                        Application.Run(downloadingView);
                    }
                    else if (uri.StartsWith(RagnacApiCommand))
                    {
                        var api = uri.Replace(RagnacApiCommand, string.Empty);
                        configuration.ApiKey = api;
                        MessageBox.Show(Resources.Program_Api_Set_api_key, "RagnaCustoms", MessageBoxButtons.OK,
                                        MessageBoxIcon.Asterisk);
                    }
                }
                else
                {
                    // Starts background services
                    //var sessionUploader = new SessionUploader(configuration, UploadSessionUri);
                    //var songResultParser = new SessionParser(RagnarockSongLogsFilePath);

                    //songResultParser.OnNewSession += async session =>
                    //    await sessionUploader.UploadAsync(configuration.ApiKey, session);
                    //songResultParser.StartAsync();

                    // Send score if Oculus is available
                    //Oculus.SendScore();

                    var overlayUploader   = new OverlayUploader(configuration, UploadOverlayUri);
                    var songOverlayParser = new OverlayParser(RagnarockSongLogsFilePath);

                    songOverlayParser.OnOverlayEndGame += async session =>
                                                          await overlayUploader.UploadAsync(configuration.ApiKey, session);

                    songOverlayParser.OnOverlayNewGame += async session =>
                                                          await overlayUploader.UploadAsync(configuration.ApiKey, session);

                    songOverlayParser.OnOverlayStartGame += async session =>
                                                            await overlayUploader.UploadAsync(configuration.ApiKey, session);

                    songOverlayParser.StartAsync();

                    // Create first view to display
                    var songView      = new SongForm();
                    var songPresenter = new SongPresenter(configuration, songView, downloadingPresenter, songProvider);
                    if (string.IsNullOrEmpty(configuration.ApiKey))
                    {
                        MessageBox.Show(songView, Resources.Program_Api_Message1, Resources.Program_Api_Message1_Title,
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    if (configuration.TwitchBotAutoStart)
                    {
                        new TwitchBotForm().Show();
                    }
                    Application.Run(songView);
                }
            }
        }