}\r
\r
private void FillTheTextBoxes() {\r
- textBox_stuffID.Text = model.StuffID;\r
- textBox_stuffTitle.Text = model.StuffTitle;\r
- textBox_stuffDescription.Text = model.StuffDescription;\r
- textBox_mediaID.Text = model.MediaID;\r
- textBox_mediaTitle.Text = model.MediaTitle;\r
- textBox_mediaDescription.Text = model.MediaDescription;\r
+ textBox_stuffID.Text = model.itemHouseId;\r
+ textBox_stuffTitle.Text = model.itemTitle;\r
+ textBox_stuffDescription.Text = model.itemDescription;\r
+ textBox_mediaID.Text = model.mediaHouseId;\r
+ textBox_mediaTitle.Text = model.mediaTitle;\r
+ textBox_mediaDescription.Text = model.mediaDescription;\r
}\r
\r
private void button_Ok_Click_1(object sender, System.EventArgs e) {\r
- model.StuffID = textBox_stuffID.Text;\r
- model.StuffTitle = textBox_stuffTitle.Text;\r
- model.StuffDescription = textBox_stuffDescription.Text;\r
- model.MediaID = textBox_mediaID.Text;\r
- model.MediaTitle = textBox_mediaTitle.Text;\r
- model.MediaDescription = textBox_mediaDescription.Text;\r
+ model.itemHouseId = textBox_stuffID.Text;\r
+ model.itemTitle = textBox_stuffTitle.Text;\r
+ model.itemDescription = textBox_stuffDescription.Text;\r
+ model.mediaHouseId = textBox_mediaID.Text;\r
+ model.mediaTitle = textBox_mediaTitle.Text;\r
+ model.mediaDescription = textBox_mediaDescription.Text;\r
Dispose();\r
}\r
\r
--- /dev/null
+using System;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace Maestro.Commons {\r
+ public enum CopyProgressResult : uint {\r
+ PROGRESS_CONTINUE = 0,\r
+ PROGRESS_CANCEL = 1,\r
+ PROGRESS_STOP = 2,\r
+ PROGRESS_QUIET = 3\r
+ }\r
+\r
+ public enum CopyProgressCallbackReason : uint {\r
+ CALLBACK_CHUNK_FINISHED = 0x00000000,\r
+ CALLBACK_STREAM_SWITCH = 0x00000001\r
+ }\r
+\r
+ [Flags]\r
+ public enum CopyFileFlags : uint {\r
+ COPY_FILE_FAIL_IF_EXISTS = 0x00000001,\r
+ COPY_FILE_RESTARTABLE = 0x00000002,\r
+ COPY_FILE_OPEN_SOURCE_FOR_WRITE = 0x00000004,\r
+ COPY_FILE_ALLOW_DECRYPTED_DESTINATION = 0x00000008\r
+ }\r
+\r
+ public delegate CopyProgressResult CopyProgressRoutine(\r
+ long TotalFileSize,\r
+ long TotalBytesTransferred,\r
+ long StreamSize,\r
+ long StreamBytesTransferred,\r
+ uint dwStreamNumber,\r
+ CopyProgressCallbackReason dwCallbackReason,\r
+ IntPtr hSourceFile,\r
+ IntPtr hDestinationFile,\r
+ IntPtr lpData);\r
+\r
+ public class Win32File {\r
+\r
+ [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]\r
+ [return: MarshalAs(UnmanagedType.Bool)]\r
+ static public extern bool CopyFileEx(string lpExistingFileName, string lpNewFileName,\r
+ CopyProgressRoutine lpProgressRoutine, IntPtr lpData, ref Int32 pbCancel,\r
+ CopyFileFlags dwCopyFlags);\r
+\r
+\r
+ int pbCancel;\r
+\r
+ private void XCopy(string oldFile, string newFile) {\r
+ CopyFileEx(oldFile, newFile, new CopyProgressRoutine(this.CopyProgressHandler), IntPtr.Zero, ref pbCancel, CopyFileFlags.COPY_FILE_RESTARTABLE);\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
+ return CopyProgressResult.PROGRESS_CONTINUE;\r
+ }\r
+ }\r
+}\r
public bool StartInTray { get; set; }\r
public bool Active { get; set; }\r
public string Title { get; set; }\r
- public bool IsAdmin { get; set; }\r
public Player Player { get; set; }\r
public Source Source { get; set; }\r
+ public bool EnableCustomMetadataId { get; set; }\r
public MetadataProvider[] Metadatas { get; set; }\r
public Target[] Targets { get; set; }\r
}\r
</Compile>\r
<Compile Include="Commons\DataGridViewProgressColumn.cs" />\r
<Compile Include="Commons\ObjectExtensions.cs" />\r
+ <Compile Include="Commons\Win32File.cs" />\r
<Compile Include="Configuration\ConfigurationInfo.cs" />\r
<Compile Include="Configuration\KeysJsonConverter.cs" />\r
<Compile Include="Configuration\KnownTypesBinder.cs" />\r
<Compile Include="Program.cs" />\r
<Compile Include="Properties\AssemblyInfo.cs" />\r
<Compile Include="Sources\Messages\FileActionMsg.cs" />\r
+ <Compile Include="Targets\UNCTargetProcessor.cs" />\r
<Compile Include="Targets\FXPTargetProcessor.cs" />\r
<Compile Include="Targets\FTPTargetProcessor.cs" />\r
<Compile Include="Targets\SegmentConverter.cs" />\r
<Compile Include="Targets\TargetProcessor.cs" />\r
<Compile Include="Targets\ITargetProcessor.cs" />\r
- <Compile Include="Targets\ProcessStatus.cs" />\r
<EmbeddedResource Include="ArchiveMetadata.resx">\r
<DependentUpon>ArchiveMetadata.cs</DependentUpon>\r
</EmbeddedResource>\r
this.splitContainer2 = new System.Windows.Forms.SplitContainer();\r
this.groupActions = new System.Windows.Forms.GroupBox();\r
this.dataGridJobs = new System.Windows.Forms.DataGridView();\r
+ this.bindingSourceJobs = new System.Windows.Forms.BindingSource(this.components);\r
+ this.metadataInfoBindingSource = new System.Windows.Forms.BindingSource(this.components);\r
this.columnID = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
+ this.columnStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
+ this.columnProgress = new Maestro.Commons.DataGridViewProgressColumn();\r
this.columnStarted = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
this.columnFinished = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
this.columnInput = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
this.columnOutput = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
- this.columnProgress = new Maestro.Commons.DataGridViewProgressColumn();\r
- this.columnStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
- this.bindingSourceJobs = new System.Windows.Forms.BindingSource(this.components);\r
- this.metadataInfoBindingSource = new System.Windows.Forms.BindingSource(this.components);\r
this.groupSource.SuspendLayout();\r
((System.ComponentModel.ISupportInitialize)(this.dataGridSource)).BeginInit();\r
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();\r
this.dataGridJobs.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r
this.dataGridJobs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {\r
this.columnID,\r
+ this.columnStatus,\r
+ this.columnProgress,\r
this.columnStarted,\r
this.columnFinished,\r
this.columnInput,\r
- this.columnOutput,\r
- this.columnProgress,\r
- this.columnStatus});\r
+ this.columnOutput});\r
this.dataGridJobs.DataSource = this.bindingSourceJobs;\r
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;\r
this.dataGridJobs.TabIndex = 0;\r
this.dataGridJobs.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridJobs_CellEnter);\r
// \r
+ // metadataInfoBindingSource\r
+ // \r
+ this.metadataInfoBindingSource.DataSource = typeof(Maestro.Metadata.MetadataInfo);\r
+ // \r
// columnID\r
// \r
this.columnID.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;\r
this.columnID.Name = "columnID";\r
this.columnID.Width = 44;\r
// \r
+ // columnStatus\r
+ // \r
+ this.columnStatus.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;\r
+ this.columnStatus.DataPropertyName = "Status";\r
+ dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.columnStatus.DefaultCellStyle = dataGridViewCellStyle6;\r
+ this.columnStatus.Frozen = true;\r
+ this.columnStatus.HeaderText = "Status";\r
+ this.columnStatus.Name = "columnStatus";\r
+ this.columnStatus.Width = 66;\r
+ // \r
+ // columnProgress\r
+ // \r
+ this.columnProgress.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;\r
+ this.columnProgress.DataPropertyName = "Progress";\r
+ dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;\r
+ dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle7.NullValue = null;\r
+ this.columnProgress.DefaultCellStyle = dataGridViewCellStyle7;\r
+ this.columnProgress.HeaderText = "Progress";\r
+ this.columnProgress.Name = "columnProgress";\r
+ this.columnProgress.Resizable = System.Windows.Forms.DataGridViewTriState.True;\r
+ this.columnProgress.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;\r
+ this.columnProgress.Width = 200;\r
+ // \r
// columnStarted\r
// \r
this.columnStarted.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;\r
this.columnOutput.Name = "columnOutput";\r
this.columnOutput.Width = 68;\r
// \r
- // columnProgress\r
- // \r
- this.columnProgress.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;\r
- this.columnProgress.DataPropertyName = "Progress";\r
- dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;\r
- dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle6.NullValue = null;\r
- this.columnProgress.DefaultCellStyle = dataGridViewCellStyle6;\r
- this.columnProgress.HeaderText = "Progress";\r
- this.columnProgress.Name = "columnProgress";\r
- this.columnProgress.Resizable = System.Windows.Forms.DataGridViewTriState.True;\r
- this.columnProgress.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;\r
- this.columnProgress.Width = 200;\r
- // \r
- // columnStatus\r
- // \r
- this.columnStatus.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;\r
- this.columnStatus.DataPropertyName = "Status";\r
- dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.columnStatus.DefaultCellStyle = dataGridViewCellStyle7;\r
- this.columnStatus.HeaderText = "Status";\r
- this.columnStatus.Name = "columnStatus";\r
- this.columnStatus.Width = 66;\r
- // \r
- // metadataInfoBindingSource\r
- // \r
- this.metadataInfoBindingSource.DataSource = typeof(Maestro.Metadata.MetadataInfo);\r
- // \r
// MaestroForm\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
private System.Windows.Forms.Label label1;\r
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;\r
private TrafficClient.TrafficIDSelector trafficIDSelector;\r
+ private System.Windows.Forms.Button buttonMetadata;\r
+ private System.Windows.Forms.TextBox txtSorceFilter;\r
private System.Windows.Forms.DataGridViewTextBoxColumn columnID;\r
+ private System.Windows.Forms.DataGridViewTextBoxColumn columnStatus;\r
+ private Commons.DataGridViewProgressColumn columnProgress;\r
private System.Windows.Forms.DataGridViewTextBoxColumn columnStarted;\r
private System.Windows.Forms.DataGridViewTextBoxColumn columnFinished;\r
private System.Windows.Forms.DataGridViewTextBoxColumn columnInput;\r
private System.Windows.Forms.DataGridViewTextBoxColumn columnOutput;\r
- private Commons.DataGridViewProgressColumn columnProgress;\r
- private System.Windows.Forms.DataGridViewTextBoxColumn columnStatus;\r
- private System.Windows.Forms.Button buttonMetadata;\r
- private System.Windows.Forms.TextBox txtSorceFilter;\r
}\r
}\r
\r
InitializeOctopusSelector();\r
InitializeTrafficSelector();\r
InitializeMediaCubeApi();\r
+ textSelectedMetadata.ReadOnly = !Configuration.EnableCustomMetadataId;\r
}\r
\r
private void InitializeTrafficSelector() {\r
CreateTarget(target);\r
}\r
\r
- textSelectedSource.ReadOnly = !Configuration.IsAdmin;\r
- textSelectedMetadata.ReadOnly = !Configuration.IsAdmin;\r
ApplyProcessorButtonsLogic();\r
segmentConverter = new SegmentConverter();\r
}\r
string typeName = string.Format("{0}.{1}", typeof(ITargetProcessor).Namespace, target.Processor);\r
Type type = Type.GetType(typeName);\r
ISourceItem selectedFile = GetSourceItemFromBindingSource(fileName);//bindingSource.Current as ISourceItem;\r
- string id = selectedMetadata.ID;\r
+ string id = selectedMetadata == null ? textSelectedMetadata.Text : selectedMetadata.ID;\r
object[] parameters = new object[] { this, Configuration.Source, target, selectedFile.Name, id, segments, mediaCubeApi, model };\r
ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters);\r
processors.Add(processor);\r
TrafficAPI api = trafficIDSelector.trafficAPI;\r
List<ArchiveMatadataWrapper> result = api.SearchArchiveMetadata(id); ;\r
ArchiveMatadataWrapper actualResult = result[0];\r
- model.StuffID = actualResult.ProgID;\r
- model.StuffTitle = actualResult.ProgTitle;\r
- model.StuffDescription = actualResult.ProgDescription;\r
- model.MediaID = actualResult.EpisodeID;\r
- model.MediaTitle = !String.IsNullOrEmpty(actualResult.EpisodeTitle) ? actualResult.EpisodeTitle : actualResult.ProgTitle;\r
- model.MediaDescription = actualResult.EpisodeDescription;\r
+ model.itemHouseId = actualResult.ProgID;\r
+ model.itemTitle = actualResult.ProgTitle;\r
+ model.itemDescription = actualResult.ProgDescription;\r
+ model.mediaHouseId = actualResult.EpisodeID;\r
+ model.mediaTitle = !String.IsNullOrEmpty(actualResult.EpisodeTitle) ? actualResult.EpisodeTitle : actualResult.ProgTitle;\r
+ model.mediaDescription = actualResult.EpisodeDescription;\r
}\r
\r
private void FillTheModelFromOctopus(ArchiveMetadataModel model) {\r
return;\r
List<StoryFolder> storyFolders = storyFoldersEnum.ToList();\r
StoryFolder folder = storyFolders[0];\r
- model.StuffID = folder.ID;\r
- model.StuffTitle = folder.Name;\r
+ model.itemHouseId = folder.ID;\r
+ model.itemTitle = folder.Name;\r
} else if (story.Rundowns != null) {\r
IEnumerable<Rundown> rundownsEnum = api.GetRundownsByStoryID(story.ID);\r
if (rundownsEnum == null)\r
return;\r
List<Rundown> rundowns = rundownsEnum.ToList();\r
Rundown rundown = rundowns[0];\r
- model.StuffID = rundown.ID;\r
- model.StuffTitle = rundown.Name;\r
- model.StuffDescription = rundown.Start;\r
+ model.itemHouseId = rundown.ID;\r
+ model.itemTitle = rundown.Name;\r
+ model.itemDescription = rundown.Start;\r
}\r
- model.MediaID = story.ID;\r
- model.MediaTitle = story.Name;\r
- model.MediaDescription = story.Script;\r
+ model.mediaHouseId = story.ID;\r
+ model.mediaTitle = story.Name;\r
+ model.mediaDescription = story.Script;\r
}\r
\r
private void IsSelectedFileAnID() {\r
groupActions.Text = StringResources.AKCIOK;\r
columnStarted.HeaderText = StringResources.KEZDES;\r
columnFinished.HeaderText = StringResources.BEFEJEZES;\r
- columnInput.HeaderText = StringResources.BEMENET;\r
- columnOutput.HeaderText = StringResources.KIMENET;\r
+ columnInput.HeaderText = StringResources.FORRAS;\r
+ columnOutput.HeaderText = StringResources.CEL;\r
columnProgress.HeaderText = StringResources.ALLAPOT;\r
columnStatus.HeaderText = StringResources.STATUSZ;\r
ctxiDefineSegments.Text = StringResources.SZEGMENS_LETREHOZASA;\r
<metadata name="columnID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
<value>True</value>\r
</metadata>\r
- <metadata name="columnStarted.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+ <metadata name="columnStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
<value>True</value>\r
</metadata>\r
- <metadata name="columnFinished.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+ <metadata name="columnProgress.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
<value>True</value>\r
</metadata>\r
- <metadata name="columnInput.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+ <metadata name="columnStarted.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
<value>True</value>\r
</metadata>\r
- <metadata name="columnOutput.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+ <metadata name="columnFinished.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
<value>True</value>\r
</metadata>\r
- <metadata name="columnProgress.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+ <metadata name="columnInput.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
<value>True</value>\r
</metadata>\r
- <metadata name="columnStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+ <metadata name="columnOutput.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
<value>True</value>\r
</metadata>\r
<metadata name="bindingSourceJobs.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
public class ArchiveMetadataModel {\r
\r
//todo rename a Stuffra??\r
- public string StuffID { get; set; }\r
- public string StuffTitle { get; set; }\r
- public string StuffDescription { get; set; }\r
- public string MediaID { get; set; }\r
- public string MediaTitle { get; set; }\r
- public string MediaDescription { get; set; }\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
{\r
"label": "Archive",\r
"processor": "FTPTargetProcessor",\r
- "outputFormat": "{0}-{1}-{2}",\r
+ "outputFormat": "%ID%-%SOURCENAME%",\r
"killDateDays": 1,\r
"remote": {\r
"address": "ftp://localhost:21/out",\r
{\r
"label": "Ready",\r
"processor": "FXPTargetProcessor",\r
- "outputFormat": "{0}-{1}-{2}",\r
+ "outputFormat": "%ID%-%SOURCENAME%",\r
"remote": {\r
"address": "ftp://localhost:22/out",\r
"userName": "dani",\r
"active": true,\r
"startInTray": false,\r
"enableNameOverride": false,\r
+ "enableCustomMetadataId": true,\r
"player": {\r
"enabled": true,\r
"autoStart": false,\r
"targets": [\r
{\r
"label": "Archiválandó",\r
- "processor": "FTPTargetProcessor",\r
- "outputFormat": "{0}-{1}",\r
+ "processor": "UNCTargetProcessor",\r
+ "outputFormat": "%ID%-%SOURCENAME%",\r
"tag": "Archiválásra kijelöl",\r
"useMetadata": true,\r
"remote": {\r
- "address": "ftp://10.10.1.100:21/ARCHIVE",\r
+ "address": "file://10.10.1.100/BRAAVOS/ARCHIVE",\r
"userName": "mediacube",\r
"password": "Broadca5T"\r
}\r
{\r
"label": "Adáskész",\r
"processor": "FTPTargetProcessor",\r
- "outputFormat": "{0}-{1}",\r
- "saveSegments": true,\r
- "killDateDays": 1,\r
- "tag": "Adáskész",\r
- "createSubFolder": true,\r
- "useMetadata": true,\r
+ "outputFormat": "%ID%-%SOURCENAME%",\r
+ "saveSegments": true,\r
+ "killDateDays": 1,\r
+ "tag": "Adáskész",\r
+ "createSubFolder": true,\r
+ "useMetadata": true,\r
"remote": {\r
"address": "ftp://10.10.1.100:21/READY",\r
- "userName": "dani",\r
- "password": "dani"\r
+ "userName": "mediacube",\r
+ "password": "Broadca5T"\r
}\r
}\r
]\r
}\r
\r
/// <summary>\r
- /// Looks up a localized string similar to Bemenet.\r
+ /// Looks up a localized string similar to Cél.\r
/// </summary>\r
- internal static string BEMENET {\r
+ internal static string CEL {\r
get {\r
- return ResourceManager.GetString("BEMENET", resourceCulture);\r
+ return ResourceManager.GetString("CEL", resourceCulture);\r
}\r
}\r
\r
}\r
\r
/// <summary>\r
- /// Looks up a localized string similar to Forrás fájl.\r
+ /// Looks up a localized string similar to Forrás.\r
/// </summary>\r
- internal static string FORRAS_FAJL {\r
+ internal static string FORRAS {\r
get {\r
- return ResourceManager.GetString("FORRAS_FAJL", resourceCulture);\r
+ return ResourceManager.GetString("FORRAS", resourceCulture);\r
}\r
}\r
\r
/// <summary>\r
- /// Looks up a localized string similar to Kezdés.\r
+ /// Looks up a localized string similar to Forrás fájl.\r
/// </summary>\r
- internal static string KEZDES {\r
+ internal static string FORRAS_FAJL {\r
get {\r
- return ResourceManager.GetString("KEZDES", resourceCulture);\r
+ return ResourceManager.GetString("FORRAS_FAJL", resourceCulture);\r
}\r
}\r
\r
/// <summary>\r
- /// Looks up a localized string similar to Kimenet.\r
+ /// Looks up a localized string similar to Kezdés.\r
/// </summary>\r
- internal static string KIMENET {\r
+ internal static string KEZDES {\r
get {\r
- return ResourceManager.GetString("KIMENET", resourceCulture);\r
+ return ResourceManager.GetString("KEZDES", resourceCulture);\r
}\r
}\r
\r
<data name="BEFEJEZES" xml:space="preserve">\r
<value>Befejezés</value>\r
</data>\r
- <data name="BEMENET" xml:space="preserve">\r
- <value>Bemenet</value>\r
+ <data name="CEL" xml:space="preserve">\r
+ <value>Cél</value>\r
</data>\r
<data name="CEL_AKCIO" xml:space="preserve">\r
<value>Cél akció</value>\r
<data name="FELVETEL_DATUMA" xml:space="preserve">\r
<value>Felvétel dátuma</value>\r
</data>\r
+ <data name="FORRAS" xml:space="preserve">\r
+ <value>Forrás</value>\r
+ </data>\r
<data name="FORRAS_FAJL" xml:space="preserve">\r
<value>Forrás fájl</value>\r
</data>\r
<data name="KEZDES" xml:space="preserve">\r
<value>Kezdés</value>\r
</data>\r
- <data name="KIMENET" xml:space="preserve">\r
- <value>Kimenet</value>\r
- </data>\r
<data name="KIVALASZTOTT_FORRAS" xml:space="preserve">\r
<value>Kiválasztott forrás</value>\r
</data>\r
using Model;\r
using JobEngineClient;\r
using Maestro.Metadata;\r
-using System.Text;\r
\r
namespace Maestro.Targets {\r
\r
- public class FTPTargetProcessor : TargetProcessor {\r
+ public class FTPTargetProcessor : UNCTargetProcessor {\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
protected FtpClient targetFTP;\r
- protected FileInfo inputFile;\r
- private string workingDir;\r
- private MediaCubeApi mediaCubeApi;\r
\r
- public WorkflowAction workFlowAction { get; set; }\r
-\r
- public FTPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi, ArchiveMetadataModel model)\r
- : base(parent, targetConfig, segments, model) {\r
+ public FTPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi, ArchiveMetadataModel archiveMetadata)\r
+ : base(parent, sourceConfig, targetConfig, inputFileName, id, segments, mediaCubeApi, archiveMetadata) {\r
FtpTrace.LogFunctions = false;\r
- this.mediaCubeApi = mediaCubeApi;\r
- this.targetConfig = targetConfig;\r
Uri inputUri = new Uri(String.Format("{0}/{1}", sourceConfig.Local.Address.LocalPath, inputFileName));\r
inputFile = new FileInfo(inputUri.LocalPath);\r
Input = inputFile.FullName;\r
workFlowAction = new WorkflowAction() { houseId = ID, tag = targetConfig.Tag, touched = DateTime.Now };\r
}\r
\r
- public override bool Execute() {\r
- logger.Info(PROCESSING, inputFile.Name);\r
- Started = DateTime.Now;\r
- workFlowAction.started = Started;\r
- bool result = false;\r
- try {\r
- targetFTP = CreateClient(targetConfig.Remote);\r
- workingDir = DetermineWorkingDirectory(targetConfig.Remote);\r
- EnsureDirectoryExistence(targetFTP, workingDir);\r
- Status = ProcessStatus.Progress;\r
- Output = CreateOutputFileName();\r
- workFlowAction.source = Input;\r
- workFlowAction.destination = Path.Combine(workingDir, Output).Replace("\\", "/");\r
- UploadFile(Output);\r
- ExecuteCompleted();\r
- Status = ProcessStatus.Completed;\r
- Message = SUCCESS;\r
- workFlowAction.successful = true;\r
- }\r
- catch (Exception e) {\r
- Status = ProcessStatus.Error;\r
- Message = e.Message;\r
- workFlowAction.description = Message;\r
- logger.Error(e);\r
- }\r
- finally {\r
- TerminateClient(targetFTP);\r
- Finished = DateTime.Now;\r
- workFlowAction.finished = Finished;\r
- SendWorkFlowAction();\r
- }\r
- logger.Info(PROCESSING_COMPLETED, inputFile.Name);\r
- return result;\r
- }\r
-\r
- protected override void ExecuteCompleted() {\r
- base.ExecuteCompleted();\r
- if (targetConfig.KillDateDays > 0)\r
- UploadKillDateFile(targetConfig.Remote, Output);\r
- if (targetConfig.UseMetadata && metadataModel != null)\r
- CreateMetadata(targetConfig.Remote, Output);\r
- }\r
-\r
- private string GetVersionedFileName(string fileName) {\r
- string result = fileName;\r
- string nameWithoutExtension = String.Format(Path.GetFileNameWithoutExtension(fileName));\r
- string extension = Path.GetExtension(fileName);\r
- int version = 0;\r
- while (targetFTP.FileExists(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
- return result;\r
- }\r
-\r
- private void SendWorkFlowAction() {\r
- try {\r
- mediaCubeApi.Create(workFlowAction);\r
- }\r
- catch (Exception e) {\r
- MessageBox.Show(parent, e.Message);\r
- }\r
- }\r
-\r
- private String DetermineWorkingDirectory(Connection connection) {\r
- string result = null;\r
- Uri address = connection.Address;\r
- if (targetConfig.CreateSubFolder)\r
- result = Path.Combine(address.PathAndQuery, ID).Replace("\\", "/");\r
- else\r
- result = address.PathAndQuery;\r
- return result;\r
+ protected override void BeforeExecute() {\r
+ base.BeforeExecute();\r
+ targetFTP = CreateClient(targetConfig.Remote);\r
}\r
\r
- private void UploadKillDateFile(Connection connection, string output) {\r
- Uri address = connection.Address;\r
- string statusWorkDir = Path.Combine(address.PathAndQuery, STATUS_FOLDER).Replace("\\", "/");\r
- EnsureDirectoryExistence(targetFTP, statusWorkDir);\r
- DateTime date = DateTime.Now;\r
- date = date.AddDays(targetConfig.KillDateDays);\r
- string fileName = String.Format(KILLDATE_FILE, output, date.ToString("yyyyMMdd"));\r
- logger.Debug("Creating KILLDATE status file {0}", fileName);\r
- //fileName = Path.Combine(statusWorkDir, fileName).Replace("\\", "/");\r
- byte[] bytes = new byte[1];\r
- bytes[0] = 0;\r
- using (Stream ostream = targetFTP.OpenWrite(fileName)) {\r
- ostream.Write(bytes, 0, 0);\r
- }\r
+ protected override void AfterExecute() {\r
+ base.AfterExecute();\r
+ TerminateClient(targetFTP);\r
}\r
\r
- private void CreateMetadata(Connection connection, string output) {\r
- Uri address = connection.Address;\r
- string statusWorkDir = Path.Combine(address.PathAndQuery, STATUS_FOLDER).Replace("\\", "/");\r
- EnsureDirectoryExistence(targetFTP, statusWorkDir);\r
- string fileName = String.Format(METADATA_FILE, output);\r
- logger.Debug("Creating METADATA file {0}", fileName);\r
- byte[] content = Encoding.UTF8.GetBytes(metadataModel.ToString());\r
- using (Stream ostream = targetFTP.OpenWrite(fileName)) {\r
- ostream.Write(content, 0, content.Length);\r
- }\r
- }\r
-\r
- private 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
- overall += read;\r
- Progress = (int)((double)overall / ilength * 100);\r
- }\r
- }\r
\r
- protected virtual void UploadFile(string outputFileName) {\r
- using (FileStream istream = File.OpenRead(inputFile.FullName)) {\r
- using (Stream ostream = targetFTP.OpenWrite(outputFileName)) {\r
+ protected override void UploadFile() {\r
+ using (FileStream istream = File.OpenRead(Input)) {\r
+ using (Stream ostream = targetFTP.OpenWrite(Output)) {\r
CopyStream(istream, inputFile.Length, ostream);\r
}\r
}\r
}\r
\r
- protected virtual string CreateOutputFileName() {\r
- string nameWithoutExtension = targetConfig.OutputFormat.Replace("%ID%", ID).Replace("%SOURCENAME%", Path.GetFileNameWithoutExtension(inputFile.Name));\r
- string result = String.Format(FILENAME, nameWithoutExtension, inputFile.Extension);\r
- int version = 1;\r
- if (targetFTP != null)\r
- while (targetFTP.FileExists(result)) {\r
- string versioned = String.Format(VERSIONED_FILENAME, nameWithoutExtension, version, inputFile.Extension);\r
- logger.Debug(ALREADY_EXISTS, result, versioned);\r
- result = versioned;\r
- version++;\r
- }\r
- return result;\r
+ protected override bool FileExists(string path) {\r
+ return targetFTP.FileExists(path);\r
}\r
\r
-\r
- private void EnsureDirectoryExistence(FtpClient client, string path) {\r
- if (!client.DirectoryExists(path))\r
- client.CreateDirectory(path, true);\r
- client.SetWorkingDirectory(path);\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
this.sourceConfig = sourceConfig;\r
}\r
\r
- protected override void UploadFile(string outputFileName) {\r
+ protected override void UploadFile() {\r
FtpClient sourceFTP = null;\r
FtpClient monitorFTP = null;\r
\r
if (!replyTYPE.Success)\r
throw new Exception(replyTYPE.ErrorMessage);\r
\r
- FtpReply replySTOR = targetFTP.Execute("STOR " + outputFileName);\r
+ FtpReply replySTOR = targetFTP.Execute("STOR " + OutputName);\r
if (!replySTOR.Success)\r
throw new Exception(replySTOR.ErrorMessage);\r
\r
\r
long overall = 0;\r
while (overall != ilength) {\r
- overall = monitorFTP.GetFileSize(outputFileName);\r
+ overall = monitorFTP.GetFileSize(OutputName);\r
Progress = (int)((double)overall / ilength * 100);\r
Thread.Sleep(100);\r
}\r
\r
string Output { get; set; }\r
\r
- ProcessStatus Status { get; set; }\r
+ string Status { get; set; }\r
\r
string Message { get; set; }\r
\r
+++ /dev/null
-namespace Maestro.Targets {\r
- public enum ProcessStatus {\r
- Idle, Progress, Completed, Error\r
- }\r
-}\r
using Maestro.Commons;\r
using System;\r
-using System.Linq;\r
using System.ComponentModel;\r
using System.Runtime.CompilerServices;\r
using System.Windows.Forms;\r
-using System.Collections.Generic;\r
-using Maestro.Configuration;\r
-using TrafficClient;\r
-using Maestro.Metadata;\r
\r
namespace Maestro.Targets {\r
public abstract class TargetProcessor : ITargetProcessor {\r
- private ProcessStatus status;\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
protected Control parent;\r
- protected Target targetConfig;\r
- protected TrafficAPI client;\r
- protected List<Segment> segments;\r
- protected ArchiveMetadataModel metadataModel;\r
\r
- public TargetProcessor(Control parent, Target targetConfig, List<Segment> segments, ArchiveMetadataModel model) {\r
+ public TargetProcessor(Control parent) {\r
this.parent = parent;\r
- this.metadataModel = model;\r
- MaestroForm maestroForm = parent as MaestroForm;\r
- TrafficMetadata metadata = maestroForm.Configuration.Metadatas.Where(m => { return m is TrafficMetadata; }).FirstOrDefault() as TrafficMetadata;\r
- client = new TrafficAPI(metadata.Server.Address.OriginalString, metadata.Server.UserName, metadata.Server.Password, metadata.Server.Timeout);\r
- this.segments = segments;\r
}\r
\r
public event PropertyChangedEventHandler PropertyChanged;\r
public abstract bool Execute();\r
\r
protected virtual void ExecuteCompleted() {\r
- if (targetConfig.SaveSegments)\r
- SaveSegments();\r
}\r
\r
- private void SaveSegments() {\r
- MaestroForm maestroForm = parent as MaestroForm;\r
- client.DeleteSegments(maestroForm.SelectedMetadata.VariantID);\r
- if (segments != null)\r
- foreach (Segment actual in segments) {\r
- Segment segment = client.AddSegmentToCopia(maestroForm.SelectedMetadata.VariantID, actual.Comment, actual.TCIn, actual.TCOut, actual.Optional);\r
- }\r
- }\r
-\r
- public ProcessStatus Status {\r
+ public string Status {\r
get {\r
return status;\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
--- /dev/null
+using Maestro.Configuration;\r
+using NLog;\r
+using System;\r
+using System.Linq;\r
+using System.IO;\r
+using System.Windows.Forms;\r
+using System.Collections.Generic;\r
+using TrafficClient;\r
+using Model;\r
+using JobEngineClient;\r
+using Maestro.Metadata;\r
+using System.Text;\r
+using Maestro.Commons;\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 MediaCubeApi mediaCubeApi;\r
+ protected Target targetConfig;\r
+ protected FileInfo inputFile;\r
+ protected string workingDir;\r
+ protected List<Segment> segments;\r
+ protected ArchiveMetadataModel archiveMetadata;\r
+ public WorkflowAction workFlowAction { get; set; }\r
+\r
+ public UNCTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi, ArchiveMetadataModel archiveMetadata)\r
+ : base(parent) {\r
+ this.mediaCubeApi = mediaCubeApi;\r
+ this.targetConfig = targetConfig;\r
+ this.archiveMetadata = archiveMetadata;\r
+ this.segments = segments;\r
+ InputName = inputFileName;\r
+ Input = Path.Combine(sourceConfig.Local.Address.LocalPath, inputFileName);\r
+ inputFile = new FileInfo(Input);\r
+ ID = id;\r
+ workFlowAction = new WorkflowAction() { houseId = ID, tag = targetConfig.Tag, touched = DateTime.Now };\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, inputFile.Name);\r
+ bool result = false;\r
+ try {\r
+ BeforeExecute();\r
+ workingDir = DetermineWorkingDirectory(targetConfig.Remote);\r
+ EnsureDirectoryExistence(workingDir);\r
+ OutputName = CreateOutputFileName();\r
+ Output = Path.Combine(workingDir, OutputName);\r
+ workFlowAction.source = Input;\r
+ workFlowAction.destination = Output;\r
+ Status = "Folyamatban";\r
+ UploadFile();\r
+ ExecuteCompleted();\r
+ }\r
+ catch (Exception e) {\r
+ Status = "Hiba";\r
+ Message = e.Message;\r
+ workFlowAction.description = Message;\r
+ logger.Error(e);\r
+ }\r
+ finally {\r
+ AfterExecute();\r
+ }\r
+ logger.Info(PROCESSING_COMPLETED, inputFile.Name);\r
+ return result;\r
+ }\r
+\r
+ protected override void ExecuteCompleted() {\r
+ base.ExecuteCompleted();\r
+ Status = "Kész";\r
+ Message = SUCCESS;\r
+ workFlowAction.description = SUCCESS;\r
+ workFlowAction.successful = true;\r
+ if (targetConfig.KillDateDays > 0)\r
+ UploadKillDateFile();\r
+ if (targetConfig.UseMetadata && archiveMetadata != null)\r
+ CreateMetadata();\r
+ if (targetConfig.SaveSegments && segments != null && segments.Count > 0) \r
+ SaveSegments();\r
+ }\r
+\r
+ private void SaveSegments() {\r
+ MaestroForm maestroForm = parent as MaestroForm;\r
+ TrafficMetadata metadata = maestroForm.Configuration.Metadatas.Where(m => { return m is TrafficMetadata; }).FirstOrDefault() as TrafficMetadata;\r
+ TrafficAPI client = new TrafficAPI(metadata.Server.Address.OriginalString, metadata.Server.UserName, metadata.Server.Password, metadata.Server.Timeout);\r
+ client.DeleteSegments(maestroForm.SelectedMetadata.VariantID);\r
+ foreach (Segment actual in segments) {\r
+ Segment segment = client.AddSegmentToCopia(maestroForm.SelectedMetadata.VariantID, actual.Comment, actual.TCIn, actual.TCOut, actual.Optional);\r
+ }\r
+ }\r
+\r
+ protected virtual void AfterExecute() {\r
+ Finished = DateTime.Now;\r
+ workFlowAction.finished = Finished;\r
+ SendWorkFlowAction();\r
+ }\r
+\r
+ protected virtual bool FileExists(string path) {\r
+ return File.Exists(path);\r
+ }\r
+\r
+ private void SendWorkFlowAction() {\r
+ try {\r
+ mediaCubeApi.Create(workFlowAction);\r
+ }\r
+ catch (Exception e) {\r
+ MessageBox.Show(parent, e.Message);\r
+ }\r
+ }\r
+\r
+ private String DetermineWorkingDirectory(Connection connection) {\r
+ string result = null;\r
+ if (targetConfig.CreateSubFolder)\r
+ result = Path.Combine(connection.Address.LocalPath, ID);\r
+ else\r
+ result = connection.Address.LocalPath;\r
+ return result;\r
+ }\r
+\r
+ private void UploadKillDateFile() {\r
+ Uri address = targetConfig.Remote.Address;\r
+ string statusWorkDir = Path.Combine(address.LocalPath, STATUS_FOLDER);\r
+ EnsureDirectoryExistence(statusWorkDir);\r
+ DateTime date = DateTime.Now;\r
+ date = date.AddDays(targetConfig.KillDateDays);\r
+ string fileName = String.Format(KILLDATE_FILE, OutputName, date.ToString("yyyyMMdd"));\r
+ logger.Debug("Creating KILLDATE status file {0}", fileName);\r
+ UploadContent(Path.Combine(statusWorkDir, fileName), null);\r
+ }\r
+\r
+ private void CreateMetadata() {\r
+ Uri address = targetConfig.Remote.Address;\r
+ string statusWorkDir = Path.Combine(address.LocalPath, 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(archiveMetadata.ToString());\r
+ UploadContent(Path.Combine(statusWorkDir, fileName), content);\r
+ }\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
+ 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
+ Progress = (int)((double)total / transferred * 100);\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 CreateOutputFileName() {\r
+ string nameWithoutExtension = targetConfig.OutputFormat.Replace("%ID%", ID).Replace("%SOURCENAME%", Path.GetFileNameWithoutExtension(inputFile.Name));\r
+ string result = String.Format(FILENAME, nameWithoutExtension, inputFile.Extension);\r
+ int version = 1;\r
+ while (FileExists(Path.Combine(workingDir, result))) {\r
+ string versioned = String.Format(VERSIONED_FILENAME, nameWithoutExtension, version, inputFile.Extension);\r
+ logger.Debug(ALREADY_EXISTS, result, versioned);\r
+ result = versioned;\r
+ version++;\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