Ejemplo n.º 1
0
        public JetBoxSettingsStorage(Lifetime lifetime, ProductSettingsLocation productSettingsLocation, ISettingsSchema settingsSchema, DataContexts dataContexts, IThreading threading, IFileSystemTracker fileSystemTracker, FileSettingsStorageBehavior settingsStorageBehavior, ISettingsLogger settingsLogger, ISettingsChangeDispatch settingsChangeDispatch, SettingsStorageMountPoints.SelfCheckControl selfCheckControl)
        {
            var filePath = productSettingsLocation.GetUserSettingsNonRoamingDir(ProductSettingsLocationFlag.ThisProductThisVersionThisEnvironment).Combine("JetBox" + XmlFileSettingsStorage.SettingsStorageFileExtensionWithDot);
              var property = new Property<FileSystemPath>(lifetime, GetType().Name + "Path", filePath);
              var settingsProvider = new JetBoxSettingsProvider(lifetime, GetType().Name + "::Provider", property, true, 0, IsAvailable.Always, SettingsStoreSerializationToXmlDiskFile.SavingEmptyContent.DeleteFile, threading, fileSystemTracker, settingsStorageBehavior, new Dictionary<PropertyId, object>());
              var mounts = new SettingsStorageMountPoints(lifetime,
            new CollectionEvents<IProvider<ISettingsStorageMountPoint>>(lifetime, GetType() + "::Mounts") { settingsProvider }, threading, settingsLogger,
            selfCheckControl);

              mySettingsStore = new SettingsStore(lifetime, settingsSchema, mounts, dataContexts, null, settingsLogger, settingsChangeDispatch );
        }
Ejemplo n.º 2
0
        private void OnSettingsChanged()
        {
            SettingsStore.LoadSettings(settings);

            SetTransforms();

            var firstLine = textView.TextViewLines.FirstVisibleLine;

            textView.DisplayTextLineContainingBufferPosition(firstLine.Start,
                                                             firstLine.Top - textView.ViewportTop,
                                                             ViewRelativePosition.Top);
        }
Ejemplo n.º 3
0
        protected RulesetConfigManager(SettingsStore store, RulesetInfo ruleset, int?variant = null)
        {
            realmFactory = store?.Realm;

            rulesetName = ruleset.ShortName;

            this.variant = variant ?? 0;

            Load();

            InitialiseDefaults();
        }
Ejemplo n.º 4
0
        private async void Wv_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            //故意放在这里先移除广告在显示动画显示wv
            RemoveBottomAD(wv);

            //InsertJS();

            newsViewModel.IsBusy = true;

            newsViewModel.IsBusy = false;

            if (args.IsSuccess)
            {
                //只有加载成功才可以记录已经看过,以便再次加载的时候能够及时更改颜色
                var model = DicStore.GetValueOrDefault <NewsModelPropertyBase>(AppCommonConst.CURRENT_NEWS_MODEL, null);
                if (model != null)
                {
                    model.NewsTitleForeground = AppCommonConst.NEWS_IS_ALREADY_READ_FOREGROUND;
                    SettingsStore.AddOrUpdateValue <bool>(model.id, true);
                }

                wv.Visibility = Visibility.Visible;

                if (AppEnvironment.IsPhone)
                {
                    await AnimationGrid.AnimateAsync(new FadeInDownAnimation()
                    {
                        Distance = 400, Duration = 0.25
                    });
                }
                else
                {
                    await AnimationGrid.AnimateAsync(new FadeInLeftAnimation()
                    {
                        Duration = 0.13, Distance = 600
                    });
                }
            }
            else
            {
                wv.Visibility = Visibility.Collapsed;

                if (AppEnvironment.IsInternetAccess)
                {
                    RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWORK_IS_OFFLINEL, typeof(MyCF.View.News.NewsDetailPage), "ReLoadUrlSource", null);
                }
                else
                {
                    RetryBox.Instance.ShowRetry(AppNetworkMessageConst.NETWOTK_IS_ERROR, typeof(MyCF.View.News.NewsDetailPage), "ReLoadUrlSource", null);
                }
            }
        }
