{\r
"title": "Development",\r
- "active": false,\r
+ "active": true,\r
"startInTray": false,\r
"enableCustomMetadataId": true,\r
"filter": "avi",\r
"source": {\r
"$type": "UNCSource",\r
"filter": "avi,wav,mxf,mts",\r
+ "useAlternateCopy": true,\r
"local": {\r
"address": "file://c:/_video",\r
"userName": "mediacube",\r
}\r
},\r
{\r
- "label": "Teszt",\r
- "processor": "FTPTargetProcessor",\r
+ "label": "UNC Teszt",\r
+ "processor": "UNCTargetProcessor",\r
"outputFormat": "%ID%-%SOURCENAME%",\r
"tag": "Betöltés",\r
"killDateDays": 7,\r
"saveArchiveMetadata": false,\r
- "sendEmailOnSuccess": true,\r
- "successEmailPattern": "%JSON%",\r
- "successEmailSubject": "%ID% - %ITEMTITLE% - %FORMAT% sikeres feltöltése",\r
- "successEmailRecipient": "vasary@elgekko.net",\r
"remote": {\r
- "address": "ftp://10.10.1.105/TESZT/CHECK",\r
+ "address": "file://c:/opt1",\r
"userName": "mediacube",\r
"password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy",\r
"timeout": 1000\r
<None Include="Configuration\-configuration - Copy.json">\r
<CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
- <None Include="Configuration\-configuration.json">\r
+ <None Include="Configuration\configuration.json">\r
<CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
<None Include="Configuration\dani-teszt-vezerlo.json">\r
<None Include="Configuration\editor-mv.json">\r
<CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
- <None Include="Configuration\editor-hirtv.json">\r
+ <None Include="Configuration\-editor-hirtv.json">\r
<CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
<None Include="Configuration\global.json">\r
force |= target.SuccessEmailPattern == null ? false : target.SuccessEmailPattern.Contains("%");\r
force |= target.SaveArchiveMetadata || target.SaveMorpheusMetadata || target.NexioServer;\r
if (force && (ArchiveMetadata == null || !ArchiveMetadata.IsFilled)) {\r
- ArchiveMetadata = GetArchiveMetadata();\r
- if (SelectedMetadata != null && String.IsNullOrEmpty(SelectedMetadata.MetadataText))\r
- SelectedMetadata.MetadataText = ArchiveMetadata.itemTitle;\r
- if (ArchiveMetadata == null) {\r
- MessageBox.Show(String.Format("A {0} folyamat nem futtatható kísérő adatok nélkül.", target.Label));\r
- return false;\r
+ //TODO eddig itt elszallt es adott hibauzenetet\r
+ try {\r
+ ArchiveMetadata = GetArchiveMetadata();\r
+ if (SelectedMetadata != null && string.IsNullOrEmpty(SelectedMetadata.MetadataText))\r
+ SelectedMetadata.MetadataText = ArchiveMetadata.itemTitle;\r
+ if (ArchiveMetadata == null) {\r
+ MessageBox.Show(String.Format("A {0} folyamat nem futtatható kísérő adatok nélkül.", target.Label));\r
+ return false;\r
+ }\r
+ } catch (Exception e) { \r
}\r
}\r
//szegmens informaciook hozzaadasa\r
--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.IO;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Threading.Tasks;\r
+\r
+namespace MaestroShared.Commons {\r
+ public delegate void ProgressChangeDelegate(double Persentage, ref bool Cancel);\r
+ public delegate void Completedelegate();\r
+\r
+ class CustomFileCopier {\r
+ public CustomFileCopier(string Source, string Dest) {\r
+ this.SourceFilePath = Source;\r
+ this.DestFilePath = Dest;\r
+\r
+ OnProgressChanged += delegate { };\r
+ OnComplete += delegate { };\r
+ }\r
+\r
+ public void Copy() {\r
+ byte[] buffer = new byte[10 * 1024 * 1024]; // 1MB buffer\r
+ bool cancelFlag = false;\r
+\r
+ using (FileStream source = new FileStream(SourceFilePath, FileMode.Open, FileAccess.Read)) {\r
+ long fileLength = source.Length;\r
+ using (FileStream dest = new FileStream(DestFilePath, FileMode.CreateNew, FileAccess.Write)) {\r
+ long totalBytes = 0;\r
+ int currentBlockSize = 0;\r
+\r
+ while ((currentBlockSize = source.Read(buffer, 0, buffer.Length)) > 0) {\r
+ totalBytes += currentBlockSize;\r
+ double persentage = (double)totalBytes * 100.0 / fileLength;\r
+\r
+ dest.Write(buffer, 0, currentBlockSize);\r
+\r
+ cancelFlag = false;\r
+ OnProgressChanged(persentage, ref cancelFlag);\r
+\r
+ if (cancelFlag == true) {\r
+ // Delete dest file here\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ OnComplete();\r
+ }\r
+\r
+ public string SourceFilePath { get; set; }\r
+ public string DestFilePath { get; set; }\r
+\r
+ public event ProgressChangeDelegate OnProgressChanged;\r
+ public event Completedelegate OnComplete;\r
+ }\r
+}\r
\r
public class UNCSource : Source {\r
public bool FoldersAutoExpand { get; set; }\r
+ public bool UseAlternateCopy { get; set; }\r
}\r
\r
public class NEXIOSource : Source {\r
<Reference Include="System.Xml" />\r
</ItemGroup>\r
<ItemGroup>\r
+ <Compile Include="Commons\CustomFileCopier.cs" />\r
<Compile Include="Commons\EdiusProject.cs" />\r
<Compile Include="Commons\MsgBox.cs" />\r
<Compile Include="Commons\MorpheusXML.cs" />\r
// You can specify all the values or you can default the Build and Revision Numbers\r
// by using the '*' as shown below:\r
// [assembly: AssemblyVersion("1.0.*")]\r
-[assembly: AssemblyVersion("2.1.0.1")]\r
-[assembly: AssemblyFileVersion("2.1.0.1")]\r
+[assembly: AssemblyVersion("2.1.0.3")]\r
+[assembly: AssemblyFileVersion("2.1.0.3")]\r
using NLog;\r
using System;\r
using System.IO;\r
+using System.Net;\r
using System.Text;\r
+using System.Threading.Tasks;\r
using System.Windows.Forms;\r
\r
namespace MaestroShared.Targets {\r
string targetFilePath = Output;\r
if (Parameters.TargetConfig.TemporaryCopy)\r
targetFilePath = Output + ".tmp";\r
- if (Win32File.CopyFileEx(Input, targetFilePath, new CopyProgressRoutine(this.CopyProgressHandler), IntPtr.Zero, ref pbCancel, CopyFileFlags.COPY_FILE_RESTARTABLE)\r
- && Parameters.TargetConfig.TemporaryCopy) {\r
+\r
+ bool copyResult = false;\r
+\r
+ if (Parameters.SourceConfig is UNCSource && ((UNCSource)Parameters.SourceConfig).UseAlternateCopy)\r
+ copyResult = doAlternateCopy(targetFilePath);\r
+ else\r
+ copyResult = doCopy(ref pbCancel, targetFilePath);\r
+\r
+\r
+ if (copyResult && Parameters.TargetConfig.TemporaryCopy) {\r
File.Move(targetFilePath, Output);\r
}\r
}\r
\r
+ private bool doCopy(ref int pbCancel, string targetFilePath) {\r
+ return Win32File.CopyFileEx(Input, targetFilePath, new CopyProgressRoutine(this.CopyProgressHandler), IntPtr.Zero, ref pbCancel, CopyFileFlags.COPY_FILE_RESTARTABLE);\r
+ }\r
+\r
+ private bool doAlternateCopy(string targetFilePath) {\r
+ CustomFileCopier copier = new CustomFileCopier(Input, targetFilePath);\r
+ copier.OnProgressChanged += Copier_OnProgressChanged;\r
+ copier.Copy();\r
+ Boolean result = true;\r
+ /*\r
+ var webClient = new WebClient();\r
+ try {\r
+ webClient.DownloadProgressChanged += (s, e) => {\r
+ Progress = e.ProgressPercentage;\r
+ };\r
+\r
+ Task task = webClient.DownloadFileTaskAsync(new Uri(Input), targetFilePath);\r
+ task.Wait();\r
+ result = task.Status == TaskStatus.RanToCompletion;\r
+ } catch (Exception e) {\r
+ result = false;\r
+ Message = e.Message;\r
+ }\r
+ */\r
+ return result;\r
+ }\r
+\r
+ private void Copier_OnProgressChanged(double Persentage, ref bool Cancel) {\r
+ Progress = (int)Persentage;\r
+ }\r
+\r
+ private void WebClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) {\r
+ throw new NotImplementedException();\r
+ }\r
+\r
protected virtual string GetOutputFilePath(string path, string fileName) {\r
return "/".Equals(workingDir) ? fileName : Path.Combine(path, fileName);\r
}\r