git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Sat, 18 Nov 2017 21:19:42 +0000 (21:19 +0000)
committerVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Sat, 18 Nov 2017 21:19:42 +0000 (21:19 +0000)
18 files changed:
client/IntegrationTests/lib/mysql.data.dll [new file with mode: 0644]
client/MXFFileParser/MXFFileParser.csproj.vspscc [new file with mode: 0644]
client/Maestro/Configuration/configuration-editor.json
client/Maestro/Configuration/configuration-playout-ingest.json
client/Maestro/MaestroForm.Designer.cs
client/Maestro/MaestroForm.Source.cs
client/Maestro/MaestroForm.Target.cs
client/Maestro/MaestroForm.cs
client/Maestro/MaestroForm.resx
client/MaestroShared/Configuration/ConfigurationInfo.cs
client/MaestroShared/MaestroShared.csproj
client/MaestroShared/MaestroShared.csproj.vspscc [new file with mode: 0644]
client/MaestroShared/Resources/MaestroColors.cs [new file with mode: 0644]
client/MaestroShared/Targets/FTPTargetProcessor.cs
client/MaestroShared/Targets/FXPTargetProcessor.cs
client/MaestroShared/Targets/ITargetProcessor.cs
client/MaestroShared/Targets/TargetProcessor.cs
client/MaestroShared/Targets/UNCTargetProcessor.cs

diff --git a/client/IntegrationTests/lib/mysql.data.dll b/client/IntegrationTests/lib/mysql.data.dll
new file mode 100644 (file)
index 0000000..216dbe3
Binary files /dev/null and b/client/IntegrationTests/lib/mysql.data.dll differ
diff --git a/client/MXFFileParser/MXFFileParser.csproj.vspscc b/client/MXFFileParser/MXFFileParser.csproj.vspscc
new file mode 100644 (file)
index 0000000..feffdec
--- /dev/null
@@ -0,0 +1,10 @@
+""\r
+{\r
+"FILE_VERSION" = "9237"\r
+"ENLISTMENT_CHOICE" = "NEVER"\r
+"PROJECT_FILE_RELATIVE_PATH" = ""\r
+"NUMBER_OF_EXCLUDED_FILES" = "0"\r
+"ORIGINAL_PROJECT_FILE_PATH" = ""\r
+"NUMBER_OF_NESTED_PROJECTS" = "0"\r
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"\r
+}\r
index 5324669dd6cd76f6cfd9596723ad7ed49ea1f1ef..98f3a22b22b505d3cfe04e7ff781e97aa761b677 100644 (file)
@@ -1,6 +1,6 @@
 {\r
   "title": "Szerkesztő",\r
-  "active": false,\r
+  "active": true,\r
   "startInTray": false,\r
   "enableCustomMetadataId": true,\r
   "player": {\r
@@ -77,6 +77,7 @@
       "outputFormat": "%ID%",\r
       "tag": "Betöltés",\r
       "nexioServer": true,\r
+      "nexioFileExistsMessage": "A feltöltéshez új 'placeholder' generálása szükséges az Octopus rendszerben, az anyagon belül az ALT+1 billenytűkombináció segítségével.",\r
       "killDateDays": 7,\r
       "disableFileVersioning": true,\r
       "agency": "MAESTRO-EDITOR",\r
index aa818ef78d9a56e12fce43f666f94ee12d06375c..ddd13040318565787876b4f4db0d6b43d9a535d9 100644 (file)
@@ -1,6 +1,6 @@
 {\r
   "title": "Lebony betöltő",\r
-  "active": true,\r
+  "active": false,\r
   "startInTray": false,\r
   "enableCustomMetadataId": true,\r
   "player": {\r
index 60924ec41223436b98ca8971509c242c74dcc081..69730c92219c019a23b7dbf36b5b7c51cc7240b8 100644 (file)
@@ -194,7 +194,7 @@ namespace Maestro {
             this.dgSource.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridSource_CellMouseDoubleClick);\r
             this.dgSource.CellMouseEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellMouseEnter);\r
             this.dgSource.CellMouseLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellMouseLeave);\r
-            this.dgSource.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.dataGridSource_CellPainting);\r
+            this.dgSource.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.OnSourceCellPainting);\r
             this.dgSource.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridSource_KeyDown);\r
             // \r
             // treeFolders\r
@@ -722,6 +722,7 @@ namespace Maestro {
             this.dgJobs.Size = new System.Drawing.Size(988, 90);\r
             this.dgJobs.TabIndex = 0;\r
             this.dgJobs.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridJobs_CellEnter);\r
+            this.dgJobs.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.OnJobsCellPainting);\r
             this.dgJobs.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dataGridJobs_MouseClick);\r
             // \r
             // columnLabel\r
index 537b70b336277b8776e60c1916276f170271df51..a13d6365a4bc6746fed1dc114df334845820b4f5 100644 (file)
@@ -1,8 +1,10 @@
 using DxPlay;\r
 using Maestro.Metadata;\r
 using Maestro.Sources;\r
+using MaestroShared.Commons;\r
 using MaestroShared.Configuration;\r
 using MaestroShared.Metadata;\r
+using MaestroShared.Resources;\r
 using System;\r
 using System.Collections.Generic;\r
 using System.Diagnostics;\r