Ejemplo n.º 5
0
 protected override void OnLoadedCommand()
 {
     Settings = SettingsStore.Load();
     OnPropertyChanged(() => IP);
     OnPropertyChanged(() => Port);
     OnPropertyChanged(() => Id);
     OnPropertyChanged(() => PrinterName);
     OnPropertyChanged(() => PathToTemplate);
     OnPropertyChanged(() => PathToZpl);
     OnPropertyChanged(() => IsCheckPrinterQueue);
     OnPropertyChanged(() => PrinterBusyMessage);
     _isLoadComplete = true;
 }
Ejemplo n.º 6
0
        private static Color?GetColorOption(SettingsStore store, string catelogName, string optionName)
        {
            if (store == null ||
                !store.CollectionExists(COLLECTION_PATH) ||
                !store.PropertyExists(COLLECTION_PATH, CombineCatelogAndOptionName(catelogName, optionName)))
            {
                return(null);
            }

            var rgb = store.GetString(COLLECTION_PATH, CombineCatelogAndOptionName(catelogName, optionName)).Split(',').Select(x => Int32.Parse(x)).ToList();

            return(Color.FromArgb(rgb[0], rgb[1], rgb[2]));
        }
Ejemplo n.º 7
0
 private void SetSelection()
 {
     try
     {
         SettingsStore store = _settings.GetReadOnlySettingsStore(SettingsScope.UserSettings);
         int           index = store.GetInt32(Vsix.Name, "type", 0);
         cbType.SelectedIndex = index;
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
     }
 }
 public RiderFieldDetector(ISolution solution, SolutionAnalysisService swa, CallGraphSwaExtensionProvider callGraphSwaExtensionProvider,
                           SettingsStore settingsStore, PerformanceCriticalCodeCallGraphAnalyzer analyzer, UnityApi unityApi,
                           UnityCodeInsightFieldUsageProvider fieldUsageProvider,
                           UnitySolutionTracker solutionTracker, ConnectionTracker connectionTracker,
                           IconHost iconHost, AssetSerializationMode assetSerializationMode)
     : base(solution, swa, callGraphSwaExtensionProvider, settingsStore, analyzer, unityApi)
 {
     myFieldUsageProvider     = fieldUsageProvider;
     mySolutionTracker        = solutionTracker;
     myConnectionTracker      = connectionTracker;
     myIconHost               = iconHost;
     myAssetSerializationMode = assetSerializationMode;
 }
        public static String GetQuickRefFontFamily()
        {
            try
            {
                ThreadHelper.ThrowIfNotOnUIThread();

                return(SettingsStore.GetString(CollectionName, QuickRefFontFamilyPropertyName, DefaultQuickRefFontFamily));
            }
            catch (ArgumentException)
            {
                return(DefaultQuickRefFontFamily);
            }
        }
Ejemplo n.º 10
0
        public void CheckLogFile()
        {
            File.WriteAllText(SettingsStore.LogPath, "");
            var settings = new SettingsStore();
            var log      = new LogWriter(settings);

            log.Report(new Side(true));
            log.Report("a1a3");
            log.Report(10, 0.3f, 10);
            var file = File.ReadAllText(SettingsStore.LogPath);

            Assert.False(file == "");
        }
Ejemplo n.º 11
0
 private string GetLastUsed()
 {
     try
     {
         SettingsStore store = _settings.GetReadOnlySettingsStore(SettingsScope.UserSettings);
         return(store.GetString("PackageInstaller", "type", null));
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
         return(null);
     }
 }
        public static DateTime GetLastModified()
        {
            try
            {
                ThreadHelper.ThrowIfNotOnUIThread();

                return(SettingsStore.GetLastWriteTime(CollectionName));
            }
            catch (ArgumentException)
            {
                return(DateTime.MinValue);
            }
        }
Ejemplo n.º 13
0
        protected override void LoadProperty(SettingsStore store)
        {
            var value = store.GetString(CollectionName, nameof(ProjectTeam), "None");

            if (value == "LW")
            {
                ProjectTeam = ProjectTeamTypes.LW;
            }
            else
            {
                ProjectTeam = ProjectTeamTypes.None;
            }
        }
Ejemplo n.º 14
0
        public XhrResponse SetSettings(
            [FromServices] SettingsStore store,
            [FromBody] Settings newSettings
            )
        {
            store.Entity.ServerAddress = newSettings.ServerAddress;
            store.Entity.ServerPort    = newSettings.ServerPort;
            var result = store.Update();

            return((result)
                ? XhrResponseFactory.CreateSucceeded(store.Entity)
                : XhrResponseFactory.CreateError("Update Failed"));
        }
