public form_main() { InitializeComponent(); combo_difficulty.DataSource = diffs; combo_difficulty.SelectedIndex = 5; try { StreamReader saved_songs = new StreamReader(new FileStream("songs.txt", FileMode.Open)); int songs_size = int.Parse(saved_songs.ReadLine()); songs = new SongName[songs_size]; { int i0; string s1, s2; for (i0 = 0; i0 < songs_size; ++i0) { s1 = saved_songs.ReadLine(); s2 = saved_songs.ReadLine(); songs[i0] = new SongName(s1, s2); } } saved_songs.Close(); combo_SongName.DataSource = songs; button_Download.Enabled = true; } catch (Exception) { } }
private void button_updateSong_Click(object sender, EventArgs e) { button_updateSong.Enabled = false; new Task(() => { try { HttpWebRequest xhr = (HttpWebRequest)WebRequest.Create("https://million.hyrorre.com/"); xhr.Method = "GET"; Invoke(new Action(() => { output_000.Text += "Connecting... "; })); string string_sr = new StreamReader(((HttpWebResponse)xhr.GetResponse()).GetResponseStream()).ReadToEnd(); Invoke(new Action(() => { output_000.Text += "Success.\r\nProcessingText..."; })); Match m_u = Regex.Match(string_sr, "(?<=<ul id=\"musiclist\" class=\"list\">)[\\s\\S]*?(?=</ul>)"); if (!m_u.Success) { throw new Exception("Songs information is not found."); } MatchCollection m_uc = Regex.Matches(m_u.Value, "(?<=<li>)[\\s\\S]*?(?=</li>)"); songs = new SongName[m_uc.Count]; Match m_u_1, m_u_2; for (int i0 = 0; i0 < m_uc.Count; ++i0) { m_u_1 = Regex.Match(m_uc[i0].Value, "(?<=<h3 class=\"title\">).*?(?=</h3>)"); if (!m_u_1.Success) { throw new Exception("Song" + i0.ToString() + "do not have a name."); } m_u_2 = Regex.Match(m_uc[i0].Value, "(?<=<a href=\"/musics/).*?(?=/\\d+\">\\d+</a>)"); if (!m_u_1.Success) { throw new Exception("Song \"" + m_u_1.Value + "\" do not have a URL."); } songs[i0] = new SongName(m_u_1.Value, m_u_2.Value); } Invoke(new Action(() => { combo_SongName.DataSource = songs; output_000.Text += "Success."; button_updateSong.Enabled = true; })); } catch (Exception err) { Invoke(new Action(() => { output_000.Text += "\r\n" + err.ToString(); button_updateSong.Enabled = true; })); } }).Start(); }
static public void ConvertMacro( ref Js_macro_OBJ _macros, ref Js_notes_OBJ _notes, ref SongName _song, ref DiffName _diff) { ((Js_macro_OBJ.class_Primitive_Combo)_macros.Primitives[0]).Description = _song.urlName + "_" + _diff.shortName + " (left)"; ((Js_macro_OBJ.class_Primitive_Combo)_macros.Primitives[1]).Description = _song.urlName + "_" + _diff.shortName + " (right)"; List <Js_macro_OBJ.class_Primitive_Combo.class_Event>[] events = { new List <Js_macro_OBJ.class_Primitive_Combo.class_Event>(0x400), new List <Js_macro_OBJ.class_Primitive_Combo.class_Event>(0x400), }; StateTimeline[] Handbusy = { new StateTimeline(), new StateTimeline(), }; for (int i0 = 0, _lr, _fl, _time; i0 < _notes.Notes.Length; ++i0) { _lr = _diff.IsLeft(_notes.Notes[i0].EndX) && !Handbusy[0].IsIn(_notes.Notes[i0].Ticks) || Handbusy[1].IsIn(_notes.Notes[i0].Ticks) ? 0 : 1; _fl = _notes.Notes[i0].FollowingNotes == null ? 0 : _notes.Notes[i0].FollowingNotes.Length; _time = FromTicksToMilisecond(_notes.Notes[i0].Ticks, _notes.Conductors); if (_fl == 0) { InsertNoteMacro( ref events[_lr], _time, _notes.Notes[i0].EndX, _notes.Notes[i0].Type == 100 ? 7 : _notes.Notes[i0].FlickDirection, ref _diff); if (_notes.Notes[i0].FlickDirection == 0) { Handbusy[_lr].Insert(_notes.Notes[i0].Ticks, _notes.Notes[i0].Ticks + 5); } else { Handbusy[_lr].Insert(_notes.Notes[i0].Ticks - 20, _notes.Notes[i0].Ticks + 20); } } else { InsertNoteMacro( ref events[_lr], _time, _notes.Notes[i0].EndX, 4, ref _diff); for (int i1 = 0; i1 < _fl; ++i1) { _time = FromTicksToMilisecond(_notes.Notes[i0].FollowingNotes[i1].Ticks, _notes.Conductors); InsertNoteMacro( ref events[_lr], _time, _notes.Notes[i0].FollowingNotes[i1].EndX, _notes.Notes[i0].FollowingNotes[i1].FlickDirection != 0 ? _notes.Notes[i0].FollowingNotes[i1].FlickDirection : i1 + 1 == _fl ? 6 : 5, ref _diff); } Handbusy[_lr].Insert(_notes.Notes[i0].Ticks, _notes.Notes[i0].FollowingNotes.Last().Ticks); } } PostProcessMacro(ref _macros, events); }