コード例 #1
0
 /// <summary>
 /// Restores the default <see cref="Settings"/> (does not save to disk).
 /// </summary>
 public void Recreate() => Settings = new OpenBulletSettings
 {
     GeneralSettings = new GeneralSettings {
         ProxyCheckTargets = new List <ProxyCheckTarget> {
             new ProxyCheckTarget()
         }
     },
     RemoteSettings        = new RemoteSettings(),
     SecuritySettings      = new SecuritySettings().GenerateJwtKey().SetupAdminPassword("admin"),
     CustomizationSettings = new CustomizationSettings()
 };
コード例 #2
0
        protected override async Task OnInitializedAsync()
        {
            settings = SettingsService.Settings;

            try
            {
                availableThemes = (await ThemeRepo.GetNames()).ToArray();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Could not fetch themes: {ex.Message}");
            }
        }
コード例 #3
0
        public OpenBulletSettingsService(string baseFolder)
        {
            BaseFolder = baseFolder;
            Directory.CreateDirectory(baseFolder);

            jsonSettings = new JsonSerializerSettings
            {
                Formatting       = Formatting.Indented,
                TypeNameHandling = TypeNameHandling.Auto
            };

            if (File.Exists(FileName))
            {
                Settings = JsonConvert.DeserializeObject <OpenBulletSettings>(File.ReadAllText(FileName), jsonSettings);
            }
            else
            {
                Recreate();
            }
        }