Beispiel #1
0
 private void SetSettingsModels(CompilerSettingsModel compilerModel, FormatSettingsModel formatModel,
                                TidySettingsModel tidyModel, GeneralSettingsModel generalModel, LlvmSettingsModel llvmModel)
 {
     SettingsProvider.CompilerSettingsModel = compilerModel;
     SettingsProvider.FormatSettingsModel   = formatModel;
     SettingsProvider.TidySettingsModel     = tidyModel;
     SettingsProvider.GeneralSettingsModel  = generalModel;
     SettingsProvider.LlvmSettingsModel     = llvmModel;
 }
        private void MapClangOptionsToSettings(ClangOptions clangOptions)
        {
            CompilerSettingsModel compilerSettingsModel = new CompilerSettingsModel();
            GeneralSettingsModel  generalSettingsModel  = new GeneralSettingsModel();

            compilerSettingsModel.CompileFlags     = clangOptions.ClangFlagsCollection;
            compilerSettingsModel.FilesToIgnore    = clangOptions.FilesToIgnore;
            compilerSettingsModel.ProjectsToIgnore = clangOptions.ProjectsToIgnore;
            compilerSettingsModel.WarningsAsErrors = clangOptions.TreatWarningsAsErrors;
            compilerSettingsModel.ContinueOnError  = clangOptions.Continue;
            compilerSettingsModel.ClangAfterMSVC   = clangOptions.ClangCompileAfterVsCompile;
            compilerSettingsModel.VerboseMode      = clangOptions.VerboseMode;
            generalSettingsModel.Version           = clangOptions.Version;

            settingsProvider.SetCompilerSettingsModel(compilerSettingsModel);
            settingsProvider.SetGeneralSettingsModel(generalSettingsModel);
        }
        private void DeserializeSettings(string path)
        {
            using (StreamReader sw = new StreamReader(path))
            {
                string         json       = sw.ReadToEnd();
                JsonSerializer serializer = new JsonSerializer();

                try
                {
                    List <object>         models        = JsonConvert.DeserializeObject <List <object> >(json);
                    CompilerSettingsModel compilerModel = JsonConvert.DeserializeObject <CompilerSettingsModel>(models[0].ToString());
                    FormatSettingsModel   formatModel   = JsonConvert.DeserializeObject <FormatSettingsModel>(models[1].ToString());
                    TidySettingsModel     tidyModel     = JsonConvert.DeserializeObject <TidySettingsModel>(models[2].ToString());
                    GeneralSettingsModel  generalModel  = JsonConvert.DeserializeObject <GeneralSettingsModel>(models[3].ToString());

                    SetSettingsModels(compilerModel, formatModel, tidyModel, generalModel);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Cannot Load Clang Power Tools Settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #4
0
        private void UpdateVersion(string version)
        {
            GeneralSettingsModel generalSettingsModel = mSettingsProvider.GetGeneralSettingsModel();

            string currentVersion = PackageUtility.GetVersion();

            if (string.IsNullOrWhiteSpace(currentVersion) == false && 0 > string.Compare(version, currentVersion))
            {
                generalSettingsModel.Version = currentVersion;
                mSettingsProvider.SetGeneralSettingsModel(generalSettingsModel);

                mSettingsHandler.SaveSettings();

                FreeTrialController freeTrialController = new FreeTrialController();
                LicenseController   licenseController   = new LicenseController();
                if (licenseController.CheckLocalLicense())
                {
                    freeTrialController.MarkAsExpired();
                }

                ReleaseNotesView releaseNotesView = new ReleaseNotesView();
                releaseNotesView.Show();
            }
        }
        private async Task UpdateVersionAsync(string version)
        {
            GeneralSettingsModel generalSettingsModel = mSettingsProvider.GetGeneralSettingsModel();

            string currentVersion = PackageUtility.GetVersion();

            if (string.IsNullOrWhiteSpace(currentVersion) == false && 0 > string.Compare(version, currentVersion))
            {
                generalSettingsModel.Version = currentVersion;
                mSettingsProvider.SetGeneralSettingsModel(generalSettingsModel);
                mSettingsHandler.SaveSettings();

                FreeTrialController freeTrialController = new FreeTrialController();
                bool activeLicense = await new LocalLicenseValidator().ValidateAsync();

                if (activeLicense)
                {
                    freeTrialController.MarkAsExpired();
                }

                ReleaseNotesView releaseNotesView = new ReleaseNotesView();
                releaseNotesView.Show();
            }
        }
 public AccountViewModel()
 {
     accountModel = SettingsProvider.AccountModel;
     generalModel = SettingsProvider.GeneralSettingsModel;
 }
Beispiel #7
0
        public GeneralSettingsViewModel()
        {
            var settingsProvider = new SettingsProvider();

            generalSettingsModel = settingsProvider.GetGeneralSettingsModel();
        }
Beispiel #8
0
 public void SetGeneralSettingsModel(GeneralSettingsModel model)
 {
     generalSettingsModel = model;
 }
 private void SetSettingsModels(CompilerSettingsModel compilerModel, FormatSettingsModel formatModel, TidySettingsModel tidyModel, GeneralSettingsModel generalModel)
 {
     settingsProvider.SetCompilerSettingsModel(compilerModel);
     settingsProvider.SetFormatSettingsModel(formatModel);
     settingsProvider.SetTidySettingsModel(tidyModel);
     settingsProvider.SetGeneralSettingsModel(generalModel);
 }