Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Awbugl committed Mar 26, 2022
1 parent 5a8129f commit 20e2b6a
Show file tree
Hide file tree
Showing 53 changed files with 2,020 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.idea
*.dll
*.xml
*.cache
*.pdb
*.txt
*.nupkg
*.p7s
*._

[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
9 changes: 9 additions & 0 deletions Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Newtonsoft.Json;

namespace ImageGenerator;

public class Config
{
[JsonProperty("iconpath")] public string IconPath { get; set; }
[JsonProperty("songpath")] public string SongPath { get; set; }
}
9 changes: 9 additions & 0 deletions Data/Json/Arcaea/ArcaeaLimitedApi/Best30.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaLimitedApi;

[Serializable]
public class Best30
{
[JsonProperty("data")] public List<RecordDataItem> Data { get; set; }
}
10 changes: 10 additions & 0 deletions Data/Json/Arcaea/ArcaeaLimitedApi/Partner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaLimitedApi;

[Serializable]
public class Partner
{
[JsonProperty("partner_id")] public int PartnerId { get; set; }
[JsonProperty("is_awakened")] public bool IsAwakened { get; set; }
}
19 changes: 19 additions & 0 deletions Data/Json/Arcaea/ArcaeaLimitedApi/RecordDataItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaLimitedApi;

[Serializable]
public class RecordDataItem
{
[JsonProperty("song_id")] public string SongId { get; set; }
[JsonProperty("difficulty")] public sbyte Difficulty { get; set; }
[JsonProperty("score")] public string Score { get; set; }
[JsonProperty("shiny_pure_count")] public string ShinyPureCount { get; set; }
[JsonProperty("pure_count")] public string PureCount { get; set; }
[JsonProperty("far_count")] public string FarCount { get; set; }
[JsonProperty("lost_count")] public string LostCount { get; set; }
[JsonProperty("recollection_rate")] public int RecollectionRate { get; set; }
[JsonProperty("time_played")] public long TimePlayed { get; set; }
[JsonProperty("gauge_type")] public int GaugeType { get; set; }
[JsonProperty("potential_value")] public double PotentialValue { get; set; }
}
9 changes: 9 additions & 0 deletions Data/Json/Arcaea/ArcaeaLimitedApi/ScoreinfoData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaLimitedApi;

[Serializable]
public class ScoreinfoData
{
[JsonProperty("data")] public RecordDataItem Data { get; set; }
}
9 changes: 9 additions & 0 deletions Data/Json/Arcaea/ArcaeaLimitedApi/UserinfoData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaLimitedApi;

[Serializable]
public class UserinfoData
{
[JsonProperty("data")] public UserinfoDataItem Data { get; set; }
}
12 changes: 12 additions & 0 deletions Data/Json/Arcaea/ArcaeaLimitedApi/UserinfoDataItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaLimitedApi;

[Serializable]
public class UserinfoDataItem
{
[JsonProperty("display_name")] public string DisplayName { get; set; }
[JsonProperty("potential")] public short? Potential { get; set; } = -1;
[JsonProperty("partner")] public Partner Partner { get; set; }
[JsonProperty("last_played_song")] public RecordDataItem LastPlayedSong { get; set; }
}
19 changes: 19 additions & 0 deletions Data/Json/Arcaea/ArcaeaUnlimitedApi/AccountInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaUnlimitedApi;

public class AccountInfo
{
[JsonProperty("code")] public int Code { get; set; }
[JsonProperty("name")] public string Name { get; set; }
[JsonProperty("user_id")] public int UserID { get; set; }
[JsonProperty("is_mutual")] public bool IsMutual { get; set; }

[JsonProperty("is_char_uncapped_override")]
public bool IsCharUncappedOverride { get; set; }

[JsonProperty("is_char_uncapped")] public bool IsCharUncapped { get; set; }
[JsonProperty("is_skill_sealed")] public bool IsSkillSealed { get; set; }
[JsonProperty("rating")] public short Rating { get; set; }
[JsonProperty("character")] public int Character { get; set; }
}
26 changes: 26 additions & 0 deletions Data/Json/Arcaea/ArcaeaUnlimitedApi/ArcSongdata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaUnlimitedApi;

public class ArcSongdata
{
[JsonProperty("song_id")] public string SongId { get; set; }

[JsonProperty("difficulty")] public sbyte Difficulty { get; set; }

[JsonProperty("score")] public string Score { get; set; }

[JsonProperty("shiny_perfect_count")] public string MaxPure { get; set; }

[JsonProperty("perfect_count")] public string Pure { get; set; }

[JsonProperty("near_count")] public string Far { get; set; }

[JsonProperty("miss_count")] public string Lost { get; set; }

[JsonProperty("time_played")] public long TimePlayed { get; set; }

[JsonProperty("clear_type")] public sbyte ClearType { get; set; }

[JsonProperty("rating")] public double Rating { get; set; }
}
10 changes: 10 additions & 0 deletions Data/Json/Arcaea/ArcaeaUnlimitedApi/ResponseRoot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaUnlimitedApi;

public class ResponseRoot
{
[JsonProperty("content")] public dynamic Content { get; set; }

internal T? DeserializeContent<T>() => JsonConvert.DeserializeObject<T>(Content.ToString());
}
9 changes: 9 additions & 0 deletions Data/Json/Arcaea/ArcaeaUnlimitedApi/SongListContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using ImageGenerator.Data.Json.Arcaea.Songlist;
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaUnlimitedApi;

public class SongListContent
{
[JsonProperty("songs")] public List<SongsItem> Songs { get; set; }
}
8 changes: 8 additions & 0 deletions Data/Json/Arcaea/ArcaeaUnlimitedApi/TooManySongsContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaUnlimitedApi;

public class TooManySongsContent
{
[JsonProperty("songs")] public List<string> Songs { get; set; }
}
11 changes: 11 additions & 0 deletions Data/Json/Arcaea/ArcaeaUnlimitedApi/UserBest30Content.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaUnlimitedApi;

public class UserBest30Content
{
[JsonProperty("best30_avg")] public double Best30Avg { get; set; }
[JsonProperty("recent10_avg")] public double Recent10Avg { get; set; }
[JsonProperty("account_info")] public AccountInfo AccountInfo { get; set; }
[JsonProperty("best30_list")] public List<ArcSongdata> Best30List { get; set; }
}
9 changes: 9 additions & 0 deletions Data/Json/Arcaea/ArcaeaUnlimitedApi/UserBestContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaUnlimitedApi;

public class UserBestContent
{
[JsonProperty("account_info")] public AccountInfo AccountInfo { get; set; }
[JsonProperty("record")] public ArcSongdata Record { get; set; }
}
9 changes: 9 additions & 0 deletions Data/Json/Arcaea/ArcaeaUnlimitedApi/UserInfoContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.ArcaeaUnlimitedApi;

public class UserInfoContent
{
[JsonProperty("account_info")] public AccountInfo AccountInfo { get; set; }
[JsonProperty("recent_score")] public List<ArcSongdata> RecentScore { get; set; }
}
45 changes: 45 additions & 0 deletions Data/Json/Arcaea/PartnerPosInfoBase/PartnerPosInfoBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Collections.Concurrent;
using ImageGenerator.Model;
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.PartnerPosInfoBase;

internal static class PartnerPosInfoBase
{
private static readonly Lazy<ConcurrentDictionary<string, List<PosInfoItem>>> Locations
= new(() =>
new(JsonConvert
.DeserializeObject<
Dictionary<string, List<PosInfoItem>>>(File.ReadAllText(Path.PartnerConfig))!));

private static readonly Lazy<ConcurrentDictionary<string, Dictionary<string, PosInfoItem>>> Dict
= new(() => new(Init()));

private static readonly PosInfoItem ImgV1 = new() { PositionX = 770, PositionY = 58, Size = 950 };
private static readonly PosInfoItem ImgV2 = new() { PositionX = 850, PositionY = 0, Size = 1400 };
private static readonly PosInfoItem ImgV4 = new() { PositionX = 550, PositionY = 50, Size = 1500 };

private static Dictionary<string, Dictionary<string, PosInfoItem>> Init()
{
var ls = new Dictionary<string, Dictionary<string, PosInfoItem>>();
foreach (var (key, value) in Locations.Value) ls.Add(key, value.ToDictionary(i => i.Partner));
return ls;
}

internal static PosInfoItem? Get(string partner, ImgVersion imgVersion)
{
return imgVersion switch
{
ImgVersion.ImgV1 => Dict.Value["1"].TryGetValue(partner, out var result)
? result
: ImgV1,
ImgVersion.ImgV2 => Dict.Value["2"].TryGetValue(partner, out var result)
? result
: ImgV2,
ImgVersion.ImgV4 => Dict.Value["4"].TryGetValue(partner, out var result)
? result
: ImgV4,
_ => null
};
}
}
9 changes: 9 additions & 0 deletions Data/Json/Arcaea/PartnerPosInfoBase/PosInfoItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ImageGenerator.Data.Json.Arcaea.PartnerPosInfoBase;

public class PosInfoItem
{
public string Partner { get; set; }
public int PositionX { get; set; }
public int PositionY { get; set; }
public int Size { get; set; }
}
16 changes: 16 additions & 0 deletions Data/Json/Arcaea/Songlist/DifficultiesItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.Songlist;

[Serializable]
public class DifficultiesItem
{
[JsonProperty("ratingClass")] public int RatingClass { get; set; }
[JsonProperty("chartDesigner")] public string ChartDesigner { get; set; } = "";
[JsonProperty("jacketDesigner")] public string JacketDesigner { get; set; } = "";

[JsonProperty("jacketOverride")] public bool JacketOverride { get; set; }

[JsonProperty("realrating")] public int RealRating { get; set; }
[JsonProperty("totalNotes")] public int TotalNotes { get; set; }
}
36 changes: 36 additions & 0 deletions Data/Json/Arcaea/Songlist/SongsItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.Songlist;

#pragma warning disable CS8618

[Serializable]
public class SongsItem
{
[JsonProperty("id")] public string Id { get; set; }

[JsonProperty("title_localized")] public TitleLocalized TitleLocalized { get; set; }

[JsonProperty("artist")] public string Artist { get; set; }

[JsonProperty("bpm")] public string Bpm { get; set; }

[JsonProperty("bpm_base")] public double BpmBase { get; set; }

[JsonProperty("set")] public string Set { get; set; }
[JsonProperty("set_friendly")] public string? Package { get; set; }

[JsonProperty("world_unlock")] public bool WorldUnlock { get; set; }

[JsonProperty("remote_dl")] public bool NeedDownload { get; set; }

[JsonProperty("side")] public int Side { get; set; }

[JsonProperty("time")] public int Time { get; set; }

[JsonProperty("date")] public long Date { get; set; }

[JsonProperty("version")] public string Version { get; set; }

[JsonProperty("difficulties")] public List<DifficultiesItem> Difficulties { get; set; }
}
13 changes: 13 additions & 0 deletions Data/Json/Arcaea/Songlist/TitleLocalized.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Newtonsoft.Json;

namespace ImageGenerator.Data.Json.Arcaea.Songlist;

#pragma warning disable CS8618

[Serializable]
public class TitleLocalized
{
[JsonProperty("en")] public string En { get; set; }

[JsonProperty("ja")] public string Ja { get; set; }
}
28 changes: 28 additions & 0 deletions ImageGenerator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>ImageGenerator</AssemblyName>
<RootNamespace>ImageGenerator</RootNamespace>
<OutputType>Exe</OutputType>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<PlatformTarget>x86</PlatformTarget>
<Prefer32bit>true</Prefer32bit>
<DebugType>full</DebugType>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PlatformTarget>x86</PlatformTarget>
<Prefer32bit>true</Prefer32bit>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
</ItemGroup>

</Project>
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Awbugl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 20e2b6a

Please sign in to comment.