using System; using System.Text.RegularExpressions; namespace AIProofread { public enum AppEnvironment { Dev, Test, Prod } public class AppServer { /// /// 开发环境 /// public const string DEV = "http://localhost:5173/"; /// /// 测试环境 /// public const string TEST = "http://gm2-plugin.zverse.group/"; /// /// 果麦预发布-灰度 /// public const string PRE = "https://pre-gm-plugin.gachafun.com/"; /// /// 果麦生产 /// public const string PROD = "https://gm-plugin.gachafun.com/"; /// /// 果麦金融 /// public const string GM_FN = "https://gm-plugin-fn.gachafun.com/"; } public class Config { public static readonly string APP_NAME = "AI校对王"; public static readonly string APP_VERSION = "2.2.5"; public static bool IS_WPS = false; public static bool UpgradeForcedNotice = false; public static readonly string APP_BASE_DIR = AppDomain.CurrentDomain.BaseDirectory; public static readonly string CONFIG_FILE = AppDomain.CurrentDomain.BaseDirectory + "app.json"; public static string USER_MANUAL_URL = "https://aiprhelp.guomai.cn/"; /// /// 文本背景色 /// public static readonly string TextBackgroundColor = "#E9DABB"; // e9dabb D6AA69 public static string DeviceId = ""; #if DEBUG /// /// 网页访问地址 /// public static string WEB_PATH = AppServer.DEV; //pre-gm-plugin.gachafun.com localhost:5173 gm2-plugin.zverse.group public static bool RUN_IN_DEBUG = true; public static AppEnvironment APP_ENV = AppEnvironment.Dev; #else public static string WEB_PATH = AppServer.DEV; // gm-plugin.gachafun.com pre-gm-plugin.gachafun.com public static bool RUN_IN_DEBUG = true; public static AppEnvironment APP_ENV = AppEnvironment.Dev; #endif public static readonly string APP_DATA_PATH = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ai_proofread"; public static readonly string APP_LOG_PATH = APP_DATA_PATH + "\\logs\\"; public static readonly string WEB_DATA_PATH = APP_DATA_PATH + "\\userdata"; /// /// 书签前缀 /// public static readonly string BOOKMARK_NAME_PREFIX = "ai_proofread_"; private static readonly Regex regex = new Regex("^ai_proofread_\\d+$"); public static bool IsProofreadMark(string name) { return name != null && regex.IsMatch(name); } /// /// 获取书签名称 /// /// 校对提示id /// 书签名称 public static string BuildBookmarkName(int id) { return BOOKMARK_NAME_PREFIX + id; } /// /// 根据书签名称获取校对提示id /// /// 书签名称 /// 校对提示id public static int GetBookmarkIdByName(string name) { if (!IsProofreadMark(name)) return -1; return int.Parse(name.Substring(BOOKMARK_NAME_PREFIX.Length)); } /// /// 获取完整访问路径 /// /// /// public static string WebPath(string path) { Random r = new Random(); return WEB_PATH + path + (path.IndexOf("?") == -1 ? "?":"&") + $"ver={APP_VERSION}&r=" + r.NextDouble(); } } }