mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-01-15 14:42:46 +01:00
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace TweetLib.Core.Features.Plugins.Enums {
|
|
enum PluginEnvironment {
|
|
Browser,
|
|
Notification
|
|
}
|
|
|
|
static class PluginEnvironments {
|
|
public static IEnumerable<PluginEnvironment> All { get; } = new PluginEnvironment[] {
|
|
PluginEnvironment.Browser,
|
|
PluginEnvironment.Notification
|
|
};
|
|
|
|
public static string GetPluginScriptNamespace(this PluginEnvironment environment) {
|
|
return environment switch {
|
|
PluginEnvironment.Browser => "tweetdeck",
|
|
PluginEnvironment.Notification => "notification",
|
|
_ => throw new InvalidOperationException($"Invalid plugin environment: {environment}")
|
|
};
|
|
}
|
|
|
|
public static string GetPluginScriptFile(this PluginEnvironment environment) {
|
|
return environment switch {
|
|
PluginEnvironment.Browser => "browser.js",
|
|
PluginEnvironment.Notification => "notification.js",
|
|
_ => throw new InvalidOperationException($"Invalid plugin environment: {environment}")
|
|
};
|
|
}
|
|
|
|
public static string GetPluginScriptVariables(this PluginEnvironment environment) {
|
|
return environment switch {
|
|
PluginEnvironment.Browser => "$,$TD,$TDP,TD",
|
|
PluginEnvironment.Notification => "$TD,$TDP",
|
|
_ => string.Empty
|
|
};
|
|
}
|
|
}
|
|
}
|