From 80d03c68b40091ff193b0a111e8612a3dc5eaca9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Thu, 12 Oct 2017 12:54:09 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30609 --- client/Maestro/MaestroForm.Designer.cs | 1 - client/Maestro/MaestroForm.Source.cs | 51 ++++++++----------- .../Resources/configuration-ingest.json | 2 +- client/Maestro/Sources/FileSourceItem.cs | 19 +++++++ client/Maestro/Sources/FileSystemSource.cs | 6 +++ client/Maestro/StringResources.Designer.cs | 9 ++++ client/Maestro/StringResources.resx | 3 ++ client/Maestro/Targets/UNCTargetProcessor.cs | 6 +-- 8 files changed, 63 insertions(+), 34 deletions(-) diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index 732c967d..aaebcbcf 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -188,7 +188,6 @@ namespace Maestro { this.dataGridSource.CellMouseEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellMouseEnter); this.dataGridSource.CellMouseLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellMouseLeave); this.dataGridSource.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.dataGridSource_CellPainting); - this.dataGridSource.SelectionChanged += new System.EventHandler(this.sourceGridView_SelectionChanged); this.dataGridSource.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridSource_KeyDown); // // tableLayoutPanel2 diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index 12c81547..6b86b104 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -67,30 +67,23 @@ namespace Maestro { } private void dataGridSource_CellMouseEnter(object sender, DataGridViewCellEventArgs e) { - if (e.RowIndex == -1) - return; - DataGridView gridView = sender as DataGridView; - if (gridView == null) - return; - DataGridViewColumn currentColumn = gridView.Columns[e.ColumnIndex]; - if (currentColumn.GetType() == typeof(DataGridViewImageColumn)) + if (IsPlayColumn(e.ColumnIndex)) dataGridSource.Cursor = Cursors.Hand; } + private bool IsPlayColumn(int columnIndex) { + return columnIndex > -1 && dataGridSource.Columns[columnIndex] is DataGridViewImageColumn; + } + private void dataGridSource_CellMouseLeave(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex != 2) - return; - dataGridSource.Cursor = Cursors.Default; + if (IsPlayColumn(e.ColumnIndex)) + dataGridSource.Cursor = Cursors.Default; } private void dataGridSource_CellEnter(object sender, DataGridViewCellEventArgs e) { ISourceItem item = bindingSource.Current as ISourceItem; - if (item == null || e.RowIndex < 0 || e.ColumnIndex < 0) - return; - item.IsHighlighted = false; - } - - private void sourceGridView_SelectionChanged(object sender, EventArgs e) { + if (item != null) + item.IsHighlighted = false; } private void sourceGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { @@ -102,19 +95,19 @@ namespace Maestro { SetSourceFromCheckBoxAction(selectedrows); return; } - if (e.ColumnIndex != 3) - return; - FileSourceItem fileSourceItem = selectedItems as FileSourceItem; - if (fileSourceItem == null) - return; - Cursor = Cursors.WaitCursor; - BeginInvoke(new Action(() => { - PlayerForm player = new PlayerForm(); - player.AutoStart = Configuration.Player.AutoStart; - player.Open(fileSourceItem.FileInfo); - player.ShowDialog(); - Cursor = Cursors.Default; - })); + if (IsPlayColumn(e.ColumnIndex)) { + FileSourceItem fileSourceItem = selectedItems as FileSourceItem; + if (fileSourceItem == null) + return; + Cursor = Cursors.WaitCursor; + BeginInvoke(new Action(() => { + PlayerForm player = new PlayerForm(); + player.AutoStart = Configuration.Player.AutoStart; + player.Open(fileSourceItem.FileInfo); + player.ShowDialog(); + Cursor = Cursors.Default; + })); + } } private void SetSourceFromCheckBoxAction(DataGridViewSelectedRowCollection selectedRows) { diff --git a/client/Maestro/Resources/configuration-ingest.json b/client/Maestro/Resources/configuration-ingest.json index a8be4c5c..07acce92 100644 --- a/client/Maestro/Resources/configuration-ingest.json +++ b/client/Maestro/Resources/configuration-ingest.json @@ -12,7 +12,7 @@ "$type": "UNCSource", "filter": "avi,wav,mxf", "local": { - "address": "file://c:\\_video\\v\\sxs\\xdroot\\clip" + "address": "file://e:/XDROOT/Clip" } }, "metadatas": [ diff --git a/client/Maestro/Sources/FileSourceItem.cs b/client/Maestro/Sources/FileSourceItem.cs index e917d411..b90f88c5 100644 --- a/client/Maestro/Sources/FileSourceItem.cs +++ b/client/Maestro/Sources/FileSourceItem.cs @@ -6,10 +6,12 @@ using System.Runtime.CompilerServices; using System.Collections.Generic; namespace Maestro.Sources { + public class FileSourceItem : ISourceItem { private FileInfo fileInfo; private Icon icon; private bool isHighlighted; + private static string[] sizes = { "", "KB", "MB", "GB", "TB" }; public event PropertyChangedEventHandler PropertyChanged; @@ -45,12 +47,29 @@ namespace Maestro.Sources { return FileInfo?.Name; } } + public DateTime Created { get { return (FileInfo == null) ? DateTime.MinValue : FileInfo.CreationTime; } } + public string FormattedSize { + get { + return (FileInfo == null) ? String.Empty : GetSizeString(FileInfo.Length); + } + } + + private string GetSizeString(long length) { + double len = length; + int order = 0; + while (len >= 1024 && order < sizes.Length - 1) { + order++; + len = len / 1024; + } + return String.Format("{0:0.##} {1}", len, sizes[order]); + } + public Icon Icon { get { return icon; diff --git a/client/Maestro/Sources/FileSystemSource.cs b/client/Maestro/Sources/FileSystemSource.cs index 042e4b8e..d840107b 100644 --- a/client/Maestro/Sources/FileSystemSource.cs +++ b/client/Maestro/Sources/FileSystemSource.cs @@ -37,6 +37,12 @@ namespace Maestro.Sources { AutoSizeMode = DataGridViewAutoSizeColumnMode.None, Width = 200 }, + new DataGridViewTextBoxColumn(){ + DataPropertyName = "FormattedSize", + HeaderText = StringResources.MERET, + AutoSizeMode = DataGridViewAutoSizeColumnMode.None, + Width = 100 + }, new DataGridViewTextBoxColumn() { DataPropertyName = "Created", HeaderText = StringResources.LETREHOZVA, diff --git a/client/Maestro/StringResources.Designer.cs b/client/Maestro/StringResources.Designer.cs index 452f016e..b55133b3 100644 --- a/client/Maestro/StringResources.Designer.cs +++ b/client/Maestro/StringResources.Designer.cs @@ -213,6 +213,15 @@ namespace Maestro { } } + /// + /// Looks up a localized string similar to Méret. + /// + internal static string MERET { + get { + return ResourceManager.GetString("MERET", resourceCulture); + } + } + /// /// Looks up a localized string similar to Metaadat. /// diff --git a/client/Maestro/StringResources.resx b/client/Maestro/StringResources.resx index 66d10991..1f3a0cc5 100644 --- a/client/Maestro/StringResources.resx +++ b/client/Maestro/StringResources.resx @@ -168,6 +168,9 @@ Létrehozva + + Méret + Metaadat diff --git a/client/Maestro/Targets/UNCTargetProcessor.cs b/client/Maestro/Targets/UNCTargetProcessor.cs index 74b3e9de..4bdbfd2b 100644 --- a/client/Maestro/Targets/UNCTargetProcessor.cs +++ b/client/Maestro/Targets/UNCTargetProcessor.cs @@ -124,18 +124,18 @@ namespace Maestro.Targets { private void UploadKillDateFile() { Uri address = parameters.TargetConfig.Remote.Address; - string statusWorkDir = Path.Combine(address.LocalPath, STATUS_FOLDER); + string statusWorkDir = Path.Combine(workingDir, STATUS_FOLDER); EnsureDirectoryExistence(statusWorkDir); DateTime date = DateTime.Now; date = date.AddDays(parameters.TargetConfig.KillDateDays); string fileName = String.Format(KILLDATE_FILE, OutputName, date.ToString("yyyyMMdd")); logger.Debug("Creating KILLDATE status file {0}", fileName); - UploadContent(Path.Combine(statusWorkDir, fileName), null); + UploadContent(Path.Combine(statusWorkDir, fileName), new byte[] { }); } private void CreateMetadata() { Uri address = parameters.TargetConfig.Remote.Address; - string statusWorkDir = Path.Combine(address.LocalPath, STATUS_FOLDER); + string statusWorkDir = Path.Combine(workingDir, STATUS_FOLDER); EnsureDirectoryExistence(statusWorkDir); string fileName = String.Format(METADATA_FILE, OutputName); logger.Debug("Creating METADATA file {0}", fileName); -- 2.54.0