From 5936ba43df6d5684a9279fe65c785bc81160ea32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Thu, 23 Nov 2017 16:06:42 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30761 --- client/AudioRecorder/FileNameForm.cs | 3 +- client/AudioRecorder/MainForm.cs | 1 - .../Configuration/configuration-nle.json | 12 +- .../configuration-playout-ingest.json | 2 +- .../Configuration/configuration-sxs.json | 2 +- client/Maestro/MaestroForm.Designer.cs | 112 +++++++++--------- client/Maestro/MaestroForm.Metadata.cs | 5 +- client/Maestro/MaestroForm.Target.cs | 18 +-- client/Maestro/MaestroForm.resx | 8 +- client/Maestro/Program.cs | 20 ++-- .../MaestroShared/Commons/PatterNameMaker.cs | 56 +++++++++ .../Configuration/ConfigurationInfo.cs | 16 ++- client/MaestroShared/MaestroShared.csproj | 1 + .../Targets/FTPTargetProcessor.cs | 25 ++-- .../MaestroShared/Targets/TargetProcessor.cs | 2 +- .../Targets/UNCTargetProcessor.cs | 88 ++++++++------ client/OctopusClient/CheckableTreeView.cs | 33 ++---- client/OctopusClient/OctopusClient.csproj | 2 +- .../OctopusIDSelector.Designer.cs | 3 +- client/OctopusClient/OctopusIDSelector.cs | 97 +++++++++++---- ...sConfiguration.cs => OctopusParameters.cs} | 3 +- 21 files changed, 316 insertions(+), 193 deletions(-) create mode 100644 client/MaestroShared/Commons/PatterNameMaker.cs rename client/OctopusClient/{OctopusConfiguration.cs => OctopusParameters.cs} (71%) diff --git a/client/AudioRecorder/FileNameForm.cs b/client/AudioRecorder/FileNameForm.cs index 7f16074c..ee798766 100644 --- a/client/AudioRecorder/FileNameForm.cs +++ b/client/AudioRecorder/FileNameForm.cs @@ -16,7 +16,8 @@ namespace AudioRecorder { this.settings = settings; this.mainForm = mainForm; octopusIDSelector1.IDChangedEvent = IdChangedEvent; - octopusIDSelector1.Properties = new OctopusConfiguration() { + octopusIDSelector1.Parameters = new OctopusParameters() { + UserName = "Hangalámondó", Configuration = new OctopusMetadata() { Server = new Connection() { Address = settings.getAddress(), diff --git a/client/AudioRecorder/MainForm.cs b/client/AudioRecorder/MainForm.cs index a645dcee..76ae5b82 100644 --- a/client/AudioRecorder/MainForm.cs +++ b/client/AudioRecorder/MainForm.cs @@ -5,7 +5,6 @@ using System.Drawing; using NAudio.CoreAudioApi; using System.Windows.Forms; using System.IO; -using System.Threading; namespace AudioRecorder { public delegate void RefreshPanelDelegate(); diff --git a/client/Maestro/Configuration/configuration-nle.json b/client/Maestro/Configuration/configuration-nle.json index 448d676b..c9fd6245 100644 --- a/client/Maestro/Configuration/configuration-nle.json +++ b/client/Maestro/Configuration/configuration-nle.json @@ -1,6 +1,6 @@ { "title": "NLE", - "active": false, + "active": true, "startInTray": false, "enableCustomMetadataId": true, "player": { @@ -24,22 +24,22 @@ "address": "http://10.10.1.27/services/rest/octopus/", "timeout": 1000 }, - "project": { + "projectSettings": { "templateRoot": { - "address": "file://10.10.1.100/BRAVOOS/.MAESTRO/PROJECT", + "address": "ftp://10.10.1.100/.MAESTRO", "userName": "mediacube", "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", "timeout": 1000 }, "projectRoot": { - "address": "file://10.10.1.100/BRAVOOS/OCTOPUS", + "address": "ftp://10.10.1.100/OCTOPUS", "userName": "mediacube", "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy", "timeout": 1000 }, "templateName": "ALAPTIMELINE.ezp", - "projectName": "%ID%-%TEXT%.ezp", - "destinationFormat": "%IDROOT%-%TEXT%/PROJECT", + "projectName": "PROJECT/%ID%-%TEXT%.ezp", + "projectFormat": "%IDROOT%-%TEXT%", "disableProject": false, "disableSourceOpen": false } diff --git a/client/Maestro/Configuration/configuration-playout-ingest.json b/client/Maestro/Configuration/configuration-playout-ingest.json index aa818ef7..ddd13040 100644 --- a/client/Maestro/Configuration/configuration-playout-ingest.json +++ b/client/Maestro/Configuration/configuration-playout-ingest.json @@ -1,6 +1,6 @@ { "title": "Lebony betöltő", - "active": true, + "active": false, "startInTray": false, "enableCustomMetadataId": true, "player": { diff --git a/client/Maestro/Configuration/configuration-sxs.json b/client/Maestro/Configuration/configuration-sxs.json index d5a2187b..c8fcc10a 100644 --- a/client/Maestro/Configuration/configuration-sxs.json +++ b/client/Maestro/Configuration/configuration-sxs.json @@ -1,6 +1,6 @@ { "title": "SxS", - "active": true, + "active": false, "startInTray": false, "enableCustomMetadataId": true, "player": { diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index 1adb1e04..4b77ea25 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -26,17 +26,17 @@ namespace Maestro { /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MaestroForm)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); this.groupSource = new System.Windows.Forms.GroupBox(); this.dgSource = new System.Windows.Forms.DataGridView(); this.bindingSource = new System.Windows.Forms.BindingSource(this.components); @@ -159,32 +159,32 @@ namespace Maestro { this.dgSource.BackgroundColor = System.Drawing.Color.White; this.dgSource.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dgSource.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgSource.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgSource.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dgSource.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgSource.DataSource = this.bindingSource; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgSource.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgSource.DefaultCellStyle = dataGridViewCellStyle12; this.dgSource.Dock = System.Windows.Forms.DockStyle.Fill; this.dgSource.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgSource.EnableHeadersVisualStyles = false; this.dgSource.Location = new System.Drawing.Point(10, 47); this.dgSource.Name = "dgSource"; this.dgSource.RowHeadersVisible = false; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle13; this.dgSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dgSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgSource.Size = new System.Drawing.Size(330, 159); @@ -706,15 +706,15 @@ namespace Maestro { this.columnOutput, this.columnKillDate}); this.dgJobs.DataSource = this.bindingSourceJobs; - dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle6.NullValue = null; - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgJobs.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle16.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle16.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle16.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle16.NullValue = null; + dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgJobs.DefaultCellStyle = dataGridViewCellStyle16; this.dgJobs.Dock = System.Windows.Forms.DockStyle.Fill; this.dgJobs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgJobs.EnableHeadersVisualStyles = false; @@ -722,8 +722,8 @@ namespace Maestro { this.dgJobs.Location = new System.Drawing.Point(3, 3); this.dgJobs.Name = "dgJobs"; this.dgJobs.RowHeadersVisible = false; - dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.dgJobs.RowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.dgJobs.RowsDefaultCellStyle = dataGridViewCellStyle17; this.dgJobs.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dgJobs.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgJobs.Size = new System.Drawing.Size(988, 90); @@ -744,8 +744,8 @@ namespace Maestro { // this.columnID.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; this.columnID.DataPropertyName = "ID"; - dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.columnID.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.columnID.DefaultCellStyle = dataGridViewCellStyle14; this.columnID.HeaderText = "ID"; this.columnID.Name = "columnID"; this.columnID.Width = 44; @@ -762,8 +762,8 @@ namespace Maestro { // this.columnStatus.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; this.columnStatus.DataPropertyName = "Status"; - dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.columnStatus.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.columnStatus.DefaultCellStyle = dataGridViewCellStyle15; this.columnStatus.HeaderText = "Status"; this.columnStatus.Name = "columnStatus"; this.columnStatus.Width = 66; @@ -831,15 +831,15 @@ namespace Maestro { this.dgMessages.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridViewTextBoxColumn1, this.dataGridViewTextBoxColumn2}); - dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle9.ForeColor = System.Drawing.Color.Red; - dataGridViewCellStyle9.NullValue = null; - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.Red; - dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgMessages.DefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle19.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle19.ForeColor = System.Drawing.Color.Red; + dataGridViewCellStyle19.NullValue = null; + dataGridViewCellStyle19.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle19.SelectionForeColor = System.Drawing.Color.Red; + dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgMessages.DefaultCellStyle = dataGridViewCellStyle19; this.dgMessages.Dock = System.Windows.Forms.DockStyle.Fill; this.dgMessages.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgMessages.EnableHeadersVisualStyles = false; @@ -848,8 +848,8 @@ namespace Maestro { this.dgMessages.Name = "dgMessages"; this.dgMessages.ReadOnly = true; this.dgMessages.RowHeadersVisible = false; - dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.dgMessages.RowsDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle20.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.dgMessages.RowsDefaultCellStyle = dataGridViewCellStyle20; this.dgMessages.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dgMessages.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgMessages.Size = new System.Drawing.Size(988, 90); @@ -868,8 +868,8 @@ namespace Maestro { // this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.dataGridViewTextBoxColumn2.DataPropertyName = "Message"; - dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle18.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle18; this.dataGridViewTextBoxColumn2.HeaderText = "Üzenet"; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.ReadOnly = true; diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index ec03942d..640c3f13 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -80,9 +80,10 @@ namespace Maestro { tabMetadata.TabPages.Remove(tpOctopus); return; } - octopusIDSelector.Properties = new OctopusConfiguration() { + octopusIDSelector.Parameters = new OctopusParameters() { Configuration = octopusConfiguration, - MessageBus = errorMessageBus + UserName = TrayApplicationContext.UserName, + MessageBus = errorMessageBus, }; octopusIDSelector.IDChangedEvent += OnOctopusIDSelected; } diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index 6b8361d3..72cdd087 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -46,18 +46,18 @@ namespace Maestro { private void OnChecked(CheckBox checkBox, Target target) { if (checkBox.Checked) { List processors = CreateProcessors(target, checkBox); - foreach (ITargetProcessor processor in processors) { - if (processor.Parameters.TargetConfig.Reference != null) { - foreach (String reference in processor.Parameters.TargetConfig.Reference) { - var key = currentProcessors.Keys.Where(c => c.Text.Equals(reference)).SingleOrDefault(); - var referencedProcessor = currentProcessors[key]?.Where(p => p.Input.Equals(processor.Input)).SingleOrDefault(); - if (referencedProcessor != null) - processor.AddReference(referencedProcessor); + if (processors != null && processors.Count > 0) { + foreach (ITargetProcessor processor in processors) { + if (processor.Parameters.TargetConfig.Reference != null) { + foreach (String reference in processor.Parameters.TargetConfig.Reference) { + var key = currentProcessors.Keys.Where(c => c.Text.Equals(reference)).SingleOrDefault(); + var referencedProcessor = currentProcessors[key]?.Where(p => p.Input.Equals(processor.Input)).SingleOrDefault(); + if (referencedProcessor != null) + processor.AddReference(referencedProcessor); + } } } - } - if (processors != null && processors.Count > 0) { if (currentProcessors.ContainsKey(checkBox)) currentProcessors[checkBox].AddRange(processors); else diff --git a/client/Maestro/MaestroForm.resx b/client/Maestro/MaestroForm.resx index 14f8d31f..401351b8 100644 --- a/client/Maestro/MaestroForm.resx +++ b/client/Maestro/MaestroForm.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACU - BwAAAk1TRnQBSQFMAwEBAAGQAQABkAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA + BwAAAk1TRnQBSQFMAwEBAAGYAQABmAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm @@ -163,6 +163,9 @@ AUADAAEQAwABAQEAAQEFAAGAFwAD/4EACw== + + 951, 17 + @@ -178,6 +181,9 @@ 846, 17 + + 846, 17 + True diff --git a/client/Maestro/Program.cs b/client/Maestro/Program.cs index 8e677d04..0aa1d4f6 100644 --- a/client/Maestro/Program.cs +++ b/client/Maestro/Program.cs @@ -91,7 +91,7 @@ namespace Maestro { public static GlobalInfo GlobalConfig { get; internal set; } public TrayApplicationContext() { - //string x = Regex.Replace("xxx/yyy/1234-00_aaa", "_*$", "*"); + //string x = Regex.Replace("xxx/yyy/1234-00_aaaANYAG/ANYAG", "[^0-9A-Za-z-._]", "*"); //Debug.WriteLine(x); } @@ -112,8 +112,8 @@ namespace Maestro { throw new Exception(CONFIG_ERROR); GlobalConfig = LoadGlobalConfig(configFiles); - if (!HasCommandlineParameter(NOLOGIN)) - CheckUser(); + + CheckUser(); CreateForms(configFiles); CreateTrayIcon(); } @@ -144,7 +144,6 @@ namespace Maestro { if (userInfo.Length < 2) throw new Exception(DOMAIN_QUERY_ERROR); string userDomainName = userInfo[0]; - UserName = userInfo[1]; if (userDomainName.Contains(".")) userDomainName = userDomainName.Split('.')[0]; if (domainName.ToLower().Equals(userDomainName.ToLower())) @@ -158,18 +157,19 @@ namespace Maestro { if (String.IsNullOrEmpty(domainName)) throw new Exception(SYSCONFIG_ERROR); else { - string userName = WindowsIdentity.GetCurrent().Name; - if (IsDomainUser(userName, domainName)) + UserName = WindowsIdentity.GetCurrent().Name; + if (IsDomainUser(UserName, domainName)) + return; + UserName = GlobalConfig.UserDomain.UserName; + if (HasCommandlineParameter(NOLOGIN)) return; - userName = GlobalConfig.UserDomain.UserName; string password = GlobalConfig.UserDomain.Password; LoginForm loginForm = null; try { using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, domainName)) { while (true) { - bool isValid = pc.ValidateCredentials(userName, password); + bool isValid = pc.ValidateCredentials(UserName, password); if (isValid) { - UserName = userName; break; } @@ -181,7 +181,7 @@ namespace Maestro { DialogResult result = loginForm.ShowDialog(); if (result == DialogResult.Cancel) throw new Exception("Bejelentkezés nélkül a Maestro alkalmazás nem indítható el."); - userName = loginForm.UserName; + UserName = loginForm.UserName; password = loginForm.Password; } } diff --git a/client/MaestroShared/Commons/PatterNameMaker.cs b/client/MaestroShared/Commons/PatterNameMaker.cs new file mode 100644 index 00000000..9927cd50 --- /dev/null +++ b/client/MaestroShared/Commons/PatterNameMaker.cs @@ -0,0 +1,56 @@ +using System; +using System.Globalization; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; + +namespace MaestroShared.Commons { + public class PatterNameMaker { + private const string NORMALIZE_TEXT_PATTERN = "[^0-9A-Za-z-._]"; + private const string PATTERN_TARGETNAME = "%TARGETNAME%"; + private const string PATTERN_ID = "%ID%"; + private const string PATTERN_IDROOT = "%IDROOT%"; + private const string PATTERN_SOURCENAME = "%SOURCENAME%"; + private const string PATTERN_TIMESTAMP = "%TIMESTAMP%"; + private const string PATTERN_DATESTAMP = "%DATESTAMP%"; + private const string DATETIME_FORMAT = "yyyyMMddhhmmss"; + private const string PATTERN_TEXT = "%TEXT%"; + private const string UNDERSCORE = "_"; + private const string DATE_FORMAT_NODOTS = "yyyyMMdd"; + + static private string Normalize(String s) { + string normalizedString = s.Normalize(NormalizationForm.FormD); + + StringBuilder stringBuilder = new StringBuilder(); + + for (int i = 0; i < normalizedString.Length; i++) { + Char c = normalizedString[i]; + if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark) + stringBuilder.Append(c); + } + string result = stringBuilder.ToString(); + result = Regex.Replace(result, NORMALIZE_TEXT_PATTERN, UNDERSCORE); + if (result.Length > 100) + result = result.Substring(0, 100); + return result; + } + + static public string Get(string pattern, string id, string fileName, string text) { + string idRoot = id.Contains(UNDERSCORE) ? id.Split(UNDERSCORE[0])[0] : id; + string result = pattern + .Replace(PATTERN_ID, id) + .Replace(PATTERN_IDROOT, idRoot) + .Replace(PATTERN_TIMESTAMP, DateTime.Now.ToString(DATETIME_FORMAT, CultureInfo.InvariantCulture)) + .Replace(PATTERN_DATESTAMP, DateTime.Now.ToString(DATE_FORMAT_NODOTS, CultureInfo.InvariantCulture)); + + if (!String.IsNullOrEmpty(fileName)) + result = result.Replace(PATTERN_SOURCENAME, Normalize(Path.GetFileNameWithoutExtension(fileName))); + + if (!String.IsNullOrEmpty(text)) + result = result.Replace(PATTERN_TEXT, Normalize(text)); + return result; + } + + + } +} diff --git a/client/MaestroShared/Configuration/ConfigurationInfo.cs b/client/MaestroShared/Configuration/ConfigurationInfo.cs index 1c5daf79..df62d608 100644 --- a/client/MaestroShared/Configuration/ConfigurationInfo.cs +++ b/client/MaestroShared/Configuration/ConfigurationInfo.cs @@ -69,6 +69,7 @@ namespace MaestroShared.Configuration { public string DeviceIDMorpheus { get; set; } public string PathMorpheusMetadata { get; set; } public bool DisableFileVersioning { get; set; } + public bool DisableOverride { get; set; } public bool SendEmailOnError { get; set; } public string ErrorEmailRecipient { get; set; } public string ErrorEmailPattern { get; set; } @@ -107,20 +108,29 @@ namespace MaestroShared.Configuration { public Connection Server { get; set; } } - public class Project { + public class ProjectSettings { public Connection TemplateRoot { get; set; } public Connection ProjectRoot { get; set; } public string TemplateName { get; set; } public string ProjectName { get; set; } - public string DestinationFormat { get; set; } + public string ProjectFormat { get; set; } public bool DisableProject { get; set; } public bool DisableSourceOpen { get; set; } + public bool IsValid { + get { + return TemplateRoot != null && TemplateRoot.Address != null && + ProjectRoot != null && ProjectRoot.Address != null && + !String.IsNullOrEmpty(TemplateName) && + !String.IsNullOrEmpty(ProjectName) && + !String.IsNullOrEmpty(ProjectFormat); + } + } } public class OctopusMetadata : MetadataProvider { public bool DisablePlaceHolderCheck { get; set; } public bool DisableStoryCheck { get; set; } - public Connection Local { get; set; } + public ProjectSettings ProjectSettings { get; set; } } public class TrafficMetadata : MetadataProvider { diff --git a/client/MaestroShared/MaestroShared.csproj b/client/MaestroShared/MaestroShared.csproj index d0282625..3c08b76a 100644 --- a/client/MaestroShared/MaestroShared.csproj +++ b/client/MaestroShared/MaestroShared.csproj @@ -83,6 +83,7 @@ + diff --git a/client/MaestroShared/Targets/FTPTargetProcessor.cs b/client/MaestroShared/Targets/FTPTargetProcessor.cs index 0d7cddd4..cced4b4b 100644 --- a/client/MaestroShared/Targets/FTPTargetProcessor.cs +++ b/client/MaestroShared/Targets/FTPTargetProcessor.cs @@ -108,6 +108,10 @@ namespace MaestroShared.Targets { targetFTP.SetWorkingDirectory(path); } + protected override string Slash(string path) { + return path.Replace(BACKSLASH, SLASH); + } + protected FtpClient CreateClient(Connection connection) { Uri address = connection.Address; FtpClient result = new FtpClient() { @@ -122,21 +126,14 @@ namespace MaestroShared.Targets { return result; } - protected override string DetermineWorkingDirectory(Connection connection) { + protected override string SearchDirectory(string path, string pattern) { string result = null; - if (!String.IsNullOrEmpty(Parameters.TargetConfig.SubFolderFormat)) { - string name = GetDynamicName(Parameters.TargetConfig.SubFolderFormat); - if (Parameters.TargetConfig.SubFolderFormat.Contains(PATTERN_TEXT)) { - string pattern = name.Split(HYPHEN[0])[0] + HYPHEN; - targetFTP.SetWorkingDirectory(connection.Address.LocalPath); - FtpListItem item = targetFTP.GetListing()?.Where(i => i.Type.Equals(FtpFileSystemObjectType.Directory) && i.Name.StartsWith(pattern)).FirstOrDefault(); - if (item != null) - name = item.Name; - targetFTP.SetWorkingDirectory(SLASH); - } - result = Path.Combine(connection.Address.LocalPath, name); - } else - result = connection.Address.LocalPath; + EnsureDirectoryExistence(path); + //targetFTP.SetWorkingDirectory(path); + FtpListItem item = targetFTP.GetListing()?.Where(i => i.Type.Equals(FtpFileSystemObjectType.Directory) && i.Name.StartsWith(pattern)).FirstOrDefault(); + if (item != null) + result = item.Name; + targetFTP.SetWorkingDirectory(SLASH); return result; } diff --git a/client/MaestroShared/Targets/TargetProcessor.cs b/client/MaestroShared/Targets/TargetProcessor.cs index dbff9690..f3399ef6 100644 --- a/client/MaestroShared/Targets/TargetProcessor.cs +++ b/client/MaestroShared/Targets/TargetProcessor.cs @@ -36,7 +36,7 @@ namespace MaestroShared.Targets { this.Parameters = parameters; } - protected void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { + protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "") { parent?.SafeCall(() => { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }); diff --git a/client/MaestroShared/Targets/UNCTargetProcessor.cs b/client/MaestroShared/Targets/UNCTargetProcessor.cs index 94a054aa..5e64ef2a 100644 --- a/client/MaestroShared/Targets/UNCTargetProcessor.cs +++ b/client/MaestroShared/Targets/UNCTargetProcessor.cs @@ -5,7 +5,6 @@ using System.Windows.Forms; using Model; using System.Text; using System.Globalization; -using System.Text.RegularExpressions; using MaestroShared.Configuration; using MaestroShared.Target; using MaestroShared.Metadata; @@ -24,7 +23,6 @@ namespace MaestroShared.Targets { private const string STATUS_FOLDER = ".STATUS"; private const string KILLDATE_FILE = "{0}.{1}.killdate"; private const string METADATA_FILE = "{0}.json"; - private const string DEFAULT_EXTENSION = ".MXF"; private const string NORMALIZE_TEXT_PATTERN = "[^0-9A-Za-z-._/]"; private const string DATE_FORMAT = "yyyy.MM.dd"; private const string PROGRAMME = "PROGRAMME"; @@ -47,6 +45,8 @@ namespace MaestroShared.Targets { protected const string HYPHEN = "-"; protected const string PATTERN_TEXT = "%TEXT%"; protected const string SLASH = "/"; + protected const string BACKSLASH = @"\"; + private const string STAR = "*"; protected FileInfo inputFile; protected string workingDir; @@ -109,12 +109,11 @@ namespace MaestroShared.Targets { } private void CreateOutput(string workingDir) { - Output = "/".Equals(workingDir) ? OutputName : Path.Combine(workingDir, OutputName); - Output = Output.Replace(@"\", "/"); + Output = SLASH.Equals(workingDir) ? OutputName : Path.Combine(workingDir, OutputName); } private void HandleFileExists(string currentFile) { - if (FileExists(currentFile) && Parameters.TargetConfig.DisableFileVersioning) { + if (FileExists(currentFile) && (Parameters.TargetConfig.DisableFileVersioning || Parameters.TargetConfig.DisableOverride)) { if (Parameters.TargetConfig.NexioServer) { Status = REVOKED; ShowNexioFileExistsMessage(); @@ -216,7 +215,7 @@ namespace MaestroShared.Targets { private void SendEmail(string to, string messagePattern) { try { - string message = messagePattern.Replace(PATTERN_TARGETNAME, OutputName); + string message = GetDynamicText(PATTERN_TARGETNAME); Parameters.MediaCubeApi.Notify(to, message); } catch (Exception e) { @@ -244,20 +243,48 @@ namespace MaestroShared.Targets { } } - protected virtual string DetermineWorkingDirectory(Connection connection) { + protected virtual string SearchDirectory(string path, string pattern) { string result = null; + string[] dirs = Directory.GetDirectories(path, pattern); + if (dirs.Length > 0) + result = dirs[0]; + return result; + } + + protected virtual string Slash(string path) { + return path; + } + + protected string DetermineWorkingDirectory(Connection connection) { + string result = Slash(connection.Address.LocalPath); if (!String.IsNullOrEmpty(Parameters.TargetConfig.SubFolderFormat)) { - string name = GetDynamicName(Parameters.TargetConfig.SubFolderFormat); - if (Parameters.TargetConfig.SubFolderFormat.Contains(PATTERN_TEXT)) { - string pattern = name.Split(HYPHEN[0])[0] + HYPHENSTAR; - string[] dirs = Directory.GetDirectories(connection.Address.LocalPath, pattern); - if (dirs.Length > 0) - name = dirs[0]; + string subFolderName = Slash(GetDynamicText(Parameters.TargetConfig.SubFolderFormat)); + string pattern = subFolderName; + string searchPath = result; + if (pattern.Contains(SLASH)) { + string[] segments = pattern.Split(SLASH[0]); + pattern = segments[segments.Length - 1]; + searchPath = Slash(Path.Combine(result, subFolderName.Substring(0, subFolderName.Length - pattern.Length - 1))); } - result = Path.Combine(connection.Address.LocalPath, name); - } else - result = connection.Address.LocalPath; - return result; + int p = pattern.IndexOf(HYPHEN); + int o = pattern.IndexOf(UNDERSCORE); + if (p > -1 || o > -1) { + if (p < o && p > -1) + pattern = pattern.Substring(0, p); + else + pattern = pattern.Substring(0, o); + + pattern += STAR; + string searchResult = SearchDirectory(searchPath, pattern); + if (searchResult == null) + result = Slash(Path.Combine(result, subFolderName)); + else + result = Slash(Path.Combine(result, searchResult)); + } else + result = Slash(Path.Combine(connection.Address.LocalPath, subFolderName)); + } + + return result.Replace(BACKSLASH, SLASH); } private DateTime GetKillDate() { @@ -343,28 +370,13 @@ namespace MaestroShared.Targets { return stringBuilder.ToString(); } - protected string GetDynamicName(string text) { - string idRoot = ID.Contains(UNDERSCORE) ? ID.Split(UNDERSCORE[0])[0] : ID; - string result = text - .Replace(PATTERN_ID, ID) - .Replace(PATTERN_IDROOT, idRoot) - .Replace(PATTERN_SOURCENAME, Path.GetFileNameWithoutExtension(InputName)) - .Replace(PATTERN_TIMESTAMP, DateTime.Now.ToString(DATETIME_FORMAT, CultureInfo.InvariantCulture)) - .Replace(PATTERN_DATESTAMP, DateTime.Now.ToString(DATE_FORMAT_NODOTS, CultureInfo.InvariantCulture)); - - if (!String.IsNullOrEmpty(Parameters.MetadataText)) - result = result.Replace(PATTERN_TEXT, HYPHEN + RemoveDiacritics(Parameters.MetadataText)); - - // replace hungarian and special characters - result = Regex.Replace(result, NORMALIZE_TEXT_PATTERN, UNDERSCORE); - if (result.Length > 100) - result = result.Substring(0, 100); - return result; + protected string GetDynamicText(string pattern) { + return PatterNameMaker.Get(pattern, ID, InputName, Parameters.MetadataText); } - protected virtual string CreateOutputFileName() { - string nameWithoutExtension = GetDynamicName(Parameters.TargetConfig.OutputFormat); - string extension = InputName.Contains(DOT) ? InputName.Substring(InputName.LastIndexOf(DOT)) : DEFAULT_EXTENSION; + private string CreateOutputFileName() { + string nameWithoutExtension = GetDynamicText(Parameters.TargetConfig.OutputFormat); + string extension = Path.GetExtension(InputName); extension = extension.ToUpper(); string result = String.Format(FILENAME, nameWithoutExtension, extension); if (!Parameters.TargetConfig.DisableFileVersioning) { @@ -376,7 +388,7 @@ namespace MaestroShared.Targets { version++; } } - return result.ToUpper(); + return result.ToUpper().Replace(BACKSLASH, SLASH); } protected virtual void EnsureDirectoryExistence(string path) { diff --git a/client/OctopusClient/CheckableTreeView.cs b/client/OctopusClient/CheckableTreeView.cs index 8a5a1124..60773a37 100644 --- a/client/OctopusClient/CheckableTreeView.cs +++ b/client/OctopusClient/CheckableTreeView.cs @@ -1,33 +1,24 @@ using System; -using System.Drawing; using System.Windows.Forms; namespace OctopusClient { class CheckableTreeView : TreeView { + public delegate void OnNodeDoubleClick(object sender, TreeNodeMouseClickEventArgs args); + + public OnNodeDoubleClick NodeDoubleClick; + protected override void WndProc(ref Message m) { // Suppress WM_LBUTTONDBLCLK - if (m.Msg == 0x203) { m.Result = IntPtr.Zero; } else base.WndProc(ref m); + if (m.Msg == 0x203) { + var point = PointToClient(Cursor.Position); + TreeNode node = GetNodeAt(point); + TreeNodeMouseClickEventArgs args = new TreeNodeMouseClickEventArgs(node, MouseButtons.Left, 2, point.X, point.Y); + NodeDoubleClick?.Invoke(this, args); + m.Result = IntPtr.Zero; + } else + base.WndProc(ref m); } - //protected override void OnDrawNode(DrawTreeNodeEventArgs e) { - // TreeNodeStates state = e.State; - // Font font = e.Node.NodeFont ?? e.Node.TreeView.Font; - // Color fore = e.Node.ForeColor; - // if (fore == Color.Empty) fore = e.Node.TreeView.ForeColor; - // if (e.Node == e.Node.TreeView.SelectedNode) { - // fore = SystemColors.ControlText; - // using (SolidBrush brush = new SolidBrush(Color.Gainsboro)) { - // e.Graphics.FillRectangle(brush, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); - // } - - // //e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds); - // ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds, fore, SystemColors.Highlight); - // TextRenderer.DrawText(e.Graphics, e.Node.Text, font, e.Bounds, fore, TextFormatFlags.GlyphOverhangPadding); - // } else { - // e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds); - // TextRenderer.DrawText(e.Graphics, e.Node.Text, font, e.Bounds, fore, TextFormatFlags.GlyphOverhangPadding); - // } - //} } } diff --git a/client/OctopusClient/OctopusClient.csproj b/client/OctopusClient/OctopusClient.csproj index 77eb85b9..7a16e275 100644 --- a/client/OctopusClient/OctopusClient.csproj +++ b/client/OctopusClient/OctopusClient.csproj @@ -101,13 +101,13 @@ Component - UserControl OctopusIDSelector.cs + True diff --git a/client/OctopusClient/OctopusIDSelector.Designer.cs b/client/OctopusClient/OctopusIDSelector.Designer.cs index af3b5c4b..d2026605 100644 --- a/client/OctopusClient/OctopusIDSelector.Designer.cs +++ b/client/OctopusClient/OctopusIDSelector.Designer.cs @@ -47,8 +47,9 @@ this.treeOctopus.Name = "treeOctopus"; this.treeOctopus.Size = new System.Drawing.Size(300, 322); this.treeOctopus.TabIndex = 5; + this.treeOctopus.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeOctopus_NodeMouseClick); + this.treeOctopus.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeOctopus_NodeMouseDoubleClick); this.treeOctopus.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeContent_KeyDown); - this.treeOctopus.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeOctopus_MouseDown); // // pSearch // diff --git a/client/OctopusClient/OctopusIDSelector.cs b/client/OctopusClient/OctopusIDSelector.cs index 1aad376f..ac5964f6 100644 --- a/client/OctopusClient/OctopusIDSelector.cs +++ b/client/OctopusClient/OctopusIDSelector.cs @@ -6,6 +6,10 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using LinkDotNet.MessageHandling.Contracts; using System.Drawing; +using MaestroShared.Configuration; +using System.IO; +using MaestroShared.Targets; +using MaestroShared.Target; namespace OctopusClient { public delegate void OnSelectedIDChanged(string id, string name, string text); @@ -18,12 +22,12 @@ namespace OctopusClient { private TreeNode selectedNode; private OctopusAPI client; public OnSelectedIDChanged IDChangedEvent { get; set; } - private OctopusConfiguration properties; + private OctopusParameters parameters; private bool refreshDisabled; - public OctopusConfiguration Properties { + public OctopusParameters Parameters { set { - properties = value; + parameters = value; client = new OctopusAPI(value.Configuration.Server.Address.OriginalString, value.Configuration.Server.UserName, value.Configuration.Server.Password, value.Configuration.Server.Timeout, value.MessageBus); rbRundown.Checked = true; RefreshFolders(); @@ -57,27 +61,20 @@ namespace OctopusClient { InitializeComponent(); InitializeControls(); treeOctopus.AfterCheck += OnTreeAfterCheck; - treeOctopus.AfterSelect += OnAfterSelect; - } - - public TreeNode previousSelectedNode = null; - - void OnAfterSelect(object sender, TreeViewEventArgs e) { - if (previousSelectedNode != null) { - previousSelectedNode.BackColor = treeOctopus.BackColor; - previousSelectedNode.ForeColor = treeOctopus.ForeColor; - } - treeOctopus.SelectedNode.BackColor = Color.Gainsboro; - treeOctopus.SelectedNode.ForeColor = Color.Black; - previousSelectedNode = treeOctopus.SelectedNode; - treeOctopus.Invalidate(treeOctopus.SelectedNode.Bounds, true); + treeOctopus.DrawMode = TreeViewDrawMode.OwnerDrawText; + treeOctopus.DrawNode += OnDrawNode; + treeOctopus.NodeDoubleClick += treeOctopus_NodeDoubleClick; } void OnDrawNode(object sender, DrawTreeNodeEventArgs e) { Graphics g = e.Graphics; if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected) { using (SolidBrush brush = new SolidBrush(Color.Gainsboro)) { - e.Graphics.FillRectangle(brush, e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height); + e.Graphics.FillRectangle(brush, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); + } + using (Pen pen = new Pen(Color.Black)) { + pen.Width = 1; + e.Graphics.DrawLine(pen, e.Bounds.X, e.Bounds.Y + 2, e.Bounds.X, e.Bounds.Y + e.Bounds.Height - 4); } } TextRenderer.DrawText(e.Graphics, e.Node.Text, treeOctopus.Font, e.Bounds, treeOctopus.ForeColor, TextFormatFlags.Left | TextFormatFlags.Top); @@ -136,7 +133,7 @@ namespace OctopusClient { TreeNode storyNode = treeOctopus.Nodes.Add(ID, label); storyNode.Tag = story; - if (properties.Configuration.DisableStoryCheck) + if (parameters.Configuration.DisableStoryCheck) HideCheckBox(treeOctopus, storyNode); else { if (lookupStoryId != null && lookupStoryId.Equals(story.ID)) @@ -149,7 +146,7 @@ namespace OctopusClient { foreach (MosObject mosObject in mosObjects) { TreeNode placeHolderNode = storyNode.Nodes.Add(mosObject.ObjID, String.Format($"{mosObject.ObjID}")); placeHolderNode.Tag = story; - if (properties.Configuration.DisablePlaceHolderCheck) + if (parameters.Configuration.DisablePlaceHolderCheck) HideCheckBox(treeOctopus, placeHolderNode); else { if (lookupPlaceHolderId != null && lookupPlaceHolderId.Equals(mosObject.ObjID)) { @@ -165,7 +162,7 @@ namespace OctopusClient { private void OnTreeAfterCheck(object sender, TreeViewEventArgs e) { //logger.Debug("Handling {0} {1} {2}", e.Node.Name, e.Node.Text, e.Node.Checked); - if (properties.Configuration.DisableStoryCheck && e.Node.Level == 0) { + if (parameters.Configuration.DisableStoryCheck && e.Node.Level == 0) { if (e.Node.Checked) { e.Node.Checked = false; HideCheckBox(treeOctopus, e.Node); @@ -173,7 +170,7 @@ namespace OctopusClient { return; } - if (properties.Configuration.DisablePlaceHolderCheck && e.Node.Level == 1) { + if (parameters.Configuration.DisablePlaceHolderCheck && e.Node.Level == 1) { if (e.Node.Checked) { e.Node.Checked = false; HideCheckBox(treeOctopus, e.Node); @@ -389,13 +386,63 @@ namespace OctopusClient { LookupByStory(txtFilter.Text); } - private void treeOctopus_MouseDown(object sender, MouseEventArgs e) { - treeOctopus.SelectedNode = treeOctopus.GetNodeAt(e.X, e.Y); - if (e.Button != MouseButtons.Left) + private void treeOctopus_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { + } + + private void treeOctopus_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { + } + + private void treeOctopus_NodeDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { + if (e.X < e.Node.Bounds.X + 5) return; + Open(e.Node); + } + private void Open(TreeNode node) { + if (MessageBox.Show("Megnyissam vágásra?", null, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) + return; + ProjectSettings projectConfiguration = parameters?.Configuration?.ProjectSettings; + if (projectConfiguration == null) { + MessageBox.Show("Nem található a 'projectSetings' beállítás a konfigurációs állományban.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (!projectConfiguration.IsValid) { + MessageBox.Show("A 'projectSetings' beállítás hiányos a konfigurációs állományban.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + //string source = Path.Combine(projectConfiguration.TemplateRoot.Address.LocalPath, projectConfiguration.TemplateName); + //if (!File.Exists(source)) { + // MessageBox.Show($"Az '{source}' állomány nem létezik.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + // return; + //} + Story story = node.Tag as Story; + + TargetProcessorParameter processorParameter = new TargetProcessorParameter() { + SourceConfig = new Source() { + Local = projectConfiguration.TemplateRoot + }, + TargetConfig = new Target() { + Remote = projectConfiguration.ProjectRoot, + OutputFormat = projectConfiguration.ProjectName, + SubFolderFormat = projectConfiguration.ProjectFormat, + DisableFileVersioning = true, + DisableOverride = true + }, + ID = node.Name, + MetadataText = String.IsNullOrEmpty(story.Format) ? story.Name : String.Format($"{story.Name}_{story.Format}"), + InputFileName = projectConfiguration.TemplateName, + UserName = parameters.UserName, + }; + + ITargetProcessor result = new FXPTargetProcessor(); + result.Initialize(null, processorParameter); + result.Execute(); + + //Patter } + + } public class OctopusAPIMessage : IMessage { diff --git a/client/OctopusClient/OctopusConfiguration.cs b/client/OctopusClient/OctopusParameters.cs similarity index 71% rename from client/OctopusClient/OctopusConfiguration.cs rename to client/OctopusClient/OctopusParameters.cs index d212548f..797d287b 100644 --- a/client/OctopusClient/OctopusConfiguration.cs +++ b/client/OctopusClient/OctopusParameters.cs @@ -2,8 +2,9 @@ using MaestroShared.Configuration; namespace OctopusClient { - public class OctopusConfiguration { + public class OctopusParameters { public OctopusMetadata Configuration { get; set; } + public string UserName { get; set; } public IMessageBus MessageBus { get; set; } } } -- 2.54.0