@@ -231,7 +233,7 @@ namespace Maestro {
             return new FileInfo(inputUri.LocalPath);\r
         }\r
 \r
-        private void dataGridSource_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) {\r
+        private void OnSourceCellPainting(object sender, DataGridViewCellPaintingEventArgs e) {\r
             if (e.RowIndex < 0)\r
                 return;\r
             ISourceItem item = dgSource.Rows[e.RowIndex].DataBoundItem as ISourceItem;\r
@@ -239,7 +241,7 @@ namespace Maestro {
                 return;\r
             DataGridViewRow row = dgSource.Rows[e.RowIndex];\r
             if (item.IsHighlighted) {\r
-                row.DefaultCellStyle.BackColor = Color.DarkGreen;\r
+                row.DefaultCellStyle.BackColor = MaestroColors.Green200;\r
                 row.DefaultCellStyle.ForeColor = Color.White;\r
             } else\r
                 row.DefaultCellStyle = null;\r
index 3765ab693cd5ae45409cb5c53e4db8a90d41b7af..cad5a5e3e99ee41c9c1c354f30261257d168ba04 100644 (file)
@@ -163,11 +163,9 @@ namespace Maestro {
                 return;\r
             var controlls = panelActions.Controls;\r
             foreach (Control actual in controlls) {\r
-                CheckBox actualCheckbox = actual as CheckBox;\r
-                if (actualCheckbox != null && actualCheckbox.Text.Equals(reference)) {\r
+                if (actual is CheckBox actualCheckbox && actualCheckbox.Text.Equals(reference)) {\r
                     if (check)\r
                         actualCheckbox.Checked = check;\r
-\r
                     actualCheckbox.Enabled = !check;\r
                 }\r
             }\r
@@ -206,11 +204,12 @@ namespace Maestro {
         }\r
 \r
         private void OnExecuteClick(object sender, EventArgs e) {\r
-            foreach (var element in currentProcessors)\r
-                foreach (ITargetProcessor value in element.Value) {\r
-                    jobs.Add(value);\r
-                    jobsQueue.Add(value);\r
+            foreach (var element in currentProcessors) {\r
+                foreach (ITargetProcessor processor in element.Value) {\r
+                    jobs.Add(processor);\r
+                    jobsQueue.Enqueue(processor);\r
                 }\r
+            }\r
 \r
             ClearSelectedProcessors();\r
             if (processorWorker == null)\r
index 3035bb2adc7db89e62b2b6e764f4b6bca0d45fb8..ff6c5b8b270dc1b27505e627dc6e06e7787bcf8f 100644 (file)
@@ -15,6 +15,7 @@ using LinkDotNet.MessageHandling;
 using MaestroShared.Configuration;\r
 using MaestroShared.Targets;\r
 using MaestroShared.Commons;\r
+using MaestroShared.Resources;\r
 \r
 namespace Maestro {\r
 \r
@@ -25,7 +26,7 @@ namespace Maestro {
         private GroupBox[] groups;\r
         private Dictionary<CheckBox, List<ITargetProcessor>> currentProcessors = new Dictionary<CheckBox, List<ITargetProcessor>>();\r
         private BindingList<ITargetProcessor> jobs = new BindingList<ITargetProcessor>();\r
-        private BlockingCollection<ITargetProcessor> jobsQueue = new BlockingCollection<ITargetProcessor>();\r
+        private ConcurrentQueue<ITargetProcessor> jobsQueue = new ConcurrentQueue<ITargetProcessor>();\r
         private BackgroundWorker processorWorker;\r
         public IMessageBus MessageBus { get; set; }\r
         private IMessageBus errorMessageBus = new MessageBus();\r
@@ -105,9 +106,9 @@ namespace Maestro {
 \r
         private void InitializeJobs() {\r
             bindingSourceJobs.DataSource = jobs;\r
-            foreach (DataGridViewColumn column in dgJobs.Columns) {\r
-                column.HeaderCell.Style.Font = new Font(dgJobs.Font, FontStyle.Regular);\r
-            }\r
+            //foreach (DataGridViewColumn column in dgJobs.Columns) {\r
+            //    column.HeaderCell.Style.Font = new Font(dgJobs.Font, FontStyle.Regular);\r
+            //}\r
         }\r
 \r
         private void MaestroForm_Resize(object sender, EventArgs e) {\r
@@ -128,7 +129,9 @@ namespace Maestro {
             processorWorker.DoWork += (s, e) => {\r
                 while (!e.Cancel) {\r
                     ITargetProcessor job;\r
-                    if (jobsQueue.TryTake(out job)) {\r
+                    if (jobsQueue.TryDequeue(out job)) {\r
+                        if (TargetProcessor.REVOKED.Equals(job.Status))\r
+                            continue;\r
                         (this).SafeCall(() => {\r
                             int position = jobs.IndexOf(job);\r
                             if (position == -1)\r
@@ -182,9 +185,8 @@ namespace Maestro {
         }\r
 \r
         private void MaestroForm_FormClosed(object sender, FormClosedEventArgs e) {\r
-            if (processorWorker != null) {\r
+            if (processorWorker != null)\r
                 processorWorker.CancelAsync();\r
-            }\r
         }\r
 \r
         private void dataGridJobs_CellEnter(object sender, DataGridViewCellEventArgs e) {\r
@@ -200,74 +202,48 @@ namespace Maestro {
             InitializeComponents();\r
         }\r
 \r
-        //private void textBox1_KeyUp(object sender, KeyEventArgs e) {\r
-        //    if (e.KeyCode != Keys.Return)\r
-        //        return;\r
-        //    if (String.IsNullOrEmpty(txtSorceFilter.Text))\r
-        //        bindingSource.RemoveFilter();\r
-        //    else {\r
-        //        bindingSource.Filter = txtSorceFilter.Text;\r
-        //    }\r
-        //}\r
-\r
         private void ActivateTab(int index) {\r
             tabSystem.SelectedIndex = index;\r
         }\r
 \r
-        //private void UpdateDataGridMessagesChanged() {\r
-        //    dataGridMessages.DataSource = null;\r
-        //    dataGridMessages.DataSource = systemMessageBindingSource;\r
-        //}\r
-\r
-        //private void buttonDeleteFilter_Click(object sender, EventArgs e) {\r
-        //    if (!String.IsNullOrEmpty(txtSorceFilter.Text)) {\r
-        //        bindingSource.RemoveFilter();\r
-        //        txtSorceFilter.Text = string.Empty;\r
-        //    }\r
-        //}\r
-\r
         private void dataGridJobs_MouseClick(object sender, MouseEventArgs e) {\r
             if (e.Button == MouseButtons.Right && dgJobs.SelectedRows.Count == 1) {\r
                 ContextMenu popupMenu = new ContextMenu();\r
                 MenuItem makeFileToProtected = new MenuItem(StringResources.ALLOMANY_VEDETTE_TETELE);\r
                 makeFileToProtected.Click += MakeFileToProtected_click;\r
-                MenuItem deleteProcess = new MenuItem(StringResources.TORLES);\r
-                deleteProcess.Click += DeleteProcess_click;\r
                 popupMenu.MenuItems.Add(makeFileToProtected);\r
-                popupMenu.MenuItems.Add(deleteProcess);\r
                 popupMenu.Show(dgJobs, new Point(e.X, e.Y));\r
             }\r
         }\r
 \r
         private void MakeFileToProtected_click(object sender, EventArgs e) {\r
-            ITargetProcessor current = bindingSourceJobs.Current as ITargetProcessor;\r
-            if (current == null)\r
+            ITargetProcessor processor = bindingSourceJobs.Current as ITargetProcessor;\r
+            if (processor == null)\r
                 return;\r
-            if (File.Exists(current.KillDatePath)) {\r
-                File.Delete(current.KillDatePath);\r
-                current.KillDate = string.Empty;\r
+            if (File.Exists(processor.KillDatePath)) {\r
+                File.Delete(processor.KillDatePath);\r
+                processor.KillDate = string.Empty;\r
             }\r
         }\r
 \r
-        private void DeleteProcess_click(object sender, EventArgs e) {\r
-            ITargetProcessor current = bindingSourceJobs.Current as ITargetProcessor;\r
-            if (current == null)\r
+        private void OnJobsCellPainting(object sender, DataGridViewCellPaintingEventArgs e) {\r
+            if (e.RowIndex < 0)\r
                 return;\r
-            //ha van státusza, már nem törölhető\r
-            if (current.Status != null)\r
+            ITargetProcessor item = dgJobs.Rows[e.RowIndex].DataBoundItem as ITargetProcessor;\r
+            if (item == null)\r
                 return;\r
-            BackgroundWorker worker = new BackgroundWorker();\r
-            worker.DoWork += (s, r) => {\r
-                ITargetProcessor outJob;\r
-                while (jobsQueue.TryTake(out outJob)) {\r
-                    if (!outJob.Equals(current)) {\r
-                        jobsQueue.TryAdd(outJob);\r
-                    }\r
-                }\r
-            };\r
-            var actualRow = dgJobs.SelectedRows[0];\r
-            dgJobs.Rows.Remove(actualRow);\r
+            DataGridViewRow row = dgJobs.Rows[e.RowIndex];\r
+            switch (item.Status) {\r
+                case TargetProcessor.ERROR:\r
+                    row.DefaultCellStyle.BackColor = MaestroColors.Red200;\r
+                    break;\r
+                case TargetProcessor.REVOKED:\r
+                    row.DefaultCellStyle.BackColor = MaestroColors.Orange200;\r
+                    break;\r
+                case TargetProcessor.READY:\r
+                    row.DefaultCellStyle.BackColor = MaestroColors.BlueGray200;\r
+                    break;\r
+            }\r
         }\r
-\r
     }\r
 }\r
index 71d129372be654bc39fdce70c338e64b9b2b607a..c8aa6e9da814555ba80333d7561cd827dc6c47d3 100644 (file)
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w\r
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0\r
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACc\r
-        BwAAAk1TRnQBSQFMAwEBAAEQAQABEAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA\r
+        BwAAAk1TRnQBSQFMAwEBAAEYAQABGAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA\r
         AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA\r
         AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA\r
         AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm\r
index 95b89b0a503ce81c766222b067ac8a6213e1c889..f6d6135bfaffb57dc019c4ad808f6d7063db72b4 100644 (file)
@@ -76,6 +76,7 @@ namespace MaestroShared.Configuration {
         public string SuccessEmailPattern { get; set; }\r
         public string Reference { get; set; }\r
         public bool NexioServer { get; set; }\r
+        public string NexioFileExistsMessage { get; set; }\r
         public string Agency { get; set; }\r
     }\r
 \r
index 98b295a74134ea07264e189c29b6ebda72bb9ba0..e7f1955ceaee76a45609771f05e8b5d21eb52006 100644 (file)
@@ -89,6 +89,7 @@
     <Compile Include="Metadata\Timecode.cs" />\r
     <Compile Include="Properties\AssemblyInfo.cs" />\r
     <Compile Include="Metadata\ArchiveMetadata.cs" />\r
+    <Compile Include="Resources\MaestroColors.cs" />\r
     <Compile Include="Targets\FTPTargetProcessor.cs" />\r
     <Compile Include="Targets\FXPTargetProcessor.cs" />\r
     <Compile Include="Targets\ITargetProcessor.cs" />\r
diff --git a/client/MaestroShared/MaestroShared.csproj.vspscc b/client/MaestroShared/MaestroShared.csproj.vspscc
new file mode 100644 (file)
index 0000000..feffdec
--- /dev/null
@@ -0,0 +1,10 @@
+""\r
+{\r
+"FILE_VERSION" = "9237"\r
+"ENLISTMENT_CHOICE" = "NEVER"\r
+"PROJECT_FILE_RELATIVE_PATH" = ""\r
+"NUMBER_OF_EXCLUDED_FILES" = "0"\r
+"ORIGINAL_PROJECT_FILE_PATH" = ""\r
+"NUMBER_OF_NESTED_PROJECTS" = "0"\r
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"\r
+}\r
diff --git a/client/MaestroShared/Resources/MaestroColors.cs b/client/MaestroShared/Resources/MaestroColors.cs
new file mode 100644 (file)
index 0000000..32497ac
--- /dev/null
@@ -0,0 +1,11 @@
+using System.Drawing;\r
+\r
+namespace MaestroShared.Resources {\r
+    public class MaestroColors {\r
+        public static readonly Color Green200 = Color.FromArgb(0xFF, 0xC5, 0xE1, 0xA5);\r
+        public static readonly Color Yellow200 = Color.FromArgb(0xFF, 0xE6, 0xEE, 0x9C);\r
+        public static readonly Color Orange200 = Color.FromArgb(0xFF, 0xFF, 0xCC, 0x80);\r
+        public static readonly Color Red200 = Color.FromArgb(0xFF, 0xEF, 0x9A, 0x9A);\r
+        public static readonly Color BlueGray200 = Color.FromArgb(0xFF, 0xB0, 0xBE, 0xC5);\r
+    }\r
+}\r
index 5a89cdd4152aa675ff260c01eee14aa374c986cf..0d7cddd414b91c34bfd9288c1eb8f3891268c6fe 100644 (file)
@@ -29,7 +29,7 @@ namespace MaestroShared.Targets {
 \r
         protected override void BeforeExecute() {\r
             base.BeforeExecute();\r
-            targetFTP = CreateClient(parameters.TargetConfig.Remote);\r
+            targetFTP = CreateClient(Parameters.TargetConfig.Remote);\r
         }\r
 \r
         protected override void AfterExecute() {\r
@@ -64,7 +64,7 @@ namespace MaestroShared.Targets {
 \r
         protected void reconnect() {\r
             TerminateClient(targetFTP);\r
-            targetFTP = CreateClient(parameters.TargetConfig.Remote);\r
+            targetFTP = CreateClient(Parameters.TargetConfig.Remote);\r
             EnsureDirectoryExistence(workingDir);\r
         }\r
 \r
@@ -124,9 +124,9 @@ namespace MaestroShared.Targets {
 \r
         protected override string DetermineWorkingDirectory(Connection connection) {\r
             string result = null;\r
-            if (!String.IsNullOrEmpty(parameters.TargetConfig.SubFolderFormat)) {\r
-                string name = GetDynamicName(parameters.TargetConfig.SubFolderFormat);\r
-                if (parameters.TargetConfig.SubFolderFormat.Contains(PATTERN_TEXT)) {\r
+            if (!String.IsNullOrEmpty(Parameters.TargetConfig.SubFolderFormat)) {\r
+                string name = GetDynamicName(Parameters.TargetConfig.SubFolderFormat);\r
+                if (Parameters.TargetConfig.SubFolderFormat.Contains(PATTERN_TEXT)) {\r
                     string pattern = name.Split(HYPHEN[0])[0] + HYPHEN;\r
                     targetFTP.SetWorkingDirectory(connection.Address.LocalPath);\r
                     FtpListItem item = targetFTP.GetListing()?.Where(i => i.Type.Equals(FtpFileSystemObjectType.Directory) && i.Name.StartsWith(pattern)).FirstOrDefault();\r
index 6ba5283df272733d08394e2a3c911b9dd75a4ba3..0517ed54aeeb53b0c996d5f2cac2380124573f9c 100644 (file)
@@ -33,7 +33,7 @@ namespace MaestroShared.Targets {
 \r
                 string input = inputUri.AbsolutePath.Replace(LITERAL_SPACE, SPACE);\r
                 long ilength = sourceFTP.GetFileSize(input);\r
-                if (parameters.TargetConfig.NexioServer)\r
+                if (Parameters.TargetConfig.NexioServer)\r
                     ilength = ilength / 2;\r
 \r
                 FtpReply replyPASV = targetFTP.Execute("PASV");\r
@@ -77,7 +77,7 @@ namespace MaestroShared.Targets {
                     throw new Exception(replySTOR.ErrorMessage);\r
 \r
 \r
-                monitorFTP = CreateClient(parameters.TargetConfig.Remote);\r
+                monitorFTP = CreateClient(Parameters.TargetConfig.Remote);\r
                 monitorFTP.SetWorkingDirectory(workingDir);\r
                 FtpReply monitorReplyTYPE = monitorFTP.Execute("TYPE I");\r
                 if (!monitorReplyTYPE.Success)\r
index 94157459029d77aed034cce965410c200bffc921..977f726dce470e0d295d58e27b3feab0f207ab99 100644 (file)
@@ -5,6 +5,7 @@ using System.Windows.Forms;
 \r
 namespace MaestroShared.Targets {\r
     public interface ITargetProcessor : INotifyPropertyChanged {\r
+        TargetProcessorParameter Parameters { get; }\r
         DateTime Started { get; set; }\r
         DateTime Finished { get; set; }\r
         string Input { get; set; }\r
index fc0b52a151833ea228296e761a3ad2d85889f086..19dc09e64e051d102333e459e83405ecd0e6f7bc 100644 (file)
@@ -7,6 +7,10 @@ using System.Windows.Forms;
 \r
 namespace MaestroShared.Targets {\r
     public abstract class TargetProcessor : MarshalByRefObject, ITargetProcessor {\r
+        public const string INPROGRESS = "Folyamatban";\r
+        public const string ERROR = "Hiba";\r
+        public const string READY = "Kész";\r
+        public const string REVOKED = "Visszavonva";\r
         private string status;\r
         private string message;\r
         private string id;\r
@@ -25,6 +29,7 @@ namespace MaestroShared.Targets {
 \r
         public virtual void Initialize(Control parent, TargetProcessorParameter parameters) {\r
             this.parent = parent;\r
+            this.Parameters = parameters;\r
         }\r
 \r
         protected void NotifyPropertyChanged([CallerMemberName] String propertyName = "") {\r
@@ -38,6 +43,8 @@ namespace MaestroShared.Targets {
         protected virtual void ExecuteCompleted() {\r
         }\r
 \r
+        public TargetProcessorParameter Parameters { get; internal set; }\r
+\r
         public string Status {\r
             get {\r
                 return status;\r
index 2a842f66a573e12149a34c3265cc6b3a84a02c88..33038f928c1018737fe97b504d3e9831b0eaddd4 100644 (file)
@@ -32,12 +32,9 @@ namespace MaestroShared.Targets {
         private const string COMMERCIAL = "COMMERCIAL";\r
         private const string JUNCTION = "JUNCTION";\r
         private const string XML_EXT = ".xml";\r
-        private const string INPROGRESS = "Folyamatban";\r
-        private const string ERROR = "Hiba";\r
         private const string DOT = ".";\r
         private const string HYPHENSTAR = "-*";\r
         private const string DATE_FORMAT_NODOTS = "yyyyMMdd";\r
-        private const string READY = "Kész";\r
         private const string HYPHEN_SPACES = " - ";\r
         private const string PATTERN_TARGETNAME = "%TARGETNAME%";\r
         private const string PATTERN_ID = "%ID%";\r
@@ -53,13 +50,11 @@ namespace MaestroShared.Targets {
         protected const string SLASH = "/";\r
         protected FileInfo inputFile;\r
         protected string workingDir;\r
-        protected TargetProcessorParameter parameters;\r
 \r
         public WorkflowAction workFlowAction { get; set; }\r
 \r
         public override void Initialize(Control parent, TargetProcessorParameter parameters) {\r
             base.Initialize(parent, parameters);\r
-            this.parameters = parameters;\r
             InputName = parameters.InputFileName;\r
             Input = Path.Combine(parameters.SourceConfig.Local.Address.LocalPath, parameters.InputFileName);\r
             inputFile = new FileInfo(Input);\r
@@ -83,34 +78,29 @@ namespace MaestroShared.Targets {
             bool result = false;\r
             try {\r
                 BeforeExecute();\r
-                workingDir = DetermineWorkingDirectory(parameters.TargetConfig.Remote);\r
+                workingDir = DetermineWorkingDirectory(Parameters.TargetConfig.Remote);\r
                 EnsureDirectoryExistence(workingDir);\r
                 OutputName = CreateOutputFileName();\r
-                OutputName = OutputName.ToUpper();\r
-                Output = "/".Equals(workingDir) ? OutputName : Path.Combine(workingDir, OutputName);\r
-                Output = Output.Replace(@"\", "/");\r
+                CreateOutput(workingDir);\r
                 workFlowAction.source = Input;\r
                 workFlowAction.destination = Output;\r
                 Status = INPROGRESS;\r
                 //DateTime started = DateTime.Now;\r
                 string currentFile = GetOutputFilePath(workingDir, OutputName);\r
-                if (FileExists(currentFile) && parameters.TargetConfig.DisableFileVersioning) {\r
-                    if (parameters.TargetConfig.NexioServer) {\r
-                        MessageBox.Show(String.Format($"Az '{OutputName}' állomány már létezik. A feltöltéshez új Octopus azonosító generálása szükséges."));\r
-                    } else \r
-                        DeleteFile(currentFile);\r
+                HandleFileExists(currentFile);\r
+                if (!REVOKED.Equals(Status)) {\r
+                    UploadFile();\r
+                    //logger.Info("Spend (s):" + (DateTime.Now - started).TotalSeconds);\r
+                    ExecuteCompleted();\r
                 }\r
-                UploadFile();\r
-                //logger.Info("Spend (s):" + (DateTime.Now - started).TotalSeconds);\r
-                ExecuteCompleted();\r
             }\r
             catch (Exception e) {\r
                 Status = ERROR;\r
                 Message = e.Message;\r
                 workFlowAction.description = Message;\r
                 logger.Error(e);\r
-                if (parameters.TargetConfig.SendEmailOnError && !String.IsNullOrEmpty(parameters.TargetConfig.ErrorEmailRecipient) && !String.IsNullOrEmpty(parameters.TargetConfig.ErrorEmailPattern))\r
-                    SendEmail(parameters.TargetConfig.ErrorEmailRecipient, parameters.TargetConfig.ErrorEmailPattern);\r
+                if (Parameters.TargetConfig.SendEmailOnError && !String.IsNullOrEmpty(Parameters.TargetConfig.ErrorEmailRecipient) && !String.IsNullOrEmpty(Parameters.TargetConfig.ErrorEmailPattern))\r
+                    SendEmail(Parameters.TargetConfig.ErrorEmailRecipient, Parameters.TargetConfig.ErrorEmailPattern);\r
             }\r
             finally {\r
                 AfterExecute();\r
@@ -119,6 +109,30 @@ namespace MaestroShared.Targets {
             return result;\r
         }\r
 \r
+        private void CreateOutput(string workingDir) {\r
+            Output = "/".Equals(workingDir) ? OutputName : Path.Combine(workingDir, OutputName);\r
+            Output = Output.Replace(@"\", "/");\r
+        }\r
+\r
+        private void HandleFileExists(string currentFile) {\r
+            if (FileExists(currentFile) && Parameters.TargetConfig.DisableFileVersioning) {\r
+                if (Parameters.TargetConfig.NexioServer) {\r
+                    Status = REVOKED;\r
+                    ShowNexioFileExistsMessage();\r
+                } else\r
+                    DeleteFile(currentFile);\r
+            }\r
+        }\r
+\r
+        private void ShowNexioFileExistsMessage() {\r
+            string message = null;\r
+            if (String.IsNullOrEmpty(Parameters.TargetConfig.NexioFileExistsMessage))\r
+                message = "A feltöltéshez új Octopus azonosító generálása szükséges.";\r
+            else\r
+                message = Parameters.TargetConfig.NexioFileExistsMessage;\r
+            MessageBox.Show(String.Format($"Az '{OutputName}' állomány már létezik. {message}"));\r
+        }\r
+\r
         protected virtual void DeleteFile(string currentFile) {\r
             File.Delete(currentFile);\r
         }\r
@@ -136,22 +150,22 @@ namespace MaestroShared.Targets {
             base.ExecuteCompleted();\r
             workFlowAction.description = SUCCESS;\r
             workFlowAction.successful = true;\r
-            if (parameters.TargetConfig.NexioServer)\r
+            if (Parameters.TargetConfig.NexioServer)\r
                 UploadNexioMetadata();\r
             else {\r
-                if (parameters.TargetConfig.KillDateDays > 0)\r
+                if (Parameters.TargetConfig.KillDateDays > 0)\r
                     UploadKillDateFile();\r
             }\r
 \r
-            if (parameters.TargetConfig.SaveArchiveMetadata && parameters.ArchiveMetadata != null)\r
+            if (Parameters.TargetConfig.SaveArchiveMetadata && Parameters.ArchiveMetadata != null)\r
                 CreateArchiveMetadata();\r
-            if (parameters.TargetConfig.SaveMorpheusMetadata && parameters.ArchiveMetadata != null && parameters.MovieSegments != null && parameters.MovieSegments.Count > 0)\r
+            if (Parameters.TargetConfig.SaveMorpheusMetadata && Parameters.ArchiveMetadata != null && Parameters.MovieSegments != null && Parameters.MovieSegments.Count > 0)\r
                 UploadMorpheusMetadata();\r
-            if (parameters.TargetConfig.SaveSegments && parameters.Segments != null)\r
-                parameters.TrafficApi.UpdateTrafficInformation(parameters.VariantID, true, (TrafficMetadataType)parameters.MetadataKind, parameters.Segments);\r
+            if (Parameters.TargetConfig.SaveSegments && Parameters.Segments != null)\r
+                Parameters.TrafficApi.UpdateTrafficInformation(Parameters.VariantID, true, (TrafficMetadataType)Parameters.MetadataKind, Parameters.Segments);\r
 \r
-            if (parameters.TargetConfig.SendEmailOnSuccess && !String.IsNullOrEmpty(parameters.TargetConfig.SuccessEmailRecipient) && !String.IsNullOrEmpty(parameters.TargetConfig.SuccessEmailPattern))\r
-                SendEmail(parameters.TargetConfig.SuccessEmailRecipient, parameters.TargetConfig.SuccessEmailPattern);\r
+            if (Parameters.TargetConfig.SendEmailOnSuccess && !String.IsNullOrEmpty(Parameters.TargetConfig.SuccessEmailRecipient) && !String.IsNullOrEmpty(Parameters.TargetConfig.SuccessEmailPattern))\r
+                SendEmail(Parameters.TargetConfig.SuccessEmailRecipient, Parameters.TargetConfig.SuccessEmailPattern);\r
             Status = READY;\r
             Message = SUCCESS;\r
         }\r
@@ -159,24 +173,24 @@ namespace MaestroShared.Targets {
         private void UploadNexioMetadata() {\r
             String xml = null;\r
             string name = GetOutputName();\r
-            string description = parameters.ArchiveMetadata?.mediaTitle;\r
-            if (parameters.TargetConfig.KillDateDays > 0) {\r
+            string description = Parameters.ArchiveMetadata?.mediaTitle;\r
+            if (Parameters.TargetConfig.KillDateDays > 0) {\r
                 DateTime date = GetKillDate();\r
                 KillDate = date.ToString(DATE_FORMAT);\r
-                xml = NexioXML.ToXML(name, date, description, parameters.TargetConfig.Agency);\r
+                xml = NexioXML.ToXML(name, date, description, Parameters.TargetConfig.Agency);\r
             } else\r
-                xml = NexioXML.ToXML(name, null, description, parameters.TargetConfig.Agency);\r
+                xml = NexioXML.ToXML(name, null, description, Parameters.TargetConfig.Agency);\r
             byte[] content = Encoding.Unicode.GetBytes(xml);\r
             UploadContent(name + XML_EXT, content);\r
         }\r
 \r
         private void UploadMorpheusMetadata() {\r
             string name = GetOutputName();\r
-            string title = parameters.ArchiveMetadata?.itemTitle;\r
-            if (!title.Equals(parameters.ArchiveMetadata?.mediaTitle))\r
-                title += HYPHEN_SPACES + parameters.ArchiveMetadata?.mediaTitle;\r
+            string title = Parameters.ArchiveMetadata?.itemTitle;\r
+            if (!title.Equals(Parameters.ArchiveMetadata?.mediaTitle))\r
+                title += HYPHEN_SPACES + Parameters.ArchiveMetadata?.mediaTitle;\r
             string type = null;\r
-            switch (parameters.MetadataKind) {\r
+            switch (Parameters.MetadataKind) {\r
                 case MetadataType.TrafficMaterial:\r
                     type = PROGRAMME;\r
                     break;\r
@@ -187,15 +201,15 @@ namespace MaestroShared.Targets {
                     type = JUNCTION;\r
                     break;\r
             }\r
-            byte[] content = MorpheusXML.ToXML(title, name, parameters.TargetConfig.DeviceIDMorpheus, type, parameters.MovieSegments);\r
-            EnsureDirectoryExistence(parameters.TargetConfig.PathMorpheusMetadata);\r
+            byte[] content = MorpheusXML.ToXML(title, name, Parameters.TargetConfig.DeviceIDMorpheus, type, Parameters.MovieSegments);\r
+            EnsureDirectoryExistence(Parameters.TargetConfig.PathMorpheusMetadata);\r
             UploadContent(name + XML_EXT, content);\r
         }\r
 \r
         private void SendEmail(string to, string messagePattern) {\r
             try {\r
                 string message = messagePattern.Replace(PATTERN_TARGETNAME, OutputName);\r
-                parameters.MediaCubeApi.Notify(to, message);\r
+                Parameters.MediaCubeApi.Notify(to, message);\r
             }\r
             catch (Exception e) {\r
                 MessageBox.Show(parent, e.Message);\r
@@ -215,7 +229,7 @@ namespace MaestroShared.Targets {
 \r
         private void SendWorkFlowAction() {\r
             try {\r
-                parameters.MediaCubeApi.Create<WorkflowAction>(workFlowAction);\r
+                Parameters.MediaCubeApi.Create<WorkflowAction>(workFlowAction);\r
             }\r
             catch (Exception e) {\r
                 MessageBox.Show(parent, e.Message);\r
@@ -224,9 +238,9 @@ namespace MaestroShared.Targets {
 \r
         protected virtual string DetermineWorkingDirectory(Connection connection) {\r
             string result = null;\r
-            if (!String.IsNullOrEmpty(parameters.TargetConfig.SubFolderFormat)) {\r
-                string name = GetDynamicName(parameters.TargetConfig.SubFolderFormat);\r
-                if (parameters.TargetConfig.SubFolderFormat.Contains(PATTERN_TEXT)) {\r
+            if (!String.IsNullOrEmpty(Parameters.TargetConfig.SubFolderFormat)) {\r
+                string name = GetDynamicName(Parameters.TargetConfig.SubFolderFormat);\r
+                if (Parameters.TargetConfig.SubFolderFormat.Contains(PATTERN_TEXT)) {\r
                     string pattern = name.Split(HYPHEN[0])[0] + HYPHENSTAR;\r
                     string[] dirs = Directory.GetDirectories(connection.Address.LocalPath, pattern);\r
                     if (dirs.Length > 0)\r
@@ -240,12 +254,12 @@ namespace MaestroShared.Targets {
 \r
         private DateTime GetKillDate() {\r
             DateTime result = DateTime.Now;\r
-            result = result.AddDays(parameters.TargetConfig.KillDateDays);\r
+            result = result.AddDays(Parameters.TargetConfig.KillDateDays);\r
             return result;\r
         }\r
 \r
         private void UploadKillDateFile() {\r
-            Uri address = parameters.TargetConfig.Remote.Address;\r
+            Uri address = Parameters.TargetConfig.Remote.Address;\r
             string statusWorkDir = Path.Combine(workingDir, STATUS_FOLDER);\r
             EnsureDirectoryExistence(statusWorkDir);\r
             DateTime date = GetKillDate();\r
@@ -257,23 +271,23 @@ namespace MaestroShared.Targets {
         }\r
 \r
         private void CreateArchiveMetadata() {\r
-            Uri address = parameters.TargetConfig.Remote.Address;\r
+            Uri address = Parameters.TargetConfig.Remote.Address;\r
             string statusWorkDir = Path.Combine(workingDir, STATUS_FOLDER);\r
             EnsureDirectoryExistence(statusWorkDir);\r
             string fileName = String.Format(METADATA_FILE, OutputName);\r
             //logger.Debug("Creating METADATA file {0}", fileName);\r
-            byte[] content = Encoding.UTF8.GetBytes(parameters.ArchiveMetadata.ToString());\r
+            byte[] content = Encoding.UTF8.GetBytes(Parameters.ArchiveMetadata.ToString());\r
             string ouputPath = GetOutputFilePath(statusWorkDir, fileName);\r
             UploadContent(ouputPath, content);\r
         }\r
 \r
         private void CreateTrafficMetadata() {\r
-            Uri address = parameters.TargetConfig.Remote.Address;\r
+            Uri address = Parameters.TargetConfig.Remote.Address;\r
             string statusWorkDir = Path.Combine(workingDir, STATUS_FOLDER);\r
             EnsureDirectoryExistence(statusWorkDir);\r
             string fileName = String.Format(METADATA_FILE, OutputName);\r
             //logger.Debug("Creating METADATA file {0}", fileName);\r
-            byte[] content = Encoding.UTF8.GetBytes(parameters.ArchiveMetadata.ToString());\r
+            byte[] content = Encoding.UTF8.GetBytes(Parameters.ArchiveMetadata.ToString());\r
             string ouputPath = GetOutputFilePath(statusWorkDir, fileName);\r
             UploadContent(ouputPath, content);\r
         }\r
@@ -330,8 +344,8 @@ namespace MaestroShared.Targets {
                 .Replace(PATTERN_TIMESTAMP, DateTime.Now.ToString(DATETIME_FORMAT, CultureInfo.InvariantCulture))\r
                 .Replace(PATTERN_DATESTAMP, DateTime.Now.ToString(DATE_FORMAT_NODOTS, CultureInfo.InvariantCulture));\r
 \r
-            if (!String.IsNullOrEmpty(parameters.MetadataText))\r
-                result = result.Replace(PATTERN_TEXT, HYPHEN + RemoveDiacritics(parameters.MetadataText));\r
+            if (!String.IsNullOrEmpty(Parameters.MetadataText))\r
+                result = result.Replace(PATTERN_TEXT, HYPHEN + RemoveDiacritics(Parameters.MetadataText));\r
 \r
             // replace hungarian and special characters\r
             result = Regex.Replace(result, NORMALIZE_TEXT_PATTERN, UNDERSCORE);\r
@@ -341,11 +355,11 @@ namespace MaestroShared.Targets {
         }\r
 \r
         protected virtual string CreateOutputFileName() {\r
-            string nameWithoutExtension = GetDynamicName(parameters.TargetConfig.OutputFormat);\r
+            string nameWithoutExtension = GetDynamicName(Parameters.TargetConfig.OutputFormat);\r
             string extension = InputName.Contains(DOT) ? InputName.Substring(InputName.LastIndexOf(DOT)) : DEFAULT_EXTENSION;\r
             extension = extension.ToUpper();\r
             string result = String.Format(FILENAME, nameWithoutExtension, extension);\r
-            if (!parameters.TargetConfig.DisableFileVersioning) {\r
+            if (!Parameters.TargetConfig.DisableFileVersioning) {\r
                 int version = 1;\r
                 while (FileExists(GetOutputFilePath(workingDir, result))) {\r
                     string versioned = String.Format(VERSIONED_FILENAME, nameWithoutExtension, version, extension);\r
@@ -354,7 +368,7 @@ namespace MaestroShared.Targets {
                     version++;\r
                 }\r
             }\r
-            return result;\r
+            return result.ToUpper();\r
         }\r
 \r
         protected virtual void EnsureDirectoryExistence(string path) {\r