public void ReadXml(XmlReader reader) { while (!reader.EOF) { if (reader.IsStartElement()) { switch (reader.Name) { case Fb2FixModeElementName: FixOptions fixMode; string elementContent = reader.ReadElementContentAsString(); if (!Enum.TryParse(elementContent, true, out fixMode)) { throw new InvalidDataException(string.Format("Invalid fix mode: {0}", elementContent)); } _fixMode = fixMode; continue; case ConverAlphaChennelElementName: _convertAlphaPng = reader.ReadElementContentAsBoolean(); continue; } } reader.Read(); } }
public void CopyFrom(IFB2ImportSettings temp) { if (temp == null) { throw new ArgumentNullException("temp"); } if (temp == this) { return; } _fixMode = temp.FixMode; _convertAlphaPng = temp.ConvertAlphaPng; }
private static async Task <int> FixProjectFilesAsync(FixOptions options) { VerboseLevel Map(int value) { switch (value) { case 3: return(VerboseLevel.High); case 2: return(VerboseLevel.Medium); case 1: return(VerboseLevel.Low); case 0: return(VerboseLevel.Disabled); } return(VerboseLevel.Disabled); } var staticOptions = new StaticOptions( Map(options.Verbose), options.DryRun, options.HoldOnExit, options.SearchProvider, string.Empty); Bootstrapper.Container.Register(typeof(IHoldOnExitOption), () => staticOptions, Lifestyle.Scoped); Bootstrapper.Container.Register(typeof(IDryRunOption), () => staticOptions, Lifestyle.Scoped); Bootstrapper.Container.Register(typeof(ISearchProviderNameOption), () => staticOptions, Lifestyle.Scoped); Bootstrapper.Container.Register(typeof(IVerboseOption), () => staticOptions, Lifestyle.Scoped); using (Bootstrapper.StartSession()) { var commandHandler = Bootstrapper.Container.GetInstance <ICommandHandler <UpdateProjectFilesCommand> >(); await commandHandler.ExecuteAsync(new UpdateProjectFilesCommand(options.RootDirectory)).ConfigureAwait(true); } return(0); }
public void SetupDefaults() { _fixMode = FixOptions.UseFb2Fix; _convertAlphaPng = true; }