From c8e06264847ede135a15165ed9c23940fa29635d Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Wed, 25 Oct 2017 14:45:22 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30670 --- client/Maestro/Commons/ObjectExtensions.cs | 5 +- .../Configuration/ConfigurationInfo.cs | 11 ++ client/Maestro/Maestro.csproj | 32 +--- client/Maestro/MaestroForm.Designer.cs | 165 ++++++++---------- client/Maestro/MaestroForm.Metadata.cs | 18 +- client/Maestro/MaestroForm.Source.cs | 57 ++---- client/Maestro/MaestroForm.Target.cs | 11 +- client/Maestro/MaestroForm.cs | 11 +- client/Maestro/MaestroForm.resx | 3 - client/Maestro/MeastroFormNotifyIcon.cs | 17 +- client/Maestro/Program.cs | 102 +++++++---- client/Maestro/Sources/FileSystemSource.cs | 91 +++++----- client/Maestro/Targets/FTPTargetProcessor.cs | 4 + client/Maestro/Targets/UNCTargetProcessor.cs | 21 ++- client/MediaCube.vssscc | 10 ++ client/OctopusClient/OctopusIDSelector.cs | 4 +- .../mediacube-dev-user.properties | 23 +++ .../octopus/test/OctopusDataMinerTest.java | 45 +++-- .../sql/5-CreateFTIndex.db2 | 1 + 19 files changed, 331 insertions(+), 300 deletions(-) create mode 100644 client/MediaCube.vssscc create mode 100644 server/-configuration/mediacube-dev-user.properties diff --git a/client/Maestro/Commons/ObjectExtensions.cs b/client/Maestro/Commons/ObjectExtensions.cs index 7d328df9..be3cb5a2 100644 --- a/client/Maestro/Commons/ObjectExtensions.cs +++ b/client/Maestro/Commons/ObjectExtensions.cs @@ -4,14 +4,15 @@ using System.Windows.Forms; namespace Maestro.Commons { public static class ObjectExtensions { - public static void SafeCall(this Control ctrl, Action x) { + public static void SafeCall(this Control ctrl, Action x, bool force = false) { if (x != null) { - if (ctrl.InvokeRequired) { + if (ctrl.InvokeRequired || force) { ctrl.BeginInvoke(x); } else { x(); } } } + } } diff --git a/client/Maestro/Configuration/ConfigurationInfo.cs b/client/Maestro/Configuration/ConfigurationInfo.cs index c5f9afbe..420f6e4b 100644 --- a/client/Maestro/Configuration/ConfigurationInfo.cs +++ b/client/Maestro/Configuration/ConfigurationInfo.cs @@ -1,5 +1,6 @@ using Newtonsoft.Json; using System; +using System.Linq; using System.Collections.Generic; using System.IO; @@ -30,6 +31,15 @@ namespace Maestro.Configuration { public bool EnableCustomMetadataId { get; set; } public MetadataProvider[] Metadatas { get; set; } public Target[] Targets { get; set; } + + public T GetMetadataProvider() { + MetadataProvider provider = Metadatas?.Where(m => { return m is T; }).FirstOrDefault(); + T result = default(T); + try { + result = (T)Convert.ChangeType(provider, typeof(T)); + } finally { } + return result; + } } public class Player { @@ -49,6 +59,7 @@ namespace Maestro.Configuration { public bool CreateSubFolder { get; set; } public string Tag { get; set; } public bool SaveMetadata {get; set;} + public bool DisableFileVersioning { get; set; } public bool SendEmailOnError { get; set; } public string ErrorEmailRecipient { get; set; } public string ErrorEmailPattern { get; set; } diff --git a/client/Maestro/Maestro.csproj b/client/Maestro/Maestro.csproj index ec0469fe..716098e0 100644 --- a/client/Maestro/Maestro.csproj +++ b/client/Maestro/Maestro.csproj @@ -129,36 +129,6 @@ ..\packages\LinkDotNet.MessageBus.Contracts.0.1.1\lib\LinkDotNet.MessageHandling.Contracts.dll - - ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll - True - - - ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll - True - - - True - ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll - True - - - True - ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll - True - - - ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll - True - - - ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll - True - - - ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll - True - ..\packages\Newtonsoft.Json.10.0.3\lib\net20\Newtonsoft.Json.dll @@ -340,7 +310,7 @@ MediaCubeClient - {8CC7C930-9DBF-487B-AED5-776937A649D5} + {8cc7c930-9dbf-487b-aed5-776937a649d5} OctopusClient diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index 1375fcc6..4c575d77 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -30,21 +30,20 @@ namespace Maestro { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = 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 dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = 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.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); this.groupSource = new System.Windows.Forms.GroupBox(); this.dataGridSource = new System.Windows.Forms.DataGridView(); this.bindingSource = new System.Windows.Forms.BindingSource(this.components); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.txtSelectedSource = new System.Windows.Forms.TextBox(); + this.textSelectedSource = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.buttonMetadata = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); @@ -64,7 +63,7 @@ namespace Maestro { this.trafficIDSelector = new TrafficClient.TrafficIDSelector(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.labelSelectedMetadata = new System.Windows.Forms.Label(); - this.txtSelectedMetadata = new System.Windows.Forms.TextBox(); + this.textSelectedMetadata = new System.Windows.Forms.TextBox(); this.menuButtonActions = new Maestro.MenuButton(); this.groupTarget = new System.Windows.Forms.GroupBox(); this.panelActions = new System.Windows.Forms.TableLayoutPanel(); @@ -78,7 +77,6 @@ namespace Maestro { this.columnLabel = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.columnProgress = new Maestro.Commons.DataGridViewProgressColumn(); this.columnStarted = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnFinished = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnInput = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -91,6 +89,7 @@ namespace Maestro { this.Level = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.systemMessageBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.columnProgress = new Maestro.Commons.DataGridViewProgressColumn(); this.metadataInfoBindingSource = new System.Windows.Forms.BindingSource(this.components); this.groupSource.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridSource)).BeginInit(); @@ -199,7 +198,7 @@ namespace Maestro { this.tableLayoutPanel2.ColumnCount = 2; this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.Controls.Add(this.txtSelectedSource, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.textSelectedSource, 0, 1); this.tableLayoutPanel2.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel2.Controls.Add(this.buttonMetadata, 1, 1); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; @@ -212,17 +211,16 @@ namespace Maestro { this.tableLayoutPanel2.Size = new System.Drawing.Size(394, 62); this.tableLayoutPanel2.TabIndex = 12; // - // txtSelectedSource + // textSelectedSource // - this.txtSelectedSource.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.txtSelectedSource.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.txtSelectedSource.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtSelectedSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.txtSelectedSource.Location = new System.Drawing.Point(3, 28); - this.txtSelectedSource.Name = "txtSelectedSource"; - this.txtSelectedSource.Size = new System.Drawing.Size(292, 26); - this.txtSelectedSource.TabIndex = 10; - this.txtSelectedSource.TextChanged += new System.EventHandler(this.OnInfoTextChanged); + this.textSelectedSource.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.textSelectedSource.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textSelectedSource.Dock = System.Windows.Forms.DockStyle.Fill; + this.textSelectedSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.textSelectedSource.Location = new System.Drawing.Point(3, 28); + this.textSelectedSource.Name = "textSelectedSource"; + this.textSelectedSource.Size = new System.Drawing.Size(292, 26); + this.textSelectedSource.TabIndex = 10; // // label1 // @@ -436,7 +434,7 @@ namespace Maestro { this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.Controls.Add(this.labelSelectedMetadata, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.txtSelectedMetadata, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.textSelectedMetadata, 0, 1); this.tableLayoutPanel1.Controls.Add(this.menuButtonActions, 1, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; this.tableLayoutPanel1.Location = new System.Drawing.Point(10, 399); @@ -461,17 +459,17 @@ namespace Maestro { this.labelSelectedMetadata.TabIndex = 13; this.labelSelectedMetadata.Text = "Selected metadata"; // - // txtSelectedMetadata + // textSelectedMetadata // - this.txtSelectedMetadata.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.txtSelectedMetadata.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.txtSelectedMetadata.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtSelectedMetadata.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.txtSelectedMetadata.Location = new System.Drawing.Point(3, 28); - this.txtSelectedMetadata.Name = "txtSelectedMetadata"; - this.txtSelectedMetadata.Size = new System.Drawing.Size(162, 26); - this.txtSelectedMetadata.TabIndex = 12; - this.txtSelectedMetadata.TextChanged += new System.EventHandler(this.OnInfoTextChanged); + this.textSelectedMetadata.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.textSelectedMetadata.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textSelectedMetadata.Dock = System.Windows.Forms.DockStyle.Fill; + this.textSelectedMetadata.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.textSelectedMetadata.Location = new System.Drawing.Point(3, 28); + this.textSelectedMetadata.Name = "textSelectedMetadata"; + this.textSelectedMetadata.Size = new System.Drawing.Size(162, 26); + this.textSelectedMetadata.TabIndex = 12; + this.textSelectedMetadata.TextChanged += new System.EventHandler(this.OnMetadataIDChanged); // // menuButtonActions // @@ -623,36 +621,35 @@ namespace Maestro { this.columnLabel, this.columnID, this.columnStatus, - this.columnProgress, this.columnStarted, this.columnFinished, this.columnInput, this.columnOutput, this.columnKillDate}); this.dataGridJobs.DataSource = this.bindingSourceJobs; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridJobs.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridJobs.DefaultCellStyle = dataGridViewCellStyle7; this.dataGridJobs.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridJobs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dataGridJobs.Location = new System.Drawing.Point(3, 3); this.dataGridJobs.Name = "dataGridJobs"; - dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridJobs.RowHeadersDefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridJobs.RowHeadersDefaultCellStyle = dataGridViewCellStyle8; this.dataGridJobs.RowHeadersVisible = false; - dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.dataGridJobs.RowsDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.dataGridJobs.RowsDefaultCellStyle = dataGridViewCellStyle9; this.dataGridJobs.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dataGridJobs.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridJobs.Size = new System.Drawing.Size(988, 92); @@ -691,20 +688,6 @@ namespace Maestro { this.columnStatus.Name = "columnStatus"; this.columnStatus.Width = 66; // - // columnProgress - // - this.columnProgress.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; - this.columnProgress.DataPropertyName = "Progress"; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle7.NullValue = null; - this.columnProgress.DefaultCellStyle = dataGridViewCellStyle7; - this.columnProgress.HeaderText = "Progress"; - this.columnProgress.Name = "columnProgress"; - this.columnProgress.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.columnProgress.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.columnProgress.Width = 200; - // // columnStarted // this.columnStarted.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; @@ -766,43 +749,43 @@ namespace Maestro { this.dataGridMessages.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells; this.dataGridMessages.BackgroundColor = System.Drawing.Color.White; this.dataGridMessages.BorderStyle = System.Windows.Forms.BorderStyle.None; - dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle11.SelectionBackColor = System.Drawing.Color.Transparent; - dataGridViewCellStyle11.SelectionForeColor = System.Drawing.Color.Transparent; - dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridMessages.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle10.SelectionForeColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridMessages.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.dataGridMessages.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridMessages.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.timeDataGridViewTextBoxColumn, this.Level, this.messageDataGridViewTextBoxColumn}); this.dataGridMessages.DataSource = this.systemMessageBindingSource; - 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.Transparent; - dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridMessages.DefaultCellStyle = dataGridViewCellStyle12; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Window; + 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.ControlText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridMessages.DefaultCellStyle = dataGridViewCellStyle11; this.dataGridMessages.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridMessages.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dataGridMessages.Location = new System.Drawing.Point(3, 3); this.dataGridMessages.Name = "dataGridMessages"; - dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridMessages.RowHeadersDefaultCellStyle = dataGridViewCellStyle13; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridMessages.RowHeadersDefaultCellStyle = dataGridViewCellStyle12; this.dataGridMessages.RowHeadersVisible = false; - dataGridViewCellStyle14.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.dataGridMessages.RowsDefaultCellStyle = dataGridViewCellStyle14; + dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.dataGridMessages.RowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridMessages.RowTemplate.DefaultCellStyle.BackColor = System.Drawing.Color.Transparent; this.dataGridMessages.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); this.dataGridMessages.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Transparent; @@ -837,6 +820,10 @@ namespace Maestro { // this.systemMessageBindingSource.DataSource = typeof(Maestro.SystemMessage); // + // columnProgress + // + this.columnProgress.Name = "columnProgress"; + // // metadataInfoBindingSource // this.metadataInfoBindingSource.DataSource = typeof(Maestro.Metadata.MetadataInfo); @@ -908,9 +895,9 @@ namespace Maestro { private System.Windows.Forms.GroupBox groupMetadata; private System.Windows.Forms.GroupBox groupTarget; private System.Windows.Forms.Button btnExecute; - private System.Windows.Forms.TextBox txtSelectedSource; + private System.Windows.Forms.TextBox textSelectedSource; private System.Windows.Forms.Label labelSelectedMetadata; - private System.Windows.Forms.TextBox txtSelectedMetadata; + private System.Windows.Forms.TextBox textSelectedMetadata; private System.Windows.Forms.TableLayoutPanel panelActions; private System.Windows.Forms.GroupBox groupActions; private System.Windows.Forms.DataGridView dataGridJobs; diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index fc7d4f0e..e4d31870 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -29,7 +29,7 @@ namespace Maestro { selectedMetadata = value; movieSegments = null; segments = null; - txtSelectedMetadata.Text = value?.ID; + textSelectedMetadata.Text = value?.ID; } } @@ -37,11 +37,11 @@ namespace Maestro { InitializeOctopusSelector(); InitializeTrafficSelector(); InitializeMediaCubeApi(); - txtSelectedMetadata.ReadOnly = !Configuration.EnableCustomMetadataId; + textSelectedMetadata.ReadOnly = !Configuration.EnableCustomMetadataId; } private void InitializeTrafficSelector() { - TrafficMetadata metadata = Configuration.Metadatas.Where(m => { return m is TrafficMetadata; }).FirstOrDefault() as TrafficMetadata; + TrafficMetadata metadata = Configuration.GetMetadataProvider(); if (metadata == null) return; trafficIDSelector.Configuration = new TrafficConfiguration() { @@ -55,7 +55,7 @@ namespace Maestro { } private void InitializeOctopusSelector() { - OctopusMetadata metadata = Configuration.Metadatas.Where(m => { return m is OctopusMetadata; }).FirstOrDefault() as OctopusMetadata; + OctopusMetadata metadata = Configuration.GetMetadataProvider(); if (metadata == null) return; octopusIDSelector.Configuration = new OctopusConfiguration() { @@ -134,12 +134,12 @@ namespace Maestro { private ArchiveMetadata GetArchiveMetadata() { ArchiveMetadata result = null; - SourceIDType idType = GetSourceType(txtSelectedMetadata.Text); + SourceIDType idType = GetSourceType(textSelectedMetadata.Text); Cursor.Current = Cursors.WaitCursor; switch (idType) { case SourceIDType.MediaCube: result = GetMediaCubeMetadata(); - txtSelectedMetadata.Text = result.itemHouseId; + textSelectedMetadata.Text = result.itemHouseId; break; case SourceIDType.OctopusID: result = GetOctopusMetadata(); @@ -163,7 +163,7 @@ namespace Maestro { } private ArchiveMetadata GetTrafficMetadata() { - string id = txtSelectedMetadata.Text; + string id = textSelectedMetadata.Text; if (String.IsNullOrEmpty(id)) return null; TrafficAPI api = trafficIDSelector.trafficAPI; @@ -195,7 +195,7 @@ namespace Maestro { private ArchiveMetadata GetOctopusMetadata() { ArchiveMetadata result = new ArchiveMetadata(); - string id = txtSelectedMetadata.Text; + string id = textSelectedMetadata.Text; OctopusAPI api = octopusIDSelector.GetClient(); IEnumerable storyEnum = api.GetStoriesById(id); if (storyEnum != null) @@ -289,7 +289,7 @@ namespace Maestro { } private void UpdateEditArchiveMetadataEnabled() { - ctxiModifyArchiveMetadata.Enabled = !String.IsNullOrEmpty(txtSelectedSource.Text); + ctxiModifyArchiveMetadata.Enabled = !String.IsNullOrEmpty(textSelectedMetadata.Text); } private void UpdateDefineSegmentEnabled() { diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index 0f6d26fa..1e23e206 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -6,7 +6,6 @@ using Maestro.Sources.Messages; using OctopusClient; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Drawing; using System.Linq; using System.Windows.Forms; @@ -30,7 +29,7 @@ namespace Maestro { } set { selectedSource = value; - txtSelectedSource.Text = selectedSource.Name; + textSelectedSource.Text = selectedSource.Name; UpdateEditArchiveMetadataEnabled(); } } @@ -55,8 +54,7 @@ namespace Maestro { logger.Debug("NEXIO source created"); } - MessageBus.Subscribe(OnFileInvolved); - MessageBus.Subscribe(OnFileInvolved); + MessageBus.Subscribe(OnFileInvolved); source.Startup(localAddress); bindingSource.DataSource = source; @@ -76,14 +74,7 @@ namespace Maestro { } private void OnFileInvolved(FileActionMsg m) { - Collection source = bindingSource.DataSource as Collection; - if (source == null) - return; - ISourceItem item = source.Where(x => x.Name.Equals(m.FileName)).SingleOrDefault(); - if (item == null) - return; - - item.IsHighlighted = true; + UpdateSelectedSources(); } private void dataGridSource_CellMouseEnter(object sender, DataGridViewCellEventArgs e) { @@ -112,7 +103,7 @@ namespace Maestro { if (selectedrows == null) return; if (e.ColumnIndex == 0) { - UpdateSelectedSources(selectedrows); + UpdateSelectedSources(); return; } if (IsPlayColumn(e.ColumnIndex)) { @@ -130,8 +121,9 @@ namespace Maestro { } } - private void UpdateSelectedSources(DataGridViewSelectedRowCollection selectedRows) { + private void UpdateSelectedSources() { String name; + var selectedRows = dataGridSource.SelectedRows; bool valueOfCheckBoxes = GetValueOfCheckBoxes(selectedRows); int nameIndex = dataGridSource.Columns.Cast().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index; int checkBoxIndex = dataGridSource.Columns.Cast().Where(x => x.GetType() == typeof(DataGridViewCheckBoxColumn)).SingleOrDefault().Index; @@ -269,36 +261,13 @@ namespace Maestro { private void dataGridSource_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) return; - var selectedRows = dataGridSource.SelectedRows; - UpdateSelectedSources(selectedRows); - } - - public void SourceDeleted(String fileName) { - int index = dataGridSource.Columns.Cast().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index; - foreach (DataGridViewRow actual in selectedSourceRows) { - String actualName = actual.Cells[index].Value as string; - if (fileName.Equals(actualName)) { - selectedSourceRows.Remove(actual); - if (txtSelectedSource.InvokeRequired) { - SetTextCallback d = new SetTextCallback(SetTextSelectedSourceAndMetadataButtonEnabled); - Invoke(d); - } else - SetTextSelectedSourceAndMetadataButtonEnabled(); - return; - } - } - } - - private void SetTextSelectedSourceAndMetadataButtonEnabled() { - SetTextSelectedSourceTextFromCheckBoxes(); - SetMetadataButtonEnabled(selectedSourceRows.Count > 0); + UpdateSelectedSources(); } private void dataGridSource_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == Keys.Space && dataGridSource.CurrentCell.GetType() != typeof(DataGridViewCheckBoxCell)) { - var selectedRows = dataGridSource.SelectedRows; - UpdateSelectedSources(selectedRows); - } + if (e.KeyCode != Keys.Space || dataGridSource.CurrentCell.GetType() == typeof(DataGridViewCheckBoxCell)) + return; + UpdateSelectedSources(); } private void buttonMetadata_Click(object sender, EventArgs e) { @@ -336,7 +305,7 @@ namespace Maestro { if (result.Count == 1) { trafficMetadataSelected?.Invoke(result[0].MediaID, result[0].VariantID); UpdateEditArchiveMetadataEnabled(); - txtSelectedMetadata.Text = result[0].MediaID; + textSelectedMetadata.Text = result[0].MediaID; } else { TrafficLookupResultSelector lookupResult = new TrafficLookupResultSelector(result, trafficMetadataSelected); lookupResult.ShowDialog(); @@ -357,7 +326,7 @@ namespace Maestro { List list = stories.ToList(); if (list.Count == 1) { UpdateEditArchiveMetadataEnabled(); - txtSelectedMetadata.Text = list[0].ID; + textSelectedMetadata.Text = list[0].ID; octopusMetadataSelected?.Invoke(list[0].ID); } else { OctopusLookupResultSelector box = new OctopusLookupResultSelector(list, octopusMetadataSelected); @@ -379,7 +348,7 @@ namespace Maestro { } if (list.Count == 1) { UpdateEditArchiveMetadataEnabled(); - txtSelectedMetadata.Text = list[0].ID; + textSelectedMetadata.Text = list[0].ID; octopusMetadataSelected?.Invoke(list[0].ID); //octopusIDSelector.IDSelectedFromOutside(list[0].ID); return; diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index cc94116e..a67fe8bb 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -167,7 +167,7 @@ namespace Maestro { MediaCubeApi = mediaCubeApi, SourceConfig = Configuration.Source, TargetConfig = target, - ID = txtSelectedMetadata.Text, + ID = textSelectedMetadata.Text, InputFileName = sourceItem.Name, Segments = segments == null ? null : new List(segments), ArchiveMetadata = ArchiveMetadata.DeepClone(archiveMetadata), @@ -209,9 +209,8 @@ namespace Maestro { return result; } - private void OnInfoTextChanged(object sender, EventArgs e) { - if (!sender.Equals(txtSelectedSource)) - ApplyProcessorButtonsLogic(); + private void OnMetadataIDChanged(object sender, EventArgs e) { + ApplyProcessorButtonsLogic(); ApplyMetaDataButtonLogic(); } @@ -240,7 +239,7 @@ namespace Maestro { private void ApplyProcessorButtonsLogic() { ClearSelectedProcessors(); - if (!String.IsNullOrEmpty(txtSelectedSource.Text) && !String.IsNullOrEmpty(txtSelectedMetadata.Text)) { + if (!String.IsNullOrEmpty(textSelectedMetadata.Text) && !String.IsNullOrEmpty(textSelectedMetadata.Text)) { ChangeProcessButtonsState(true); } else { ChangeProcessButtonsState(false); @@ -273,7 +272,7 @@ namespace Maestro { private void ApplyProcessorButtonsLogicWithoutArchiveMetadataButton() { ClearSelectedProcessors(); - if (!String.IsNullOrEmpty(txtSelectedMetadata.Text) && !String.IsNullOrEmpty(txtSelectedMetadata.Text)) { + if (!String.IsNullOrEmpty(textSelectedMetadata.Text) && !String.IsNullOrEmpty(textSelectedMetadata.Text)) { ChangeProcessButtonsState(true); } else { ChangeProcessButtonsState(false); diff --git a/client/Maestro/MaestroForm.cs b/client/Maestro/MaestroForm.cs index a6722265..3d67fd99 100644 --- a/client/Maestro/MaestroForm.cs +++ b/client/Maestro/MaestroForm.cs @@ -27,7 +27,15 @@ namespace Maestro { private BlockingCollection jobsQueue = new BlockingCollection(); private BackgroundWorker processorWorker; public IMessageBus MessageBus { get; set; } - public ConfigurationInfo Configuration; + private ConfigurationInfo configuration; + public ConfigurationInfo Configuration { + get { return configuration; } + set { + //Try modban indulva, ennek mar futnia kell + configuration = value; + InitializeSource(); + } + } private TraficMetadataSelected trafficMetadataSelected; private OctopusMetadataSelected octopusMetadataSelected; private Color newMSGColor; @@ -71,7 +79,6 @@ namespace Maestro { } private void InitializeComponents() { - InitializeSource(); InitializeMetadata(); InitializeTarget(); InitializeJobs(); diff --git a/client/Maestro/MaestroForm.resx b/client/Maestro/MaestroForm.resx index 065969d1..b4607954 100644 --- a/client/Maestro/MaestroForm.resx +++ b/client/Maestro/MaestroForm.resx @@ -132,9 +132,6 @@ True - - True - True diff --git a/client/Maestro/MeastroFormNotifyIcon.cs b/client/Maestro/MeastroFormNotifyIcon.cs index 4182c2e6..f5d74d5b 100644 --- a/client/Maestro/MeastroFormNotifyIcon.cs +++ b/client/Maestro/MeastroFormNotifyIcon.cs @@ -14,8 +14,8 @@ namespace Maestro { public MeastroFormNotifyIcon(ConfigurationInfo config, IMessageBus messageBus) { Config = config; - form.Configuration = config; form.MessageBus = messageBus; + form.Configuration = config; messageBus.Subscribe(OnFileCreated); messageBus.Subscribe(OnFileRemoved); @@ -24,6 +24,11 @@ namespace Maestro { notification.Icon = System.Drawing.SystemIcons.Information; notification.Click += Notification_Click; notification.BalloonTipClicked += Notification_BalloonTipClicked; + notification.BalloonTipClosed += Notification_BalloonTipClosed; ; + } + + private void Notification_BalloonTipClosed(object sender, EventArgs e) { + notification.Visible = false; } private void OnFileCreated(FileActionMsg m) { @@ -45,7 +50,7 @@ namespace Maestro { } public void Show(string tooltipText) { - if (tooltipText == null) + if (tooltipText == null || form.Visible) return; notification.BalloonTipText = tooltipText; notification.Visible = true; @@ -62,10 +67,10 @@ namespace Maestro { form.Activate(); } - public void BeginShowForm() { - Task.Run(() => { - ShowForm(); - }); + public void ShowFormMinimized() { + notification.Visible = false; + form.WindowState = FormWindowState.Minimized; + form.Show(); } public void HideForm() { diff --git a/client/Maestro/Program.cs b/client/Maestro/Program.cs index 382eaf5a..1709bf76 100644 --- a/client/Maestro/Program.cs +++ b/client/Maestro/Program.cs @@ -9,6 +9,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Drawing; using System.IO; +using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Security.AccessControl; @@ -26,36 +27,36 @@ namespace Maestro { /// [STAThread] static void Main() { - //string appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value.ToString(); - //string mutexId = string.Format("Global\\{{{0}}}", appGuid); - //bool createdNew; - //var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow); - //var securitySettings = new MutexSecurity(); - //securitySettings.AddAccessRule(allowEveryoneRule); - //using (var mutex = new Mutex(false, mutexId, out createdNew, securitySettings)) { - // var hasHandle = false; - // try { - // try { - // hasHandle = mutex.WaitOne(500, false); - // if (hasHandle == false) - // MessageBox.Show("A MediaCube Maestro alkalmazás már fut egy példányban."); - // } - // catch (AbandonedMutexException) { - // hasHandle = true; - // } - // } - // finally { - // if (hasHandle) { - // Application.EnableVisualStyles(); - // Application.SetCompatibleTextRenderingDefault(false); - // Application.Run(new TrayApplicationContext()); - // mutex.ReleaseMutex(); - // } - // } - //} - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new TrayApplicationContext()); + string appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value.ToString(); + string mutexId = string.Format("Global\\{{{0}}}", appGuid); + bool createdNew; + var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow); + var securitySettings = new MutexSecurity(); + securitySettings.AddAccessRule(allowEveryoneRule); + using (var mutex = new Mutex(false, mutexId, out createdNew, securitySettings)) { + var hasHandle = false; + try { + try { + hasHandle = mutex.WaitOne(500, false); + if (hasHandle == false) + MessageBox.Show("A MediaCube Maestro alkalmazás már fut egy példányban."); + } + catch (AbandonedMutexException) { + hasHandle = true; + } + } + finally { + if (hasHandle) { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new TrayApplicationContext()); + mutex.ReleaseMutex(); + } + } + } + //Application.EnableVisualStyles(); + //Application.SetCompatibleTextRenderingDefault(false); + //Application.Run(new TrayApplicationContext()); } } @@ -66,11 +67,14 @@ namespace Maestro { private IMessageBus messageBus = new MessageBus(); public TrayApplicationContext() { - Splash splash = new Splash(); - Task.Run(() => { - Application.Run(splash); - }); + String[] arguments = Environment.GetCommandLineArgs(); + if (!arguments.ToList().Contains("nosplash")) { + Splash splash = new Splash(); + Task.Run(() => { + Application.Run(splash); + }); + } CreateForms(); CreateTrayIcon(); } @@ -93,13 +97,14 @@ namespace Maestro { private void CreateForm(string file) { try { ConfigurationInfo config = Loader.Get(file); - //string decryptedstring = StringCipher.Decrypt(encryptedstring, password); - if (!config.Active) return; + ApplyCommandLineParameters(ref config); MeastroFormNotifyIcon form = new MeastroFormNotifyIcon(config, messageBus); forms.Add(form); - if (!config.StartInTray) + if (config.StartInTray) + form.ShowFormMinimized(); + else form.ShowForm(); } catch (Exception e) { @@ -108,6 +113,29 @@ namespace Maestro { } } + private void ApplyCommandLineParameters(ref ConfigurationInfo config) { + String[] arguments = Environment.GetCommandLineArgs(); + string replacementHost = arguments.ToList().Where(i => i.StartsWith("http") || i.StartsWith("https")).FirstOrDefault(); + if (String.IsNullOrEmpty(replacementHost)) + return; + var mediaCubeProvider = config.GetMetadataProvider(); + mediaCubeProvider.Server.Address = replaceAuthority(replacementHost, mediaCubeProvider.Server.Address); + var octopusProvider = config.GetMetadataProvider(); + octopusProvider.Server.Address = replaceAuthority(replacementHost, octopusProvider.Server.Address); + if (config.Source is NEXIOSource) + config.Source.Local.Address = replaceAuthority(replacementHost, config.Source.Local.Address); + } + + private Uri replaceAuthority(string replacementHost, Uri address) { + if (address == null) + return address; + Uri replacementUri = new Uri(replacementHost); + var builder = new UriBuilder(address); + builder.Host = replacementUri.Host; + builder.Port = replacementUri.Port; + return builder.Uri; + } + private List CreateMenuItems() { List menuItems = new List(); menuItems.Add(new MenuItem("Mindet megjeleníti", ShowAll)); diff --git a/client/Maestro/Sources/FileSystemSource.cs b/client/Maestro/Sources/FileSystemSource.cs index 8df8c903..0d277666 100644 --- a/client/Maestro/Sources/FileSystemSource.cs +++ b/client/Maestro/Sources/FileSystemSource.cs @@ -107,10 +107,7 @@ namespace Maestro.Sources { } private void ClearDataGridView() { - this.parent.SafeCall(() => { - Clear(); - } - ); + parent.SafeCall(() => Clear()); cache.Clear(); initialized = false; } @@ -176,70 +173,86 @@ namespace Maestro.Sources { public void OnRenamed(object sender, RenamedEventArgs e) { logger.Debug("{0} {1} {2}", e.ChangeType, e.OldName, e.Name); - var item = this.Where(x => x.Name == e.OldName).SingleOrDefault(); - if (item == null) - return; - if (item.CanHandle(acceptableExtensions)) { - item.FileInfo = new FileInfo(e.FullPath); + FileInfo fiOld = new FileInfo(e.OldFullPath); + FileInfo fiNew = new FileInfo(e.FullPath); + if (fiOld.Extension.Equals(fiNew.Extension)) { + var item = this.Where(x => x.Name == e.OldName).SingleOrDefault(); + if (item == null || !item.CanHandle(acceptableExtensions)) + return; parent.SafeCall(() => { + item.FileInfo = new FileInfo(e.FullPath); + item.IsHighlighted = true; messageBus.Send(new ModifyFileActionMsg() { FileName = e.Name, Source = parent }); }); + } else { + var newItem = CreateItem(fiNew, true); + if (newItem.CanHandle(acceptableExtensions)) + SafeCreateItem(newItem); + else { + var item = this.Where(x => x.Name == e.OldName).SingleOrDefault(); + SafeDeleteItem(item); + } } } private void OnChanged(object sender, FileSystemEventArgs e) { logger.Debug("{0} {1}", e.ChangeType, e.Name); - var item = this.Where(x => x.Name == e.Name).SingleOrDefault(); - if (item == null) + var item = this.Where(x => x.Name == e.Name).FirstOrDefault(); + if (item == null || !item.CanHandle(acceptableExtensions)) return; - if (item.CanHandle(acceptableExtensions)) { + parent.SafeCall(() => { item.FileInfo = new FileInfo(e.FullPath); - parent.SafeCall(() => { - messageBus.Send(new ModifyFileActionMsg() { - FileName = e.Name, - Source = parent - }); + item.IsHighlighted = true; + messageBus.Send(new ModifyFileActionMsg() { + FileName = e.Name, + Source = parent }); - } + }); } private void OnCreated(object sender, FileSystemEventArgs e) { //TODO enable cancel + var item = CreateItem(new FileInfo(e.FullPath), true); + if (!item.CanHandle(acceptableExtensions)) + return; CreatedFileMonitor createdFileMonitor = new CreatedFileMonitor(e.FullPath); createdFileMonitor.RunWorkerCompleted += (s1, e1) => { FileInfo fileInfo = e1.Result as FileInfo; - parent.SafeCall(() => { - Insert(0, CreateItem(fileInfo, true)); - messageBus.Send(new CreateFileActionMsg() { - FileName = fileInfo.Name, - Source = parent - }); - }); + var completedItem = CreateItem(fileInfo, true); + SafeCreateItem(completedItem); }; logger.Debug("{0} {1}", e.ChangeType, e.Name); } + private void SafeCreateItem(FileSourceItem item) { + parent.SafeCall(() => { + Insert(0, item); + messageBus.Send(new CreateFileActionMsg() { + FileName = item.Name, + Source = parent + }); + }); + } + private void OnDeleted(object sender, FileSystemEventArgs e) { logger.Debug("{0} {1}", e.ChangeType, e.Name); - var enumList = this.Where(item => item.Name.Equals(e.Name))?.ToList(); - FileSourceItem fileSourceItem = enumList.Count == 0 ? null : enumList.First(); - if (fileSourceItem == null) + FileSourceItem item = this.Where(i => i.Name.Equals(e.Name)).FirstOrDefault(); + if (item == null || !item.CanHandle(acceptableExtensions)) return; - if (fileSourceItem.CanHandle(acceptableExtensions)) { - parent.SafeCall(() => { - Remove(fileSourceItem); - messageBus.Send(new RemoveFileActionMsg() { - FileName = e.Name, - Source = parent - }); + SafeDeleteItem(item); + } + + private void SafeDeleteItem(FileSourceItem item) { + parent.SafeCall(() => { + Remove(item); + messageBus.Send(new RemoveFileActionMsg() { + FileName = item.Name, + Source = parent }); - MaestroForm form = (MaestroForm)parent; - form.SourceDeleted(e.Name); - return; - } + }); } public void ApplySort(ListSortDescriptionCollection sorts) { diff --git a/client/Maestro/Targets/FTPTargetProcessor.cs b/client/Maestro/Targets/FTPTargetProcessor.cs index 5911c427..b391febc 100644 --- a/client/Maestro/Targets/FTPTargetProcessor.cs +++ b/client/Maestro/Targets/FTPTargetProcessor.cs @@ -34,6 +34,10 @@ namespace Maestro.Targets { TerminateClient(targetFTP); } + private void DeleteFile(string currentFile) { + targetFTP.DeleteFile(currentFile); + } + protected override void UploadFile() { using (FileStream istream = File.OpenRead(Input)) { using (Stream ostream = targetFTP.OpenWrite(OutputName)) { diff --git a/client/Maestro/Targets/UNCTargetProcessor.cs b/client/Maestro/Targets/UNCTargetProcessor.cs index abac4edb..aa50f3b3 100644 --- a/client/Maestro/Targets/UNCTargetProcessor.cs +++ b/client/Maestro/Targets/UNCTargetProcessor.cs @@ -60,6 +60,9 @@ namespace Maestro.Targets { workFlowAction.destination = Output; Status = "Folyamatban"; //DateTime started = DateTime.Now; + string currentFile = GetOutputFilePath(workingDir, OutputName); + if (FileExists(currentFile) && parameters.TargetConfig.DisableFileVersioning) + DeleteFile(currentFile); UploadFile(); //logger.Info("Spend (s):" + (DateTime.Now - started).TotalSeconds); ExecuteCompleted(); @@ -79,6 +82,9 @@ namespace Maestro.Targets { return result; } + private void DeleteFile(string currentFile) { + File.Delete(currentFile); + } private string GetOutputName() { if (String.IsNullOrEmpty(OutputName)) @@ -228,14 +234,15 @@ namespace Maestro.Targets { string nameWithoutExtension = parameters.TargetConfig.OutputFormat.Replace("%ID%", ID).Replace("%SOURCENAME%", Path.GetFileNameWithoutExtension(InputName)); string extension = InputName.Contains(".") ? InputName.Substring(InputName.LastIndexOf(".")) : DEFAULT_EXTENSION; extension = extension.ToUpper(); - string result = String.Format(FILENAME, nameWithoutExtension, extension); - int version = 1; - while (FileExists(GetOutputFilePath(workingDir, result))) { - string versioned = String.Format(VERSIONED_FILENAME, nameWithoutExtension, version, extension); - logger.Debug(ALREADY_EXISTS, result, versioned); - result = versioned; - version++; + if (!parameters.TargetConfig.DisableFileVersioning) { + int version = 1; + while (FileExists(GetOutputFilePath(workingDir, result))) { + string versioned = String.Format(VERSIONED_FILENAME, nameWithoutExtension, version, extension); + logger.Debug(ALREADY_EXISTS, result, versioned); + result = versioned; + version++; + } } return result; } diff --git a/client/MediaCube.vssscc b/client/MediaCube.vssscc new file mode 100644 index 00000000..794f014c --- /dev/null +++ b/client/MediaCube.vssscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" +} diff --git a/client/OctopusClient/OctopusIDSelector.cs b/client/OctopusClient/OctopusIDSelector.cs index b44190b9..276618f0 100644 --- a/client/OctopusClient/OctopusIDSelector.cs +++ b/client/OctopusClient/OctopusIDSelector.cs @@ -40,8 +40,8 @@ namespace OctopusClient { tpRundown.Text = Resources.ADASTUKOR; tpStoryFolder.Text = Resources.MAPPA; linkID.Text = Resources.KERESES; - bindingRundown.Add(Resources.VALASSZON_ELEMET); - bindingStoryFolder.Add(Resources.VALASSZON_ELEMET); + //bindingRundown.Add(Resources.VALASSZON_ELEMET); + //bindingStoryFolder.Add(Resources.VALASSZON_ELEMET); } private void OctopusIDSelector_Load(object sender, EventArgs e) { diff --git a/server/-configuration/mediacube-dev-user.properties b/server/-configuration/mediacube-dev-user.properties new file mode 100644 index 00000000..bb284ab3 --- /dev/null +++ b/server/-configuration/mediacube-dev-user.properties @@ -0,0 +1,23 @@ +#A user.dir mindig a test projekt mappaja, a relativ hivatkozasok ehhez kepest ertendok. +#JobEngine +jobengine.loglevel=INFO +jobengine.jobsteps.root=../user.jobengine.osgi.server/resources/executors +jobengine.jobtemplates.root=../user.jobengine.osgi.server/resources/templates +jobengine.jobsteps.alternate.root=../user.jobengine.executors/bin/user/jobengine/server/steps +jobengine.db.url=jdbc:db2://10.228.198.1:50000/mediaarc:retrieveMessagesFromServerOnGetMessage=true; +jobengine.db.user=db2admin +jobengine.db.password=password +jobengine.octopus.api.address=http://10.10.1.11/api/v1 +jobengine.octopus.api.user=mam +jobengine.octopus.api.password=napocska +jobengine.nosql.db.url=jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true; +jobengine.nosql.db.user=db2admin +jobengine.nosql.db.password=password +jobengine.nexio.db.url=jdbc:sqlserver://10.10.1.59:1433;databaseName=NXDB; +jobengine.nexio.db.user=sa +jobengine.nexio.db.password=resolve +#System +jetty.home=../user.jobengine.osgi.rest/ +jetty.etc.config.urls=etc/user-jetty.xml,etc/user-jetty-ssl.xml,etc/user-jetty-ssl-context.xml,etc/user-jetty-http.xml,etc/user-jetty-https.xml +log4j.configuration=../-configuration/log4j.properties +log4j.configurationFile=../-configuration/log4j2.xml \ No newline at end of file diff --git a/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusDataMinerTest.java b/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusDataMinerTest.java index ebb1c1b2..14710599 100644 --- a/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusDataMinerTest.java +++ b/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusDataMinerTest.java @@ -26,8 +26,6 @@ import user.commons.octopus.OctopusDataMiner; public class OctopusDataMinerTest { - private OctopusDataMiner sut; - @BeforeClass public static void initialize() throws Exception { // System.setProperty("jobengine.nosql.db.url", @@ -43,34 +41,19 @@ public class OctopusDataMinerTest { Properties properties = new Properties(); URL srcLocation = MethodHandles.lookup().lookupClass().getProtectionDomain().getCodeSource().getLocation(); - URL location = new URL(srcLocation, "../../-configuration/mediacube-dev.properties"); + //URL location = new URL(srcLocation, "../../-configuration/mediacube-dev.properties"); + URL location = new URL(srcLocation, "../../-configuration/mediacube-dev-user.properties"); properties.load(new FileInputStream(location.toURI().getPath().toString())); System.getProperties().putAll(properties); } - @Test - public void run() { - sut = new OctopusDataMiner(); - sut.run(); - } - - @Test - public void integrationTestWithClear() { - // fixture - sut = new OctopusDataMiner(); - sut.clear(); - - // Exercise - sut.run(); - } + private OctopusDataMiner sut; @Test public void deleteOrphanStories() { try { - DB db = NoSQLClient.getDB( - "jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true;", "db2admin", - "password", "test"); + DB db = NoSQLClient.getDB("jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true;", "db2admin", "password", "test"); DBCollection collection = db.getCollection("testCollection"); long id1 = 1, id2 = 2, id3 = 3, id4 = 4, id5 = 5; @@ -111,15 +94,31 @@ public class OctopusDataMinerTest { } } + @Test + public void integrationTestWithClear() { + // fixture + sut = new OctopusDataMiner(); + sut.clear(); + + // Exercise + sut.run(); + } + + @Test + public void run() { + sut = new OctopusDataMiner(); + sut.run(); + } + @Test public void test() throws SQLException { IOctopusAPI api = new OctopusAPI(); List stories = api.getStories(); for (DBObject actual : stories) { if (actual.containsField("rundown")) { - BasicDBList rundowns = (BasicDBList)actual.get("rundown"); + BasicDBList rundowns = (BasicDBList) actual.get("rundown"); BasicDBList objs = (BasicDBList) actual.get("mosObjects"); - if(objs.size() > 0) + if (objs.size() > 0) System.out.println(rundowns); } } diff --git a/server/user.jobengine.osgi.db/sql/5-CreateFTIndex.db2 b/server/user.jobengine.osgi.db/sql/5-CreateFTIndex.db2 index 24ba00c4..59a905aa 100644 --- a/server/user.jobengine.osgi.db/sql/5-CreateFTIndex.db2 +++ b/server/user.jobengine.osgi.db/sql/5-CreateFTIndex.db2 @@ -18,6 +18,7 @@ db2ts "create index media_desc for text on media(description) UPDATE FREQUENCY D db2ts "create index media_houseid for text on media(houseid) UPDATE FREQUENCY D(*) H(*) M(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59) UPDATE MINIMUM 1 connect to mc" db2ts "create index mediafile_houseid for text on mediafile(houseid) UPDATE FREQUENCY D(*) H(*) M(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59) UPDATE MINIMUM 1 connect to mc" + db2ts "update index item_title for text connect to mc" db2ts "update index item_desc for text connect to mc" db2ts "update index item_houseid for text connect to mc" -- 2.54.0