/// <summary> /// Try to create new instance of <see cref="ID2D1Factory"/>. /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public static T D2D1CreateFactory <T>(FactoryType factoryType = FactoryType.SingleThreaded) where T : ID2D1Factory { var options = new FactoryOptions { DebugLevel = DebugLevel.None, }; D2D1CreateFactory(factoryType, typeof(T).GUID, options, out IntPtr nativePtr).CheckError(); return(MarshallingHelpers.FromPointer <T>(nativePtr)); }
private void LoadDictionary() { FactoryOptions.Populate(); IDictionary dictionary = FactoryOptions.Instance; var adapter = new DictionaryPropertyGridAdapter(dictionary); __grid.SelectedObject = adapter; }
/// <summary> /// Gets a collection of key/value pairs which describe public settable properties of a 'webdriver factory options' /// type, along with the values for those properties. /// </summary> /// <returns>The option key/value pairs.</returns> #region IGetsFactoryConfiguration and IIndicatesEnvironmentSupport implementation public virtual IDictionary <string, string> GetOptionKeyValuePairs() { if (FactoryOptions == null) { return(new Dictionary <string, string>()); } return(FactoryOptions .Cast <FactoryOption>() .ToDictionary(k => k.Name, v => v.Value)); }
public static ID2D1Factory CreateFactory() { var factoryOptions = new FactoryOptions(); object factory = NativeMethods.D2D1CreateFactory( FactoryType.SingleThreaded, new Guid(IID_ID2D1Factory), factoryOptions); if (factory != null) { Debug.WriteLine("ID2D1Factory created."); } return (ID2D1Factory) factory; }
/// <summary> /// Default Constructor for a <see cref = "SharpDX.Direct2D1.Factory" />. /// </summary> public Factory(FactoryType factoryType, DebugLevel debugLevel) : base(IntPtr.Zero) { FactoryOptions? options = null; if (debugLevel != DebugLevel.None) options = new FactoryOptions() { DebugLevel = debugLevel }; IntPtr temp; D2D1.CreateFactory(factoryType, Utilities.GetGuidFromType(GetType()), options, out temp); FromTemp(temp); }
/// <summary> /// Try to create new instance of <see cref="ID2D1Factory"/>. /// </summary> /// <param name="factoryType">The type of factory.</param> /// <param name="options">The <see cref="FactoryOptions"/>.</param> /// <param name="factory">The <see cref="ID2D1Factory"/> being created.</param> /// <returns>Return the <see cref="Result"/>.</returns> public static Result D2D1CreateFactory <T>(FactoryType factoryType, FactoryOptions options, out T?factory) where T : ID2D1Factory { var result = D2D1CreateFactory(factoryType, typeof(T).GUID, options, out IntPtr nativePtr); if (result.Success) { factory = MarshallingHelpers.FromPointer <T>(nativePtr); return(result); } factory = null; return(result); }
/// <summary> /// Try to create new instance of <see cref="ID2D1Factory"/>. /// </summary> /// <param name="factoryType">The type of factory.</param> /// <param name="options">The <see cref="FactoryOptions"/>.</param> /// <param name="factory">The <see cref="ID2D1Factory"/> being created.</param> /// <returns>Return the <see cref="Result"/>.</returns> public static Result D2D1CreateFactory <T>(FactoryType factoryType, FactoryOptions options, out T factory) where T : ID2D1Factory { var result = D2D1CreateFactory(factoryType, typeof(T).GUID, options, out var nativePtr); if (result.Success) { factory = CppObject.FromPointer <T>(nativePtr); return(result); } factory = null; return(result); }
private static IServiceFactory <IInterface> CreateServiceFactory(FactoryOptions options = null) { var services = new ServiceCollection(); services.AddSingleton <Implementation1>(); services.AddSingleton <Implementation2>(); services.AddSingleton(new FactoryOptions { Implementor = options?.Implementor, Implementors = options?.Implementors }); var serviceProvider = services.BuildServiceProvider(); return(new ServiceFactory <IInterface>(serviceProvider)); }
/// <summary> /// Default Constructor for a <see cref = "SharpDX.Direct2D1.Factory" />. /// </summary> public Factory(FactoryType factoryType, DebugLevel debugLevel) : base(IntPtr.Zero) { FactoryOptions?options = null; if (debugLevel != DebugLevel.None) { options = new FactoryOptions() { DebugLevel = debugLevel } } ; IntPtr temp; D2D1.CreateFactory(factoryType, Utilities.GetGuidFromType(GetType()), options, out temp); FromTemp(temp); }
static void Main(string[] args) { var options = new FactoryOptions() { HostName = "Allen-PC076", HostPort = 5672, UserName = "******", UserPassword = "******", VirtualHost = "dev" }; var msg = "hello word"; var publisher = new Publisher(options, "log"); var publisher2 = new Publisher(options, "logs-serverity2"); publisher.Pub("mo rout"); Console.ReadLine(); }
/// <summary> /// Try to create new instance of <see cref="ID2D1Factory"/>. /// </summary> /// <param name="factoryType">The type of factory.</param> /// <param name="options">The <see cref="FactoryOptions"/>.</param> /// <returns>Return the <see cref="Result"/>.</returns> public static T D2D1CreateFactory <T>(FactoryType factoryType, FactoryOptions options) where T : ID2D1Factory { D2D1CreateFactory(factoryType, typeof(T).GUID, options, out IntPtr nativePtr).CheckError(); return(MarshallingHelpers.FromPointer <T>(nativePtr)); }
public SqlMigrationDocumentFactory(FactoryOptions options) { Options = options; _currentAttachments = new Dictionary <string, byte[]>(); }
public void Execute(PackageExecutionSettings settings) { /////////////////////////////////// // Prepare EnsureState(); if (IsBusy) { throw new InvalidOperationException("Cannot execute another package whilst executing a package."); } IsBusy = true; if (settings.LiteMode) { FactoryOptions.Populate(); FactoryOptions.Instance[Anolis.Core.Data.DirectoryResourceDataFactory.IconSizeLimit] = 128; } /////////////////////////////////// // Create Backup Details Group backupGroup = null; if (settings.BackupDirectory != null) { if (settings.BackupDirectory.Exists) { settings.BackupDirectory = new DirectoryInfo(PackageUtility.GetUnusedDirectoryName(settings.BackupDirectory.FullName)); } settings.BackupDirectory.Create(); settings.BackupDirectory.Refresh(); Package backupPackage = new Package(settings.BackupDirectory); backupPackage.Version = this.Version; backupPackage.Name = this.Name + " Uninstallation Package"; backupPackage.Attribution = "Anolis Installer"; backupPackage.FeedbackUri = this.FeedbackUri; backupGroup = backupPackage.RootGroup; } ExecutionInfo = new PackageExecutionSettingsInfo(this, settings.ExecutionMode, settings.CreateSystemRestorePoint, settings.LiteMode, backupGroup, settings.I386Directory); /////////////////////////////////// // Flatten Log.Add(LogSeverity.Info, "Beginning package execution: " + this.Name + ", with mode " + ExecutionInfo.ExecutionMode.ToString()); OnProgressEvent(new PackageProgressEventArgs(0, "Flattening Package Tree")); List <Operation> operations = new List <Operation>(); RootGroup.Flatten(operations); List <Operation> obsoleteOperations = new List <Operation>(); Dictionary <String, Operation> uniques = new Dictionary <String, Operation>(); foreach (Operation op in operations) { if (!op.IsEnabled) { obsoleteOperations.Add(op); continue; } Operation originalOperation; if (uniques.TryGetValue(op.Key, out originalOperation)) { if (originalOperation.Merge(op)) { obsoleteOperations.Add(op); } } else { uniques.Add(op.Key, op); } } operations.RemoveAll(op => obsoleteOperations.Contains(op)); /////////////////////////////////// // Prepare if (ExecutionInfo.ExecutionMode == PackageExecutionMode.Regular) { PackageUtility.AllowProtectedRenames(); } Int64 restorePointSequenceNumber = -2; /////////////////////////////////// // System Restore, Part 1 if (ExecutionInfo.ExecutionMode == PackageExecutionMode.Regular && ExecutionInfo.CreateSystemRestorePoint) { if (SystemRestore.IsSystemRestoreAvailable()) { OnProgressEvent(new PackageProgressEventArgs(-1, "Creating System Restore Point")); String pointName = "Installed Anolis Package \"" + this.Name + '"'; restorePointSequenceNumber = SystemRestore.CreateRestorePoint(pointName, SystemRestoreType.ApplicationInstall); if (restorePointSequenceNumber < 0) { Log.Add(LogSeverity.Error, "Failed to create System Restore point"); } } else { Log.Add(LogSeverity.Error, "System Restore not supported"); } } /////////////////////////////////// // Install (Backup and Execute; backups are the responisiblity of each Operation) try { float i = 0, cnt = operations.Count; foreach (Operation op in operations) { OnProgressEvent(new PackageProgressEventArgs((int)(100 * i++ / cnt), op.ToString())); if (!op.SupportsCDImage && ExecutionInfo.ExecutionMode == PackageExecutionMode.CDImage) { continue; } try { if (op.CustomEvaluation) { op.Execute(); } else { EvaluationResult result = op.Evaluate(); switch (result) { case EvaluationResult.False: Log.Add(LogSeverity.Info, "Evaluation False - " + op.Key); break; case EvaluationResult.FalseParent: Log.Add(LogSeverity.Info, "Evaluation ParentFalse - " + op.Key); break; case EvaluationResult.Error: Log.Add(LogSeverity.Error, "Evaluation Error - " + op.Key); break; case EvaluationResult.True: op.Execute(); break; } } } catch (Exception ex) { Log.Add(new LogItem(LogSeverity.Error, ex, op.Name + " failed: \"" + ex.Message + "\"")); continue; } #if !DEBUG // don't add "Info - Done {op}" in debug mode because it's too verbose and clutters up the logfile PathOperation pathOp = op as PathOperation; if (pathOp != null) { Log.Add(LogSeverity.Info, "Done " + op.Name + ": " + pathOp.Path); } else { Log.Add(LogSeverity.Info, "Done " + op.Name); } #endif } //foreach OnProgressEvent(new PackageProgressEventArgs(100, "Complete")); } finally { /////////////////////////////////// // System Restore, Part 2 if (restorePointSequenceNumber >= 0) { OnProgressEvent(new PackageProgressEventArgs(-1, "Finishing System Restore Point")); SystemRestore.EndRestorePoint(restorePointSequenceNumber); } /////////////////////////////////// // Backup, Part 2 if (ExecutionInfo.BackupGroup != null) { String backupFileName = Path.Combine(ExecutionInfo.BackupDirectory.FullName, "Package.xml"); ExecutionInfo.BackupPackage.Write(backupFileName); } /////////////////////////////////// // Dump the log to disk Log.Save(Path.Combine(this.RootDirectory.FullName, "Anolis.Installer.log")); IsBusy = false; } //try/finally }
public static FactoryOptions InjectIdentityProvider(this FactoryOptions options) { options.AddDependency(IdentityProviderKey, services => services.GetService <IIdentityProvider>()); return(options); }