public void ShowDatabaseInformation(OperationParameters AOperationParameters) { string LStrCollationName = string.Empty; string LStrCollationDescription = string.Empty; try { DataTable LDataTableCollations = ((DataSet)AOperationParameters.ObjectSource2).Tables[0]; IListStrServerInformation = AOperationParameters.ObjectSource1 as List <string>; ComboBoxItem LComboBoxItemDefaultCollation = new ComboBoxItem(); ComboBoxCollations.Items.Clear(); foreach (DataRow LDataRowSingleCollations in LDataTableCollations.Rows) { ComboBoxItem LComboBoxItemSingleCollationItem = new ComboBoxItem(); LComboBoxItemSingleCollationItem.Style = (Style)App.Current.Resources["ComboBoxItemFontStyle"]; LStrCollationName = LDataRowSingleCollations[1].ToString(); LStrCollationDescription = LDataRowSingleCollations[5].ToString(); LComboBoxItemSingleCollationItem.Content = LStrCollationName; LComboBoxItemSingleCollationItem.DataContext = LStrCollationName; LComboBoxItemSingleCollationItem.ToolTip = LStrCollationDescription; ComboBoxCollations.Items.Add(LComboBoxItemSingleCollationItem); if (LStrCollationName == IListStrServerInformation[1]) { LComboBoxItemDefaultCollation = LComboBoxItemSingleCollationItem; } } ComboBoxCollations.SelectedItem = LComboBoxItemDefaultCollation; TextBoxDataPath.Text = IListStrServerInformation[2]; TextBoxLogPath.Text = IListStrServerInformation[3]; } catch { } }
public void ShowConfirmInformation(List <string> AListStrDatabaseServerProfile, OperationParameters AOperationParameters22, OperationParameters AOperationParameters23) { string LStrVerificationCode104 = string.Empty; try { LStrVerificationCode104 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104); GridConfirmInformation.IsEnabled = false; IBoolHaveError = false; IParameterStep22 = AOperationParameters22; IParameterStep23 = AOperationParameters23; TextBoxServerName.Text = EncryptionAndDecryption.EncryptDecryptString(AListStrDatabaseServerProfile[0], LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104); TextBoxServerPort.Text = EncryptionAndDecryption.EncryptDecryptString(AListStrDatabaseServerProfile[1], LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104); IPageParent.ShowWaitProgressBar(true); IBackgroundWorkerObtainDatabasesLogins = new BackgroundWorker(); IBackgroundWorkerObtainDatabasesLogins.RunWorkerCompleted += IBackgroundWorkerObtainDatabasesLogins_RunWorkerCompleted; IBackgroundWorkerObtainDatabasesLogins.DoWork += IBackgroundWorkerObtainDatabasesLogins_DoWork; IBackgroundWorkerObtainDatabasesLogins.RunWorkerAsync(AListStrDatabaseServerProfile); } catch { IPageParent.ShowWaitProgressBar(false); GridConfirmInformation.IsEnabled = true; IBoolHaveError = true; if (IBackgroundWorkerObtainDatabasesLogins != null) { IBackgroundWorkerObtainDatabasesLogins.Dispose(); IBackgroundWorkerObtainDatabasesLogins = null; } } }
public void Execute(OperationParameters parameters) { var inputStream = File.OpenRead(parameters.InputFileName); var outputStream = File.Create(parameters.OutputFileName); blockStreamWriter.Initialize(outputStream); int inputBlockSize = parameters.InputBlockSize; int blocksCount = (int)(inputStream.Length / inputBlockSize) + (inputStream.Length % inputBlockSize == 0 ? 0 : 1); int lastInputBlockSize = (int)(inputStream.Length - inputBlockSize * (blocksCount - 1)); bufferPool.Initialize(Math.Min(threadPool.WorkersCount, blocksCount) * 3, inputBlockSize); logger.Debug($"{nameof(CompressOperationExecutor)}. Number of blocks {blocksCount}"); outputStream.Write(BitConverter.GetBytes(inputStream.Length)); outputStream.Write(BitConverter.GetBytes(inputBlockSize)); for (int blockNumber = 0; blockNumber < blocksCount; blockNumber++) { var inputBlock = bufferPool.Take(); int currentInputBlockSize = blockNumber == blocksCount - 1 ? lastInputBlockSize : inputBlockSize; inputBlock.FillFrom(inputStream, currentInputBlockSize); var outputBlock = bufferPool.Take(); int number = blockNumber; threadPool.Enqueue(() => CompressBlock(inputBlock, number, outputBlock)); } inputStream.Close(); threadPool.Wait(); blockStreamWriter.Wait(blocksCount); outputStream.Close(); }
private void OnEnable() { Logger.Log("Lighting system enabled.", Category.Lighting); //don't run lighting system on headless if (GameData.IsHeadlessServer) { return; } OnLightingSystemEnabled?.Invoke(true); if (!SystemInfo.supportsAsyncGPUReadback) { Logger.LogWarning("LightingSystem: Async GPU Readback not supported on this machine, slower synchronous readback will" + " be used instead.", Category.Lighting); } HandlePPPositionRequest += ProviderPPPosition; // Initialize members. mMainCamera = gameObject.GetComponent <Camera>(); if (mMainCamera == null) { throw new Exception("FovSystemManager require Camera component to operate."); } // Let's force camera to cull background light mMainCamera.cullingMask &= ~renderSettings.backgroundLayers; // Now validate other settings ValidateMainCamera(mMainCamera, renderSettings); if (mOcclusionRenderer == null) { mOcclusionRenderer = OcclusionMaskRenderer.InitializeMaskRenderer(gameObject, renderSettings.occlusionLayers, materialContainer.OcclusionMaskShader); } if (mLightMaskRenderer == null) { mLightMaskRenderer = LightMaskRenderer.InitializeMaskRenderer(gameObject); } if (mBackgroundRenderer == null) { mBackgroundRenderer = BackgroundRenderer.InitializeMaskRenderer(gameObject); } if (mPostProcessingStack == null) { mPostProcessingStack = new PostProcessingStack(materialContainer); } if (!renderSettings.disableAsyncGPUReadback && SystemInfo.supportsAsyncGPUReadback) { mTextureDataRequest = new TextureDataRequest(); } operationParameters = new OperationParameters(mMainCamera, renderSettings, matrixRotationMode);; ResolveRenderingTextures(operationParameters); }
private void OnDisable() { Logger.Log("Lighting system disabled.", Category.Lighting); //don't run lighting system on headless if (GameData.IsHeadlessServer) { return; } OnLightingSystemEnabled?.Invoke(false); // Set object occlusion white, so occlusion dependent shaders will show appropriately while system is off. Shader.SetGlobalTexture("_ObjectFovMask", Texture2D.whiteTexture); // Default parameters to force parameters update on enable. operationParameters = default(OperationParameters); HandlePPPositionRequest -= ProviderPPPosition; // We can enable background layers again if (mMainCamera) { mMainCamera.cullingMask |= renderSettings.backgroundLayers; } if (mTextureDataRequest != null) { mTextureDataRequest.Dispose(); mTextureDataRequest = null; } }
/// <summary> /// Generates the final FOV occlusion Mask and stores it in iGlobalOcclusionMaskExtended. Note that this does not apply the PPRT Transform.shader. /// </summary> /// <param name="iRawOcclusionMask">Raw occlusion mask where red indicates walls and black indicates floors.</param> /// <param name="iFloorOcclusionMask">will be used to hold the occlusion mask where only the floor occlusion has been calculated</param> /// <param name="iWallFloorOcclusionMask">will hold the occlusion mask which calcualtes occlusion for walls + floors</param> /// <param name="iRenderSettings"></param> /// <param name="iFovCenterInViewSpace"></param> /// <param name="iFovDistance"></param> /// <param name="iOperationParameters"></param> public void GenerateFovMask( PixelPerfectRT iRawOcclusionMask, PixelPerfectRT iFloorOcclusionMask, PixelPerfectRT iWallFloorOcclusionMask, RenderSettings iRenderSettings, Vector3 iFovCenterInViewSpace, float iFovDistance, OperationParameters iOperationParameters) { mMaterialContainer.floorFovMaterial.SetVector("_PositionOffset", iFovCenterInViewSpace); mMaterialContainer.floorFovMaterial.SetFloat("_OcclusionSpread", iRenderSettings.fovOcclusionSpread); // Adjust scale from Extended mask to Screen size mask. float _yUVScale = 1 / ((float)iFloorOcclusionMask.renderTexture.width / iFloorOcclusionMask.renderTexture.height); Vector3 _adjustedDistance = iFovDistance * iOperationParameters.cameraViewportUnitsInWorldSpace * iRawOcclusionMask.orthographicSize / iFloorOcclusionMask.orthographicSize; mMaterialContainer.floorFovMaterial.SetVector("_Distance", new Vector3(_adjustedDistance.x, _yUVScale, iRenderSettings.fovHorizonSmooth)); iRawOcclusionMask.renderTexture.filterMode = FilterMode.Bilinear; PixelPerfectRT.Blit(iRawOcclusionMask, iFloorOcclusionMask, mMaterialContainer.floorFovMaterial); //second pass to handle walls mMaterialContainer.fovMaterial.SetVector("_PositionOffset", iFovCenterInViewSpace); iFloorOcclusionMask.renderTexture.filterMode = FilterMode.Bilinear; PixelPerfectRT.Blit(iFloorOcclusionMask, iWallFloorOcclusionMask, mMaterialContainer.fovMaterial); }
private void Update() { // Monitor state to detect when we should trigger reinitialization of rendering textures. var _newParameters = new OperationParameters(mMainCamera, renderSettings, matrixRotationMode); bool _shouldReinitializeTextures = _newParameters != operationParameters; if (_shouldReinitializeTextures) { operationParameters = _newParameters; ResolveRenderingTextures(operationParameters); } // Blend switch for matrix rotation effects. // Used to smooth effects in and out. if (mMatrixRotationMode == true) { mMatrixRotationModeBlend = Mathf.MoveTowards(mMatrixRotationModeBlend, 1, Time.unscaledDeltaTime * 5); } else { mMatrixRotationModeBlend = 0; } }
public async Task Init(Block block, RawOperation op, RawTransactionContent content) { var sender = await Cache.Accounts.GetAsync(content.Source); sender.Delegate ??= Cache.Accounts.GetDelegate(sender.DelegateId); var target = await Cache.Accounts.GetAsync(content.Destination); if (target != null) { target.Delegate ??= Cache.Accounts.GetDelegate(target.DelegateId); } Transaction = new TransactionOperation { Id = Cache.AppState.NextOperationId(), Block = block, Level = block.Level, Timestamp = block.Timestamp, OpHash = op.Hash, Amount = content.Amount, BakerFee = content.Fee, Counter = content.Counter, GasLimit = content.GasLimit, StorageLimit = content.StorageLimit, Sender = sender, Target = target, Parameters = OperationParameters.Parse(content.Parameters), Status = content.Metadata.Result.Status switch { "applied" => OperationStatus.Applied, "failed" => OperationStatus.Failed, _ => throw new NotImplementedException() },
protected override Command BuildCommand(OperationParameters operationParameters) { Arguments args = UnrealArguments.MakeArguments(operationParameters, GetOutputPath(operationParameters)); args.SetFlag("windowed"); args.SetKeyValue("resx", "1920", false); args.SetKeyValue("resy", "1080", false); return(new Command(GetProject(operationParameters).GetStagedPackageExecutablePath(), args)); }
protected override Command BuildCommand(OperationParameters operationParameters) { Arguments args = new Arguments(); args.SetArgument(GetTargetName(operationParameters) + "Editor"); args.SetArgument("Win64"); args.SetArgument(operationParameters.Configuration.ToString()); args.SetPath(GetProject(operationParameters).UProjectPath); return(new Command(GetProject(operationParameters).GetEngineInstall().GetBuildPath(), args)); }
private void OnDisable() { // Set object occlusion white, so occlusion dependent shaders will show appropriately while system is off. Shader.SetGlobalTexture("_ObjectFovMask", Texture2D.whiteTexture); // Default parameters to force parameters update on enable. operationParameters = default(OperationParameters); HandlePPPositionRequest -= ProviderPPPosition; }
protected override Command BuildCommand(OperationParameters operationParameters) { Arguments args = UnrealArguments.MakeArguments(operationParameters, GetOutputPath(operationParameters), true); args.SetFlag("game"); args.SetFlag("windowed"); args.SetKeyValue("resx", "1920", false); args.SetKeyValue("resy", "1080", false); return(new Command(EnginePaths.GetEditorExe(GetProject(operationParameters).GetEngineInstall(), operationParameters), args)); }
protected override Command BuildCommand(OperationParameters operationParameters) { Arguments args = new Arguments(); args.SetFlag("projectfiles"); args.SetKeyPath("project", GetProject(operationParameters).UProjectPath); args.SetFlag("game"); args.SetFlag("rocket"); args.SetFlag("progress"); return(new Command(GetProject(operationParameters).GetEngineInstall().GetUBTExe(), args)); }
protected override Command BuildCommand(OperationParameters operationParameters) { Arguments arguments = UATArguments.MakeArguments(operationParameters); arguments.SetFlag("cook"); arguments.SetFlag("stage"); arguments.SetFlag("pak"); arguments.SetFlag("package"); arguments.SetFlag("nocompileeditor"); return(new Command(GetProject(operationParameters).GetEngineInstall().GetRunUATPath(), arguments)); }
protected override Command BuildCommand(OperationParameters operationParameters) { //Engine\Build\BatchFiles\RunUAT.bat BuildPlugin -Plugin=[Path to .uplugin file, must be outside engine directory] -Package=[Output directory] -Rocket Arguments buildPluginArguments = new Arguments(); buildPluginArguments.SetArgument("BuildPlugin"); buildPluginArguments.SetKeyPath("Plugin", GetPlugin(operationParameters).UPluginPath); buildPluginArguments.SetKeyPath("Package", GetOutputPath(operationParameters)); buildPluginArguments.SetFlag("Rocket"); return(new Command(GetPlugin(operationParameters).PluginDescriptor.GetRunUATPath(), buildPluginArguments)); }
public static async Task SendTelemetry() { var sendTelemetry = new SendTelemetryOperation(context); var operationParameters = new OperationParameters(); operationParameters.Arguments.Add("deviceid", deviceId); operationParameters.Arguments.Add("deviceKey", deviceKey); operationParameters.Arguments.Add("message", "sample"); await sendTelemetry.ExecuteAsync(operationParameters); Console.WriteLine("Successfully sent"); }
public void DeserializeRequest(Message message, object[] parameters) { DeserializeMessageProperties(message, parameters); Converter.DeserializeRequest(ReadMessageBinaryHelper(message), parameters); var requestParameter = OperationParameters.FirstOrDefault(p => !p.IsFromProperty && p.IsRequired && parameters[p.Index] == null); if (requestParameter.IsRequired) { throw new ArgumentException("Required parameter was not provided.", requestParameter.Name); } }
public bool Initialize(string familyName, FluidInfo baseInfo, FluidRenderer renderer) { this.familyName = familyName; string result = null; BeginSimulatorProfilerSample(); Profiler.BeginSample("Initialize"); if (baseInfo == null) { result = "Attempting to initialize FluidSimulator without valid info"; } fluidParameters = baseInfo.fluidParameters; cellParameters = baseInfo.cellParameters; operationParameters = baseInfo.operationParameters; operationFlags = baseInfo.operationFlags; if (string.IsNullOrEmpty(result) && this.renderer != null) { result = "Attempting to re-initialize a FluidSimulator"; } if (string.IsNullOrEmpty(result)) { cellParameters.cellSize = fluidParameters.physicalSize / fluidParameters.gridSize; fluidParameters.container = fluidParameters.container ?? transform; // TODO Renderer stuff should probably just be handled by the dispatcher ... if simulator and renderer can be complete ignorant of each other, that would be best. This may not be possible as the Collider depends on both the renderer and the simulator. this.renderer = renderer; this.renderer.transform.parent = fluidParameters.container; this.renderer.gameObject.name = string.Format("{0} Renderer", familyName); result = this.renderer.Initialize(this, baseInfo); } Profiler.BeginSample("InitializeBuffers"); result = initializeBuffers(); if (!string.IsNullOrEmpty(result)) { EndSimulatorProfilerSample(); result = string.Format("Failed to initialize buffers: {0}", result); } Profiler.EndSample(); EndSimulatorProfilerSample(); if (!string.IsNullOrEmpty(result)) { Debug.LogError(result); return(false); } return(true); }
public NotificationDefinitionAggregate ToDomain() { return(new NotificationDefinitionAggregate { Name = Name, Priority = Priority, Rendering = Rendering, OperationParameters = OperationParameters.Select(_ => _.ToDomain()).ToList(), PeopleAssignments = PeopleAssignments.Select(_ => _.ToDomain()).ToList(), PresentationElements = PresentationElements.Select(_ => _.ToDomain()).ToList(), PresentationParameters = PresentationParameters.Select(_ => _.ToDomain()).ToList() }); }
/// <summary> /// Initialize a new instance of the OperationManager class. /// </summary> static OperationManager() { // This object is used by the System.Monitor methods that control multithreaded access to the data in this class. OperationManager.syncRoot = new Object(); // These are the initial operating parameters for the business rules. OperationParameters operatingParameters = new OperationParameters(); operatingParameters.AreBusinessRulesActive = true; operatingParameters.IsCrossingActive = true; operatingParameters.IsChatActive = true; OperationManager.OperatingParameters = operatingParameters; }
private void ResolveRenderingTextures(OperationParameters iParameters) { // Prepare render textures. occlusionMaskExtended = new PixelPerfectRT(operationParameters.fovPPRTParameter); globalOcclusionMask = new PixelPerfectRT(operationParameters.lightPPRTParameter); obstacleLightMask = new PixelPerfectRT(operationParameters.obstacleLightPPRTParameter); // Let members handle their own textures. // Possibly move to container? mPostProcessingStack.ResetRenderingTextures(iParameters); mBackgroundRenderer.ResetRenderingTextures(iParameters); }
private void ResolveRenderingTextures(OperationParameters iParameters) { // Prepare render textures. floorOcclusionMask = new PixelPerfectRT(operationParameters.fovPPRTParameter); wallFloorOcclusionMask = new PixelPerfectRT(operationParameters.fovPPRTParameter); mTex2DWallFloorOcclusionMask = new Texture2D(wallFloorOcclusionMask.renderTexture.width, wallFloorOcclusionMask.renderTexture.height, TextureFormat.RGB24, false); objectOcclusionMask = new PixelPerfectRT(operationParameters.lightPPRTParameter); obstacleLightMask = new PixelPerfectRT(operationParameters.obstacleLightPPRTParameter); // Let members handle their own textures. // Possibly move to container? mPostProcessingStack.ResetRenderingTextures(iParameters); mBackgroundRenderer.ResetRenderingTextures(iParameters); }
private void OnDisable() { Logger.Log("Lighting system disabled.", Category.Lighting); //don't run lighting system on headless if (GameData.IsHeadlessServer) { return; } // Set object occlusion white, so occlusion dependent shaders will show appropriately while system is off. Shader.SetGlobalTexture("_ObjectFovMask", Texture2D.whiteTexture); // Default parameters to force parameters update on enable. operationParameters = default(OperationParameters); HandlePPPositionRequest -= ProviderPPPosition; }
public static async Task ProcessOperation(string operationSelected) { var operationParameters = new OperationParameters(); switch (operationSelected) { case ProvisionDevice: Console.WriteLine("Plese enter device Id"); var input = Console.ReadLine(); var provisionDevice = new CreateDeviceOperation(context); operationParameters.Arguments.Add("deviceid", input); Console.WriteLine("Do you want to auto generate Key? (Y or N) "); var selection = Console.Read(); switch (selection) { case 'Y': operationParameters.Arguments.Add("auto", true); await provisionDevice.ExecuteAsync(operationParameters); break; case 'N': operationParameters.Arguments.Add("auto", false); //Console.WriteLine("Please enter device Key"); var deviceKey = "PVjPkqj3loB1P0VJzMAkIg=="; operationParameters.Arguments.Add("deviceKey", deviceKey); await provisionDevice.ExecuteAsync(operationParameters); break; default: Console.WriteLine("Wrong input"); break; } break; case SendCommand: var sendCommandOperation = new SendCommandOperation(context); operationParameters.Arguments["deviceid"] = "T5720022"; operationParameters.Arguments["commandtoexecute"] = "Command"; Console.WriteLine("Sending Command"); await sendCommandOperation.ExecuteAsync(operationParameters); Console.WriteLine("Successfully sent command"); break; } }
public void ResetRenderingTextures(OperationParameters iParameters) { // Prepare and assign RenderTexture. int _textureWidth = iParameters.screenSize.x; int _textureHeight = iParameters.screenSize.y; var _newRenderTexture = new RenderTexture(_textureWidth, _textureHeight, 0, RenderTextureFormat.Default); _newRenderTexture.name = "Background Mask"; _newRenderTexture.autoGenerateMips = false; _newRenderTexture.useMipMap = false; // Note: Assignment will release previous texture if exist. mask = _newRenderTexture; mMaskCamera.orthographicSize = iParameters.cameraOrthographicSize; }
private void btn_deleteFase_Click(object sender, EventArgs e) { //if gridview has data if (dgv_FaseArticles.DataSource == null) { return; } if (dgv_FaseArticles.Rows.Count == 0) { return; } var dr = MessageBox.Show("Are you sure you want to delete article phase '" + cmb_Fase.Text + "'?", "ArticlePhase", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) { return; } var fase = (from line in Tables.TblOperatii where line.Operatie == dgv_FaseArticles.SelectedRows[0].Cells[0].Value.ToString() select line).Single(); OperationParameters oper = Exacta.Menu.db.GetTable <OperationParameters>().Single(articol => articol.IdArticol.ToString() == _selectedArticle && articol.IdOperatie == fase.Id); Tables.TblOperatiiArticole.DeleteOnSubmit(oper); Exacta.Menu.db.SubmitChanges(); //List<OperatiiArticole> art = null; //art = Exacta.Menu.db.GetTable<OperatiiArticole>().Where(operation => operation.IdArticol.ToString() == _selectedArticle).ToList(); //lstFases = new List<FaseForArticle>(); //for (var i = 0; i < art.Count; i++) // { // Operatii opers = Exacta.Menu.db.GetTable<Operatii>().Where(operation => operation.Id == art[i].IdOperatie).Single(); // FaseForArticle f = new FaseForArticle(opers.Operatie, art[i].BucatiOra, art[i].Centes); // lstFases.Add(f); // } //dgv_FaseArticles.DataSource = lstFases; loadArticleFase(); }
public void Execute(OperationParameters parameters) { var inputStream = File.OpenRead(parameters.InputFileName); var inputStreamReader = new BinaryReader(inputStream); long dataSize = inputStreamReader.ReadInt64(); int outputBlockSize = inputStreamReader.ReadInt32(); int blocksCount = (int)(dataSize / outputBlockSize) + (dataSize % outputBlockSize == 0 ? 0 : 1); int lastOutputBlockSize = (int)(dataSize - outputBlockSize * (blocksCount - 1)); logger.Debug($"{nameof(DecompressOperationExecutor)}. Number of blocks {blocksCount}"); var outputStream = File.Create(parameters.OutputFileName); blockStreamWriter.Initialize(outputStream); bufferPool.Initialize(Math.Min(threadPool.WorkersCount, blocksCount) * 3, outputBlockSize); for (int blockNumber = 0; blockNumber < blocksCount; blockNumber++) { var inputBlock = bufferPool.Take(); int inputBlockSize = inputStreamReader.ReadInt32(); inputBlock.FillFrom(inputStream, inputBlockSize); var outputBlock = bufferPool.Take(); int currentOutputBlockSize = blockNumber == blocksCount - 1 ? lastOutputBlockSize : outputBlockSize; int number = blockNumber; threadPool.Enqueue(() => DecompressBlock(inputBlock, number, outputBlock, currentOutputBlockSize)); logger.Debug($"{nameof(DecompressOperationExecutor)}. Block {number}: input size {inputBlockSize}, output size {outputBlockSize}"); } inputStream.Close(); threadPool.Wait(); blockStreamWriter.Wait(blocksCount); var resultDataSize = outputStream.Length; outputStream.Close(); if (dataSize != resultDataSize) { throw new InvalidDataException($"Decompressed data size is {resultDataSize}, but expected {dataSize}"); } }
public async Task ExecuteAsync(OperationParameters parameters) { try { var deviceId = parameters.Arguments["deviceid"].ToString(); if (string.IsNullOrWhiteSpace(deviceId)) { throw new ArgumentNullException("deviceid"); } var autoGenerateDevicekey = Convert.ToBoolean(parameters.Arguments["auto"]); if (autoGenerateDevicekey) { var device = new Microsoft.Azure.Devices.Device(deviceId); device.Authentication = new Microsoft.Azure.Devices.AuthenticationMechanism(); device.Authentication.SymmetricKey.PrimaryKey = CryptoKeyGenerator.GenerateKey(32); device.Authentication.SymmetricKey.SecondaryKey = CryptoKeyGenerator.GenerateKey(32); var devices = await this.IoTHubContext.RegistryManager.AddDeviceAsync(device); } else { var deviceKey = parameters.Arguments["deviceKey"].ToString(); if (string.IsNullOrWhiteSpace(deviceKey)) { throw new ArgumentNullException("devicekey"); } var device = new Microsoft.Azure.Devices.Device(deviceId); device.Authentication = new Microsoft.Azure.Devices.AuthenticationMechanism(); device.Authentication.SymmetricKey.PrimaryKey = deviceKey; device.Authentication.SymmetricKey.SecondaryKey = deviceKey; var devices = await this.IoTHubContext.RegistryManager.AddDeviceAsync(device); } } catch (Exception exception) { // return Task.FromResult(true); } }
public async Task ExecuteAsync(OperationParameters parameters) { try { var deviceId = parameters.Arguments["deviceid"].ToString(); if (string.IsNullOrWhiteSpace(deviceId)) { throw new ArgumentNullException("deviceid"); } var autoGenerateDevicekey = Convert.ToBoolean(parameters.Arguments["auto"]); if (autoGenerateDevicekey) { var device = new Microsoft.Azure.Devices.Device(deviceId); device.Authentication = new Microsoft.Azure.Devices.AuthenticationMechanism(); device.Authentication.SymmetricKey.PrimaryKey = CryptoKeyGenerator.GenerateKey(32); device.Authentication.SymmetricKey.SecondaryKey = CryptoKeyGenerator.GenerateKey(32); var devices = await this.IoTHubContext.RegistryManager.AddDeviceAsync(device); } else { var deviceKey = parameters.Arguments["deviceKey"].ToString(); if (string.IsNullOrWhiteSpace(deviceKey)) { throw new ArgumentNullException("devicekey"); } var device = new Microsoft.Azure.Devices.Device(deviceId); device.Authentication = new Microsoft.Azure.Devices.AuthenticationMechanism(); device.Authentication.SymmetricKey.PrimaryKey = deviceKey; device.Authentication.SymmetricKey.SecondaryKey = deviceKey; var devices = await this.IoTHubContext.RegistryManager.AddDeviceAsync(device); } } catch (Exception exception) { // return Task.FromResult(true); } }
// // 再定義メソッド // /// <summary> /// 操作可能かを返す /// </summary> /// <returns>操作の可否</returns> public override sealed bool CanOperate() { if (effective == false) { return(true); } if (OperationParameters.ContainsKey(PARAMETER_INPUT) == false || string.IsNullOrWhiteSpace(UseCaseCatalogFilePath)) { Console.Error.WriteLine(Resources.Resources.Message_InputParameterIsRequired); return(false); } var useCaseCatalogFilePath = Path.GetFullPath(Utilities.TryToNormalizeFilePath(UseCaseCatalogFilePath)); if (File.Exists(useCaseCatalogFilePath) == false) { Console.Error.WriteLine(string.Format(Resources.Resources.Message_Format_NotFoundUseCaseCatalog, useCaseCatalogFilePath)); return(false); } OperationParameters[PARAMETER_INPUT] = useCaseCatalogFilePath; if (OperationParameters.ContainsKey(PARAMETER_OUTPUT)) { var outputDirPath = OperationParameters[PARAMETER_OUTPUT] as string; if (string.IsNullOrWhiteSpace(outputDirPath)) { Console.Error.WriteLine(Resources.Resources.Message_OutputParameterRequiresPath); return(false); } var outputDirFullPath = Path.GetFullPath(outputDirPath); if (Directory.Exists(outputDirFullPath) == false) { Console.Error.WriteLine(string.Format(Resources.Resources.Message_Format_NotExistOutputDirectory, outputDirFullPath)); return(false); } OperationParameters[PARAMETER_OUTPUT] = outputDirFullPath; } return(DoCanOperate()); }
public static Arguments MakeArguments(OperationParameters operationParameters) { Arguments arguments = new Arguments(); arguments.SetArgument("BuildCookRun"); if (operationParameters.Target is Project project) { arguments.SetKeyPath("project", project.UProjectPath); } arguments.SetFlag("build"); string configuration = operationParameters.Configuration.ToString(); arguments.SetKeyValue("clientconfig", configuration); arguments.SetKeyValue("serverconfig", configuration); if (!string.IsNullOrWhiteSpace(operationParameters.AdditionalArguments)) { arguments.AddRawArgsString(operationParameters.AdditionalArguments); } return(arguments); }