HotReloadPrefs.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. using System;
  2. using System.Globalization;
  3. using System.IO;
  4. using JetBrains.Annotations;
  5. using SingularityGroup.HotReload.Editor.Cli;
  6. using UnityEditor;
  7. using UnityEngine;
  8. namespace SingularityGroup.HotReload.Editor {
  9. internal static class HotReloadPrefs {
  10. private const string RemoteServerKey = "HotReloadWindow.RemoteServer";
  11. private const string RemoteServerHostKey = "HotReloadWindow.RemoteServerHost";
  12. private const string LicenseEmailKey = "HotReloadWindow.LicenseEmail";
  13. private const string RenderAuthLoginKey = "HotReloadWindow.RenderAuthLogin";
  14. private const string FirstLoginCachedKey = "HotReloadWindow.FirstLoginCachedKey";
  15. [Obsolete]
  16. private const string ShowOnStartupKey = "HotReloadWindow.ShowOnStartup";
  17. private const string PasswordCachedKey = "HotReloadWindow.PasswordCached";
  18. private const string ExposeServerToLocalNetworkKey = "HotReloadWindow.ExposeServerToLocalNetwork";
  19. private const string ErrorHiddenCachedKey = "HotReloadWindow.ErrorHiddenCachedKey";
  20. private const string RefreshManuallyTipCachedKey = "HotReloadWindow.RefreshManuallyTipCachedKey";
  21. private const string ShowLoginCachedKey = "HotReloadWindow.ShowLoginCachedKey";
  22. private const string ConfigurationKey = "HotReloadWindow.Configuration";
  23. private const string AvdancedKey = "HotReloadWindow.Avdanced";
  24. private const string ShowPromoCodesCachedKey = "HotReloadWindow.ShowPromoCodesCached";
  25. private const string ShowOnDeviceKey = "HotReloadWindow.ShowOnDevice";
  26. private const string ShowChangelogKey = "HotReloadWindow.ShowChangelog";
  27. private const string UnsupportedChangesKey = "HotReloadWindow.ShowUnsupportedChanges";
  28. private const string LoggedBurstHintKey = "HotReloadWindow.LoggedBurstHint";
  29. private const string ShouldDoAutoRefreshFixupKey = "HotReloadWindow.ShouldDoAutoRefreshFixup";
  30. private const string ActiveDaysKey = "HotReloadWindow.ActiveDays";
  31. [Obsolete]
  32. private const string RateAppShownKey = "HotReloadWindow.RateAppShown";
  33. private const string PatchesCollapseKey = "HotReloadWindow.PatchesCollapse";
  34. private const string PatchesGroupAllKey = "HotReloadWindow.PatchesGroupAll";
  35. private const string LaunchOnEditorStartKey = "HotReloadWindow.LaunchOnEditorStart";
  36. private const string AutoRecompileUnsupportedChangesKey = "HotReloadWindow.AutoRecompileUnsupportedChanges";
  37. private const string AutoRecompilePartiallyUnsupportedChangesKey = "HotReloadWindow.AutoRecompilePartiallyUnsupportedChanges";
  38. private const string DisplayNewMonobehaviourMethodsAsPartiallySupportedKey = "HotReloadWindow.DisplayNewMonobehaviourMethodsAsPartiallySupported";
  39. private const string ShowNotificationsKey = "HotReloadWindow.ShowNotifications";
  40. private const string ShowPatchingNotificationsKey = "HotReloadWindow.ShowPatchingNotifications";
  41. private const string ShowCompilingUnsupportedNotificationsKey = "HotReloadWindow.ShowCompilingUnsupportedNotifications";
  42. private const string AutoRecompileUnsupportedChangesImmediatelyKey = "HotReloadWindow.AutoRecompileUnsupportedChangesImmediately";
  43. private const string AutoRecompileUnsupportedChangesOnExitPlayModeKey = "HotReloadWindow.AutoRecompileUnsupportedChangesOnExitPlayMode";
  44. private const string AutoRecompileUnsupportedChangesInPlayModeKey = "HotReloadWindow.AutoRecompileUnsupportedChangesInPlayMode";
  45. private const string AllowDisableUnityAutoRefreshKey = "HotReloadWindow.AllowDisableUnityAutoRefresh";
  46. private const string DefaultAutoRefreshKey = "HotReloadWindow.DefaultAutoRefresh";
  47. private const string DefaultAutoRefreshModeKey = "HotReloadWindow.DefaultAutoRefreshMode";
  48. private const string DefaultScriptCompilationKeyKey = "HotReloadWindow.DefaultScriptCompilationKey";
  49. private const string DefaultEditorTintKey = "HotReloadWindow.DefaultEditorTint";
  50. private const string AppliedAutoRefreshKey = "HotReloadWindow.AppliedAutoRefresh";
  51. private const string AppliedScriptCompilationKey = "HotReloadWindow.AppliedScriptCompilation";
  52. private const string AppliedEditorTintKey = "HotReloadWindow.AppliedEditorTint";
  53. private const string AllAssetChangesKey = "HotReloadWindow.AllAssetChanges";
  54. private const string IncludeShaderChangesKey = "HotReloadWindow.IncludeShaderChanges";
  55. private const string DisableConsoleWindowKey = "HotReloadWindow.DisableConsoleWindow";
  56. private const string DisableDetailedErrorReportingKey = "HotReloadWindow.DisableDetailedErrorReporting";
  57. private const string DebuggerCompatibilityEnabledKey = "HotReloadWindow.DebuggerCompatibilityEnabled";
  58. private const string RedeemLicenseEmailKey = "HotReloadWindow.RedeemLicenseEmail";
  59. private const string RedeemLicenseInvoiceKey = "HotReloadWindow.RedeemLicenseInvoice";
  60. private const string RunTabEventsSuggestionsFoldoutKey = "HotReloadWindow.RunTabEventsSuggestionsFoldout";
  61. private const string RunTabEventsTimelineFoldoutKey = "HotReloadWindow.RunTabEventsTimelineFoldout";
  62. private const string RunTabUnsupportedChangesFilterKey = "HotReloadWindow.RunTabUnsupportedChangesFilter";
  63. private const string RunTabCompileErrorFilterKey = "HotReloadWindow.RunTabCompileErrorFilter";
  64. private const string RunTabPartiallyAppliedPatchesFilterKey = "HotReloadWindow.RunTabPartiallyAppliedPatchesFilter";
  65. private const string RunTabUndetectedPatchesFilterKey = "HotReloadWindow.RunTabUndetectedPatchesFilter";
  66. private const string RunTabAppliedPatchesFilterKey = "HotReloadWindow.RunTabAppliedPatchesFilter";
  67. private const string RecompileDialogueShownKey = "HotReloadWindow.RecompileDialogueShown";
  68. private const string ApplyFieldInitiailzerEditsToExistingClassInstancesKey = "HotReloadWindow.ApplyFieldInitiailzerEditsToExistingClassInstances";
  69. private const string LoggedInlinedMethodsDialogueKey = "HotReloadWindow.LoggedInlinedMethodsDialogue";
  70. private const string OpenedWindowAtLeastOnceKey = "HotReloadWindow.OpenedWindowAtLeastOnce";
  71. private const string DeactivateHotReloadKey = "HotReloadWindow.DeactivateHotReload";
  72. public const string DontShowPromptForDownloadKey = "ServerDownloader.DontShowPromptForDownload";
  73. [Obsolete] public const string AllowHttpSettingCacheKey = "HotReloadWindow.AllowHttpSettingCacheKey";
  74. [Obsolete] public const string AutoRefreshSettingCacheKey = "HotReloadWindow.AutoRefreshSettingCacheKey";
  75. [Obsolete] public const string ScriptCompilationSettingCacheKey = "HotReloadWindow.ScriptCompilationSettingCacheKey";
  76. [Obsolete] public const string ProjectGenerationSettingCacheKey = "HotReloadWindow.ProjectGenerationSettingCacheKey";
  77. [Obsolete]
  78. public static bool RemoteServer {
  79. get { return EditorPrefs.GetBool(RemoteServerKey, false); }
  80. set { EditorPrefs.SetBool(RemoteServerKey, value); }
  81. }
  82. public static bool DontShowPromptForDownload {
  83. get { return EditorPrefs.GetBool(DontShowPromptForDownloadKey, false); }
  84. set { EditorPrefs.SetBool(DontShowPromptForDownloadKey, value); }
  85. }
  86. [Obsolete]
  87. public static string RemoteServerHost {
  88. get { return EditorPrefs.GetString(RemoteServerHostKey); }
  89. set { EditorPrefs.SetString(RemoteServerHostKey, value); }
  90. }
  91. public static string LicenseEmail {
  92. get { return EditorPrefs.GetString(LicenseEmailKey); }
  93. set { EditorPrefs.SetString(LicenseEmailKey, value); }
  94. }
  95. public static string LicensePassword {
  96. get { return EditorPrefs.GetString(PasswordCachedKey); }
  97. set { EditorPrefs.SetString(PasswordCachedKey, value); }
  98. }
  99. [Obsolete]
  100. public static bool RenderAuthLogin { // false = render free trial
  101. get { return EditorPrefs.GetBool(RenderAuthLoginKey); }
  102. set { EditorPrefs.SetBool(RenderAuthLoginKey, value); }
  103. }
  104. [Obsolete]
  105. public static bool FirstLogin {
  106. get { return EditorPrefs.GetBool(FirstLoginCachedKey, true); }
  107. set { EditorPrefs.SetBool(FirstLoginCachedKey, value); }
  108. }
  109. [Obsolete]
  110. public static string ShowOnStartupLegacy { // WindowAutoOpen
  111. get { return EditorPrefs.GetString(ShowOnStartupKey); }
  112. set { EditorPrefs.SetString(ShowOnStartupKey, value); }
  113. }
  114. public static string showOnStartupPath { get; }= Path.Combine(CliUtils.GetAppDataPath(), "showOnStartup.txt");
  115. static ShowOnStartupEnum? showOnStartup;
  116. public static ShowOnStartupEnum ShowOnStartup {
  117. get {
  118. if (showOnStartup != null) {
  119. return showOnStartup.Value;
  120. }
  121. if (!File.Exists(showOnStartupPath)) {
  122. showOnStartup = ShowOnStartupEnum.Always;
  123. return showOnStartup.Value;
  124. }
  125. var text = File.ReadAllText(showOnStartupPath);
  126. ShowOnStartupEnum _showOnStartup;
  127. if (Enum.TryParse(text, true, out _showOnStartup)) {
  128. showOnStartup = _showOnStartup;
  129. return showOnStartup.Value;
  130. }
  131. showOnStartup = ShowOnStartupEnum.Always;
  132. return showOnStartup.Value;
  133. }
  134. set {
  135. // ReSharper disable once AssignNullToNotNullAttribute
  136. Directory.CreateDirectory(Path.GetDirectoryName(showOnStartupPath));
  137. File.WriteAllText(showOnStartupPath, value.ToString());
  138. showOnStartup = value;
  139. }
  140. }
  141. public static bool ErrorHidden {
  142. get { return EditorPrefs.GetBool(ErrorHiddenCachedKey); }
  143. set { EditorPrefs.SetBool(ErrorHiddenCachedKey, value); }
  144. }
  145. public static bool ShowLogin {
  146. get { return EditorPrefs.GetBool(ShowLoginCachedKey, true); }
  147. set { EditorPrefs.SetBool(ShowLoginCachedKey, value); }
  148. }
  149. public static bool ShowConfiguration {
  150. get { return EditorPrefs.GetBool(ConfigurationKey, true); }
  151. set { EditorPrefs.SetBool(ConfigurationKey, value); }
  152. }
  153. public static bool ShowAdvanced {
  154. get { return EditorPrefs.GetBool(AvdancedKey, false); }
  155. set { EditorPrefs.SetBool(AvdancedKey, value); }
  156. }
  157. public static bool ShowPromoCodes {
  158. get { return EditorPrefs.GetBool(ShowPromoCodesCachedKey, true); }
  159. set { EditorPrefs.SetBool(ShowPromoCodesCachedKey, value); }
  160. }
  161. public static bool ShowOnDevice {
  162. get { return EditorPrefs.GetBool(ShowOnDeviceKey, true); }
  163. set { EditorPrefs.SetBool(ShowOnDeviceKey, value); }
  164. }
  165. public static bool ShowChangeLog {
  166. get { return EditorPrefs.GetBool(ShowChangelogKey, true); }
  167. set { EditorPrefs.SetBool(ShowChangelogKey, value); }
  168. }
  169. public static bool ShowUnsupportedChanges {
  170. get { return EditorPrefs.GetBool(UnsupportedChangesKey, true); }
  171. set { EditorPrefs.SetBool(UnsupportedChangesKey, value); }
  172. }
  173. [Obsolete]
  174. public static bool RefreshManuallyTip {
  175. get { return EditorPrefs.GetBool(RefreshManuallyTipCachedKey); }
  176. set { EditorPrefs.SetBool(RefreshManuallyTipCachedKey, value); }
  177. }
  178. public static bool LoggedBurstHint {
  179. get { return EditorPrefs.GetBool(LoggedBurstHintKey); }
  180. set { EditorPrefs.SetBool(LoggedBurstHintKey, value); }
  181. }
  182. [Obsolete]
  183. public static bool ShouldDoAutoRefreshFixup {
  184. get { return EditorPrefs.GetBool(ShouldDoAutoRefreshFixupKey, true); }
  185. set { EditorPrefs.SetBool(ShouldDoAutoRefreshFixupKey, value); }
  186. }
  187. public static string ActiveDays {
  188. get { return EditorPrefs.GetString(ActiveDaysKey, string.Empty); }
  189. set { EditorPrefs.SetString(ActiveDaysKey, value); }
  190. }
  191. [Obsolete]
  192. public static bool RateAppShownLegacy {
  193. get { return EditorPrefs.GetBool(RateAppShownKey, false); }
  194. set { EditorPrefs.SetBool(RateAppShownKey, value); }
  195. }
  196. static string rateAppPath = Path.Combine(CliUtils.GetAppDataPath(), "ratedApp.txt");
  197. static bool? rateAppShown;
  198. public static bool RateAppShown {
  199. get {
  200. if (rateAppShown != null) {
  201. return rateAppShown.Value;
  202. }
  203. rateAppShown = File.Exists(rateAppPath);
  204. return rateAppShown.Value;
  205. }
  206. set {
  207. // ReSharper disable once AssignNullToNotNullAttribute
  208. Directory.CreateDirectory(Path.GetDirectoryName(rateAppPath));
  209. if (value && !File.Exists(rateAppPath)) {
  210. using (File.Create(rateAppPath)) { }
  211. } else if (!value && File.Exists(rateAppPath)) {
  212. File.Delete(rateAppPath);
  213. }
  214. rateAppShown = value;
  215. }
  216. }
  217. [Obsolete]
  218. public static bool PatchesGroupAll {
  219. get { return EditorPrefs.GetBool(PatchesGroupAllKey, false); }
  220. set { EditorPrefs.SetBool(PatchesGroupAllKey, value); }
  221. }
  222. [Obsolete]
  223. public static bool PatchesCollapse {
  224. get { return EditorPrefs.GetBool(PatchesCollapseKey, true); }
  225. set { EditorPrefs.SetBool(PatchesCollapseKey, value); }
  226. }
  227. [Obsolete]
  228. public static ShowOnStartupEnum GetShowOnStartupEnum() {
  229. ShowOnStartupEnum showOnStartupEnum;
  230. if (Enum.TryParse(HotReloadPrefs.ShowOnStartupLegacy, true, out showOnStartupEnum)) {
  231. return showOnStartupEnum;
  232. }
  233. return ShowOnStartupEnum.Always;
  234. }
  235. public static bool ExposeServerToLocalNetwork {
  236. get { return EditorPrefs.GetBool(ExposeServerToLocalNetworkKey, false); }
  237. set { EditorPrefs.SetBool(ExposeServerToLocalNetworkKey, value); }
  238. }
  239. public static bool LaunchOnEditorStart {
  240. get { return EditorPrefs.GetBool(LaunchOnEditorStartKey, false); }
  241. set { EditorPrefs.SetBool(LaunchOnEditorStartKey, value); }
  242. }
  243. public static bool AutoRecompileUnsupportedChanges {
  244. get { return EditorPrefs.GetBool(AutoRecompileUnsupportedChangesKey, false); }
  245. set { EditorPrefs.SetBool(AutoRecompileUnsupportedChangesKey, value); }
  246. }
  247. public static bool AutoRecompilePartiallyUnsupportedChanges {
  248. get { return EditorPrefs.GetBool(AutoRecompilePartiallyUnsupportedChangesKey, false); }
  249. set { EditorPrefs.SetBool(AutoRecompilePartiallyUnsupportedChangesKey, value); }
  250. }
  251. public static bool DisplayNewMonobehaviourMethodsAsPartiallySupported {
  252. get { return EditorPrefs.GetBool(DisplayNewMonobehaviourMethodsAsPartiallySupportedKey, false); }
  253. set { EditorPrefs.SetBool(DisplayNewMonobehaviourMethodsAsPartiallySupportedKey, value); }
  254. }
  255. public static bool ShowNotifications {
  256. get { return EditorPrefs.GetBool(ShowNotificationsKey, true); }
  257. set { EditorPrefs.SetBool(ShowNotificationsKey, value); }
  258. }
  259. public static bool ShowPatchingNotifications {
  260. get { return EditorPrefs.GetBool(ShowPatchingNotificationsKey, true); }
  261. set { EditorPrefs.SetBool(ShowPatchingNotificationsKey, value); }
  262. }
  263. public static bool ShowCompilingUnsupportedNotifications {
  264. get { return EditorPrefs.GetBool(ShowCompilingUnsupportedNotificationsKey, true); }
  265. set { EditorPrefs.SetBool(ShowCompilingUnsupportedNotificationsKey, value); }
  266. }
  267. public static bool AutoRecompileUnsupportedChangesImmediately {
  268. get { return EditorPrefs.GetBool(AutoRecompileUnsupportedChangesImmediatelyKey, false); }
  269. set { EditorPrefs.SetBool(AutoRecompileUnsupportedChangesImmediatelyKey, value); }
  270. }
  271. public static bool AutoRecompileUnsupportedChangesOnExitPlayMode {
  272. get { return EditorPrefs.GetBool(AutoRecompileUnsupportedChangesOnExitPlayModeKey, false); }
  273. set { EditorPrefs.SetBool(AutoRecompileUnsupportedChangesOnExitPlayModeKey, value); }
  274. }
  275. public static bool AutoRecompileUnsupportedChangesInPlayMode {
  276. get { return EditorPrefs.GetBool(AutoRecompileUnsupportedChangesInPlayModeKey, false); }
  277. set { EditorPrefs.SetBool(AutoRecompileUnsupportedChangesInPlayModeKey, value); }
  278. }
  279. public static bool AllowDisableUnityAutoRefresh {
  280. get { return EditorPrefs.GetBool(AllowDisableUnityAutoRefreshKey, false); }
  281. set { EditorPrefs.SetBool(AllowDisableUnityAutoRefreshKey, value); }
  282. }
  283. public static int DefaultAutoRefresh {
  284. get { return EditorPrefs.GetInt(DefaultAutoRefreshKey, -1); }
  285. set { EditorPrefs.SetInt(DefaultAutoRefreshKey, value); }
  286. }
  287. [UsedImplicitly]
  288. public static int DefaultAutoRefreshMode {
  289. get { return EditorPrefs.GetInt(DefaultAutoRefreshModeKey, -1); }
  290. set { EditorPrefs.SetInt(DefaultAutoRefreshModeKey, value); }
  291. }
  292. public static int DefaultScriptCompilation {
  293. get { return EditorPrefs.GetInt(DefaultScriptCompilationKeyKey, -1); }
  294. set { EditorPrefs.SetInt(DefaultScriptCompilationKeyKey, value); }
  295. }
  296. public static Color? DefaultEditorTint {
  297. get { return ColorFromString(EditorPrefs.GetString(DefaultEditorTintKey, string.Empty)); }
  298. set { EditorPrefs.SetString(DefaultEditorTintKey, ColorToString(value)); }
  299. }
  300. public static bool AppliedAutoRefresh {
  301. get { return EditorPrefs.GetBool(AppliedAutoRefreshKey); }
  302. set { EditorPrefs.SetBool(AppliedAutoRefreshKey, value); }
  303. }
  304. public static bool AppliedScriptCompilation {
  305. get { return EditorPrefs.GetBool(AppliedScriptCompilationKey); }
  306. set { EditorPrefs.SetBool(AppliedScriptCompilationKey, value); }
  307. }
  308. public static Color? AppliedEditorTint {
  309. get { return ColorFromString(EditorPrefs.GetString(AppliedEditorTintKey, string.Empty)); }
  310. set { EditorPrefs.SetString(AppliedEditorTintKey, ColorToString(value)); }
  311. }
  312. public static bool AllAssetChanges {
  313. get { return EditorPrefs.GetBool(AllAssetChangesKey, false); }
  314. set { EditorPrefs.SetBool(AllAssetChangesKey, value); }
  315. }
  316. public static bool IncludeShaderChanges {
  317. get { return EditorPrefs.GetBool(IncludeShaderChangesKey, false); }
  318. set { EditorPrefs.SetBool(IncludeShaderChangesKey, value); }
  319. }
  320. public static bool DisableConsoleWindow {
  321. get { return EditorPrefs.GetBool(DisableConsoleWindowKey, false); }
  322. set { EditorPrefs.SetBool(DisableConsoleWindowKey, value); }
  323. }
  324. public static string RedeemLicenseEmail {
  325. get { return EditorPrefs.GetString(RedeemLicenseEmailKey); }
  326. set { EditorPrefs.SetString(RedeemLicenseEmailKey, value); }
  327. }
  328. public static string RedeemLicenseInvoice {
  329. get { return EditorPrefs.GetString(RedeemLicenseInvoiceKey); }
  330. set { EditorPrefs.SetString(RedeemLicenseInvoiceKey, value); }
  331. }
  332. public static bool RunTabEventsTimelineFoldout {
  333. get { return EditorPrefs.GetBool(RunTabEventsTimelineFoldoutKey, true); }
  334. set { EditorPrefs.SetBool(RunTabEventsTimelineFoldoutKey, value); }
  335. }
  336. public static bool RunTabEventsSuggestionsFoldout {
  337. get { return EditorPrefs.GetBool(RunTabEventsSuggestionsFoldoutKey, true); }
  338. set { EditorPrefs.SetBool(RunTabEventsSuggestionsFoldoutKey, value); }
  339. }
  340. public static bool RunTabUnsupportedChangesFilter {
  341. get { return EditorPrefs.GetBool(RunTabUnsupportedChangesFilterKey, true); }
  342. set { EditorPrefs.SetBool(RunTabUnsupportedChangesFilterKey, value); }
  343. }
  344. public static bool RunTabCompileErrorFilter {
  345. get { return EditorPrefs.GetBool(RunTabCompileErrorFilterKey, true); }
  346. set { EditorPrefs.SetBool(RunTabCompileErrorFilterKey, value); }
  347. }
  348. public static bool RunTabPartiallyAppliedPatchesFilter {
  349. get { return EditorPrefs.GetBool(RunTabPartiallyAppliedPatchesFilterKey, true); }
  350. set { EditorPrefs.SetBool(RunTabPartiallyAppliedPatchesFilterKey, value); }
  351. }
  352. public static bool RunTabUndetectedPatchesFilter {
  353. get { return EditorPrefs.GetBool(RunTabUndetectedPatchesFilterKey, true); }
  354. set { EditorPrefs.SetBool(RunTabUndetectedPatchesFilterKey, value); }
  355. }
  356. public static bool RunTabAppliedPatchesFilter {
  357. get { return EditorPrefs.GetBool(RunTabAppliedPatchesFilterKey, true); }
  358. set { EditorPrefs.SetBool(RunTabAppliedPatchesFilterKey, value); }
  359. }
  360. public static bool RecompileDialogueShown {
  361. get { return EditorPrefs.GetBool(RecompileDialogueShownKey); }
  362. set { EditorPrefs.SetBool(RecompileDialogueShownKey, value); }
  363. }
  364. public static bool OpenedWindowAtLeastOnce {
  365. get { return EditorPrefs.GetBool(OpenedWindowAtLeastOnceKey); }
  366. set { EditorPrefs.SetBool(OpenedWindowAtLeastOnceKey, value); }
  367. }
  368. private const string rgbaDelimiter = ";";
  369. public static string ColorToString(Color? _color) {
  370. if (_color == null) {
  371. return null;
  372. }
  373. var color = _color.Value;
  374. var cultInfo = CultureInfo.InvariantCulture;
  375. string[] rgbaList = { color.r.ToString(cultInfo), color.g.ToString(cultInfo), color.b.ToString(cultInfo), color.a.ToString(cultInfo)};
  376. return String.Join(rgbaDelimiter, rgbaList);
  377. }
  378. public static Color? ColorFromString(string ser) {
  379. if (string.IsNullOrEmpty(ser)) {
  380. return null;
  381. }
  382. string[] rgbaParts = ser.Split(rgbaDelimiter.ToCharArray());
  383. return new Color(float.Parse(rgbaParts[0]), float.Parse(rgbaParts[1]),float.Parse(rgbaParts[2]),float.Parse(rgbaParts[3]));
  384. }
  385. [Obsolete("was not implemented")]
  386. public static bool ApplyFieldInitiailzerEditsToExistingClassInstances {
  387. get { return EditorPrefs.GetBool(ApplyFieldInitiailzerEditsToExistingClassInstancesKey); }
  388. set { EditorPrefs.SetBool(ApplyFieldInitiailzerEditsToExistingClassInstancesKey, value); }
  389. }
  390. public static bool LoggedInlinedMethodsDialogue {
  391. get { return EditorPrefs.GetBool(LoggedInlinedMethodsDialogueKey); }
  392. set { EditorPrefs.SetBool(LoggedInlinedMethodsDialogueKey, value); }
  393. }
  394. public static bool DeactivateHotReload {
  395. get { return EditorPrefs.GetBool(DeactivateHotReloadKey); }
  396. set { EditorPrefs.SetBool(DeactivateHotReloadKey, value); }
  397. }
  398. public static bool DisableDetailedErrorReporting {
  399. get { return EditorPrefs.GetBool(DisableDetailedErrorReportingKey, false); }
  400. set { EditorPrefs.SetBool(DisableDetailedErrorReportingKey, value); }
  401. }
  402. public static bool AutoDisableHotReloadWithDebugger {
  403. get { return EditorPrefs.GetBool(DebuggerCompatibilityEnabledKey, true); }
  404. set { EditorPrefs.SetBool(DebuggerCompatibilityEnabledKey, value); }
  405. }
  406. }
  407. }