Ejemplo n.º 15
0
 public void UpdateValueSaveAllTest()
 {
     using (TestFile testFile = new TestFile("[Folders]\r\nName=string:Value"))
     {
         FolderSettings source = new FolderSettings(null, SettingsStore.GetSettingsStore(StoreType.Ini, testFile.FileName, null));
         source.Folders.Add("Another", "Folder");
         source.Folders["Name"] = "NewValue";
         source.Save();
         FolderSettings target = new FolderSettings(null, SettingsStore.GetSettingsStore(StoreType.Ini, testFile.FileName, null));
         Assert.IsTrue(target.Folders.Count == 2);
         Assert.IsTrue(target.Folders["Name"] == "NewValue");
     }
 }
Ejemplo n.º 16
0
        public void LoadSectionsSimpleTest()
        {
            string[] contentArray = new string[] { "[ORTS]", "[End]", "#[End]" };
            string   content      = string.Join(Environment.NewLine, contentArray);

            using (TestFile file = new TestFile(content))
            {
                SettingsStoreLocalIni store = SettingsStore.GetSettingsStore(StoreType.Ini, file.FileName, null) as SettingsStoreLocalIni;
                var sections = store.GetSectionNames();

                CollectionAssert.AreEqual(contentArray.Where((s) => !s.StartsWith("#")).Select((s) => s.Trim('[', ']')).ToArray(), sections);
            }
        }
Ejemplo n.º 17
0
 private void SetSelection()
 {
     try
     {
         SettingsStore store = _settings.GetReadOnlySettingsStore(SettingsScope.UserSettings);
         int           index = store.GetInt32(Vsix.Name, "type", 0);
         cbType.SelectedIndex = index;
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.Write(ex);
     }
 }
Ejemplo n.º 18
0
        public void GetValueNamesSectionNotExistingTest()
        {
            string[] contentArray = new string[] { "[ORTS]", "name=value", "name1=value", "name2=value", "#[End]", "name=value", "[End]", "name=value" };
            string   content      = string.Join(Environment.NewLine, contentArray);

            using (TestFile file = new TestFile(content))
            {
                SettingsStoreLocalIni store = SettingsStore.GetSettingsStore(StoreType.Ini, file.FileName, "STRO") as SettingsStoreLocalIni;
                string[] names = store.GetSettingNames();

                CollectionAssert.AreEqual(Array.Empty <string>(), names);
            }
        }
Ejemplo n.º 19
0
        public void LoadSectionsExtendedTest()
        {
            string[] contentArray = new string[] { "[ORTS]", "name=value", "[End]", "name=value", "name=value", "#[End]" };
            string   content      = string.Join(Environment.NewLine, contentArray);

            using (TestFile file = new TestFile(content))
            {
                SettingsStoreLocalIni store = SettingsStore.GetSettingsStore(StoreType.Ini, file.FileName, null) as SettingsStoreLocalIni;
                string[] sections           = store.GetSectionNames();

                CollectionAssert.AreEqual(contentArray.Where((s) => s.StartsWith("[", StringComparison.OrdinalIgnoreCase)).Select((s) => s.Trim('[', ']')).ToArray(), sections);
            }
        }
