using System.Drawing.Drawing2D;\r
using System.Collections.Generic;\r
using Myriadbits.MXF;\r
+using MaestroShared.Metadata;\r
\r
namespace DxPlay {\r
\r
+using MaestroShared.Metadata;\r
using System;\r
using System.ComponentModel;\r
using System.Drawing;\r
using System.Diagnostics;\r
using System.Globalization;\r
using NLog;\r
+using MaestroShared.Metadata;\r
\r
namespace DxPlay {\r
/// <summary>\r
using System.Runtime.InteropServices;\r
using System.Text;\r
using System.Windows.Forms;\r
-\r
using DirectShowLib;\r
using DirectShowLib.DES;\r
-using MediaInfoLib;\r
-using System.Diagnostics;\r
-using System.Globalization;\r
using NLog;\r
+using MaestroShared.Metadata;\r
\r
namespace DxPlay {\r
/// <summary>\r
this.btnPlay.AutoSize = true;\r
this.btnPlay.BackColor = System.Drawing.Color.White;\r
this.btnPlay.FlatAppearance.BorderSize = 0;\r
+ this.btnPlay.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
this.btnPlay.Image = global::DxPlay.Properties.Resources.ic_play_arrow_black_24dp_2x;\r
this.btnPlay.Location = new System.Drawing.Point(3, 3);\r
this.btnPlay.Name = "btnPlay";\r
this.btnStop.AutoSize = true;\r
this.btnStop.BackColor = System.Drawing.Color.White;\r
this.btnStop.FlatAppearance.BorderSize = 0;\r
- this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Popup;\r
+ this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
this.btnStop.Image = global::DxPlay.Properties.Resources.ic_stop_black_24dp_2x;\r
this.btnStop.Location = new System.Drawing.Point(63, 3);\r
this.btnStop.Name = "btnStop";\r
this.btnPause.AutoSize = true;\r
this.btnPause.BackColor = System.Drawing.Color.White;\r
this.btnPause.FlatAppearance.BorderSize = 0;\r
- this.btnPause.FlatStyle = System.Windows.Forms.FlatStyle.Popup;\r
+ this.btnPause.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
this.btnPause.Image = global::DxPlay.Properties.Resources.ic_pause_black_24dp_2x;\r
this.btnPause.Location = new System.Drawing.Point(123, 3);\r
this.btnPause.Name = "btnPause";\r
this.MinimumSize = new System.Drawing.Size(640, 480);\r
this.Name = "PlayerForm";\r
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;\r
- this.Text = "MediaCUBE Video Player";\r
+ this.Text = "MediaCube Player";\r
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PlayerForm_FormClosing);\r
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.PlayerForm_FormClosed);\r
this.Load += new System.EventHandler(this.PlayerForm_Load);\r
-/****************************************************************************\r
-While the underlying libraries are covered by LGPL, this sample is released \r
-as public domain. It is distributed in the hope that it will be useful, but \r
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY \r
-or FITNESS FOR A PARTICULAR PURPOSE. \r
-*****************************************************************************/\r
-\r
using System;\r
using System.Windows.Forms;\r
-using System.Runtime.InteropServices;\r
using System.Diagnostics;\r
using static DxPlay.DxPlayer;\r
using JR.Utils.GUI.Forms;\r
using System.IO;\r
using System.Linq;\r
using System.ComponentModel;\r
-using System.Collections.Generic;\r
+using MaestroShared.Metadata;\r
\r
namespace DxPlay {\r
\r
using DxPlay;\r
+using MaestroShared.Metadata;\r
using Microsoft.VisualStudio.TestTools.UnitTesting;\r
using MongoDB.Bson;\r
using MongoDB.Driver;\r
using System.Windows.Forms;\r
using Maestro.Metadata;\r
+using MaestroShared.Metadata;\r
\r
namespace Maestro {\r
public partial class ArchiveMetadataForm : Form {\r
/// </summary>\r
private void InitializeComponent() {\r
this.components = new System.ComponentModel.Container();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();\r
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MaestroForm));\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();\r
this.groupSource = new System.Windows.Forms.GroupBox();\r
this.dgSource = new System.Windows.Forms.DataGridView();\r
this.bindingSource = new System.Windows.Forms.BindingSource(this.components);\r
this.dgSource.BackgroundColor = System.Drawing.Color.White;\r
this.dgSource.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
this.dgSource.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised;\r
- dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle29.BackColor = System.Drawing.SystemColors.Control;\r
- dataGridViewCellStyle29.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle29.ForeColor = System.Drawing.SystemColors.WindowText;\r
- dataGridViewCellStyle29.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
- dataGridViewCellStyle29.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
- dataGridViewCellStyle29.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
- this.dgSource.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle29;\r
+ dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control;\r
+ dataGridViewCellStyle15.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
+ dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
+ dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
+ this.dgSource.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle15;\r
this.dgSource.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r
this.dgSource.DataSource = this.bindingSource;\r
- dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle30.BackColor = System.Drawing.SystemColors.Window;\r
- dataGridViewCellStyle30.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle30.ForeColor = System.Drawing.SystemColors.ControlText;\r
- dataGridViewCellStyle30.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
- dataGridViewCellStyle30.SelectionForeColor = System.Drawing.Color.Black;\r
- dataGridViewCellStyle30.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
- this.dgSource.DefaultCellStyle = dataGridViewCellStyle30;\r
+ dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle16.BackColor = System.Drawing.SystemColors.Window;\r
+ dataGridViewCellStyle16.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle16.ForeColor = System.Drawing.SystemColors.ControlText;\r
+ dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
+ dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.Black;\r
+ dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+ this.dgSource.DefaultCellStyle = dataGridViewCellStyle16;\r
this.dgSource.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dgSource.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
this.dgSource.EnableHeadersVisualStyles = false;\r
this.dgSource.Location = new System.Drawing.Point(10, 47);\r
this.dgSource.Name = "dgSource";\r
this.dgSource.RowHeadersVisible = false;\r
- dataGridViewCellStyle31.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle31;\r
+ dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle17;\r
this.dgSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dgSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
this.dgSource.Size = new System.Drawing.Size(330, 352);\r
this.tpTraffic.Location = new System.Drawing.Point(4, 24);\r
this.tpTraffic.Name = "tpTraffic";\r
this.tpTraffic.Padding = new System.Windows.Forms.Padding(3);\r
- this.tpTraffic.Size = new System.Drawing.Size(278, 348);\r
+ this.tpTraffic.Size = new System.Drawing.Size(322, 348);\r
this.tpTraffic.TabIndex = 1;\r
this.tpTraffic.Text = "Traffic";\r
this.tpTraffic.UseVisualStyleBackColor = true;\r
this.trafficIDSelector.Margin = new System.Windows.Forms.Padding(4);\r
this.trafficIDSelector.Name = "trafficIDSelector";\r
this.trafficIDSelector.Padding = new System.Windows.Forms.Padding(6);\r
- this.trafficIDSelector.Size = new System.Drawing.Size(272, 342);\r
+ this.trafficIDSelector.Size = new System.Drawing.Size(316, 342);\r
this.trafficIDSelector.TabIndex = 0;\r
// \r
// tableLayoutPanel1\r
this.dgJobs.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells;\r
this.dgJobs.BackgroundColor = System.Drawing.Color.White;\r
this.dgJobs.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
- dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Control;\r
- dataGridViewCellStyle32.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.WindowText;\r
- dataGridViewCellStyle32.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
- dataGridViewCellStyle32.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
- dataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
- this.dgJobs.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle32;\r
+ dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Control;\r
+ dataGridViewCellStyle18.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
+ dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
+ dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
+ this.dgJobs.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18;\r
this.dgJobs.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r
this.dgJobs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {\r
this.columnLabel,\r
this.columnOutput,\r
this.columnKillDate});\r
this.dgJobs.DataSource = this.bindingSourceJobs;\r
- dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle35.BackColor = System.Drawing.SystemColors.Window;\r
- dataGridViewCellStyle35.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle35.ForeColor = System.Drawing.SystemColors.ControlText;\r
- dataGridViewCellStyle35.NullValue = null;\r
- dataGridViewCellStyle35.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
- dataGridViewCellStyle35.SelectionForeColor = System.Drawing.Color.Black;\r
- dataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
- this.dgJobs.DefaultCellStyle = dataGridViewCellStyle35;\r
+ dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle21.BackColor = System.Drawing.SystemColors.Window;\r
+ dataGridViewCellStyle21.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle21.ForeColor = System.Drawing.SystemColors.ControlText;\r
+ dataGridViewCellStyle21.NullValue = null;\r
+ dataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
+ dataGridViewCellStyle21.SelectionForeColor = System.Drawing.Color.Black;\r
+ dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+ this.dgJobs.DefaultCellStyle = dataGridViewCellStyle21;\r
this.dgJobs.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dgJobs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
this.dgJobs.EnableHeadersVisualStyles = false;\r
this.dgJobs.GridColor = System.Drawing.Color.White;\r
this.dgJobs.Location = new System.Drawing.Point(3, 3);\r
this.dgJobs.Name = "dgJobs";\r
- dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle36.BackColor = System.Drawing.SystemColors.Control;\r
- dataGridViewCellStyle36.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle36.ForeColor = System.Drawing.SystemColors.WindowText;\r
- dataGridViewCellStyle36.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
- dataGridViewCellStyle36.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
- dataGridViewCellStyle36.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
- this.dgJobs.RowHeadersDefaultCellStyle = dataGridViewCellStyle36;\r
+ dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle22.BackColor = System.Drawing.SystemColors.Control;\r
+ dataGridViewCellStyle22.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle22.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ dataGridViewCellStyle22.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
+ dataGridViewCellStyle22.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
+ dataGridViewCellStyle22.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
+ this.dgJobs.RowHeadersDefaultCellStyle = dataGridViewCellStyle22;\r
this.dgJobs.RowHeadersVisible = false;\r
- dataGridViewCellStyle37.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.dgJobs.RowsDefaultCellStyle = dataGridViewCellStyle37;\r
+ dataGridViewCellStyle23.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.dgJobs.RowsDefaultCellStyle = dataGridViewCellStyle23;\r
this.dgJobs.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dgJobs.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
this.dgJobs.Size = new System.Drawing.Size(988, 92);\r
// \r
this.columnID.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;\r
this.columnID.DataPropertyName = "ID";\r
- dataGridViewCellStyle33.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.columnID.DefaultCellStyle = dataGridViewCellStyle33;\r
+ dataGridViewCellStyle19.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.columnID.DefaultCellStyle = dataGridViewCellStyle19;\r
this.columnID.HeaderText = "ID";\r
this.columnID.Name = "columnID";\r
this.columnID.Width = 44;\r
// \r
this.columnStatus.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;\r
this.columnStatus.DataPropertyName = "Status";\r
- dataGridViewCellStyle34.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.columnStatus.DefaultCellStyle = dataGridViewCellStyle34;\r
+ dataGridViewCellStyle20.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.columnStatus.DefaultCellStyle = dataGridViewCellStyle20;\r
this.columnStatus.HeaderText = "Status";\r
this.columnStatus.Name = "columnStatus";\r
this.columnStatus.Width = 66;\r
this.dgMessages.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells;\r
this.dgMessages.BackgroundColor = System.Drawing.Color.White;\r
this.dgMessages.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
- dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle38.BackColor = System.Drawing.SystemColors.Control;\r
- dataGridViewCellStyle38.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle38.ForeColor = System.Drawing.SystemColors.WindowText;\r
- dataGridViewCellStyle38.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
- dataGridViewCellStyle38.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
- dataGridViewCellStyle38.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
- this.dgMessages.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle38;\r
+ dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle24.BackColor = System.Drawing.SystemColors.Control;\r
+ dataGridViewCellStyle24.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle24.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ dataGridViewCellStyle24.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
+ dataGridViewCellStyle24.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
+ dataGridViewCellStyle24.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
+ this.dgMessages.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle24;\r
this.dgMessages.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r
this.dgMessages.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {\r
this.dataGridViewTextBoxColumn1,\r
this.dataGridViewTextBoxColumn2});\r
- dataGridViewCellStyle40.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle40.BackColor = System.Drawing.SystemColors.Window;\r
- dataGridViewCellStyle40.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle40.ForeColor = System.Drawing.Color.Red;\r
- dataGridViewCellStyle40.NullValue = null;\r
- dataGridViewCellStyle40.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
- dataGridViewCellStyle40.SelectionForeColor = System.Drawing.Color.Red;\r
- dataGridViewCellStyle40.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
- this.dgMessages.DefaultCellStyle = dataGridViewCellStyle40;\r
+ dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle26.BackColor = System.Drawing.SystemColors.Window;\r
+ dataGridViewCellStyle26.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle26.ForeColor = System.Drawing.Color.Red;\r
+ dataGridViewCellStyle26.NullValue = null;\r
+ dataGridViewCellStyle26.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
+ dataGridViewCellStyle26.SelectionForeColor = System.Drawing.Color.Red;\r
+ dataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+ this.dgMessages.DefaultCellStyle = dataGridViewCellStyle26;\r
this.dgMessages.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dgMessages.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
this.dgMessages.EnableHeadersVisualStyles = false;\r
this.dgMessages.Location = new System.Drawing.Point(3, 3);\r
this.dgMessages.Name = "dgMessages";\r
this.dgMessages.ReadOnly = true;\r
- dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle41.BackColor = System.Drawing.SystemColors.Control;\r
- dataGridViewCellStyle41.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle41.ForeColor = System.Drawing.SystemColors.WindowText;\r
- dataGridViewCellStyle41.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
- dataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
- dataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
- this.dgMessages.RowHeadersDefaultCellStyle = dataGridViewCellStyle41;\r
+ dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle27.BackColor = System.Drawing.SystemColors.Control;\r
+ dataGridViewCellStyle27.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle27.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ dataGridViewCellStyle27.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
+ dataGridViewCellStyle27.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
+ dataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
+ this.dgMessages.RowHeadersDefaultCellStyle = dataGridViewCellStyle27;\r
this.dgMessages.RowHeadersVisible = false;\r
- dataGridViewCellStyle42.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.dgMessages.RowsDefaultCellStyle = dataGridViewCellStyle42;\r
+ dataGridViewCellStyle28.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.dgMessages.RowsDefaultCellStyle = dataGridViewCellStyle28;\r
this.dgMessages.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dgMessages.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
this.dgMessages.Size = new System.Drawing.Size(988, 92);\r
// \r
this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;\r
this.dataGridViewTextBoxColumn2.DataPropertyName = "Message";\r
- dataGridViewCellStyle39.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle39;\r
+ dataGridViewCellStyle25.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle25;\r
this.dataGridViewTextBoxColumn2.HeaderText = "Üzenet";\r
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";\r
this.dataGridViewTextBoxColumn2.ReadOnly = true;\r
+++ /dev/null
-using System;\r
-using Newtonsoft.Json;\r
-using System.Runtime.Serialization.Formatters.Binary;\r
-using System.IO;\r
-\r
-namespace Maestro.Metadata {\r
-\r
- [Serializable()]\r
- public class ArchiveMetadata {\r
-\r
- //todo rename a Stuffra??\r
- public string itemHouseId { get; set; }\r
- public string itemTitle { get; set; }\r
- public string itemDescription { get; set; }\r
- public string mediaHouseId { get; set; }\r
- public string mediaTitle { get; set; }\r
- public string mediaDescription { get; set; }\r
-\r
- public override string ToString() {\r
- return JsonConvert.SerializeObject(this);\r
- //return String.Format("{{\n \"Anyag azonosító\": \"{0}\",\n, \"Anyag cím\": \"{1}\",\n \"Anyag leírása\": \"{2}\",\n \"Média azonosító\": \"{3}\",\n \"Média cím\": \"{4}\",\n \"Média leírás\": \"{5}\" \n}}",\r
- // StuffID, StuffTitle, StuffDescription, MediaID, MediaTitle, MediaDescription);\r
- }\r
-\r
- [JsonIgnore]\r
- public bool IsFilled {\r
- get {\r
- return\r
- !String.IsNullOrEmpty(itemHouseId) &&\r
- !String.IsNullOrEmpty(itemTitle) &&\r
- !String.IsNullOrEmpty(mediaHouseId) &&\r
- !String.IsNullOrEmpty(mediaTitle);\r
- }\r
- }\r
-\r
- public static ArchiveMetadata DeepClone(ArchiveMetadata obj) {\r
- if (obj == null)\r
- return null;\r
- using (var ms = new MemoryStream()) {\r
- var formatter = new BinaryFormatter();\r
- formatter.Serialize(ms, obj);\r
- ms.Position = 0;\r
- return (ArchiveMetadata)formatter.Deserialize(ms);\r
- }\r
- }\r
- }\r
-}\r
-namespace Maestro.Metadata {\r
+using MaestroShared.Metadata;\r
+\r
+namespace Maestro.Metadata {\r
public class MetadataInfo {\r
public string ID { get; set; }\r
public string MetadataText { get; set; }\r
using System.Windows.Forms;\r
using LinkDotNet.MessageHandling.Contracts;\r
using Maestro.Sources.Messages;\r
-using Maestro.Commons;\r
using System.Drawing;\r
using NLog;\r
+using MaestroShared.Commons;\r
\r
namespace Maestro.Sources {\r
public delegate void ClearAndInitialize();\r
using System.Windows.Forms;\r
using LinkDotNet.MessageHandling.Contracts;\r
using Maestro.Sources.Messages;\r
-using Maestro.Commons;\r
using NexioClient;\r
using Newtonsoft.Json.Linq;\r
using WebSocketSharp;\r
using System.Drawing;\r
using NLog;\r
using System.Collections.Generic;\r
+using MaestroShared.Commons;\r
\r
namespace Maestro.Sources {\r
class NexioRESTSource : BindingList<NexioSourceItem>, ISource {\r
+++ /dev/null
-using FluentFTP;\r
-using MaestroShared.Configuration;\r
-using NLog;\r
-using System;\r
-using System.IO;\r
-using System.Linq;\r
-using System.Net;\r
-using System.Windows.Forms;\r
-\r
-namespace Maestro.Targets {\r
-\r
- public class FTPTargetProcessor : UNCTargetProcessor {\r
- private const string PATTERN_CONCAT = "{0}{1}";\r
- private const string _226 = "226";\r
- private const string UPLOAD_ERROR = "Feltöltési hiba.";\r
- private readonly Logger logger = LogManager.GetCurrentClassLogger();\r
- protected FtpClient targetFTP;\r
-\r
- public FTPTargetProcessor(Control parent, TargetProcessorParameter parameters)\r
- : base(parent, parameters) {\r
- FtpTrace.LogFunctions = false;\r
- if (!(parameters.SourceConfig is UNCSource)) {\r
- inputFile = null;\r
- Uri inputUri = new Uri(String.Format(PATTERN_CONCAT, parameters.SourceConfig.Remote.Address, parameters.InputFileName));\r
- Input = inputUri.ToString();\r
- }\r
- }\r
-\r
- protected override void BeforeExecute() {\r
- base.BeforeExecute();\r
- targetFTP = CreateClient(parameters.TargetConfig.Remote);\r
- }\r
-\r
- protected override void AfterExecute() {\r
- base.AfterExecute();\r
- TerminateClient(targetFTP);\r
- }\r
-\r
- protected override void DeleteFile(string currentFile) {\r
- targetFTP.DeleteFile(currentFile);\r
- }\r
-\r
- protected override void UploadFile() {\r
- using (FileStream istream = File.OpenRead(Input)) {\r
- using (Stream ostream = targetFTP.OpenWrite(OutputName)) {\r
- try {\r
- CopyStream(istream, inputFile.Length, ostream);\r
- }\r
- catch (Exception e) {\r
- logger.Error(e.Message);\r
- throw e;\r
- }\r
- finally {\r
- ostream.Close();\r
- }\r
- }\r
- }\r
- FtpReply reply = targetFTP.GetReply();\r
- if (!reply.Success || !_226.Equals(reply.Code)) {\r
- throw new Exception(UPLOAD_ERROR);\r
- }\r
- }\r
-\r
- protected void reconnect() {\r
- TerminateClient(targetFTP);\r
- targetFTP = CreateClient(parameters.TargetConfig.Remote);\r
- EnsureDirectoryExistence(workingDir);\r
- }\r
-\r
- protected override void UploadContent(string outputPath, byte[] content) {\r
- using (Stream ostream = targetFTP.OpenWrite(outputPath, FtpDataType.Binary, false)) {\r
- try {\r
- ostream.Write(content, 0, content.Length);\r
- }\r
- catch (Exception e) {\r
- logger.Error(e.Message);\r
- throw e;\r
- }\r
- finally {\r
- ostream.Close();\r
- }\r
- }\r
- FtpReply reply = targetFTP.GetReply();\r
- if (!reply.Success || !_226.Equals(reply.Code)) {\r
- throw new Exception(UPLOAD_ERROR);\r
- }\r
- }\r
-\r
- protected override bool FileExists(string path) {\r
- long x = -1;\r
- try {\r
- x = targetFTP.GetFileSize(path);\r
- }\r
- catch (Exception e) {\r
- logger.Warn(e.Message);\r
- }\r
- return x > -1;\r
- }\r
-\r
- protected override string GetOutputFilePath(string path, string fileName) {\r
- return fileName;\r
- }\r
-\r
- protected override void EnsureDirectoryExistence(string path) {\r
- if (!targetFTP.DirectoryExists(path))\r
- targetFTP.CreateDirectory(path, true);\r
- targetFTP.SetWorkingDirectory(path);\r
- }\r
-\r
- protected FtpClient CreateClient(Connection connection) {\r
- Uri address = connection.Address;\r
- FtpClient result = new FtpClient() {\r
- Host = address.Host,\r
- Port = address.Port,\r
- InternetProtocolVersions = FtpIpVersion.IPv4,\r
- UploadDataType = FtpDataType.Binary,\r
- DownloadDataType = FtpDataType.Binary,\r
- Credentials = new NetworkCredential(connection.UserName, connection.Password)\r
- };\r
- result.Connect();\r
- return result;\r
- }\r
-\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
- //TODO ellenőrizni, hogy mi van placeholder esetén\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
- if (item != null)\r
- name = item.Name;\r
- targetFTP.SetWorkingDirectory(SLASH);\r
- }\r
- result = Path.Combine(connection.Address.LocalPath, name);\r
- } else\r
- result = connection.Address.LocalPath;\r
- return result;\r
- }\r
-\r
- protected void TerminateClient(FtpClient ftpClient) {\r
- if (ftpClient != null) {\r
- ftpClient.Disconnect();\r
- ftpClient.Dispose();\r
- }\r
- }\r
-\r
- }\r
-}\r
+++ /dev/null
-using FluentFTP;\r
-using MaestroShared.Configuration;\r
-using NLog;\r
-using System;\r
-using System.IO;\r
-using System.Text.RegularExpressions;\r
-using System.Threading;\r
-using System.Windows.Forms;\r
-\r
-namespace Maestro.Targets {\r
-\r
- public class FXPTargetProcessor : FTPTargetProcessor {\r
- private const string LITERAL_SPACE = "%20";\r
- private const string SPACE = " ";\r
- private Logger logger = LogManager.GetCurrentClassLogger();\r
- private Source sourceConfig;\r
- Uri inputUri;\r
-\r
- public FXPTargetProcessor(Control parent,TargetProcessorParameter parameters) :\r
- base(parent, parameters) {\r
- sourceConfig = parameters.SourceConfig;\r
- //inputUri = new Uri(String.Format("{0}/{1}", parameters.SourceConfig.Remote.Address, parameters.InputFileName));\r
- inputUri = new Uri(Path.Combine(parameters.SourceConfig.Remote.Address.ToString(), parameters.InputFileName));\r
- Input = inputUri.ToString();\r
- }\r
-\r
- protected override void UploadFile() {\r
- FtpClient sourceFTP = null;\r
- FtpClient monitorFTP = null;\r
-\r
- try {\r
- sourceFTP = CreateClient(sourceConfig.Remote);\r
-\r
- string input = inputUri.AbsolutePath.Replace(LITERAL_SPACE, SPACE);\r
- long ilength = sourceFTP.GetFileSize(input);\r
- if (parameters.TargetConfig.NexioServer)\r
- ilength = ilength / 2;\r
-\r
- FtpReply replyPASV = targetFTP.Execute("PASV");\r
- if (!replyPASV.Success)\r
- throw new Exception(replyPASV.ErrorMessage);\r
-\r
- Regex regex = new Regex(Regex.Escape("(") + "(.*)" + Regex.Escape(")"));\r
- var v = regex.Match(replyPASV.Message);\r
- string port = v.Groups[1].ToString();\r
-\r
- FtpReply replyPORT = sourceFTP.Execute("PORT " + port);\r
- if (!replyPORT.Success)\r
- throw new Exception(replyPORT.ErrorMessage);\r
-\r
-\r
- FtpReply sourceReplyTYPE = sourceFTP.Execute("TYPE I");\r
- if (!sourceReplyTYPE.Success)\r
- throw new Exception(sourceReplyTYPE.ErrorMessage);\r
-\r
- if (input.LastIndexOf("/") == 0)\r
- input = input.Replace("/", "");\r
- FtpReply replyRETR = sourceFTP.Execute("RETR " + input);\r
-\r
- if (!replyRETR.Success) {\r
- input = inputUri.Segments[inputUri.Segments.Length - 1];\r
- input = input.Replace("%20", " ");\r
- replyRETR = sourceFTP.Execute("RETR " + input);\r
-\r
- if (!replyRETR.Success)\r
- throw new Exception(replyRETR.ErrorMessage);\r
- }\r
-\r
- FtpReply targetReplyTYPE = targetFTP.Execute("TYPE I");\r
- if (!targetReplyTYPE.Success)\r
- throw new Exception(targetReplyTYPE.ErrorMessage);\r
-\r
- string currentWorkingDir = targetFTP.GetWorkingDirectory();\r
- logger.Debug("Current target working directory is {0}", currentWorkingDir);\r
- FtpReply replySTOR = targetFTP.Execute("STOR " + OutputName);\r
- if (!replySTOR.Success)\r
- throw new Exception(replySTOR.ErrorMessage);\r
-\r
-\r
- monitorFTP = CreateClient(parameters.TargetConfig.Remote);\r
- monitorFTP.SetWorkingDirectory(workingDir);\r
- FtpReply monitorReplyTYPE = monitorFTP.Execute("TYPE I");\r
- if (!monitorReplyTYPE.Success)\r
- throw new Exception(targetReplyTYPE.ErrorMessage);\r
- if (!monitorFTP.FileExists(OutputName))\r
- throw new Exception("A cél állomány nem jött létre.");\r
- long overall = 0;\r
- long lastSize = 0;\r
- while (overall != ilength) {\r
- overall = monitorFTP.GetFileSize(OutputName);\r
- if (overall == lastSize) {\r
- Progress = 100;\r
- break;\r
- } else {\r
- int currentProgress = (int)((double)overall / ilength * 100);\r
- Progress = currentProgress > 100 ? 100 : currentProgress;\r
- lastSize = overall;\r
- }\r
- Thread.Sleep(1000);\r
- }\r
-\r
- }\r
- catch (Exception e) {\r
- throw e;\r
- }\r
- finally {\r
- TerminateClient(monitorFTP);\r
- TerminateClient(sourceFTP);\r
- }\r
-\r
- //logger.Debug("Done");\r
- }\r
-\r
- }\r
-}\r
+++ /dev/null
-using System;\r
-using System.ComponentModel;\r
-\r
-namespace Maestro.Targets {\r
- internal interface ITargetProcessor : INotifyPropertyChanged {\r
-\r
- DateTime Started { get; set; }\r
-\r
- DateTime Finished { get; set; }\r
-\r
- string Input { get; set; }\r
-\r
- string Output { get; set; }\r
-\r
- string Status { get; set; }\r
-\r
- string Message { get; set; }\r
-\r
- string ID { get; set; }\r
-\r
- int Progress { get; set; }\r
-\r
- string KillDate { get; set; }\r
-\r
- string Label { get; set; }\r
-\r
- string KillDatePath { get; set; }\r
-\r
- bool Execute();\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-using Maestro.Commons;\r
-using System;\r
-using System.ComponentModel;\r
-using System.Runtime.CompilerServices;\r
-using System.Windows.Forms;\r
-\r
-namespace Maestro.Targets {\r
- public abstract class TargetProcessor : ITargetProcessor {\r
- private string status;\r
- private string message;\r
- private string id;\r
- private DateTime started;\r
- private DateTime finished;\r
- private string input;\r
- private string output;\r
- private string inputName;\r
- private string outputName;\r
- private int progress;\r
- private string killDate;\r
- private string label;\r
- private string killDatePath;\r
- protected Control parent;\r
-\r
- public TargetProcessor(Control parent) {\r
- this.parent = parent;\r
- }\r
-\r
- public event PropertyChangedEventHandler PropertyChanged;\r
-\r
- protected void NotifyPropertyChanged([CallerMemberName] String propertyName = "") {\r
- parent?.SafeCall(() => {\r
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));\r
- });\r
- }\r
-\r
- public abstract bool Execute();\r
-\r
- protected virtual void ExecuteCompleted() {\r
- }\r
-\r
- public string Status {\r
- get {\r
- return status;\r
- }\r
- set {\r
- if (status != value) {\r
- status = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public DateTime Started {\r
- get {\r
- return started;\r
- }\r
- set {\r
- if (started != value) {\r
- started = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public DateTime Finished {\r
- get {\r
- return finished;\r
- }\r
- set {\r
- if (finished != value) {\r
- finished = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public string Input {\r
- get {\r
- return input;\r
- }\r
- set {\r
- if (input != value) {\r
- input = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public string Output {\r
- get {\r
- return output;\r
- }\r
- set {\r
- if (output != value) {\r
- output = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public string InputName {\r
- get {\r
- return inputName;\r
- }\r
- set {\r
- if (inputName != value) {\r
- inputName = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public string OutputName {\r
- get {\r
- return outputName;\r
- }\r
- set {\r
- if (outputName != value) {\r
- outputName = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public string Message {\r
- get {\r
- return message;\r
- }\r
- set {\r
- if (message != value) {\r
- message = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public string ID {\r
- get {\r
- return id;\r
- }\r
- set {\r
- if (id != value) {\r
- id = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public int Progress {\r
- get {\r
- return progress;\r
- }\r
- set {\r
- if (progress != value) {\r
- progress = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public string KillDate {\r
- get {\r
- return killDate;\r
- }\r
- set {\r
- if (killDate != value) {\r
- killDate = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
-\r
- public string Label {\r
- get { return label; }\r
- set {\r
- //label != value biztos jó stringeknél?\r
- if (label != value) {\r
- label = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
-\r
- public string KillDatePath {\r
- get { return killDatePath; }\r
- set {\r
- //label != value biztos jó stringeknél?\r
- if (killDatePath != value) {\r
- killDatePath = value;\r
- NotifyPropertyChanged();\r
- }\r
- }\r
- }\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-using NLog;\r
-using System;\r
-using System.IO;\r
-using System.Windows.Forms;\r
-using TrafficClient;\r
-using Model;\r
-using System.Text;\r
-using Maestro.Commons;\r
-using Commons;\r
-using Maestro.Metadata;\r
-using System.Globalization;\r
-using System.Text.RegularExpressions;\r
-using MaestroShared.Configuration;\r
-\r
-namespace Maestro.Targets {\r
-\r
- public class UNCTargetProcessor : TargetProcessor {\r
- private readonly Logger logger = LogManager.GetCurrentClassLogger();\r
- private const string SUCCESS = "Successfully completed.";\r
- private const string PROCESSING = "Processing {0}";\r
- private const string PROCESSING_COMPLETED = "Finished processing {0}";\r
- private const string FILENAME = "{0}{1}";\r
- private const string VERSIONED_FILENAME = "{0}-{1}{2}";\r
- private const string ALREADY_EXISTS = "File {0} already exists, trying {1}";\r
- private const string STATUS_FOLDER = ".STATUS";\r
- private const string KILLDATE_FILE = "{0}.{1}.killdate";\r
- private const string METADATA_FILE = "{0}.json";\r
- private const string DEFAULT_EXTENSION = ".MXF";\r
- private const string NORMALIZE_TEXT_PATTERN = "[^0-9A-Za-z-._]";\r
- protected const string UNDERSCORE = "_";\r
- protected const string HYPHEN = "-";\r
- private const string DATE_FORMAT = "yyyy.MM.dd";\r
- private const string PROGRAMME = "PROGRAMME";\r
- private const string COMMERCIAL = "COMMERCIAL";\r
- private const string JUNCTION = "JUNCTION";\r
- private const string XML_EXT = ".xml";\r
- private const string PATTERN_TARGETNAME = "%TARGETNAME%";\r
- protected const string PATTERN_TEXT = "%TEXT%";\r
- protected const string SLASH = "/";\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_ID = "%ID%";\r
- private const string PATTERN_IDROOT = "%IDROOT%";\r
- private const string PATTERN_SOURCENAME = "%SOURCENAME%";\r
- private const string PATTERN_TIMESTAMP = "%TIMESTAMP%";\r
- private const string DATETIME_FORMAT = "yyyyMMddhhmmss";\r
- protected FileInfo inputFile;\r
- protected string workingDir;\r
- protected TargetProcessorParameter parameters;\r
-\r
- public WorkflowAction workFlowAction { get; set; }\r
-\r
- public UNCTargetProcessor(Control parent, TargetProcessorParameter parameters)\r
- : base(parent) {\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
- ID = parameters.ID;\r
- workFlowAction = new WorkflowAction() {\r
- houseId = ID,\r
- tag = parameters.TargetConfig.Tag,\r
- touched = DateTime.Now,\r
- userName = TrayApplicationContext.UserName\r
- };\r
- Label = parameters.TargetConfig.Label;\r
- }\r
-\r
- protected virtual void BeforeExecute() {\r
- Started = DateTime.Now;\r
- workFlowAction.started = Started;\r
- }\r
-\r
- public override bool Execute() {\r
- logger.Info(PROCESSING, InputName);\r
- bool result = false;\r
- try {\r
- BeforeExecute();\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
- 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
- DeleteFile(currentFile);\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
- }\r
- finally {\r
- AfterExecute();\r
- }\r
- logger.Info(PROCESSING_COMPLETED, InputName);\r
- return result;\r
- }\r
-\r
- protected virtual void DeleteFile(string currentFile) {\r
- File.Delete(currentFile);\r
- }\r
-\r
- private string GetOutputName() {\r
- if (String.IsNullOrEmpty(OutputName))\r
- return null;\r
- string result = OutputName;\r
- if (result.Contains(DOT))\r
- result = result.Substring(0, result.LastIndexOf(DOT));\r
- return result;\r
- }\r
-\r
- protected override void ExecuteCompleted() {\r
- base.ExecuteCompleted();\r
- workFlowAction.description = SUCCESS;\r
- workFlowAction.successful = true;\r
- if (parameters.TargetConfig.NexioServer)\r
- UploadNexioMetadata();\r
- else {\r
- if (parameters.TargetConfig.KillDateDays > 0)\r
- UploadKillDateFile();\r
- }\r
-\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
- UploadMorpheusMetadata();\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
- Status = READY;\r
- Message = SUCCESS;\r
- }\r
-\r
- private void UploadNexioMetadata() {\r
- String xml = null;\r
- string name = GetOutputName();\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
- } else\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 type = null;\r
- switch (parameters.MetadataKind) {\r
- case MetadataType.TrafficMaterial:\r
- type = PROGRAMME;\r
- break;\r
- case MetadataType.TrafficPromo:\r
- type = COMMERCIAL;\r
- break;\r
- case MetadataType.TrafficAD:\r
- type = JUNCTION;\r
- break;\r
- }\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
- }\r
- catch (Exception e) {\r
- MessageBox.Show(parent, e.Message);\r
- }\r
- }\r
-\r
- protected virtual void AfterExecute() {\r
- Finished = DateTime.Now;\r
- workFlowAction.finished = Finished;\r
- SendWorkFlowAction();\r
- Progress = 0;\r
- }\r
-\r
- protected virtual bool FileExists(string path) {\r
- return File.Exists(path);\r
- }\r
-\r
- private void SendWorkFlowAction() {\r
- try {\r
- parameters.MediaCubeApi.Create<WorkflowAction>(workFlowAction);\r
- }\r
- catch (Exception e) {\r
- MessageBox.Show(parent, e.Message);\r
- }\r
- }\r
-\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
- string pattern = name.Split(HYPHEN[0])[0] + HYPHENSTAR;\r
- string[] dirs = Directory.GetDirectories(connection.Address.LocalPath, pattern);\r
- if (dirs.Length > 0)\r
- name = dirs[0];\r
- }\r
- result = Path.Combine(connection.Address.LocalPath, name);\r
- } else\r
- result = connection.Address.LocalPath;\r
- return result;\r
- }\r
-\r
- private DateTime GetKillDate() {\r
- DateTime result = DateTime.Now;\r
- result = result.AddDays(parameters.TargetConfig.KillDateDays);\r
- return result;\r
- }\r
-\r
- private void UploadKillDateFile() {\r
- Uri address = parameters.TargetConfig.Remote.Address;\r
- string statusWorkDir = Path.Combine(workingDir, STATUS_FOLDER);\r
- EnsureDirectoryExistence(statusWorkDir);\r
- DateTime date = GetKillDate();\r
- string fileName = String.Format(KILLDATE_FILE, OutputName, date.ToString(DATE_FORMAT_NODOTS));\r
- //logger.Debug("Creating KILLDATE status file {0}", fileName);\r
- KillDatePath = GetOutputFilePath(statusWorkDir, fileName);\r
- UploadContent(KillDatePath, new byte[] { });\r
- KillDate = date.ToString(DATE_FORMAT);\r
- }\r
-\r
- private void CreateArchiveMetadata() {\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
- string ouputPath = GetOutputFilePath(statusWorkDir, fileName);\r
- UploadContent(ouputPath, content);\r
- }\r
-\r
- private void CreateTrafficMetadata() {\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
- string ouputPath = GetOutputFilePath(statusWorkDir, fileName);\r
- UploadContent(ouputPath, content);\r
- }\r
-\r
- protected void CopyStream(Stream istream, long ilength, Stream ostream) {\r
- byte[] buffer = new byte[32768];\r
- int read, overall = 0;\r
- while ((read = istream.Read(buffer, 0, buffer.Length)) > 0) {\r
- ostream.Write(buffer, 0, read);\r
- ostream.Flush();\r
- overall += read;\r
- Progress = (int)((double)overall / ilength * 100);\r
- }\r
- }\r
-\r
- protected virtual void UploadContent(string outputPath, byte[] content) {\r
- File.WriteAllBytes(outputPath, content);\r
- }\r
-\r
- private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData) {\r
- if (transferred > 0)\r
- Progress = (int)((double)transferred * 100 / total);\r
- return CopyProgressResult.PROGRESS_CONTINUE;\r
- }\r
-\r
- protected virtual void UploadFile() {\r
- int pbCancel = 0;\r
- Win32File.CopyFileEx(Input, Output, new CopyProgressRoutine(this.CopyProgressHandler), IntPtr.Zero, ref pbCancel, CopyFileFlags.COPY_FILE_RESTARTABLE);\r
- }\r
-\r
- protected virtual string GetOutputFilePath(string path, string fileName) {\r
- return "/".Equals(workingDir) ? fileName : Path.Combine(path, fileName);\r
- }\r
-\r
- public static String RemoveDiacritics(String s) {\r
- String normalizedString = s.Normalize(NormalizationForm.FormD);\r
- StringBuilder stringBuilder = new StringBuilder();\r
-\r
- for (int i = 0; i < normalizedString.Length; i++) {\r
- Char c = normalizedString[i];\r
- if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)\r
- stringBuilder.Append(c);\r
- }\r
-\r
- return stringBuilder.ToString();\r
- }\r
-\r
- protected string GetDynamicName(string text) {\r
- string idRoot = ID.Contains(UNDERSCORE) ? ID.Split(UNDERSCORE[0])[0] : ID;\r
- string result = text\r
- .Replace(PATTERN_ID, ID)\r
- .Replace(PATTERN_IDROOT, idRoot)\r
- .Replace(PATTERN_TEXT, HYPHEN + RemoveDiacritics(parameters.MetadataText))\r
- .Replace(PATTERN_SOURCENAME, Path.GetFileNameWithoutExtension(InputName))\r
- .Replace(PATTERN_TIMESTAMP, DateTime.Now.ToString(DATETIME_FORMAT, CultureInfo.InvariantCulture));\r
- // replace hungarian and special characters\r
- result = Regex.Replace(result, NORMALIZE_TEXT_PATTERN, UNDERSCORE);\r
- if (result.Length > 100)\r
- result = result.Substring(0, 100);\r
- return result;\r
- }\r
-\r
- protected virtual string CreateOutputFileName() {\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
- int version = 1;\r
- while (FileExists(GetOutputFilePath(workingDir, result))) {\r
- string versioned = String.Format(VERSIONED_FILENAME, nameWithoutExtension, version, extension);\r
- logger.Debug(ALREADY_EXISTS, result, versioned);\r
- result = versioned;\r
- version++;\r
- }\r
- }\r
- return result;\r
- }\r
-\r
- protected virtual void EnsureDirectoryExistence(string path) {\r
- if (!Directory.Exists(path))\r
- Directory.CreateDirectory(path);\r
- }\r
-\r
-\r
- }\r
-}\r
-using DxPlay;\r
-using Maestro.Metadata;\r
+using MaestroShared.Metadata;\r
using System;\r
using System.Collections.Generic;\r
using System.Globalization;\r
</ImportItem>\r
</ImportItems>\r
*/\r
-namespace Commons {\r
+namespace MaestroShared.Commons {\r
\r
public class MorpheusXML {\r
\r
<ExtendedAgency>AGENT AGENT</ExtendedAgency>\r
</ID>\r
*/\r
-namespace Commons {\r
+namespace MaestroShared.Commons {\r
\r
public class NexioXML {\r
public static string ToXML(string fileName, DateTime? killDate, string description, string agency) {\r
using System;\r
using System.Windows.Forms;\r
\r
-namespace Maestro.Commons {\r
+namespace MaestroShared.Commons {\r
public static class ObjectExtensions {\r
\r
public static void SafeCall(this Control ctrl, Action x, bool force = false) {\r
using System;\r
using System.Runtime.InteropServices;\r
\r
-namespace Maestro.Commons {\r
+namespace MaestroShared.Commons {\r
public enum CopyProgressResult : uint {\r
PROGRESS_CONTINUE = 0,\r
PROGRESS_CANCEL = 1,\r
-using DxPlay;\r
-using TrafficClient;\r
+using TrafficClient;\r
\r
-namespace Maestro.Targets {\r
- class SegmentConverter {\r
+namespace MaestroShared.Metadata {\r
+ public class SegmentConverter {\r
\r
public MovieSegment ConvertToMovieSegment(Segment source) {\r
Timecode tcIn = new Timecode();\r