Esempio n. 1
0
        private Bitmap GetImage(string Url)
        {
            try
            {
                WebRequest request        = WebRequest.Create(Url);
                Stream     responseStream = request.GetResponse().GetResponseStream();
                return(new Bitmap(responseStream));
            }
            catch (WebException WebExc)
            {
                DialogResult result = MessageBox.Show(WebExc.Message + "\nWould you like to try Get the image again??", "Web Exception!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);

                if (result == DialogResult.Yes)
                {
                    return(GetImage(Url));
                }
                else
                {
                    return(null);
                }
            }
            catch (ArgumentException AExc)
            {
                //  Add code later
                MessageBox.Show(AExc.ToString(), "===:GetImage ArgumentException:===");
                return(null);
            }
            catch (Exception Exc)
            {
                MessageBox.Show(Exc.ToString(), "===:Get Image:===");
                MessageBox.Show(Exc.GetType().ToString());

                return(null);
            }
        }
Esempio n. 2
0
        private async void SearchButton_Click(object sender, EventArgs e)
        {
            FlowLayoutPanelSong.Controls.Clear();

            try
            {
                Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "fxjPUENH-tGJthT1vzpZtH4EcdZAOTfj_zIDA1xicETAQXc7xhuBVs1j1sr3yb68");

                var response = await Client.GetAsync("search?q=" + SearchTextBox.Text);

                string value = await response.Content.ReadAsStringAsync();

                dynamic Answer = JsonConvert.DeserializeObject(value);

                try
                {
                    for (int i = 0; i < 4;)
                    {
                        if (Answer.response.hits[i].type == "song")
                        {
                            int    id    = Answer.response.hits[i].result.id;
                            string url   = Answer.response.hits[i].result.song_art_image_thumbnail_url;
                            Bitmap Cover = GetImage(url);

                            if (Cover == null)
                            {
                                Cover = (Bitmap) new PictureBox().Image;
                            }

                            string Title  = Answer.response.hits[i].result.title_with_featured;
                            string Artist = Answer.response.hits[i].result.primary_artist.name;

                            FlowLayoutPanelSong.Controls.Add(CreateSongCard(id, Cover, Title, Artist));
                            i++;
                        }
                        else
                        {
                            i--;
                        }
                    }
                }
                catch (ArgumentOutOfRangeException)
                {
                    //  Add Code Later
                }
                catch (Exception Exc)
                {
                    MessageBox.Show(Exc.ToString(), "===:Answer Response Hits:===");
                    MessageBox.Show(Exc.GetType().ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "===:Search Button Click -Answer-:===");
                MessageBox.Show(ex.GetType().ToString());
            }
        }
Esempio n. 3
0
        internal void ReportAndCrashPlugin()
        {
            Logger.Fatal("CrashReporter", "--------------------------------------------------");
            Logger.Fatal("CrashReporter", "NAL encountered a problem and must exit!");
            Logger.Fatal("CrashReporter", "Exception: " + Exc.GetType());
            Logger.Fatal("CrashReporter", "Hardware Specifications: ");
            Logger.Fatal("CrashReporter", "OS Version: " + Environment.OSVersion.VersionString);
            Logger.Fatal("CrashReporter", "x64 Process: " + Environment.Is64BitProcess);
            Logger.Fatal("CrashReporter", "Game Version: " + Game.BuildNumber);
            Logger.Fatal("CrashReporter", "--------------------------------------------------");
            Logger.Fatal("CrashReporter", "Exception Message: " + Exc.Message);
            Logger.Fatal("CrashReporter", Exc.StackTrace);
            Logger.Fatal("CrashReporter", "--------------------------------------------------");
#pragma warning disable S112 // General exceptions should never be thrown
            throw new Exception("Aborting this instance! See report above!");
#pragma warning restore S112 // General exceptions should never be thrown
        }
Esempio n. 4
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (TextBoxTitle.Tag.ToString() == "Ok")
                {
                    TagFile.SetTitle(MainForm.Music[CurrentPlayingMusicIndex], TextBoxTitle.Text);
                    TextBoxTitle.Tag = "";
                }

                if (TextBoxArtists.Tag.ToString() == "Ok")
                {
                    TagFile.SetArtists(MainForm.Music[CurrentPlayingMusicIndex], TextBoxArtists.Text);
                    TextBoxArtists.Tag = "";
                }

                try
                {
                    if (TextBoxAlbum.Tag.ToString() == "Ok")
                    {
                        TagFile.SetAlbum(MainForm.Music[CurrentPlayingMusicIndex], TextBoxAlbum.Text);
                        TextBoxAlbum.Tag = "";
                    }
                }
                catch (NullReferenceException)
                {
                    //  Add Code later
                }
                catch (Exception Exc)
                {
                    MessageBox.Show(Exc.ToString(), "====:TextBoxAlbum:====");
                    MessageBox.Show(Exc.GetType().ToString(), "====:TextBoxAlbum:====");
                }

                if (TextBoxTrack.Tag.ToString() == "Ok")
                {
                    TagFile.SetTrackN(MainForm.Music[CurrentPlayingMusicIndex], TextBoxTrack.Text);
                    TextBoxTrack.Tag = "";
                }

                if (TextBoxTrackCount.Tag.ToString() == "Ok")
                {
                    TagFile.SetTrackCount(MainForm.Music[CurrentPlayingMusicIndex], TextBoxTrackCount.Text);
                    TextBoxTrackCount.Tag = "";
                }

                if (TextBoxYear.Tag.ToString() == "Ok")
                {
                    TagFile.SetYear(MainForm.Music[CurrentPlayingMusicIndex], TextBoxYear.Text);
                    TextBoxYear.Tag = "";
                }

                if (TextBoxGenre.Tag.ToString() == "Ok")
                {
                    TagFile.SetGenre(MainForm.Music[CurrentPlayingMusicIndex], TextBoxGenre.Text);
                    TextBoxGenre.Tag = "";
                }

                try
                {
                    if (PictureBoxCover.Tag.ToString() == "Ok")
                    {
                        TagFile.SetCover(MainForm.Music[CurrentPlayingMusicIndex], PictureBoxCover.Image);
                        PictureBoxCover.Tag = "";
                    }
                }
                catch (NullReferenceException)
                {
                    //  Add Code later
                }
                catch (Exception Exc)
                {
                    MessageBox.Show(Exc.ToString(), "====:PictureBoxCover:====");
                    MessageBox.Show(Exc.GetType().ToString(), "====:PictureBoxCover:====");
                }

                TagFile.SetLyrics(MainForm.Music[CurrentPlayingMusicIndex], RichTextBoxLyrics.Text);

                MessageBox.Show("All Tags Saved");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "====:Save:====");
                MessageBox.Show(ex.GetType().ToString(), "====:Save:====");
            }
        }