From 0d556d845bcfab86be75241595b8011a8e2de891 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Thu, 19 Oct 2017 08:50:13 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30648 --- client/Maestro/MaestroForm.Metadata.cs | 45 ++++++++++++------- client/Maestro/MaestroForm.Source.cs | 18 ++++---- client/Maestro/MaestroForm.Target.cs | 34 +++++--------- client/Maestro/MaestroForm.cs | 1 - client/Maestro/Metadata/MetaDataInfo.cs | 1 + client/Maestro/Metadata/MetadataType.cs | 2 +- client/Maestro/Targets/FTPTargetProcessor.cs | 13 ++++-- client/Maestro/Targets/UNCTargetProcessor.cs | 3 +- .../PasswordEncrypter.csproj.vspscc | 10 +++++ 9 files changed, 73 insertions(+), 54 deletions(-) create mode 100644 client/PasswordEncrypter/PasswordEncrypter.csproj.vspscc diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index 5d7da90c..5e1eb7d3 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -86,19 +86,18 @@ namespace Maestro { form.ShowDialog(); } - private IDTypes GetSelectedMetadataType() { + private IDTypes GetIDType(string id) { IDTypes result = IDTypes.None; - string id = textSelectedMetadata.Text; - if (String.IsNullOrEmpty(id)) - return IDTypes.None; - string pattern = "[A-Z]{1}[0-9]{6}[A-Z]{1}"; - Match match = Regex.Match(id, pattern); - if (match.Success) { - result = IDTypes.TrafficID; - } else { - pattern = "^[0-9]+$"; - match = Regex.Match(id, pattern); - result = match.Success ? IDTypes.OctopusID : IDTypes.None; + if (!String.IsNullOrEmpty(id)) { + Match match = Regex.Match(id, "[A-Z]{1}[0-9]{6}[A-Z]{1}"); + if (match.Success) + result = IDTypes.TrafficID; + else { + //"^[0-9]+$"; + match = Regex.Match(id, "[0-9]"); + if (match.Success) + result = IDTypes.OctopusID; + } } return result; } @@ -140,7 +139,7 @@ namespace Maestro { private void TrafficIDSelected(string selectedID, int variantID) { SelectedMetadata = new MetadataInfo() { - Kind = MetadataType.Traffic, + Kind = GetTrafficMetadataType(selectedID), Tooltip = "Epizod ID", ID = selectedID, VariantID = variantID @@ -148,6 +147,22 @@ namespace Maestro { // EnableArchiveMetadataButtonAndCreateMetadataModel(); } + private MetadataType GetTrafficMetadataType(string id) { + MetadataType result = MetadataType.TrafficMaterial; + switch (id[0]) { + case 'M': + result = MetadataType.TrafficMaterial; + break; + case 'P': + result = MetadataType.TrafficPromo; + break; + case 'R': + result = MetadataType.TrafficAD; + break; + } + return result; + } + private void EnableArchiveMetadataButtonAndCreateMetadataModel() { ctxiModifyArchiveMetadata.Enabled = selectedMetadata != null; if (ctxiModifyArchiveMetadata.Enabled) { @@ -158,11 +173,11 @@ namespace Maestro { private ArchiveMetadata GetArchiveMetadata() { ArchiveMetadata result = null; + IDTypes idType = GetIDType(textSelectedMetadata.Text); Cursor.Current = Cursors.WaitCursor; - IDTypes idType = GetSelectedMetadataType(); if (idType == IDTypes.OctopusID) result = GetOctopusMetadata(); - else //if (idType == IDTypes.TrafficID) + if (idType == IDTypes.TrafficID) result = GetTrafficMetadata(); Cursor.Current = Cursors.Default; return result; diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index 66040d89..15b8dcd4 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -9,7 +9,6 @@ using System.Collections.ObjectModel; using System.Drawing; using System.Linq; using System.Windows.Forms; -using System.Linq; namespace Maestro { @@ -60,8 +59,6 @@ namespace Maestro { bindingSource.DataSource = source; dataGridSource.Columns.AddRange(new DataGridViewCheckBoxColumn()); dataGridSource.Columns.AddRange(source.Columns); - - } private void SetSourceTitle(String text) { @@ -112,7 +109,7 @@ namespace Maestro { if (selectedrows == null) return; if (e.ColumnIndex == 0) { - SetSourceFromCheckBoxAction(selectedrows); + UpdateSelectedSources(selectedrows); return; } if (IsPlayColumn(e.ColumnIndex)) { @@ -130,7 +127,7 @@ namespace Maestro { } } - private void SetSourceFromCheckBoxAction(DataGridViewSelectedRowCollection selectedRows) { + private void UpdateSelectedSources(DataGridViewSelectedRowCollection selectedRows) { String name; bool valueOfCheckBoxes = GetValueOfCheckBoxes(selectedRows); int nameIndex = dataGridSource.Columns.Cast().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index; @@ -175,12 +172,13 @@ namespace Maestro { SetStartingName(checkBox); if (selectedSourceRows == null || selectedSourceRows.Count == 0) { buttonMetadata.Enabled = false; - IsSelectedFileAnID(); + + //IsSelectedFileAnID(); return; } if (selectedSourceRows.Count == 1) { buttonMetadata.Enabled = true; - IsSelectedFileAnID(); + //IsSelectedFileAnID(); return; } int index = dataGridSource.Columns.Cast().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index; @@ -194,7 +192,7 @@ namespace Maestro { } } buttonMetadata.Enabled = true; - IsSelectedFileAnID(); + //IsSelectedFileAnID(); } private void SetStartingName(bool checkBox) { @@ -266,7 +264,7 @@ namespace Maestro { if (e.RowIndex < 0) return; var selectedRows = dataGridSource.SelectedRows; - SetSourceFromCheckBoxAction(selectedRows); + UpdateSelectedSources(selectedRows); } public void SourceDeleted(String fileName) { @@ -293,7 +291,7 @@ namespace Maestro { private void dataGridSource_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Space && dataGridSource.CurrentCell.GetType() != typeof(DataGridViewCheckBoxCell)) { var selectedRows = dataGridSource.SelectedRows; - SetSourceFromCheckBoxAction(selectedRows); + UpdateSelectedSources(selectedRows); } } } diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index 365f3049..067107aa 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Windows.Forms; using Maestro.Metadata; using System.Collections.Generic; -using System.Text.RegularExpressions; using TrafficClient; using JobEngineClient; @@ -212,28 +211,20 @@ namespace Maestro { ChangeProcessButtonsState(false); } - if (Configuration.Player != null) - ctxiDefineSegments.Enabled = SelectedSource?.FileInfo != null && Configuration.Player.SegmentEditor && MetadataType.Traffic.Equals(SelectedMetadata?.Kind); - IsSelectedFileAnID(); + UpdateDefineSegmentEnabled(); EnableArchiveMetadataButtonAndCreateMetadataModel(); } - - private void IsSelectedFileAnID() { - IDType = IDTypes.None; - if (String.IsNullOrEmpty(startingName)) - return; - Match match = Regex.Match(startingName, "[A-Z]{1}[0-9]{6}[A-Z]{1}"); - if (match.Success) { - IDType = IDTypes.TrafficID; - return; - } - - match = Regex.Match(startingName, "[0-9]"); - if (match.Success) - IDType = IDTypes.OctopusID; - - buttonMetadata.Enabled = IDType != IDTypes.None; + private void UpdateDefineSegmentEnabled() { + MetadataType[] validTypes = { MetadataType.TrafficAD, MetadataType.TrafficMaterial, MetadataType.TrafficPromo }; + ctxiDefineSegments.Enabled = + Configuration.Player != null && + Configuration.Player.SegmentEditor && + SelectedSource != null && + SelectedSource.FileInfo != null && + SelectedMetadata != null && + validTypes.ToList().Contains(SelectedMetadata.Kind); + buttonMetadata.Enabled = GetIDType(startingName) != IDTypes.None; } public void OnTargetPanelsMouseClick(object sender, MouseEventArgs e) { @@ -265,8 +256,7 @@ namespace Maestro { ChangeProcessButtonsState(false); } - if (Configuration.Player != null) - ctxiDefineSegments.Enabled = SelectedSource?.FileInfo != null && Configuration.Player.SegmentEditor && MetadataType.Traffic.Equals(SelectedMetadata?.Kind); + UpdateDefineSegmentEnabled(); } } diff --git a/client/Maestro/MaestroForm.cs b/client/Maestro/MaestroForm.cs index f1b32cd7..5b8c3585 100644 --- a/client/Maestro/MaestroForm.cs +++ b/client/Maestro/MaestroForm.cs @@ -180,7 +180,6 @@ namespace Maestro { } private void buttonMetadata_Click(object sender, EventArgs e) { - IsSelectedFileAnID(); switch (IDType) { case Metadata.IDTypes.TrafficID: SetTrafficIDToMetadataText(); diff --git a/client/Maestro/Metadata/MetaDataInfo.cs b/client/Maestro/Metadata/MetaDataInfo.cs index 33eed301..d0afc234 100644 --- a/client/Maestro/Metadata/MetaDataInfo.cs +++ b/client/Maestro/Metadata/MetaDataInfo.cs @@ -4,5 +4,6 @@ public string Tooltip { get; set; } public MetadataType Kind { get; set; } public int VariantID { get; set; } + } } diff --git a/client/Maestro/Metadata/MetadataType.cs b/client/Maestro/Metadata/MetadataType.cs index 80088e78..bfbd4ed5 100644 --- a/client/Maestro/Metadata/MetadataType.cs +++ b/client/Maestro/Metadata/MetadataType.cs @@ -1,5 +1,5 @@ namespace Maestro.Metadata { public enum MetadataType { - OctopusStory, OctopusPlaceHolder, Traffic, Archive + OctopusStory, OctopusPlaceHolder, TrafficMaterial, TrafficPromo, TrafficAD } } diff --git a/client/Maestro/Targets/FTPTargetProcessor.cs b/client/Maestro/Targets/FTPTargetProcessor.cs index 005b588b..39faad52 100644 --- a/client/Maestro/Targets/FTPTargetProcessor.cs +++ b/client/Maestro/Targets/FTPTargetProcessor.cs @@ -50,11 +50,14 @@ namespace Maestro.Targets { } } FtpReply reply = targetFTP.GetReply(); - if ((reply.Success && "226".Equals(reply.Code) && !FileExists(OutputName)) || - !reply.Success || - (reply.Success && !"226".Equals(reply.Code))) { + if (!reply.Success || !"226".Equals(reply.Code)) { throw new Exception("Feltöltési hiba."); } + //if ((reply.Success && "226".Equals(reply.Code) && !FileExists(OutputName)) || + // !reply.Success || + // (reply.Success && !"226".Equals(reply.Code))) { + // throw new Exception("Feltöltési hiba."); + //} } protected void reconnect() { @@ -76,6 +79,10 @@ namespace Maestro.Targets { ostream.Close(); } } + FtpReply reply = targetFTP.GetReply(); + if (!reply.Success || !"226".Equals(reply.Code)) { + throw new Exception("Feltöltési hiba."); + } } protected override bool FileExists(string path) { diff --git a/client/Maestro/Targets/UNCTargetProcessor.cs b/client/Maestro/Targets/UNCTargetProcessor.cs index 332270d9..33ee24e9 100644 --- a/client/Maestro/Targets/UNCTargetProcessor.cs +++ b/client/Maestro/Targets/UNCTargetProcessor.cs @@ -186,7 +186,7 @@ namespace Maestro.Targets { string fileName = String.Format(KILLDATE_FILE, OutputName, date.ToString("yyyyMMdd")); logger.Debug("Creating KILLDATE status file {0}", fileName); KillDatePath = Path.Combine(statusWorkDir, fileName); - UploadContent(KillDatePath, new byte[] { }); + UploadContent(fileName, new byte[] { }); KillDate = date.ToString("yyyy.MM.dd"); } @@ -200,7 +200,6 @@ namespace Maestro.Targets { UploadContent(Path.Combine(statusWorkDir, fileName), content); } - protected void CopyStream(Stream istream, long ilength, Stream ostream) { byte[] buffer = new byte[32768]; int read, overall = 0; diff --git a/client/PasswordEncrypter/PasswordEncrypter.csproj.vspscc b/client/PasswordEncrypter/PasswordEncrypter.csproj.vspscc new file mode 100644 index 00000000..feffdeca --- /dev/null +++ b/client/PasswordEncrypter/PasswordEncrypter.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} -- 2.54.0