Ejemplo n.º 20
0
        public Program()
        {
            var logger       = new Logger();
            var settings     = new SettingsStore();
            var uiMap        = new UIMap(settings, new WindowFinder(), new OCRReader(new OCRSplitter()), new InputDevice(), new Screen(new ScreenDataRetriever(new Sleeper(), new ScreenshotCapturer())));
            var messages     = new MessageManager();
            var executor     = new QueryExecutor();
            var database     = new AuroraDatabase(executor);
            var eventManager = new EventManager(uiMap, settings, messages, database, executor);

            new Thread(new CommandFlowManager(settings, uiMap, messages, eventManager, logger).Begin).Start();
            RESTManager.Begin();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TrackActiveItemsCommandHandler"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private TrackActiveItemsCommandHandler(Package package)
        {
            this.package = package ?? throw new ArgumentNullException("package");

            ShellSettingsManager settingsManager = new ShellSettingsManager(package);

            SettingsStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);

            OptionsService = ServicesUtil.GetMefService <IEditorOptionsFactoryService>(this.ServiceProvider);
            TextManager    = (IVsTextManager2)ServiceProvider.GetService(typeof(SVsTextManager));

            RegisterGlobalCommands();
        }
        public static Int32 GetQuickRefFontSize()
        {
            try
            {
                ThreadHelper.ThrowIfNotOnUIThread();

                return(SettingsStore.GetInt32(CollectionName, QuickRefFontSizePropertyName, DefaultQuickRefFontSize));
            }
            catch (ArgumentException)
            {
                return(DefaultQuickRefFontSize);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Hydrates the properties from the registry asyncronously.
        /// </summary>
        public virtual async Task LoadAsync()
        {
            ShellSettingsManager manager = await _settingsManager.GetValueAsync().ConfigureAwait(true);

            SettingsStore settingsStore = manager.GetReadOnlySettingsStore(SettingsScope.UserSettings);

            if (!settingsStore.CollectionExists(CollectionName))
            {
                return;
            }

#if DEBUG_OPTION_VALUES_LOAD_SAVE
            Debug.WriteLine($"LoadAsync<{typeof(T).Name}>()");
            Debug.WriteLine($"GetPropertyCount = {settingsStore.GetPropertyCount(CollectionName)}");
            Debug.WriteLine($"GetPropertyCount = {settingsStore.GetPropertyCount(CollectionName)}");
            //var pnv = settingsStore.GetPropertyNamesAndValues(CollectionName);
            var pn = settingsStore.GetPropertyNames(CollectionName);
            foreach (var n in pn)
            {
                Debug.WriteLine($"Property: Name={n} Type = {settingsStore.GetPropertyType(CollectionName, n).ToString()}");
            }
#endif
            var propertiesToSerialize = GetOptionProperties();
            foreach (PropertyInfo property in propertiesToSerialize)
            {
                if (!settingsStore.PropertyExists(CollectionName, property.Name))
                {
#if DEBUG_OPTION_VALUES_LOAD_SAVE
                    Debug.WriteLine($"Skipping property {property.Name}. Not found in settings store");
#endif
                    property.SetValue(this, property.GetValue(this));
                    continue;
                }
                try
                {
                    string serializedProp = settingsStore.GetString(CollectionName, property.Name);
                    object value          = DeserializeValue(serializedProp, property.PropertyType);
                    property.SetValue(this, value);
#if DEBUG_OPTION_VALUES_LOAD_SAVE
                    Debug.WriteLine($"{property.Name} = {property.GetValue(this)} | value = {value}");
#endif
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex);
                }
            }
#if DEBUG_OPTION_VALUES_LOAD_SAVE
            Debug.WriteLine($"LoadAsync<{typeof(T).Name}>() finished ===================================");
#endif
        }
Ejemplo n.º 24
0
        private async void szPC_ViewChangeCompleted(object sender, SemanticZoomViewChangedEventArgs e)
        {
            if (e.IsSourceZoomedInView)
            {
                if (!AppEnvironment.IsPhone)
                {
                    ViewModelLocator.Instance.VideoFullScreenHandler += VideoFullScreenHandler;
                }

                ViewModelLocator.Instance.VideoVolumeToMuteHandler += VideoVolumeToMuteHandler;

                var model = DicStore.GetValueOrDefault <ModelPropertyBase>(AppCommonConst.CURRENT_SELECTED_ITEM
                                                                           , null);
                if (model != null)
                {
                    this.szCategoryDetailFlipView.SelectedItem = model;

                    this.videoMediaPlayer.Stop();
                    this.videoMediaPlayer.Source = null;

                    this.videoMediaPlayer.DataContext = model;
                    this.videoMediaPlayer.Volume      = SettingsStore.GetValueOrDefault <double>(AppCommonConst.CURRETN_VIDEO_VOLUME_VALUE, 0.5);
                    var playUrl = await CommonHelper.Instance.DecidePlayUrl(model);

                    if (!string.IsNullOrEmpty(playUrl))
                    {
                        this.videoMediaPlayer.Source = new Uri(playUrl, UriKind.RelativeOrAbsolute);
                    }
                    else
                    {
                        await new MessageDialog(AppNetworkMessageConst.VIDEO_URL_IS_ERROR, "提示").ShowAsyncQueue();

                        szPC.IsZoomedInViewActive = true;
                    }
                }
            }
            else
            {
                if (!AppEnvironment.IsPhone)
                {
                    appBarFullScreenBtn = null;
                    ViewModelLocator.Instance.VideoFullScreenHandler -= VideoFullScreenHandler;
                }

                appBarVolumeBtn = null;
                ViewModelLocator.Instance.VideoVolumeToMuteHandler -= VideoVolumeToMuteHandler;

                this.videoMediaPlayer.Stop();
                this.videoMediaPlayer.Source = null;
            }
        }
Ejemplo n.º 25
0
        public void TestSerialization()
        {
            SettingsStore store = SettingsStore.Default;

            SettingsStore.Default = new SettingsStore();

            ExportInfo info = new ExportInfo();

            info.FileRenameValues.Clear();

            FileRenameValueProperty prop   = (FileRenameValueProperty)FileRenameManager.Default.GetFileRenameValue("Caption");
            FileRenameValueCustom   custom = (FileRenameValueCustom)FileRenameManager.Default.GetFileRenameValue("CustomText");
            FileRenameValueIndex    index  = (FileRenameValueIndex)FileRenameManager.Default.GetFileRenameValue("Index");
            FileRenameValueCount    count  = (FileRenameValueCount)FileRenameManager.Default.GetFileRenameValue("Count");

            index.StartIndex = 99;

            FileRenameValueReference       propRef    = prop.CreateReference();
            FileRenameValueReferenceString propCustom = (FileRenameValueReferenceString)custom.CreateReference();
            FileRenameValueReference       propIndex  = index.CreateReference();
            FileRenameValueReference       propCount  = count.CreateReference();

            Assert.AreEqual("Caption", propRef.FileRenameValueName);
            Assert.AreEqual("CustomText", propCustom.FileRenameValueName);
            Assert.AreEqual("Index", propIndex.FileRenameValueName);
            Assert.AreEqual("Count", propCount.FileRenameValueName);

            propCustom.Text = "My Custom String";

            info.FileRenameValues.Add(propRef);
            info.FileRenameValues.Add(propCustom);
            info.FileRenameValues.Add(propIndex);
            info.FileRenameValues.Add(propCount);

            SettingsStore.Default.ExportPresets.Add(info);
            SettingsStore.Default.SaveToXml();

            SettingsStore.Default.ExportPresets.Clear();
            SettingsStore.Default.RestoreFromXml();

            Assert.AreEqual(1, SettingsStore.Default.ExportPresets.Count);
            ExportInfo info2 = SettingsStore.Default.ExportPresets[0];

            Assert.AreEqual(info.FileRenameValues.Count, info2.FileRenameValues.Count);
            for (int i = 0; i < info.FileRenameValues.Count; i++)
            {
                Assert.AreEqual(info.FileRenameValues[i].GetType(), info2.FileRenameValues[i].GetType());
                Assert.AreEqual(info.FileRenameValues[i].FileRenameValue.GetType(), info2.FileRenameValues[i].FileRenameValue.GetType());
            }
            SettingsStore.Default = store;
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Initialize Maime with Options
        /// </summary>
        /// <param name="options">Options used for reparation</param>
        public static void Init(Options.Options options)
        {
            Logger.Common("Maime initializing");
            _options = options;

            // If debugger attached, then locate folders in solution folder.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                _projectPathFolder = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));
                _dataFolder        = Path.GetFullPath(Path.Combine(_projectPathFolder, "..\\", "Data"));
            }
            else // Else locate in same folder as .exe file
            {
                _projectPathFolder = AppDomain.CurrentDomain.BaseDirectory;
                _dataFolder        = Path.GetFullPath(Path.Combine(_projectPathFolder, "Data"));
            }

            Logger.Common($"Settings stored at {_projectPathFolder}");
            Logger.Common($"Data folder location {_dataFolder}");

            // ======== Settings ======== //
            Logger.Common("Loading settings");
            SettingsStore.Init(
                new JsonSettingsProvider(_dataFolder),
                new JsonEDSProvider()
                );
            Logger.Common("Settings loaded");

            // ======== Metadata store ======== //
            Logger.Common("Initializing metadata store");
            MetaDataStore.Init(new JSONSnapshotProvider());
            Logger.Common("Metadata store initialized");

            _application = new Application();

            // ======== Fetch Changes ======== //
            Logger.Common("Fetching latest metadata changes");
            _latestChanges = MetaDataStore.GetLatestChanges(SettingsStore.EDSSettings);

            if (_latestChanges.Count == 0)
            {
                Logger.Error("No database(s) or change(s) found. Please create a snapshot and rerun the program.");
                _databaseMetaChange = null;
                return;
            }

            _databaseMetaChange = _latestChanges.Values.First();
            Logger.Common("Finished fetching metadata changes");

            Logger.Common("Maime initialized");
        }
Ejemplo n.º 27
0
        public async Task SkippableFiles()
        {
            SettingsStore.EnterTestMode();
            foreach (var baseName in new[] { "_underscore", "Sprite.png" })
            {
                var fileName = Path.Combine(TestCaseDirectory, baseName + ".less");

                File.WriteAllText(fileName, @"a{b{color:red;}}");
                DTE.ItemOperations.OpenFile(fileName).Document.Save();
                await Task.Delay(TimeSpan.FromSeconds(7.5));

                File.Exists(Path.ChangeExtension(fileName, ".css")).Should().BeFalse("Should not compile " + baseName + ".less");
            }
        }
Ejemplo n.º 28
0
        private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
        {
            var toggle = sender as ToggleSwitch;

            if (toggle != null)
            {
                switch (toggle.Tag.ToString())
                {
                case "autoPlayToggle":
                    SettingsStore.AddOrUpdateValue <bool>(AppCommonConst.IS_AUTOPLAY_TOGGLLESWITCH_ON, toggle.IsOn);
                    break;

                case "autoBackToggle":
                    SettingsStore.AddOrUpdateValue <bool>(AppCommonConst.IS_AUTOBACK_TOGGLLESWITCH_ON, toggle.IsOn);
                    break;

                case "hightQualityToggle":
                    SettingsStore.AddOrUpdateValue <bool>(AppCommonConst.IS_HIGHQUALITY_TOGGLLESWITCH_ON, toggle.IsOn);
                    break;

                case "downloadToggle":
                    SettingsStore.AddOrUpdateValue <bool>(AppCommonConst.IS_AUTO_DOWNLOAD_HIGHT_QUALITY_VIDEO, toggle.IsOn);
                    break;

                case "downloadWhenFavoriteToggle":
                    SettingsStore.AddOrUpdateValue <bool>(AppCommonConst.IS_AUTO_DOWNLOAD_WHEN_FAVORITE_VIDEO, toggle.IsOn);
                    break;

                case "tileToggle":
                    SettingsStore.AddOrUpdateValue <bool>(AppCommonConst.IS_TILE_ACTIVE, toggle.IsOn);
                    if (toggle.IsOn)
                    {
                        var collection = DicStore.GetValueOrDefault <object>(AppCommonConst.CURRENT_TILE_COLLECTION, null) as List <Videolist>;
                        if (collection != null)
                        {
                            TileHelper.Instance.UpdateTiles(collection);
                        }
                    }
                    else
                    {
                        TileHelper.Instance.CloseTiles();
                    }
                    break;

                case "sureToggle":
                    SettingsStore.AddOrUpdateValue <bool>(AppCommonConst.IS_SURE_TOGGLLESWITCH_ON, toggle.IsOn);
                    break;
                }
            }
        }
Ejemplo n.º 29
0
        public JetBoxSettingsStorage(Lifetime lifetime, ProductSettingsLocation productSettingsLocation, ISettingsSchema settingsSchema, DataContexts dataContexts, IThreading threading, IFileSystemTracker fileSystemTracker, IFileSettingsStorageBehavior settingsStorageBehavior, ISettingsLogger settingsLogger, ISettingsChangeDispatch settingsChangeDispatch, SettingsStorageMountPoints.SelfCheckControl selfCheckControl, InternKeyPathComponent interned)
        {
            var filePath         = productSettingsLocation.GetUserSettingsNonRoamingDir(ApplicationHostDetails.PerHostAndWave).Combine("JetBox" + XmlFileSettingsStorage.SettingsStorageFileExtensionWithDot);
            var property         = new Property <FileSystemPath>(lifetime, GetType().Name + "Path", filePath);
            var settingsProvider = new JetBoxSettingsProvider(lifetime, GetType().Name + "::Provider", property, true, 0, IsAvailable.Always, SettingsStoreSerializationToXmlDiskFile.SavingEmptyContent.DeleteFile, threading, fileSystemTracker, settingsStorageBehavior, interned, new Dictionary <PropertyId, object>());
            var mounts           = new SettingsStorageMountPoints(lifetime,
                                                                  new CollectionEvents <IProvider <ISettingsStorageMountPoint> >(lifetime, GetType() + "::Mounts")
            {
                settingsProvider
            }, threading, settingsLogger,
                                                                  selfCheckControl);

            mySettingsStore = new SettingsStore(lifetime, settingsSchema, mounts, dataContexts, null, settingsLogger, settingsChangeDispatch);
        }
Ejemplo n.º 30
0
        public static void Initialize(IServiceProvider provider)
        {
            _manager = new ShellSettingsManager(provider);
            _readStore = _manager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
            _writeStore = _manager.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (!_writeStore.CollectionExists(_name))
            {
                _writeStore.CreateCollection(_name);

                string defaults = string.Join(_separator, PreEnabledExtensions.List);
                _writeStore.SetString(_name, _identifierKey, defaults);
            }
        }
Ejemplo n.º 31
0
        public static bool IsFileTypeIgnored(IEnumerable <string> fileTypes)
        {
            SettingsStore store = _settings.GetReadOnlySettingsStore(SettingsScope.UserSettings);

            foreach (string fileType in fileTypes.Where(f => !string.IsNullOrEmpty(f)))
            {
                if (store.PropertyExists(Constants.VSIX_NAME, fileType.ToLowerInvariant()))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 32
0
        /// <summary>
        ///     Initializes properties in the package
        /// </summary>
        /// <param name="package">The package</param>
        private void Initialize(ShelvesetComparerPackage package)
        {
            SettingsManager settingsManager = new ShellSettingsManager(package);

            this.writableSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            if (!this.writableSettingsStore.CollectionExists(CollectionPath))
            {
                this.writableSettingsStore.CreateCollection(CollectionPath);
                this.ShowAsButton = true;
                this.TwoUsersView = true;
            }

            this.readableSettingStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
        }
        private PythonInterpreterFactoryWithDatabase LoadUserDefinedInterpreter(SettingsStore store, string guid) {
            // PythonInterpreters\
            //      Id\
            //          Description
            //          InterpreterPath
            //          WindowsInterpreterPath
            //          Architecture
            //          Version
            //          PathEnvironmentVariable

            Guid id;
            string collection;
            if (Guid.TryParse(guid, out id) && store.CollectionExists((collection = PythonInterpreterKey + "\\" + id.ToString("B")))) {
                var path = store.GetString(collection, PathKey, string.Empty);
                var winPath = store.GetString(collection, WindowsPathKey, string.Empty);
                var libPath = store.GetString(collection, LibraryPathKey, string.Empty);
                var arch = store.GetString(collection, ArchitectureKey, string.Empty);
                var version = store.GetString(collection, VersionKey, string.Empty);
                var pathEnvVar = store.GetString(collection, PathEnvVarKey, string.Empty);
                var description = store.GetString(collection, DescriptionKey, string.Empty);

                return InterpreterFactoryCreator.CreateInterpreterFactory(
                    new InterpreterFactoryCreationOptions {
                        LanguageVersionString = version,
                        Id = id,
                        Description = description,
                        InterpreterPath = path,
                        WindowInterpreterPath = winPath,
                        LibraryPath = libPath,
                        PathEnvironmentVariableName = pathEnvVar,
                        ArchitectureString = arch,
                        WatchLibraryForNewModules = true
                    }
                );
            }
            return null;
        }
Ejemplo n.º 34
0
		public void add(SettingsStore ss) {
			foreach (SettingCollection sc in ss.collections)
				add (sc);
		}
Ejemplo n.º 35
0
 public StoreWrapper(SettingsStore inner)
 {
     this.inner = inner;
 }
 /// <summary>
 /// Internal constructor that takes the COM interface that provides the functionality of this class.
 /// </summary>
 /// <param name="writableSettingsStore">COM interface wrapped by this class.</param>
 internal ShellWritableSettingsStore(IVsWritableSettingsStore writableSettingsStore)
 {
     HelperMethods.CheckNullArgument(writableSettingsStore, "writableSettingsStore");
     this.writableSettingsStore = writableSettingsStore;
     this.settingsStore = new ShellSettingsStore(this.writableSettingsStore);
 }
Ejemplo n.º 37
0
 private void LoadSettings(XmlNode node, string storeKey)
 {
     var store = new SettingsStore();
     store.Content = node.InnerText;
     stores.Add(storeKey, store);
 }
        /// <summary>
        /// Initializes properties in the package
        /// </summary>
        /// <param name="package">The package</param>
        private void Initialize(ShelvesetComparerPackage package)
        {
            SettingsManager settingsManager = new ShellSettingsManager(package);
            this.writableSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            if (!this.writableSettingsStore.CollectionExists("ShelveSetComparer"))
            {
                this.writableSettingsStore.CreateCollection("ShelveSetComparer");
                this.ShowAsButton = true;
                this.TwoUsersView = true;
            }

            this.readableSettingStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
        }
Ejemplo n.º 39
0
 private void ReadSettings(IEditorOptions options)
 {
     var settings_manager = ServiceProvider.GetService(typeof(SVsSettingsManager)) as IVsSettingsManager;
     var store = new SettingsStore(settings_manager, options);
     store.Load();
     SettingsLoaded = true;
 }
Ejemplo n.º 40
0
        private IPythonInterpreterFactoryProvider[] LoadProviders(
            SettingsStore store,
            IServiceProvider serviceProvider
        ) {
            var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
            var catalog = new List<ComposablePartCatalog>();

            if (store.CollectionExists(SuppressFactoryProvidersCollection)) {
                return new IPythonInterpreterFactoryProvider[0];
            }

            if (store.CollectionExists(FactoryProvidersCollection)) {
                foreach (var idStr in store.GetSubCollectionNames(FactoryProvidersCollection)) {
                    var key = FactoryProvidersCollection + "\\" + idStr;
                    LoadOneProvider(
                        store.GetString(key, FactoryProviderCodeBaseSetting, ""),
                        seen,
                        catalog,
                        _activityLog
                    );
                }
            }

            foreach (var baseKey in new[] { Registry.CurrentUser, Registry.LocalMachine }) {
                using (var key = baseKey.OpenSubKey(FactoryProvidersRegKey)) {
                    if (key != null) {
                        foreach (var idStr in key.GetSubKeyNames()) {
                            using (var subkey = key.OpenSubKey(idStr)) {
                                if (subkey != null) {
                                    LoadOneProvider(
                                        subkey.GetValue(FactoryProviderCodeBaseSetting, "") as string,
                                        seen,
                                        catalog,
                                        _activityLog
                                    );
                                }
                            }
                        }
                    }
                }
            }

            if (!catalog.Any()) {
                LoadOneProvider(
                    typeof(CPythonInterpreterFactoryConstants).Assembly.Location,
                    seen,
                    catalog,
                    _activityLog
                );
            }

            const string FailedToImportMessage = "Failed to import factory providers";
            var providers = new List<IPythonInterpreterFactoryProvider>();
            var serviceProviderProvider = new MockExportProvider();
            if (serviceProvider != null) {
                serviceProviderProvider.SetExport(typeof(SVsServiceProvider), () => serviceProvider);
            }

            foreach (var part in catalog) {
                var container = new CompositionContainer(part, serviceProviderProvider);
                try {
                    foreach (var provider in container.GetExports<IPythonInterpreterFactoryProvider>()) {
                        if (provider.Value != null) {
                            providers.Add(provider.Value);
                        }
                    }
                } catch (CompositionException ex) {
                    LogException(_activityLog, FailedToImportMessage, null, ex, ex.Errors);
                } catch (ReflectionTypeLoadException ex) {
                    LogException(_activityLog, FailedToImportMessage, null, ex, ex.LoaderExceptions);
                } catch (Exception ex) {
                    LogException(_activityLog, FailedToImportMessage, null, ex);
                }
            }

            return providers.ToArray();
        }