public override void Initialize(Configurations conf) { listener = new HttpListener(); listener.Prefixes.Add("http://*:" + conf.GetInt("Port", 80) + "/"); Thread thread = new Thread(RecievingLoop); thread.Priority = ThreadPriority.Lowest; thread.Start(); }
public override void Initialize(Configurations conf) { socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPAddress address; if (!IPAddress.TryParse(conf.GetString("Address", "127.0.0.1"), out address)) address = IPAddress.Loopback; socket.Bind(new IPEndPoint(address, conf.GetInt("Port", 10888))); Thread thread = new Thread(RecievingLoop); thread.Priority = ThreadPriority.Lowest; thread.Start(); }
public BarrageRenderer(Configurations conf) { stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; borderPen = new Pen(conf.GetRgbColor("Border-Color", Color.Black), conf.GetSingle("Border-Width", 2)); borderPen.LineJoin = LineJoin.Round; borderPen.Alignment = PenAlignment.Outset; borderBrush = new SolidBrush(conf.GetRgbColor("Border-Color", Color.Black)); fillBrush = new SolidBrush(conf.GetRgbColor("Fill-Color", Color.White)); FontStyle fontStyle = FontStyle.Regular; if (conf.GetBoolean("Font-Bold", true)) fontStyle |= FontStyle.Bold; if (conf.GetBoolean("Font-Italic", false)) fontStyle |= FontStyle.Italic; Font = new Font(conf.GetString("Font-Family", "黑体"), conf.GetSingle("Font-Size", 30), fontStyle, GraphicsUnit.Pixel); HorizontalMargin = conf.GetInt("Horizontal-Margin", 5); BarrageHeight = conf.GetInt("Height", 40); BlurRadius = conf.GetInt("Blur-Radius", 2); Transparency = conf.GetSingle("Transparency", 1.0f); ShadowX = conf.GetInt("Shadow-XOffset", 1); ShadowY = conf.GetInt("Shadow-YOffset", 1); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddDbContext <DataContext>(x => x.UseNpgsql(Configurations.GetNpgsqlConnectionString())); var settings = Configurations.GetAppSettings().Build().GetSection("JwtSettings").Get <JwtSettings>(); var key = Encoding.ASCII.GetBytes(settings.SigningKey); services.AddAuthentication(c => { c.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; c.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(c => { c.RequireHttpsMetadata = false; c.SaveToken = true; c.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = false, ValidateAudience = false }; }); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "eScout - Server", Version = "v1", Contact = new OpenApiContact { Name = Configurations.GetAppSettings("Developer.Name"), Email = string.Empty, Url = new System.Uri(Configurations.GetAppSettings("Developer.Email")) } }); var securitySchema = new OpenApiSecurityScheme { Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", Name = "Authorization", In = ParameterLocation.Header, Type = SecuritySchemeType.Http, Scheme = "bearer", Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "Bearer" } }; c.AddSecurityDefinition("Bearer", securitySchema); var securityRequirement = new OpenApiSecurityRequirement { { securitySchema, new[] { "Bearer" } } }; c.AddSecurityRequirement(securityRequirement); }); }
//---------------------------------------------------------------------------------------------------------- #region Constructor protected AiTurnState(TurnBasedFsm fsm, IGameData gameData, Configurations configurations) : base(fsm, gameData, configurations) =>
private void buttonGetConfig_Click(object sender, RoutedEventArgs e) { Tuple <Configuration, ApiCallResponse> config = Configurations.get(); Console.WriteLine(); }
/// <summary> /// Initializes from template. /// </summary> /// <param name="projectCreateInfo">Project create info.</param> /// <param name="template">Template.</param> protected override void OnInitializeFromTemplate(ProjectCreateInformation projectCreateInfo, XmlElement template) { base.OnInitializeFromTemplate(projectCreateInfo, template); string binPath = "."; if (projectCreateInfo != null) { Name = projectCreateInfo.ProjectName; binPath = projectCreateInfo.BinPath; } Compiler = null; // use default compiler depending on language var configuration = (CProjectConfiguration)CreateConfiguration("Debug"); configuration.DefineSymbols = "DEBUG MONODEVELOP"; configuration.DebugSymbols = true; Configurations.Add(configuration); configuration = (CProjectConfiguration)CreateConfiguration("Release"); configuration.DebugSymbols = false; configuration.OptimizationLevel = 3; configuration.DefineSymbols = "MONODEVELOP"; Configurations.Add(configuration); foreach (CProjectConfiguration c in Configurations) { c.OutputDirectory = Path.Combine(binPath, c.Id); c.SourceDirectory = projectCreateInfo.ProjectBasePath; c.Output = Name; if (template != null) { if (template.Attributes ["LanguageName"] != null) { string languageName = template.Attributes ["LanguageName"].InnerText; switch (languageName) { case "C": this.Language = Language.C; break; case "C++": this.Language = Language.CPP; break; case "Objective-C": this.Language = Language.OBJC; break; case "Objective-C++": this.Language = Language.OBJCPP; break; } } if (template.Attributes ["Target"] != null) { c.CompileTarget = (CompileTarget)Enum.Parse( typeof(CompileTarget), template.Attributes ["Target"].InnerText); } if (template.GetAttribute("ExternalConsole") == "True") { c.ExternalConsole = true; c.PauseConsoleOutput = true; } if (template.Attributes ["PauseConsoleOutput"] != null) { c.PauseConsoleOutput = bool.Parse( template.Attributes ["PauseConsoleOutput"].InnerText); } if (template.Attributes ["CompilerArgs"].InnerText != null) { c.ExtraCompilerArguments = template.Attributes ["CompilerArgs"].InnerText; } if (template.Attributes ["LinkerArgs"].InnerText != null) { c.ExtraLinkerArguments = template.Attributes ["LinkerArgs"].InnerText; } } } }
public override void ExecuteCmdlet() { parameters.UserName = HttpCredential.UserName; parameters.Password = HttpCredential.Password.ConvertToString(); if (RdpCredential != null) { parameters.RdpUsername = RdpCredential.UserName; parameters.RdpPassword = RdpCredential.Password.ConvertToString(); } if (OSType == OSType.Linux && SshCredential != null) { parameters.SshUserName = SshCredential.UserName; if (!string.IsNullOrEmpty(SshCredential.Password.ConvertToString())) { parameters.SshPassword = SshCredential.Password.ConvertToString(); } if (!string.IsNullOrEmpty(SshPublicKey)) { parameters.SshPublicKey = SshPublicKey; } } if (DefaultStorageAccountType == null || DefaultStorageAccountType == StorageType.AzureStorage) { parameters.DefaultStorageInfo = new AzureStorageInfo(DefaultStorageAccountName, DefaultStorageAccountKey, DefaultStorageContainer); } else { parameters.DefaultStorageInfo = new AzureDataLakeStoreInfo(DefaultStorageAccountName, DefaultStorageRootPath); } foreach ( var storageAccount in AdditionalStorageAccounts.Where( storageAccount => !parameters.AdditionalStorageAccounts.ContainsKey(storageAccount.Key))) { parameters.AdditionalStorageAccounts.Add(storageAccount.Key, storageAccount.Value); } foreach (var config in Configurations.Where(config => !parameters.Configurations.ContainsKey(config.Key))) { parameters.Configurations.Add(config.Key, config.Value); } foreach (var action in ScriptActions.Where(action => parameters.ScriptActions.ContainsKey(action.Key))) { parameters.ScriptActions.Add(action.Key, action.Value.Select(a => a.GetScriptActionFromPSModel()).ToList()); } foreach (var component in ComponentVersion.Where(component => !parameters.ComponentVersion.ContainsKey(component.Key))) { parameters.ComponentVersion.Add(component.Key, component.Value); } if (OozieMetastore != null) { var metastore = OozieMetastore; parameters.OozieMetastore = new Metastore(metastore.SqlAzureServerName, metastore.DatabaseName, metastore.Credential.UserName, metastore.Credential.Password.ConvertToString()); } if (HiveMetastore != null) { var metastore = HiveMetastore; parameters.HiveMetastore = new Metastore(metastore.SqlAzureServerName, metastore.DatabaseName, metastore.Credential.UserName, metastore.Credential.Password.ConvertToString()); } if (!string.IsNullOrEmpty(CertificatePassword)) { if (!string.IsNullOrEmpty(CertificateFilePath)) { CertificateFileContents = File.ReadAllBytes(CertificateFilePath); } var servicePrincipal = new Management.HDInsight.Models.ServicePrincipal( GetApplicationId(), GetTenantId(AadTenantId), CertificateFileContents, CertificatePassword); parameters.Principal = servicePrincipal; } if (SecurityProfile != null) { parameters.SecurityProfile = new SecurityProfile() { DirectoryType = DirectoryType.ActiveDirectory, Domain = SecurityProfile.Domain, DomainUsername = SecurityProfile.DomainUserCredential != null ? SecurityProfile.DomainUserCredential.UserName : null, DomainUserPassword = SecurityProfile.DomainUserCredential != null && SecurityProfile.DomainUserCredential.Password != null ? SecurityProfile.DomainUserCredential.Password.ConvertToString() : null, OrganizationalUnitDN = SecurityProfile.OrganizationalUnitDN, LdapsUrls = SecurityProfile.LdapsUrls, ClusterUsersGroupDNs = SecurityProfile.ClusterUsersGroupDNs }; } var cluster = HDInsightManagementClient.CreateNewCluster(ResourceGroupName, ClusterName, parameters); if (cluster != null) { WriteObject(new AzureHDInsightCluster(cluster.Cluster)); } }
/// <summary> Get posible configurations after considering given object </summary> Configurations ProcessObject(Configurations oldConfigs, AXmlObject obj) { AXmlParser.Log("Processing {0}", obj); AXmlTag objAsTag = obj as AXmlTag; AXmlElement objAsElement = obj as AXmlElement; AXmlParser.DebugAssert(objAsTag != null || objAsElement != null || obj is AXmlText, obj.GetType().Name + " not expected"); if (objAsElement != null) { AXmlParser.Assert(objAsElement.IsProperlyNested, "Element not properly nested"); } Configurations newConfigs = new Configurations(); foreach (var kvp in oldConfigs) { Configuration oldConfig = kvp.Value; var oldStartTags = oldConfig.StartTags; var oldDocument = oldConfig.Document; int oldCost = oldConfig.Cost; if (objAsTag != null && objAsTag.IsStartTag) { newConfigs.Add(new Configuration { // Push start-tag (cost 0) StartTags = oldStartTags.Push(objAsTag), Document = oldDocument.Push(objAsTag), Cost = oldCost, }); } else if (objAsTag != null && objAsTag.IsEndTag) { newConfigs.Add(new Configuration { // Ignore (cost 1) StartTags = oldStartTags, Document = oldDocument.Push(StartTagPlaceholder).Push(objAsTag), Cost = oldCost + 1, }); if (!oldStartTags.IsEmpty && oldStartTags.Peek().Name != objAsTag.Name) { newConfigs.Add(new Configuration { // Pop 1 item (cost 1) - not mathcing StartTags = oldStartTags.Pop(), Document = oldDocument.Push(objAsTag), Cost = oldCost + 1, }); } int popedCount = 0; var startTags = oldStartTags; var doc = oldDocument; foreach (AXmlTag poped in oldStartTags) { popedCount++; if (poped.Name == objAsTag.Name) { newConfigs.Add(new Configuration { // Pop 'x' items (cost x-1) - last one is matching StartTags = startTags.Pop(), Document = doc.Push(objAsTag), Cost = oldCost + popedCount - 1, }); } startTags = startTags.Pop(); doc = doc.Push(EndTagPlaceholder); } } else { // Empty tag or other tag type or text or properly nested element newConfigs.Add(new Configuration { // Ignore (cost 0) StartTags = oldStartTags, Document = oldDocument.Push(obj), Cost = oldCost, }); } } // Log("New configurations:" + newConfigs.ToString()); Configurations bestNewConfigurations = new Configurations( newConfigs.Values.OrderBy(v => v.Cost).Take(maxConfigurationCount) ); // AXmlParser.Log("Best new configurations:" + bestNewConfigurations.ToString()); return(bestNewConfigurations); }
/// <summary> /// Executes the simulation. /// </summary> /// <exception cref="SpiceSharp.CircuitException"> /// Could not find source {0}".FormatString(sweep.Parameter) /// or /// Invalid sweep object /// </exception> protected override void Execute() { // Base base.Execute(); var exportargs = new ExportDataEventArgs(this); // Setup the state var state = RealState; var dcconfig = Configurations.Get <DCConfiguration>(); state.Init = InitializationModes.Junction; state.UseIc = false; // UseIC is only used in transient simulations state.UseDc = true; // Initialize Sweeps = new NestedSweeps(dcconfig.Sweeps); var swept = new Parameter <double> [Sweeps.Count]; var original = new Parameter <double> [Sweeps.Count]; var levelNeedsTemperature = -1; // Initialize first time for (var i = 0; i < dcconfig.Sweeps.Count; i++) { // Get the component to be swept var sweep = Sweeps[i]; // Try finding the parameter to sweep var args = new DCParameterSearchEventArgs(sweep.Parameter, i); OnParameterSearch?.Invoke(this, args); if (args.Result != null) { swept[i] = args.Result; // Keep track of the highest level that needs to recalculate temperature if (args.TemperatureNeeded) { levelNeedsTemperature = Math.Max(levelNeedsTemperature, i); } } else { // Get entity parameters if (!EntityBehaviors.ContainsKey(sweep.Parameter)) { throw new CircuitException("Could not find source {0}".FormatString(sweep.Parameter)); } var eb = EntityParameters[sweep.Parameter]; // Check for a Voltage source or Current source parameters if (eb.TryGet <Components.VoltageSourceBehaviors.BaseParameters>(out var pvsrc)) { swept[i] = pvsrc.DcValue; } else if (eb.TryGet <Components.CurrentSourceBehaviors.BaseParameters>(out var pisrc)) { swept[i] = pisrc.DcValue; } else { throw new CircuitException("Invalid sweep object"); } } original[i] = (Parameter <double>)swept[i].Clone(); swept[i].Value = sweep.Initial; } // Execute temperature behaviors if necessary the first time if (levelNeedsTemperature >= 0) { Temperature(); } // Execute the sweeps var level = Sweeps.Count - 1; while (level >= 0) { // Fill the values with start values while (level < Sweeps.Count - 1) { level++; Sweeps[level].Reset(); swept[level].Value = Sweeps[level].CurrentValue; state.Init = InitializationModes.Junction; } // Calculate the solution if (!Iterate(dcconfig.SweepMaxIterations)) { IterationFailed?.Invoke(this, EventArgs.Empty); Op(DcMaxIterations); } // Export data OnExport(exportargs); // Remove all values that are greater or equal to the maximum value while (level >= 0 && Sweeps[level].CurrentStep >= Sweeps[level].Limit) { level--; } // Go to the next step for the top level if (level >= 0) { Sweeps[level].Increment(); swept[level].Value = Sweeps[level].CurrentValue; // If temperature behavior is needed for this level or higher, run behaviors if (levelNeedsTemperature >= level) { Temperature(); } } } // Restore all the parameters of the swept components for (var i = 0; i < Sweeps.Count; i++) { swept[i].CopyFrom(original[i]); } }
/// <summary> /// Initializes a new instance of the <see cref="DC"/> class. /// </summary> /// <param name="name">The identifier of the simulation.</param> public DC(string name) : base(name) { Configurations.Add(new DCConfiguration()); }
IEnumerator IEnumerable.GetEnumerator() { return(Configurations.GetEnumerator()); }
/// <summary> /// Build driver configuration /// </summary> protected IConfiguration DriverConfiguration <TMapInput, TMapOutput, TResult, TPartitionType>( IMRUJobDefinition jobDefinition, IConfiguration driverHandlerConfig) { string driverId = string.Format("IMRU-{0}-Driver", jobDefinition.JobName); IConfiguration overallPerMapConfig = null; var configurationSerializer = new AvroConfigurationSerializer(); try { overallPerMapConfig = Configurations.Merge(jobDefinition.PerMapConfigGeneratorConfig.ToArray()); } catch (Exception e) { Exceptions.Throw(e, "Issues in merging PerMapCOnfigGenerator configurations", Logger); } var imruDriverConfiguration = TangFactory.GetTang().NewConfigurationBuilder(new[] { driverHandlerConfig, CreateGroupCommunicationConfiguration <TMapInput, TMapOutput, TResult, TPartitionType>(jobDefinition.NumberOfMappers + 1, driverId), jobDefinition.PartitionedDatasetConfiguration, overallPerMapConfig, jobDefinition.JobCancelSignalConfiguration }) .BindNamedParameter(typeof(SerializedUpdateTaskStateConfiguration), configurationSerializer.ToString(jobDefinition.UpdateTaskStateConfiguration)) .BindNamedParameter(typeof(SerializedMapTaskStateConfiguration), configurationSerializer.ToString(jobDefinition.MapTaskStateConfiguration)) .BindNamedParameter(typeof(SerializedMapConfiguration), configurationSerializer.ToString(jobDefinition.MapFunctionConfiguration)) .BindNamedParameter(typeof(SerializedUpdateConfiguration), configurationSerializer.ToString(jobDefinition.UpdateFunctionConfiguration)) .BindNamedParameter(typeof(SerializedMapInputCodecConfiguration), configurationSerializer.ToString(jobDefinition.MapInputCodecConfiguration)) .BindNamedParameter(typeof(SerializedMapInputPipelineDataConverterConfiguration), configurationSerializer.ToString(jobDefinition.MapInputPipelineDataConverterConfiguration)) .BindNamedParameter(typeof(SerializedUpdateFunctionCodecsConfiguration), configurationSerializer.ToString(jobDefinition.UpdateFunctionCodecsConfiguration)) .BindNamedParameter(typeof(SerializedMapOutputPipelineDataConverterConfiguration), configurationSerializer.ToString(jobDefinition.MapOutputPipelineDataConverterConfiguration)) .BindNamedParameter(typeof(SerializedReduceConfiguration), configurationSerializer.ToString(jobDefinition.ReduceFunctionConfiguration)) .BindNamedParameter(typeof(SerializedResultHandlerConfiguration), configurationSerializer.ToString(jobDefinition.ResultHandlerConfiguration)) .BindNamedParameter(typeof(MemoryPerMapper), jobDefinition.MapperMemory.ToString(CultureInfo.InvariantCulture)) .BindNamedParameter(typeof(MemoryForUpdateTask), jobDefinition.UpdateTaskMemory.ToString(CultureInfo.InvariantCulture)) .BindNamedParameter(typeof(CoresPerMapper), jobDefinition.MapTaskCores.ToString(CultureInfo.InvariantCulture)) .BindNamedParameter(typeof(CoresForUpdateTask), jobDefinition.UpdateTaskCores.ToString(CultureInfo.InvariantCulture)) .BindNamedParameter(typeof(MaxRetryNumberInRecovery), jobDefinition.MaxRetryNumberInRecovery.ToString(CultureInfo.InvariantCulture)) .BindNamedParameter(typeof(InvokeGC), jobDefinition.InvokeGarbageCollectorAfterIteration.ToString(CultureInfo.InvariantCulture)) .Build(); return(imruDriverConfiguration); }
public IEnumerator <Solution.Configuration> GetEnumerator() { return(Configurations.Cast <Solution.Configuration>().GetEnumerator()); }
public void OnNext(IAllocatedEvaluator allocatedEvaluator) { string control = string.Empty; ISet <string> arguments = ClrHandlerHelper.GetCommandLineArguments(); if (arguments != null && arguments.Any()) { foreach (string argument in arguments) { Console.WriteLine("testing argument: " + argument); } control = arguments.Last(); } IEvaluatorDescriptor descriptor = allocatedEvaluator.GetEvaluatorDescriptor(); IConfiguration serviceConfiguration = ServiceConfiguration.ConfigurationModule .Set(ServiceConfiguration.Services, GenericType <HelloService> .Class) .Build(); IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule .Set(ContextConfiguration.Identifier, "bridgeHelloCLRContextId_" + Guid.NewGuid().ToString("N")) .Build(); IConfiguration taskConfiguration = TaskConfiguration.ConfigurationModule .Set(TaskConfiguration.Identifier, "bridgeHelloCLRTaskId_" + Guid.NewGuid().ToString("N")) .Set(TaskConfiguration.Task, GenericType <HelloTask> .Class) .Set(TaskConfiguration.OnMessage, GenericType <HelloTask.HelloDriverMessageHandler> .Class) .Set(TaskConfiguration.OnSendMessage, GenericType <HelloTaskMessage> .Class) .Build(); IConfiguration mergedTaskConfiguration = taskConfiguration; if (allocatedEvaluator.NameServerInfo != null) { IPEndPoint nameServerEndpoint = NetUtilities.ParseIpEndpoint(allocatedEvaluator.NameServerInfo); IConfiguration nameClientConfiguration = TangFactory.GetTang().NewConfigurationBuilder( NamingConfiguration.ConfigurationModule .Set(NamingConfiguration.NameServerAddress, nameServerEndpoint.Address.ToString()) .Set(NamingConfiguration.NameServerPort, nameServerEndpoint.Port.ToString(CultureInfo.InvariantCulture)) .Build()) .BindImplementation(GenericType <INameClient> .Class, GenericType <NameClient> .Class) .Build(); mergedTaskConfiguration = Configurations.Merge(taskConfiguration, nameClientConfiguration); } string ipAddress = descriptor.NodeDescriptor.InetSocketAddress.Address.ToString(); int port = descriptor.NodeDescriptor.InetSocketAddress.Port; string hostName = descriptor.NodeDescriptor.HostName; Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Alloated evaluator {0} with ip {1}:{2}. Hostname is {3}", allocatedEvaluator.Id, ipAddress, port, hostName)); Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Evaluator is assigned with {0} MB of memory and {1} cores.", descriptor.Memory, descriptor.VirtualCore)); if (control.Equals("submitContext", StringComparison.OrdinalIgnoreCase)) { allocatedEvaluator.SubmitContext(contextConfiguration); } else if (control.Equals("submitContextAndServiceAndTask", StringComparison.OrdinalIgnoreCase)) { allocatedEvaluator.SubmitContextAndServiceAndTask(contextConfiguration, serviceConfiguration, mergedTaskConfiguration); } else { // default behavior allocatedEvaluator.SubmitContextAndTask(contextConfiguration, mergedTaskConfiguration); } }
//---------------------------------------------------------------------------------------------------------- #region Constructor public TopPlayerState(TurnBasedFsm fsm, IGameData gameData, Configurations configurations) : base(fsm, gameData, configurations) { }
/// <summary> /// Sets LCD Configuration. /// </summary> /// <param name="config">LCD configuration stucture containing LCD configuration information to be set.</param> /// <returns><c>true</c> if configurations were updated. <c>false</c> if configurations did not change.</returns> public static bool Set(Configurations config) { if (DeviceInfo.GetDeviceID() != DeviceID.FEZ_HYDRA) throw new NotImplementedException("LCD Controller only available for FEZ Hydra at this time."); return Set(config.Width, config.Height, config.PriorityEnable, config.OutputEnableIsFixed, config.OutputEnablePolarity, config.HorizontalSyncPolarity, config.VerticalSyncPolarity, config.PixelPolarity, config.HorizontalSyncPulseWidth, config.HorizontalBackPorch, config.HorizontalFrontPorch, config.VerticalSyncPulseWidth, config.VerticalBackPorch, config.VerticalFrontPorch, config.PixelClockRateKHz); }
internal int MaxClasses() { return(Configurations.Max(c => c.Subparts.Length)); }
public SubtitleManager(BarrageWindow parent, Rectangle rect, Configurations subtitleConf) { FontStyle fontStyle = FontStyle.Regular; if (subtitleConf.GetBoolean("Font-Bold", true)) fontStyle |= FontStyle.Bold; if (subtitleConf.GetBoolean("Font-Italic", false)) fontStyle |= FontStyle.Italic; Font = new Font(subtitleConf.GetString("Font-Family", "黑体"), subtitleConf.GetSingle("Font-Size", 30), fontStyle, GraphicsUnit.Pixel); Padding = subtitleConf.GetInt("Padding", 10); FillColor = subtitleConf.GetRgbColor("Fill-Color", Color.White); BorderColor = subtitleConf.GetRgbColor("Border-Color", Color.Black); BorderWidth = subtitleConf.GetSingle("Border-Width", 1.0f); current = -1; groups = new List<SubtitleGroup>(); int n; var lycFiles = from pair in subtitleConf where pair.Key.StartsWith("Lyc-File") && Int32.TryParse(pair.Key.Substring("Lyc-File".Length), out n) select new { Index = Int32.Parse(pair.Key.Substring("Lyc-File".Length)) - 1, FileName = pair.Value }; foreach (var lycFile in lycFiles.OrderBy(l => l.Index)) { try { groups.Add(new SubtitleGroup(this, new LyricFile(lycFile.FileName))); Core.Debugger.Log("lyc loaded: " + lycFile.FileName); } catch (Exception exc) { Core.Debugger.Log("lyc file load failed: " + lycFile.FileName + " (" + exc.Message + ")"); } } if (groups.Count >= 0) current = 0; stopwatch = new Stopwatch(); this.Rect = Rectangle.FromLTRB(rect.Left + Padding, rect.Top + Padding, rect.Right - Padding, rect.Bottom - Padding); GlobalKeyHook.Instance.SetProcessor( subtitleConf.GetKeys("Start-Key", Keys.Control | Keys.Alt | Keys.D1), k => { if (StartSubtitle()) parent.ShowNotice("字幕开始"); return true; } ); GlobalKeyHook.Instance.SetProcessor( subtitleConf.GetKeys("End-Key", Keys.Control | Keys.Alt | Keys.D2), k => { if (StopSubtitle()) parent.ShowNotice("字幕停止"); return true; } ); GlobalKeyHook.Instance.SetProcessor( subtitleConf.GetKeys("Prev-Key", Keys.Control | Keys.Alt | Keys.PageUp), k => { PrevSubtitle(); return true; } ); GlobalKeyHook.Instance.SetProcessor( subtitleConf.GetKeys("Next-Key", Keys.Control | Keys.Alt | Keys.PageDown), k => { NextSubtitle(); return true; } ); GlobalKeyHook.Instance.SetProcessor( subtitleConf.GetKeys("Prev-Lrc", Keys.Control | Keys.Alt | Keys.D3), k => { if (PrevGroup()) parent.ShowNotice("字幕:" + CurrentGroup.Title); return true; } ); GlobalKeyHook.Instance.SetProcessor( subtitleConf.GetKeys("Next-Lrc", Keys.Control | Keys.Alt | Keys.D4), k => { if (NextGroup()) parent.ShowNotice("字幕:" + CurrentGroup.Title); return true; } ); }
public GenreDao() { this.Conexion = Configurations.ReadDataBaseConnection(); }
private void RegisterServices(IServiceCollection services) { Configurations.RegisterServices(services); }
// Start is called before the first frame update void Start() { instance = this; }
public void Prepare(Configurations configuration) { Current = this; }
public override void ExecuteCmdlet() { foreach (var component in ComponentVersion.Where(component => !clusterComponentVersion.ContainsKey(component.Key))) { clusterComponentVersion.Add(component.Key, component.Value); } // Construct Configurations foreach (var config in Configurations.Where(config => !clusterConfigurations.ContainsKey(config.Key))) { clusterConfigurations.Add(config.Key, config.Value); } // Add cluster username/password to gateway config. ClusterCreateHelper.AddClusterCredentialToGatewayConfig(HttpCredential, clusterConfigurations); // Construct OS Profile OsProfile osProfile = ClusterCreateHelper.CreateOsProfile(SshCredential, SshPublicKey); // Construct Virtual Network Profile VirtualNetworkProfile vnetProfile = ClusterCreateHelper.CreateVirtualNetworkProfile(VirtualNetworkId, SubnetName); // Handle storage account StorageProfile storageProfile = new StorageProfile() { Storageaccounts = new List <StorageAccount> { } }; if (StorageAccountType == null || StorageAccountType == StorageType.AzureStorage) { var azureStorageAccount = ClusterCreateHelper.CreateAzureStorageAccount(ClusterName, StorageAccountResourceId, StorageAccountKey, StorageContainer, this.DefaultContext.Environment.StorageEndpointSuffix); storageProfile.Storageaccounts.Add(azureStorageAccount); } else if (StorageAccountType == StorageType.AzureDataLakeStore) { ClusterCreateHelper.AddAzureDataLakeStorageGen1ToCoreConfig(StorageAccountResourceId, StorageRootPath, this.DefaultContext.Environment.AzureDataLakeStoreFileSystemEndpointSuffix, clusterConfigurations); } else if (StorageAccountType == StorageType.AzureDataLakeStorageGen2) { var adlsgen2Account = ClusterCreateHelper.CreateAdlsGen2StorageAccount(ClusterName, StorageAccountResourceId, StorageAccountKey, StorageFileSystem, StorageAccountManagedIdentity, this.DefaultContext.Environment.StorageEndpointSuffix); storageProfile.Storageaccounts.Add(adlsgen2Account); } // Handle additional storage accounts foreach ( var storageAccount in AdditionalStorageAccounts.Where( storageAccount => !clusterAdditionalStorageAccounts.ContainsKey(storageAccount.Key))) { clusterAdditionalStorageAccounts.Add(storageAccount.Key, storageAccount.Value); } ClusterCreateHelper.AddAdditionalStorageAccountsToCoreConfig(clusterAdditionalStorageAccounts, clusterConfigurations); // Handle script action foreach (var action in ScriptActions.Where(action => clusterScriptActions.ContainsKey(action.Key))) { clusterScriptActions.Add(action.Key, action.Value.Select(a => a.GetScriptActionFromPSModel()).ToList()); } // Handle metastore if (OozieMetastore != null) { ClusterCreateHelper.AddOozieMetastoreToConfigurations(OozieMetastore, clusterConfigurations); } if (HiveMetastore != null) { ClusterCreateHelper.AddHiveMetastoreToConfigurations(HiveMetastore, clusterConfigurations); } // Handle Custom Ambari Database if (AmbariDatabase != null) { ClusterCreateHelper.AddCustomAmbariDatabaseToConfigurations(AmbariDatabase, clusterConfigurations); } // Handle ADLSGen1 identity if (!string.IsNullOrEmpty(CertificatePassword)) { if (!string.IsNullOrEmpty(CertificateFilePath)) { CertificateFileContents = File.ReadAllBytes(CertificateFilePath); } ClusterCreateHelper.AddDataLakeStorageGen1IdentityToIdentityConfig( GetApplicationId(ApplicationId), GetTenantId(AadTenantId), CertificateFileContents, CertificatePassword, clusterConfigurations, this.DefaultContext.Environment.ActiveDirectoryAuthority, this.DefaultContext.Environment.DataLakeEndpointResourceId); } // Handle Kafka Rest Proxy KafkaRestProperties kafkaRestProperties = null; if (KafkaClientGroupId != null && KafkaClientGroupName != null) { kafkaRestProperties = new KafkaRestProperties() { ClientGroupInfo = new ClientGroupInfo(KafkaClientGroupName, KafkaClientGroupId) }; } bool isKafkaRestProxyEnable = kafkaRestProperties != null; var defaultVmSizeConfigurations = GetDefaultVmsizesConfigurations(Location); // Compute profile contains headnode, workernode, zookeepernode, edgenode, kafkamanagementnode, idbrokernode, etc. ComputeProfile computeProfile = ClusterCreateHelper.CreateComputeProfile(osProfile, vnetProfile, clusterScriptActions, ClusterType, ClusterSizeInNodes, HeadNodeSize, WorkerNodeSize, ZookeeperNodeSize, EdgeNodeSize, isKafkaRestProxyEnable, KafkaManagementNodeSize, EnableIDBroker.IsPresent, defaultVmSizeConfigurations); // Handle SecurityProfile SecurityProfile securityProfile = ClusterCreateHelper.ConvertAzureHDInsightSecurityProfileToSecurityProfile(SecurityProfile, AssignedIdentity); // Handle DisksPerWorkerNode feature Role workerNode = Utils.ExtractRole(ClusterNodeType.WorkerNode.ToString(), computeProfile); if (DisksPerWorkerNode > 0) { workerNode.DataDisksGroups = new List <DataDisksGroups>() { new DataDisksGroups() { DisksPerNode = DisksPerWorkerNode } }; } // Handle ClusterIdentity ClusterIdentity clusterIdentity = null; if (AssignedIdentity != null || StorageAccountManagedIdentity != null) { clusterIdentity = new ClusterIdentity { Type = ResourceIdentityType.UserAssigned, UserAssignedIdentities = new Dictionary <string, UserAssignedIdentity>() }; if (AssignedIdentity != null) { clusterIdentity.UserAssignedIdentities.Add(AssignedIdentity, new UserAssignedIdentity()); } if (StorageAccountManagedIdentity != null) { clusterIdentity.UserAssignedIdentities.Add(StorageAccountManagedIdentity, new UserAssignedIdentity()); } } // Handle CMK feature DiskEncryptionProperties diskEncryptionProperties = null; if (EncryptionKeyName != null && EncryptionKeyVersion != null && EncryptionVaultUri != null) { diskEncryptionProperties = new DiskEncryptionProperties() { KeyName = EncryptionKeyName, KeyVersion = EncryptionKeyVersion, VaultUri = EncryptionVaultUri, EncryptionAlgorithm = EncryptionAlgorithm != null ? EncryptionAlgorithm : JsonWebKeyEncryptionAlgorithm.RSAOAEP, MsiResourceId = AssignedIdentity }; } // Handle encryption at host feature if (EncryptionAtHost != null) { if (diskEncryptionProperties != null) { diskEncryptionProperties.EncryptionAtHost = EncryptionAtHost; } else { diskEncryptionProperties = new DiskEncryptionProperties() { EncryptionAtHost = EncryptionAtHost }; } } // Handle autoscale featurer Autoscale autoscaleParameter = null; if (AutoscaleConfiguration != null) { autoscaleParameter = AutoscaleConfiguration.ToAutoscale(); workerNode.AutoscaleConfiguration = autoscaleParameter; } // Handle relay outound and private link feature NetworkProperties networkProperties = null; if (ResourceProviderConnection != null || PrivateLink != null) { networkProperties = new NetworkProperties(ResourceProviderConnection, PrivateLink); } // Handle compute isolation properties ComputeIsolationProperties computeIsolationProperties = null; if (EnableComputeIsolation.IsPresent) { computeIsolationProperties = new ComputeIsolationProperties(EnableComputeIsolation.IsPresent, ComputeIsolationHostSku); } // Construct cluster create parameter ClusterCreateParametersExtended createParams = new ClusterCreateParametersExtended { Location = Location, //Tags = Tags, //To Do add this Tags parameter Zones = Zone, Properties = new ClusterCreateProperties { Tier = ClusterTier, ClusterDefinition = new ClusterDefinition { Kind = ClusterType ?? "Hadoop", ComponentVersion = clusterComponentVersion, Configurations = clusterConfigurations }, ClusterVersion = Version ?? "default", KafkaRestProperties = kafkaRestProperties, ComputeProfile = computeProfile, OsType = OSType, SecurityProfile = securityProfile, StorageProfile = storageProfile, DiskEncryptionProperties = diskEncryptionProperties, //handle Encryption In Transit feature EncryptionInTransitProperties = EncryptionInTransit != null ? new EncryptionInTransitProperties() { IsEncryptionInTransitEnabled = EncryptionInTransit } : null, MinSupportedTlsVersion = MinSupportedTlsVersion, NetworkProperties = networkProperties, ComputeIsolationProperties = computeIsolationProperties, PrivateLinkConfigurations = PrivateLinkConfiguration != null?PrivateLinkConfiguration.Select(item => item.ToPrivateLinkConfiguration()).ToList() : null }, Identity = clusterIdentity }; var cluster = HDInsightManagementClient.CreateCluster(ResourceGroupName, ClusterName, createParams); if (cluster != null) { WriteObject(new AzureHDInsightCluster(cluster)); } }
public static void DriverConfigurationBuilder(DriverConfigurationSettings driverConfigurationSettings) { ExtractConfigFromJar(driverConfigurationSettings.JarFileFolder); if (!File.Exists(DriverChFile)) { Log.Log(Level.Warning, string.Format(CultureInfo.CurrentCulture, "There is no file {0} extracted from the jar file at {1}.", DriverChFile, driverConfigurationSettings.JarFileFolder)); return; } if (!File.Exists(HttpServerConfigFile)) { Log.Log(Level.Warning, string.Format(CultureInfo.CurrentCulture, "There is no file {0} extracted from the jar file at {1}.", HttpServerConfigFile, driverConfigurationSettings.JarFileFolder)); return; } if (!File.Exists(JobDriverConfigFile)) { Log.Log(Level.Warning, string.Format(CultureInfo.CurrentCulture, "There is no file {0} extracted from the jar file at {1}.", JobDriverConfigFile, driverConfigurationSettings.JarFileFolder)); return; } if (!File.Exists(NameServerConfigFile)) { Log.Log(Level.Warning, string.Format(CultureInfo.CurrentCulture, "There is no file {0} extracted from the jar file at {1}.", NameServerConfigFile, driverConfigurationSettings.JarFileFolder)); return; } AvroConfigurationSerializer serializer = new AvroConfigurationSerializer(); IClassHierarchy driverClassHierarchy = ProtocolBufferClassHierarchy.DeSerialize(DriverChFile); AvroConfiguration jobDriverAvroconfiguration = serializer.AvroDeserializeFromFile(JobDriverConfigFile); IConfiguration jobDriverConfiguration = serializer.FromAvro(jobDriverAvroconfiguration, driverClassHierarchy); AvroConfiguration httpAvroconfiguration = serializer.AvroDeserializeFromFile(HttpServerConfigFile); IConfiguration httpConfiguration = serializer.FromAvro(httpAvroconfiguration, driverClassHierarchy); AvroConfiguration nameAvroconfiguration = serializer.AvroDeserializeFromFile(NameServerConfigFile); IConfiguration nameConfiguration = serializer.FromAvro(nameAvroconfiguration, driverClassHierarchy); IConfiguration merged; if (driverConfigurationSettings.IncludingHttpServer && driverConfigurationSettings.IncludingNameServer) { merged = Configurations.MergeDeserializedConfs(jobDriverConfiguration, httpConfiguration, nameConfiguration); } else if (driverConfigurationSettings.IncludingHttpServer) { merged = Configurations.MergeDeserializedConfs(jobDriverConfiguration, httpConfiguration); } else if (driverConfigurationSettings.IncludingNameServer) { merged = Configurations.MergeDeserializedConfs(jobDriverConfiguration, nameConfiguration); } else { merged = jobDriverConfiguration; } var b = merged.newBuilder(); b.BindSetEntry("org.apache.reef.driver.parameters.DriverIdentifier", driverConfigurationSettings.DriverIdentifier); b.Bind("org.apache.reef.driver.parameters.DriverMemory", driverConfigurationSettings.DriverMemory.ToString(CultureInfo.CurrentCulture)); b.Bind("org.apache.reef.driver.parameters.DriverJobSubmissionDirectory", driverConfigurationSettings.SubmissionDirectory); // add for all the globallibaries if (File.Exists(UserSuppliedGlobalLibraries)) { var globalLibString = File.ReadAllText(UserSuppliedGlobalLibraries); if (!string.IsNullOrEmpty(globalLibString)) { foreach (string fname in globalLibString.Split(',')) { b.BindSetEntry("org.apache.reef.driver.parameters.JobGlobalLibraries", fname); } } } foreach (string f in Directory.GetFiles(driverConfigurationSettings.ClrFolder)) { b.BindSetEntry("org.apache.reef.driver.parameters.JobGlobalFiles", f); } IConfiguration c = b.Build(); serializer.ToFile(c, DriverConfigFile); Log.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "driver.config is written to: {0} {1}.", Directory.GetCurrentDirectory(), DriverConfigFile)); // additional file for easy to read using (StreamWriter outfile = new StreamWriter(DriverConfigFile + ".txt")) { outfile.Write(serializer.ToString(c)); } }
/// <summary>Shortcut to getting a configuration's properties</summary> public virtual ConfigurationProperties PropertiesFor(string configurationName) { return(Configurations.PropertiesFor(configurationName)); }
public ManifestHandler(Configurations config) { Config = config; LocalFileName = DateStampFile(GetFileName(config.Manifest), "_yyyyMMdd"); Logger = LogManager.GetLogger(typeof(ManifestHandler)); }
public BarrageManager(BarrageWindow parent, Size size, Configurations styleConf, Configurations actionConf) { renderer = new BarrageRenderer(styleConf); GlobalKeyHook.Instance.SetProcessor( styleConf.GetKeys("ReverseColor-Key", Keys.Control | Keys.Alt | Keys.W), k => { reverseColor = !reverseColor; renderer.BorderColor = Color.FromArgb( 255 - renderer.BorderColor.R, 255 - renderer.BorderColor.G, 255 - renderer.BorderColor.B); renderer.FillColor = Color.FromArgb( 255 - renderer.FillColor.R, 255 - renderer.FillColor.G, 255 - renderer.FillColor.B); parent.ShowNotice(reverseColor ? "颜色:反色" : "颜色:正常"); return true; } ); GlobalKeyHook.Instance.SetProcessor( styleConf.GetKeys("IncreaseAlpha-Key", Keys.Control | Keys.Alt | Keys.Oemplus), k => { float value = (float)Math.Round(renderer.Transparency + 0.1f, 1); if (value > 1.0f) value = 1.0f; renderer.Transparency = value; parent.ShowNotice("透明度:" + (renderer.Transparency * 100).ToString() + "%"); return true; } ); GlobalKeyHook.Instance.SetProcessor( styleConf.GetKeys("DecreaseAlpha-Key", Keys.Control | Keys.Alt | Keys.OemMinus), k => { float value = (float)Math.Round(renderer.Transparency - 0.1f, 1); if (value < 0.0f) value = 0.0f; renderer.Transparency = value; parent.ShowNotice("透明度:" + (renderer.Transparency * 100).ToString() + "%"); return true; } ); string style = styleConf.GetString("Style", "border-blur"); switch (style) { case "border-blur": this.barrageStyle = BarrageStyle.BorderBlur; break; case "border": this.barrageStyle = BarrageStyle.Border; break; default: this.barrageStyle = BarrageStyle.Shadow; break; } this.barrageHeight = styleConf.GetInt("Height", 40); this.speed = actionConf.GetInt("Speed", 5); this.maxTime = actionConf.GetInt("Max-Time", 560); this.maxWait = actionConf.GetInt("Max-Wait", 100); this.maxRenderWait = actionConf.GetInt("Max-RenderWait", 500); this.maxCount = actionConf.GetInt("Max-Count", 200); this.maxLength = actionConf.GetInt("Max-Length", 40); this.size = size; barrageLines = new BarrageLine[size.Height / barrageHeight]; for (int i = 0; i < barrageLines.Length; i++) barrageLines[i] = new BarrageLine(this); Visible = true; }
protected void Application_Start() { GlobalConfiguration.Configure(WebApiConfig.Register); Configurations.Register(); }
/// <summary> /// 根据设置项进行弹幕源的初始化,并开始接收弹幕评论。 /// </summary> /// <param name="configurations">包含CommentInput相关设置的设置项集合。</param> public virtual void Initialize(Configurations configurations) { }
public Sections(string SectionConfigurationFilePath) { Configurations Config = new Configurations(); }
public ProdutoController() { configurations = new Configurations(); }
/// <summary> /// Saves the Visual Studio solution to a file. /// </summary> /// <param name="writer">The <see cref="TextWriter" /> to save the solution file to.</param> /// <param name="useFolders">Specifies if folders should be created.</param> internal void Save(TextWriter writer, bool useFolders) { writer.WriteLine(Header, _fileFormatVersion); if (SolutionItems.Count > 0) { writer.WriteLine($@"Project(""{SlnFolder.FolderProjectTypeGuid}"") = ""Solution Items"", ""Solution Items"", ""{Guid.NewGuid().ToSolutionString()}"" "); writer.WriteLine(" ProjectSection(SolutionItems) = preProject"); foreach (string solutionItem in SolutionItems) { writer.WriteLine($" {solutionItem} = {solutionItem}"); } writer.WriteLine(" EndProjectSection"); writer.WriteLine("EndProject"); } foreach (SlnProject project in _projects.OrderBy(i => i.FullPath)) { writer.WriteLine($@"Project(""{project.ProjectTypeGuid.ToSolutionString()}"") = ""{project.Name}"", ""{project.FullPath}"", ""{project.ProjectGuid.ToSolutionString()}"""); writer.WriteLine("EndProject"); } SlnHierarchy hierarchy = null; if (useFolders && _projects.Any(i => !i.IsMainProject)) { hierarchy = new SlnHierarchy(_projects); foreach (SlnFolder folder in hierarchy.Folders) { writer.WriteLine($@"Project(""{folder.ProjectTypeGuid}"") = ""{folder.Name}"", ""{folder.FullPath}"", ""{folder.FolderGuid.ToSolutionString()}"""); writer.WriteLine("EndProject"); } } writer.WriteLine("Global"); if (useFolders && _projects.Count > 1 && hierarchy != null) { writer.WriteLine(@" GlobalSection(NestedProjects) = preSolution"); foreach (SlnFolder folder in hierarchy.Folders.Where(i => i.Parent != null)) { foreach (SlnProject project in folder.Projects) { writer.WriteLine($@" {project.ProjectGuid.ToSolutionString()} = {folder.FolderGuid.ToSolutionString()}"); } writer.WriteLine($@" {folder.FolderGuid.ToSolutionString()} = {folder.Parent.FolderGuid.ToSolutionString()}"); } writer.WriteLine(" EndGlobalSection"); } writer.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution"); HashSet <string> solutionPlatforms = Platforms != null && Platforms.Any() ? new HashSet <string>(GetValidSolutionPlatforms(Platforms), StringComparer.OrdinalIgnoreCase) : new HashSet <string>(GetValidSolutionPlatforms(_projects.SelectMany(i => i.Platforms)), StringComparer.OrdinalIgnoreCase); HashSet <string> solutionConfigurations = Configurations != null && Configurations.Any() ? new HashSet <string>(Configurations, StringComparer.OrdinalIgnoreCase) : new HashSet <string>(_projects.SelectMany(i => i.Configurations).Where(i => !i.IsNullOrWhiteSpace()), StringComparer.OrdinalIgnoreCase); foreach (string configuration in solutionConfigurations) { foreach (string platform in solutionPlatforms) { if (!string.IsNullOrWhiteSpace(configuration) && !string.IsNullOrWhiteSpace(platform)) { writer.WriteLine($" {configuration}|{platform} = {configuration}|{platform}"); } } } writer.WriteLine(" EndGlobalSection"); writer.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution"); foreach (SlnProject project in _projects) { string projectGuid = project.ProjectGuid.ToSolutionString(); foreach (string configuration in solutionConfigurations) { bool foundConfiguration = TryGetProjectSolutionConfiguration(configuration, project, out string projectSolutionConfiguration); foreach (string platform in solutionPlatforms) { bool foundPlatform = TryGetProjectSolutionPlatform(platform, project, out string projectSolutionPlatform, out string projectBuildPlatform); writer.WriteLine($@" {projectGuid}.{configuration}|{platform}.ActiveCfg = {projectSolutionConfiguration}|{projectSolutionPlatform}"); if (foundPlatform && foundConfiguration) { writer.WriteLine($@" {projectGuid}.{configuration}|{platform}.Build.0 = {projectSolutionConfiguration}|{projectBuildPlatform}"); } if (project.IsDeployable) { writer.WriteLine($@" {projectGuid}.{configuration}|{platform}.Deploy.0 = {projectSolutionConfiguration}|{projectSolutionPlatform}"); } } } } writer.WriteLine(" EndGlobalSection"); writer.WriteLine(" GlobalSection(SolutionProperties) = preSolution"); writer.WriteLine(" HideSolutionNode = FALSE"); writer.WriteLine(" EndGlobalSection"); writer.WriteLine(" GlobalSection(ExtensibilityGlobals) = postSolution"); writer.WriteLine($" SolutionGuid = {SolutionGuid.ToSolutionString()}"); writer.WriteLine(" EndGlobalSection"); writer.WriteLine("EndGlobal"); }
public async Task <dynamic> Dispatch(GetUserTransactionsByFilterMessage message, Configurations configurations) { using var context = new FinancialControlDataContext(configurations.DataConnectionString); using var dbConnection = new SqlConnection(configurations.DataConnectionString); var handler = new GetUserTransactionsByFilterMessageHandler(dbConnection); return(await handler.Execute(message)); }
static LCDController() { HeadlessConfig = new Configurations(); HeadlessConfig.Width = 0; HeadlessConfig.Height = 0; }
public IPhoneProject(string languageName, ProjectCreateInformation info, XmlElement projectOptions) : base(languageName, info, projectOptions) { Init(); var mainNibAtt = projectOptions.Attributes ["MainNibFile"]; if (mainNibAtt != null) { this.mainNibFile = mainNibAtt.InnerText; } var ipadNibAtt = projectOptions.Attributes ["MainNibFileIPad"]; if (ipadNibAtt != null) { this.mainNibFileIPad = ipadNibAtt.InnerText; } var supportedDevicesAtt = projectOptions.Attributes ["SupportedDevices"]; if (supportedDevicesAtt != null) { this.supportedDevices = (TargetDevice)Enum.Parse(typeof(TargetDevice), supportedDevicesAtt.InnerText); } var sdkVersionAtt = projectOptions.Attributes ["SdkVersion"]; IPhoneSdkVersion?sdkVersion = null; if (sdkVersionAtt != null) { sdkVersion = IPhoneSdkVersion.Parse(sdkVersionAtt.InnerText); } FilePath binPath = (info != null)? info.BinPath : new FilePath("bin"); int confCount = Configurations.Count; for (int i = 0; i < confCount; i++) { var simConf = (IPhoneProjectConfiguration)Configurations[i]; simConf.Platform = PLAT_SIM; var deviceConf = (IPhoneProjectConfiguration)simConf.Clone(); deviceConf.Platform = PLAT_IPHONE; deviceConf.CodesignKey = DEV_CERT_PREFIX; Configurations.Add(deviceConf); deviceConf.MtouchSdkVersion = simConf.MtouchSdkVersion = sdkVersion ?? IPhoneSdkVersion.UseDefault; if (simConf.Name == "Debug") { simConf.MtouchDebug = deviceConf.MtouchDebug = true; } simConf.MtouchLink = MtouchLinkMode.None; simConf.OutputDirectory = binPath.Combine(simConf.Platform, simConf.Name); deviceConf.OutputDirectory = binPath.Combine(deviceConf.Platform, deviceConf.Name); simConf.SanitizeAppName(); deviceConf.SanitizeAppName(); } }
public ProducerViewModel(Producer producer, Configurations.Role userRole) { Producer = producer; OriginalEmail = producer.Email; UserRole = userRole; }
//---------------------------------------------------------------------------------------------------------- #region Constructor public EndBattleState(TurnBasedFsm fsm, IGameData gameData, Configurations configurations) : base(fsm, gameData, configurations) { }
public ConsumerViewModel(Consumer consumer, Configurations.Role userRole) { Consumer = consumer; UserRole = userRole; OriginalEmail = consumer.Email; }
protected override void ProcessRecord() { parameters.UserName = HttpCredential.UserName; parameters.Password = HttpCredential.Password.ConvertToString(); if (RdpCredential != null) { parameters.RdpUsername = RdpCredential.UserName; parameters.RdpPassword = RdpCredential.Password.ConvertToString(); } if (OSType == OSType.Linux) { parameters.SshUserName = SshCredential.UserName; if (!string.IsNullOrEmpty(SshCredential.Password.ConvertToString())) { parameters.SshPassword = SshCredential.Password.ConvertToString(); } if (!string.IsNullOrEmpty(SshPublicKey)) { parameters.SshPublicKey = SshPublicKey; } } foreach ( var storageAccount in AdditionalStorageAccounts.Where( storageAccount => !parameters.AdditionalStorageAccounts.ContainsKey(storageAccount.Key))) { parameters.AdditionalStorageAccounts.Add(storageAccount.Key, storageAccount.Value); } foreach (var config in Configurations.Where(config => !parameters.Configurations.ContainsKey(config.Key))) { parameters.Configurations.Add(config.Key, config.Value); } foreach (var action in ScriptActions.Where(action => parameters.ScriptActions.ContainsKey(action.Key))) { parameters.ScriptActions.Add(action.Key, action.Value.Select(a => a.GetScriptActionFromPSModel()).ToList()); } if (OozieMetastore != null) { var metastore = OozieMetastore; parameters.OozieMetastore = new Metastore(metastore.SqlAzureServerName, metastore.DatabaseName, metastore.Credential.UserName, metastore.Credential.Password.ConvertToString()); } if (HiveMetastore != null) { var metastore = HiveMetastore; parameters.OozieMetastore = new Metastore(metastore.SqlAzureServerName, metastore.DatabaseName, metastore.Credential.UserName, metastore.Credential.Password.ConvertToString()); } if (CertificateFilePath != null && CertificatePassword != null) { Microsoft.Azure.Management.HDInsight.Models.ServicePrincipal servicePrincipal = new Microsoft.Azure.Management.HDInsight.Models.ServicePrincipal( GetApplicationId(), GetTenantId(AadTenantId), File.ReadAllBytes(CertificateFilePath), CertificatePassword); parameters.Principal = servicePrincipal; } var cluster = HDInsightManagementClient.CreateNewCluster(ResourceGroupName, ClusterName, parameters); if (cluster != null) { WriteObject(new AzureHDInsightCluster(cluster.Cluster)); } }
public async Task<IActionResult> Edit(ProducerViewModel vmProducer, IFormFile uploadFile, Configurations.Role UserRole) { if (ModelState.IsValid) { if (uploadFile != null) { string uploads = Path.Combine(_environment.WebRootPath, Configurations.UserAvatarStockagePath); //Deleting old image string oldImage = Path.Combine(uploads, vmProducer.Producer.Avatar); if (System.IO.File.Exists(oldImage) && vmProducer.Producer.Avatar != Path.Combine(Configurations.UserAvatarStockagePath, Configurations.DefaultFileName)) System.IO.File.Delete(Path.Combine(uploads, vmProducer.Producer.Avatar)); //Image uploading string fileName = Guid.NewGuid().ToString() + "_" + ContentDispositionHeaderValue.Parse(uploadFile.ContentDisposition).FileName.Trim('"'); await uploadFile.SaveAsAsync(Path.Combine(uploads, fileName)); //Setting new value, saving vmProducer.Producer.Avatar = Path.Combine(Configurations.UserAvatarStockagePath, fileName); } ApplicationUser producerAppUser = _context.Users.First(x => x.Email == vmProducer.OriginalEmail); producerAppUser.Email = vmProducer.Producer.Email; _context.Update(producerAppUser); //Getting actual roles IList<string> roles = await _userManager.GetRolesAsync(producerAppUser); if (!roles.Contains(UserRole.ToString())) { string roleToRemove = roles.FirstOrDefault(x => Configurations.GetRoles().Contains(x)); await _userManager.RemoveFromRoleAsync(producerAppUser, roleToRemove); //Add user role await _userManager.AddToRoleAsync(producerAppUser, UserRole.ToString()); } _context.Update(vmProducer.Producer); _context.SaveChanges(); return RedirectToAction("Index"); } return View(vmProducer); }
public async Task<IActionResult> ChangeProducerInformations(ProducerViewModel producerVm, IFormFile uploadFile, Configurations.Role UserRole) { if (ModelState.IsValid) { if (uploadFile != null) { //Deleting old image string oldImage = Path.Combine(_environment.WebRootPath, Configurations.UserAvatarStockagePath, producerVm.Producer.Avatar); if (System.IO.File.Exists(oldImage) && producerVm.Producer.Avatar != Path.Combine(Configurations.UserAvatarStockagePath, Configurations.DefaultFileName)) System.IO.File.Delete(Path.Combine(_environment.WebRootPath, Configurations.UserAvatarStockagePath, producerVm.Producer.Avatar)); //Image uploading string fileName = await Configurations.UploadAndResizeImageFile(_environment, uploadFile, Configurations.UserAvatarStockagePath); //Setting new value, saving producerVm.Producer.Avatar = Path.Combine( fileName); } ApplicationUser appUser = _context.Users.First(x => x.Email == producerVm.OriginalEmail); appUser.Email = producerVm.Producer.Email; _context.Update(appUser); //Getting actual roles IList<string> roles = await _userManager.GetRolesAsync(appUser); if (!roles.Contains(UserRole.ToString())) { string roleToRemove = roles.FirstOrDefault(x => Configurations.GetRoles().Contains(x)); await _userManager.RemoveFromRoleAsync(appUser, roleToRemove); //Add user role await _userManager.AddToRoleAsync(appUser, UserRole.ToString()); } _context.Update(producerVm.Producer); _context.SaveChanges(); return RedirectToAction("Index"); } return View(producerVm); }