Skip to content

Commit 2df7f12

Browse files
feat: Lite検知を追加
1 parent 009de09 commit 2df7f12

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

src/YmmRPC/YmmRpc.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
using DiscordRPC;
1+
using System.Diagnostics;
2+
using System.Windows;
3+
using DiscordRPC;
24
using DiscordRPC.Logging;
35
using YukkuriMovieMaker.Plugin;
46
using YmmRPC.Settings;
57

68
namespace YmmRPC;
79

810
[PluginDetails(AuthorName = "namakemono-san", ContentId = "")]
9-
public abstract class YmmRpcPlugin : IPlugin, IDisposable
11+
// ReSharper disable once ClassNeverInstantiated.Global
12+
public class YmmRpcPlugin : IPlugin, IDisposable
1013
{
1114
public string Name => "YMM-RPC";
12-
13-
private const string ClientId = "1353376132732420136";
15+
16+
private static readonly string ClientId = IsLiteEdition() ? "1455192227734098075" : "1353376132732420136";
1417
private const string Version = "0.3.0";
1518
private const int UpdateIntervalMs = 15000;
1619

@@ -20,7 +23,7 @@ public abstract class YmmRpcPlugin : IPlugin, IDisposable
2023
private static volatile bool _updateRequested;
2124
private bool _disposed;
2225

23-
protected YmmRpcPlugin()
26+
public YmmRpcPlugin()
2427
{
2528
_startTime = DateTime.UtcNow;
2629
InitializeClient();
@@ -80,7 +83,7 @@ private static RichPresence BuildDefaultPresence()
8083
return new RichPresence
8184
{
8285
Details = "動画を編集中...",
83-
State = "Working on YMM4",
86+
State = IsLiteEdition() ? "Working on YMM4 Lite" : "Working on YMM4",
8487
Assets = new Assets
8588
{
8689
LargeImageKey = "icon",
@@ -147,4 +150,14 @@ public void Dispose()
147150

148151
GC.SuppressFinalize(this);
149152
}
153+
154+
private static bool IsLiteEdition()
155+
{
156+
var exeName = Process.GetCurrentProcess().MainModule?.FileName ?? "";
157+
if (exeName.Contains("Lite", StringComparison.OrdinalIgnoreCase))
158+
return true;
159+
160+
var title = Application.Current?.MainWindow?.Title ?? "";
161+
return title.Contains("Lite", StringComparison.OrdinalIgnoreCase);
162+
}
150163
}

0 commit comments

Comments
 (0)