public static Settings LoadSettings(DecoupledStorage storage) { return new Settings() { Prefixes = storage.ReadStrings("Fader", "Prefixes") }; }
public static Color ReadTestSkipColor(DecoupledStorage storage) { int alpha = storage.ReadInt32("Preferences", "SkipAlphaComponent", Default.SkipColor.Alpha); int red = storage.ReadInt32("Preferences", "SkipRedComponent", Default.SkipColor.Red); int blue = storage.ReadInt32("Preferences", "SkipGreenComponent", Default.SkipColor.Green); int green = storage.ReadInt32("Preferences", "SkipBlueComponent", Default.SkipColor.Blue); return Color.FromArgb(alpha, red, blue, green); }
public void Load(DecoupledStorage storage) { ShowBeacon = storage.ReadBoolean(STR_Preferences, STR_ShowBeacon, ShowBeacon); BeaconColor = storage.ReadColor(STR_Preferences, STR_BeaconColor, BeaconColor); BeaconDuration = storage.ReadInt32(STR_Preferences, STR_BeaconDuration, BeaconDuration); RollOverOnPrevNext = storage.ReadBoolean(STR_Preferences, STR_RollOverOnPrevNext, RollOverOnPrevNext); SkipSelectionMarkers = storage.ReadBoolean(STR_Preferences, STR_SkipSelectionMarkers, SkipSelectionMarkers); }
public void Save(DecoupledStorage storage) { storage.WriteBoolean(STR_Preferences, STR_ShowBeacon, ShowBeacon); storage.WriteColor(STR_Preferences, STR_BeaconColor, BeaconColor); storage.WriteInt32(STR_Preferences, STR_BeaconDuration, BeaconDuration); storage.WriteBoolean(STR_Preferences, STR_RollOverOnPrevNext, RollOverOnPrevNext); storage.WriteBoolean(STR_Preferences, STR_SkipSelectionMarkers, SkipSelectionMarkers); }
private static bool? GetStoredState(DecoupledStorage storage, string propertyName) { CheckState checkState = storage.ReadEnum<CheckState>("ProjectDefaults", propertyName, CheckState.Indeterminate); if (checkState == CheckState.Checked) return true; else if (checkState == CheckState.Unchecked) return false; else return null; }
public static List<Replacement> LoadReplacements(DecoupledStorage storage) { var xml = storage.ReadString("Replacements", "Replacements", "<root/>"); List<Replacement> Replacements = new List<Replacement>(); XElement root = XElement.Parse(xml); foreach (XElement item in root.Elements()) { Replacement Replacement = new Replacement(item.Attribute("replace").Value, item.Attribute("with").Value); Replacements.Add(Replacement); } return Replacements; }
/// <summary> /// Saves the options to storage. /// </summary> /// <param name="storage">A storage object to which the options should be saved.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="storage" /> is <see langword="null" />. /// </exception> public void Save(DecoupledStorage storage) { if (storage == null) { throw new ArgumentNullException("storage"); } Log.SendMsg("Saving 'format on save' options."); storage.LanguageID = ""; storage.WriteBoolean(SectionGeneral, KeyEnabled, this.Enabled); Log.SendBool("Enabled", this.Enabled); storage.WriteEnum(SectionGeneral, KeyLanguagesToFormat, this.LanguagesToFormat); Log.SendEnum("Languages to format", this.LanguagesToFormat); storage.UpdateStorage(); }
public void Start(ProjectWrapper projectWrapper) { string outputFileName = projectWrapper.OutPutFileName; if (outputFileName.ToLower().EndsWith(".exe")) outputFileName += ".config"; using (var storage = new DecoupledStorage(typeof(Options))) { string path = storage.ReadString(Options.GetPageName(), "modelEditorPath"); if (!String.IsNullOrEmpty(path)) { StartMEProcess(projectWrapper, outputFileName, path); return; } const string modeleditorpathPathIsEmpty = "ModelEditorPath path is empty"; MessageBox.Show(modeleditorpathPathIsEmpty); } }
private void convertProject_Execute(ExecuteEventArgs ea) { using (var storage = new DecoupledStorage(typeof(Options))) { string path = storage.ReadString(Options.GetPageName(), "projectConverterPath"); string token = storage.ReadString(Options.GetPageName(), "token"); if (!string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(token)) { var directoryName = Path.GetDirectoryName(CodeRush.Solution.Active.FileName); var userName = string.Format("/s /k:{0} \"{1}\"", token, directoryName); Process.Start(path, userName); actionHint1.Text = "Project Converter Started !!!"; Rectangle rectangle = Screen.PrimaryScreen.Bounds; actionHint1.PointTo(new Point(rectangle.Width / 2, rectangle.Height / 2)); } } }
/// <summary> /// Loads the options from storage. /// </summary> /// <param name="storage">A storage object from which options should be loaded.</param> /// <returns> /// A populated <see cref="DX_FormatOnSave.OptionSet"/> from the storage. /// </returns> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="storage" /> is <see langword="null" />. /// </exception> public static OptionSet Load(DecoupledStorage storage) { if (storage == null) { throw new ArgumentNullException("storage"); } Log.SendMsg("Loading 'format on save' options."); OptionSet options = new OptionSet(); OptionSet defaults = new OptionSet(); options.Enabled = storage.ReadBoolean(SectionGeneral, KeyEnabled, defaults.Enabled); Log.SendBool("Enabled", options.Enabled); options.LanguagesToFormat = storage.ReadEnum<DocumentLanguages>(SectionGeneral, KeyLanguagesToFormat, defaults.LanguagesToFormat); Log.SendEnum("Languages to format", options.LanguagesToFormat); return options; }
public DrawLinesBetweenMethodsSettings(DecoupledStorage storage) { FullWidth = storage.ReadBoolean("DrawLinesBetweenMethods", "FullWidth", FullWidth); LineDashStyle = (DashStyle)storage.ReadEnum("DrawLinesBetweenMethods", "LineDashStyle", typeof(DashStyle), LineDashStyle); LineWidth = storage.ReadInt32("DrawLinesBetweenMethods", "LineWidth", LineWidth); LineColor = storage.ReadColor("DrawLinesBetweenMethods", "LineColor", LineColor); DrawLineAtStartOfMethod = storage.ReadBoolean("DrawLinesBetweenMethods", "DrawLineAtStartOfMethod", DrawLineAtStartOfMethod); DrawLineAtEndOfMethod = storage.ReadBoolean("DrawLinesBetweenMethods", "DrawLineAtEndOfMethod", DrawLineAtEndOfMethod); DrawShadow = storage.ReadBoolean("DrawLinesBetweenMethods", "DrawShadow", DrawShadow); EnableOnClass = storage.ReadBoolean("DrawLinesBetweenMethods", "EnableOnClass", EnableOnClass); EnableOnProperty = storage.ReadBoolean("DrawLinesBetweenMethods", "EnableOnProperty", EnableOnProperty); EnableOnMethod = storage.ReadBoolean("DrawLinesBetweenMethods", "EnableOnMethod", EnableOnMethod); EnableOnEnum = storage.ReadBoolean("DrawLinesBetweenMethods", "EnableOnEnum", EnableOnEnum); LineSpacer = storage.ReadInt32("DrawLinesBetweenMethods", "LineSpacer", LineSpacer); ShadowHeight = storage.ReadInt32("DrawLinesBetweenMethods", "ShadowHeight", ShadowHeight); Enabled = storage.ReadBoolean("DrawLinesBetweenMethods", "Enabled", Enabled); }
// Methods public void Load(DecoupledStorage storage) { KeepFirstAttribute = false; Sort = false; OverrideTabSettings = true; TabSize = 2; PutCloseTagOnOwnLine = true; if (storage != null) { KeepFirstAttribute = storage.ReadBoolean("General", STR_KeepFirstAttribute, false); Sort = storage.ReadBoolean("General", STR_SortAttributes, false); OverrideTabSettings = storage.ReadBoolean("General", "OverrideTabSettings", true); TabSize = ((short)storage.ReadInt32("General", "TabSize", 2)); PutCloseTagOnOwnLine = storage.ReadBoolean("General", "PutCloseTagOnOwnLine", true); } }
public static List <string> GetGroupedKeys(this DecoupledStorage decoupledStorage, string section) { return(decoupledStorage.GetKeys(section).Where(s => Regex.IsMatch(s, @"\A.*_Count\Z")).Select(s1 => Regex.Replace(s1, "(.*)_Count", "$1")).ToList()); }
public static FormatXamlAttributesOptions LoadFrom(DecoupledStorage storage) { FormatXamlAttributesOptions options = new FormatXamlAttributesOptions(); options.Load(storage); return options; }
private static IBlockPaintingStrategySettings LoadSettingsForStrategy(Type strategyType, DecoupledStorage storage) { object strategyInstance = Activator.CreateInstance(strategyType); string blockTypeName = strategyInstance.GetType().GetProperty("BlockTypeName").GetValue(strategyInstance, null) as string; IBlockPaintingStrategySettings result = new BlockPaintingStrategySettings(blockTypeName); result.Enabled = storage.ReadBoolean(result.BlockTypeName, SettingNames.Enabled, true); result.ShowDetailedBlockMetaData = storage.ReadBoolean(result.BlockTypeName, SettingNames.ShowDetailedBlockMetaData, DefaultValues.ShowDetailedBlockMetaData); result.MinimumBlockSize = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.MinimumBlockSize, 0); result.BlockMetaDataAlpha = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.BlockMetaDataAlpha, DefaultValues.BlockMetaDataAlpha); result.BlockMetaDataRed = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.BlockMetaDataRed, DefaultValues.BlockMetaDataRed); result.BlockMetaDataGreen = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.BlockMetaDataGreen, DefaultValues.BlockMetaDataGreen); result.BlockMetaDataBlue = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.BlockMetaDataBlue, DefaultValues.BlockMetaDataBlue); result.PrefixAlpha = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.PrefixAlpha, DefaultValues.PrefixAlpha); result.PrefixRed = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.PrefixRed, DefaultValues.PrefixRed); result.PrefixGreen = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.PrefixGreen, DefaultValues.PrefixGreen); result.PrefixBlue = (byte)storage.ReadInt32(result.BlockTypeName, SettingNames.PrefixBlue, DefaultValues.PrefixBlue); result.PrefixText = storage.ReadString(result.BlockTypeName, SettingNames.PrefixText, DefaultValues.PrefixText); return(result); }
public static void SaveSettings(PlugInSettings settings) { using (DecoupledStorage storage = GetStorage()) settings.Save(storage); }
public static bool ReadShortenLongStrings(DecoupledStorage storage) { return storage.ReadBoolean(kPreferencesSection, kShortenLongStrings, Default.ShortenLongStrings); }
public static bool ReadShadeAttribute(DecoupledStorage storage) { return storage.ReadBoolean(kPreferencesSection, kShadeAttributeKey, Default.ShadeAttribute); }
void SaveDataSource <T>(Func <T, string> func, string key, DecoupledStorage storage, IEnumerable <T> dataSource) { string connectionStrings = dataSource.Aggregate <T, string>(null, (current, connectionString) => current + func.Invoke(connectionString)); storage.WriteString(PageName, key, connectionStrings); }
public override void Load(DecoupledStorage storage, string section, int index) { base.Load(storage, section, index); IsBlocked = storage.ReadBoolean(section, "IsBlocked" + index); }
public override void Save(DecoupledStorage storage, string section, int index) { base.Save(storage, section, index); storage.WriteBoolean(section, "IsBlocked" + index, IsBlocked); }
public static BindingList<ConnectionString> GetConnectionStrings(DecoupledStorage storage) { string readString = storage.ReadString(GetPageName(), "ConnectionStrings", ""); return new BindingList<ConnectionString>( readString.Split(';').Where(s => !(string.IsNullOrEmpty(s))).Select( s => new ConnectionString { Name = s }).ToList()); }
public static bool ReadConvertEscapeCharacters(DecoupledStorage storage) { return storage.ReadBoolean(kPreferencesSection, kConvertEscape, Default.ConvertEscapeCharacters); }
/// <summary> /// Loads the command key bindings from storage. /// </summary> /// <param name="aDecoupledStorage"></param> /// <returns>Returns the most recently selected command key binding.</returns> public CommandKeyBinding Load(DecoupledStorage aDecoupledStorage) { return(Load(aDecoupledStorage, null)); }
public void Save(DecoupledStorage storage) { if (storage != null) { storage.WriteBoolean("General", "KeepFirstAttribute", KeepFirstAttribute); storage.WriteBoolean("General", "SortAttributes", Sort); } }
public static bool ReadShadeAttribute(DecoupledStorage storage) { return(storage.ReadBoolean(kPreferencesSection, kShadeAttributeKey, Default.ShadeAttribute)); }
public static bool ReadDisplayIcon(DecoupledStorage storage) { return storage.ReadBoolean("Preferences", "DisplayRunIcon", true); }
public static bool ReadDrawArrow(DecoupledStorage storage) { return(storage.ReadBoolean(kPreferencesSection, kDrawArrowKey, Default.DrawArrow)); }
public static bool ReadShortenLongStrings(DecoupledStorage storage) { return(storage.ReadBoolean(kPreferencesSection, kShortenLongStrings, Default.ShortenLongStrings)); }
public static bool ReadDrawArrow(DecoupledStorage storage) { return storage.ReadBoolean(kPreferencesSection, kDrawArrowKey, Default.DrawArrow); }
public static string ReadMaxContextLength(DecoupledStorage storage) { return(storage.ReadString(kPreferencesSection, kMaxContextLength, Default.ContextLength)); }
public static string ReadMaxContextLength(DecoupledStorage storage) { return storage.ReadString(kPreferencesSection, kMaxContextLength, Default.ContextLength); }
public static bool ReadConvertEscapeCharacters(DecoupledStorage storage) { return(storage.ReadBoolean(kPreferencesSection, kConvertEscape, Default.ConvertEscapeCharacters)); }
public static Color ReadTestPassColor(DecoupledStorage storage) { int alpha = storage.ReadInt32(kPreferencesSection, "PassAlphaComponent", Default.PassColor.Alpha); int red = storage.ReadInt32(kPreferencesSection, "PassRedComponent", Default.PassColor.Red); int blue = storage.ReadInt32(kPreferencesSection, "PassGreenComponent", Default.PassColor.Green); int green = storage.ReadInt32(kPreferencesSection, "PassBlueComponent", Default.PassColor.Blue); return Color.FromArgb(alpha, red, blue, green); }
public static Settings LoadSettings(DecoupledStorage storage) { Settings settings = new Settings(); settings.AttributeNames = storage.ReadString("XMLNav", "AttributeNames","id|ref"); return settings; }
private void SpAtDesignTime_Execute(ExecuteEventArgs ea) { IEnumerable<ProjectItem> enumerable = CodeRush.ApplicationObject.Solution.FindStartUpProject().ProjectItems.Cast<ProjectItem>(); Trace.Listeners.Add(new DefaultTraceListener { LogFileName = "log.txt" }); foreach (ProjectItem item in enumerable) { if (item.Name.ToLower() == "app.config" || item.Name.ToLower() == "web.config") { Trace.Write("config found"); using (var storage = new DecoupledStorage(typeof (Options))) { string connectionStringName = storage.ReadString(Options.GetPageName(), "connectionStringName"); if (!string.IsNullOrEmpty(connectionStringName)) { Trace.Write("conneection string found"); ConnectionStringSettings connectionStringSettings = GetConnectionStringSettings(item); dropDatabase(connectionStringSettings.ConnectionString); } } } } }
public static void SaveSettings(DecoupledStorage storage, Settings settings) { storage.WriteString("XMLNav", "AttributeNames", settings.AttributeNames); }
private void openModelEditor(Project project) { Configuration configuration = project.ConfigurationManager.ActiveConfiguration; Property outputPathProperty = configuration.FindProperty(ConfigurationProperty.OutputPath); Property outputFileProperty = project.FindProperty(ProjectProperty.OutputFileName); Property outputDiffsProperty = project.FindProperty(ProjectProperty.FullPath); string outputFileName = outputFileProperty.Value.ToString(); if (outputFileName.ToLower().EndsWith(".exe")) outputFileName += ".config"; ProjectItem modelItem = getModelItem(project); if (modelItem != null) using (var storage = new DecoupledStorage(typeof(Options))) { string path = storage.ReadString(Options.GetPageName(), "modelEditorPath"); if (!string.IsNullOrEmpty(path)) { string assemblyName = Path.Combine(outputDiffsProperty.Value.ToString(), Path.Combine(outputPathProperty.Value.ToString(), outputFileName)); if (!File.Exists(assemblyName)) { MessageBox.Show("Assembly " + assemblyName + " not found", null, MessageBoxButtons.OK); return; } string arguments = string.Format("\"{0}\" \"{1}\"", assemblyName, outputDiffsProperty.Value); if (File.Exists(path)) Process.Start(path, arguments); else MessageBox.Show("Model editor not found at " + path); } else MessageBox.Show("ModelEditorPath path is empty"); } }
public static void LoadSettings(PlugInSettings settings) { using (DecoupledStorage storage = GetStorage()) settings.Load(storage); }