Skip to content

Commit b76d42a

Browse files
committed
Initial commit and beta version
0 parents  commit b76d42a

11 files changed

+854
-0
lines changed

.gitignore

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
ExtraWorkspace/
5+
6+
# User-specific files
7+
*.suo
8+
*.user
9+
*.sln.docstates
10+
11+
# Build results
12+
13+
[Dd]ebug/
14+
[Rr]elease/
15+
x64/
16+
build/
17+
[Bb]in/
18+
[Oo]bj/
19+
20+
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
21+
!packages/*/build/
22+
23+
# MSTest test Results
24+
[Tt]est[Rr]esult*/
25+
[Bb]uild[Ll]og.*
26+
27+
*_i.c
28+
*_p.c
29+
*.ilk
30+
*.meta
31+
*.obj
32+
*.pch
33+
*.pdb
34+
*.pgc
35+
*.pgd
36+
*.rsp
37+
*.sbr
38+
*.tlb
39+
*.tli
40+
*.tlh
41+
*.tmp
42+
*.tmp_proj
43+
*.log
44+
*.vspscc
45+
*.vssscc
46+
.builds
47+
*.pidb
48+
*.log
49+
*.scc
50+
*.json
51+
52+
# Visual C++ cache files
53+
ipch/
54+
*.aps
55+
*.ncb
56+
*.opensdf
57+
*.sdf
58+
*.cachefile
59+
60+
# Visual Studio profiler
61+
*.psess
62+
*.vsp
63+
*.vspx
64+
65+
# Guidance Automation Toolkit
66+
*.gpState
67+
68+
# ReSharper is a .NET coding add-in
69+
_ReSharper*/
70+
*.[Rr]e[Ss]harper
71+
72+
# TeamCity is a build add-in
73+
_TeamCity*
74+
75+
# DotCover is a Code Coverage Tool
76+
*.dotCover
77+
78+
# NCrunch
79+
*.ncrunch*
80+
.*crunch*.local.xml
81+
82+
# Installshield output folder
83+
[Ee]xpress/
84+
85+
# DocProject is a documentation generator add-in
86+
DocProject/buildhelp/
87+
DocProject/Help/*.HxT
88+
DocProject/Help/*.HxC
89+
DocProject/Help/*.hhc
90+
DocProject/Help/*.hhk
91+
DocProject/Help/*.hhp
92+
DocProject/Help/Html2
93+
DocProject/Help/html
94+
95+
# Click-Once directory
96+
publish/
97+
98+
# Publish Web Output
99+
*.Publish.xml
100+
*.pubxml
101+
102+
# NuGet Packages Directory
103+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
104+
#packages/
105+
106+
# Windows Azure Build Output
107+
csx
108+
*.build.csdef
109+
110+
# Windows Store app package directory
111+
AppPackages/
112+
113+
# Others
114+
sql/
115+
*.Cache
116+
ClientBin/
117+
[Ss]tyle[Cc]op.*
118+
~$*
119+
*~
120+
*.dbmdl
121+
*.[Pp]ublish.xml
122+
*.pfx
123+
*.publishsettings
124+
125+
# RIA/Silverlight projects
126+
Generated_Code/
127+
128+
# Backup & report files from converting an old project file to a newer
129+
# Visual Studio version. Backup files are not needed, because we have git ;-)
130+
_UpgradeReport_Files/
131+
Backup*/
132+
UpgradeLog*.XML
133+
UpgradeLog*.htm
134+
135+
# SQL Server files
136+
App_Data/*.mdf
137+
App_Data/*.ldf
138+
139+
# =========================
140+
# Windows detritus
141+
# =========================
142+
143+
# Windows image file caches
144+
Thumbs.db
145+
ehthumbs.db
146+
147+
# Folder config file
148+
Desktop.ini
149+
150+
# Recycle Bin used on file shares
151+
$RECYCLE.BIN/
152+
153+
# Mac crap
154+
.DS_Store
155+
156+
.vs/
157+
.vscode/

AnimationGifPlayer.csproj

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{426F5A24-AB56-411A-8723-BB388A445D7E}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>AnimationGifPlayer</RootNamespace>
11+
<AssemblyName>AnimationGifPlayer</AssemblyName>
12+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
<TargetFrameworkProfile />
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>..\..\Sync\bin\Debug\Plugins\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
<PlatformTarget>x86</PlatformTarget>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Drawing" />
39+
<Reference Include="System.Windows.Forms" />
40+
<Reference Include="System.Xml.Linq" />
41+
<Reference Include="System.Data.DataSetExtensions" />
42+
<Reference Include="Microsoft.CSharp" />
43+
<Reference Include="System.Data" />
44+
<Reference Include="System.Net.Http" />
45+
<Reference Include="System.Xml" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Compile Include="BeatmapTiming.cs" />
49+
<Compile Include="Configuration.cs" />
50+
<Compile Include="GifPlayer.cs">
51+
<SubType>Form</SubType>
52+
</Compile>
53+
<Compile Include="GifPlayer.Designer.cs">
54+
<DependentUpon>GifPlayer.cs</DependentUpon>
55+
</Compile>
56+
<Compile Include="GifPlayerApp.cs" />
57+
<Compile Include="GifPlayerPlugin.cs" />
58+
<Compile Include="Properties\AssemblyInfo.cs" />
59+
</ItemGroup>
60+
<ItemGroup>
61+
<ProjectReference Include="..\..\Sync\Sync.csproj">
62+
<Project>{FBD514C2-2830-479E-B050-D1C383028456}</Project>
63+
<Name>Sync</Name>
64+
<Private>False</Private>
65+
</ProjectReference>
66+
<ProjectReference Include="C:\Users\deliay\source\repos\OsuRTDataProvider\OsuRTDataProvider.csproj">
67+
<Project>{d518dc59-cc9a-4886-839f-7691d5efae56}</Project>
68+
<Name>OsuRTDataProvider</Name>
69+
<Private>False</Private>
70+
</ProjectReference>
71+
</ItemGroup>
72+
<ItemGroup>
73+
<EmbeddedResource Include="GifPlayer.resx">
74+
<DependentUpon>GifPlayer.cs</DependentUpon>
75+
</EmbeddedResource>
76+
</ItemGroup>
77+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
78+
</Project>

BeatmapTiming.cs

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace AnimationGifPlayer
8+
{
9+
public class BeatmapTiming
10+
{
11+
private readonly Dictionary<double, double> RedLines = new Dictionary<double, double>();
12+
private readonly Dictionary<double, int> RedLinesMeters = new Dictionary<double, int>();
13+
private readonly List<double> Offsets = new List<double>();
14+
15+
private void ParseLine(string raw)
16+
{
17+
var splitPos = raw.IndexOf(',');
18+
var secondSplitPos = raw.IndexOf(',', splitPos + 1);
19+
var thirdSplitPos = raw.IndexOf(',', secondSplitPos + 1);
20+
// [offset],[bpm],[meter],...
21+
double offset = double.Parse(raw.Substring(0, splitPos));
22+
double bpm = double.Parse(raw.Substring(splitPos + 1, secondSplitPos - splitPos - 1));
23+
int meter = int.Parse(raw.Substring(secondSplitPos + 1, thirdSplitPos - secondSplitPos - 1));
24+
// < 0 mean grean line
25+
if (bpm < 0)
26+
{
27+
return;
28+
}
29+
RedLines.Add(offset, bpm);
30+
RedLinesMeters.Add(offset, meter);
31+
Offsets.Add(offset);
32+
}
33+
private void Parse(string[] raw)
34+
{
35+
int index = 0;
36+
while (raw[index++].Trim() != "[TimingPoints]") { }
37+
while (raw[index].Length > 0 && char.IsNumber(raw[index][0]))
38+
{
39+
ParseLine(raw[index++]);
40+
}
41+
}
42+
public BeatmapTiming(string[] raw)
43+
{
44+
Parse(raw);
45+
}
46+
47+
public double GetBeatDelay(double offset)
48+
{
49+
foreach (var redlineOffset in Offsets.OrderByDescending(_ => _))
50+
{
51+
if (offset >= redlineOffset) return RedLines[redlineOffset];
52+
}
53+
// default set to 60bpm (1e3 ms)
54+
return 1000;
55+
}
56+
57+
public int GetReadlineMeter(double offset)
58+
{
59+
foreach (var redlineOffset in Offsets.OrderByDescending(_ => _))
60+
{
61+
if (offset >= redlineOffset) return RedLinesMeters[redlineOffset];
62+
}
63+
// default set to 60bpm (1e3 ms)
64+
return 4;
65+
}
66+
67+
public double GetBeatPreMinute(double offset)
68+
{
69+
return 60000 / GetBeatDelay(offset);
70+
}
71+
}
72+
}

Configuration.cs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Sync.Tools;
2+
using Sync.Tools.ConfigurationAttribute;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace AnimationGifPlayer
10+
{
11+
public class Configuration : IConfigurable
12+
{
13+
private GifPlayerApp App { get; }
14+
public Configuration(GifPlayerApp app)
15+
{
16+
this.App = app;
17+
}
18+
[Path(IsDirectory = false)]
19+
public ConfigurationElement ImagePath { get; set; }
20+
21+
public void onConfigurationLoad()
22+
{
23+
App.LoadImage(ImagePath);
24+
}
25+
26+
public void onConfigurationReload()
27+
{
28+
App.LoadImage(ImagePath);
29+
}
30+
31+
public void onConfigurationSave()
32+
{
33+
App.LoadImage(ImagePath);
34+
}
35+
}
36+
}

GifPlayer.Designer.cs

+49
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)