-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGifPlayerApp.cs
68 lines (61 loc) · 1.82 KB
/
GifPlayerApp.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using OsuRTDataProvider.Mods;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static OsuRTDataProvider.Listen.OsuListenerManager;
namespace AnimationGifPlayer
{
public class GifPlayerApp
{
private GifPlayer UIForm;
private Thread UIThread;
private BeatmapTiming Timings;
private ModsInfo CurrentMods = default;
public void Start()
{
UIThread = new Thread(ShowForm);
UIThread.SetApartmentState(ApartmentState.STA);
UIThread.Name = "STAThreadForm";
UIThread.Start();
}
public void SetCurrentState(OsuStatus state)
{
UIForm.SetCurrentState(state);
}
public void SetCurrentMods(ModsInfo mods)
{
this.CurrentMods = mods;
UIForm.SetCurrentMods(mods);
}
public void SetBeatmap(string[] raw)
{
Timings = new BeatmapTiming(raw);
}
public void SetCurrentPlaytime(double time)
{
if (Timings == null) return;
UIForm.SetAnimationDelay(Timings.GetBeatDelay(time), Timings.GetReadlineMeter(time));
UIForm.SetCurrentPlaytime(time);
}
public void LoadImage(string path)
{
if (UIForm != null)
{
UIForm.LoadImage(path);
}
}
[STAThread]
public void ShowForm()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
UIForm = new GifPlayer();
Application.Run(UIForm);
}
}
}