using Maestro;\r
using Microsoft.VisualStudio.TestTools.UnitTesting;\r
using System;\r
-using Commons;\r
using Maestro.Commons;\r
using System.Diagnostics;\r
using SharpCifs.Smb;\r
+using Commons;\r
\r
namespace IntegrationTests {\r
[TestClass]\r
sut.Execute();\r
}\r
\r
+ [TestMethod]\r
+ public void TestNexioXML() {\r
+ String xml = NexioXML.ToXML("aaaaa", DateTime.Now, "description", "agency");\r
+ Debug.WriteLine(xml);\r
+\r
+ string result = "valammi.mxf";\r
+ result = result.Substring(0, result.LastIndexOf("."));\r
+ Debug.WriteLine(result);\r
+ }\r
}\r
-}\r
+}
\ No newline at end of file
--- /dev/null
+using System;\r
+using System.IO;\r
+using System.Text;\r
+using System.Xml;\r
+\r
+/*\r
+<?xml version="1.0" encoding="UTF-16"?>\r
+<ID extendedId="aaaaaaa">\r
+ <KillDate>02-02-2018</KillDate>\r
+ <ExtendedDescription>TEST TEST</ExtendedDescription>\r
+ <ExtendedAgency>AGENT AGENT</ExtendedAgency>\r
+</ID>\r
+*/\r
+namespace Commons {\r
+\r
+ public class NexioXML {\r
+ public static string ToXML(string fileName, DateTime? killDate, string description, string agency) {\r
+ if (String.IsNullOrEmpty(fileName))\r
+ throw new NullReferenceException("Hiányzik a cél állomány neve.");\r
+\r
+ string result = null;\r
+ XmlDocument doc = new XmlDocument();\r
+ XmlElement rootElement = (XmlElement)doc.AppendChild(doc.CreateElement("ID"));\r
+ rootElement.SetAttribute("extendedId", fileName);\r
+ if (killDate != null)\r
+ rootElement.AppendChild(doc.CreateElement("KillDate")).InnerText = ((DateTime)killDate).ToString("MM-dd-yyyy");\r
+ if (!String.IsNullOrEmpty(description))\r
+ rootElement.AppendChild(doc.CreateElement("ExtendedDescription")).InnerText = description;\r
+ if (!String.IsNullOrEmpty(agency))\r
+ rootElement.AppendChild(doc.CreateElement("ExtendedAgency")).InnerText = agency;\r
+\r
+ XmlWriterSettings settings = new XmlWriterSettings();\r
+ settings.Indent = true;\r
+ StringBuilder ms = new StringBuilder();\r
+ XmlWriter writer = XmlWriter.Create(ms, settings);\r
+ doc.Save(writer);\r
+ result = ms.ToString();\r
+ return result;\r
+ }\r
+ }\r
+\r
+}
\ No newline at end of file
public string SuccessEmailRecipient { get; set; }\r
public string SuccessEmailPattern { get; set; }\r
public string Reference { get; set; }\r
+ public bool NexioServer { get; set; }\r
+ public string Agency { get; set; }\r
}\r
\r
public class Connection {\r
"processor": "FTPTargetProcessor",\r
"outputFormat": "%ID%",\r
"tag": "Betöltés",\r
+ "nexioServer": true,\r
+ "killDateDays": 7,\r
"remote": {\r
"address": "ftp://10.10.1.56:2098",\r
"userName": "administaror",\r
"processor": "FTPTargetProcessor",\r
"outputFormat": "%ID%",\r
"tag": "Betöltés",\r
+ "nexioServer": true,\r
+ "agency": "NLE UPLOAD",\r
+ "killDateDays": 7,\r
"remote": {\r
"address": "ftp://10.10.1.56:2098",\r
"userName": "administaror",\r
- "password": "system",\r
+ "password": "system",\r
"timeout": 1000\r
}\r
},\r
<Reference Include="System.Web" />\r
<Reference Include="System.Windows.Forms" />\r
<Reference Include="System.Xml" />\r
+ <Reference Include="System.Xml.Linq" />\r
<Reference Include="websocket-sharp, Version=1.0.2.42480, Culture=neutral, PublicKeyToken=5660b08a1845a91e" />\r
<Reference Include="WindowsBase" />\r
</ItemGroup>\r
<DependentUpon>ArchiveMetadataForm.cs</DependentUpon>\r
</Compile>\r
<Compile Include="Commons\DataGridViewProgressColumn.cs" />\r
+ <Compile Include="Commons\NexioXML.cs" />\r
<Compile Include="Commons\ObjectExtensions.cs" />\r
<Compile Include="Commons\SambaClient.cs" />\r
<Compile Include="Commons\Win32File.cs" />\r
this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
this.systemMessageBindingSource = new System.Windows.Forms.BindingSource(this.components);\r
this.metadataInfoBindingSource = new System.Windows.Forms.BindingSource(this.components);\r
+ this.lbSourceTitle = new System.Windows.Forms.Label();\r
this.groupSource.SuspendLayout();\r
((System.ComponentModel.ISupportInitialize)(this.dataGridSource)).BeginInit();\r
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();\r
this.groupSource.Controls.Add(this.dataGridSource);\r
this.groupSource.Controls.Add(this.tableLayoutPanel2);\r
this.groupSource.Controls.Add(this.panel2);\r
+ this.groupSource.Controls.Add(this.lbSourceTitle);\r
this.groupSource.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.groupSource.Location = new System.Drawing.Point(0, 0);\r
this.groupSource.Name = "groupSource";\r
this.dataGridSource.DefaultCellStyle = dataGridViewCellStyle2;\r
this.dataGridSource.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dataGridSource.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
- this.dataGridSource.Location = new System.Drawing.Point(10, 43);\r
+ this.dataGridSource.Location = new System.Drawing.Point(10, 56);\r
this.dataGridSource.Name = "dataGridSource";\r
this.dataGridSource.RowHeadersVisible = false;\r
dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dataGridSource.RowsDefaultCellStyle = dataGridViewCellStyle3;\r
this.dataGridSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dataGridSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
- this.dataGridSource.Size = new System.Drawing.Size(394, 356);\r
+ this.dataGridSource.Size = new System.Drawing.Size(394, 343);\r
this.dataGridSource.TabIndex = 0;\r
this.dataGridSource.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.sourceGridView_CellContentClick);\r
this.dataGridSource.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellEnter);\r
this.panel2.Controls.Add(this.buttonDeleteFilter);\r
this.panel2.Controls.Add(this.txtSorceFilter);\r
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;\r
- this.panel2.Location = new System.Drawing.Point(10, 23);\r
+ this.panel2.Location = new System.Drawing.Point(10, 36);\r
this.panel2.Name = "panel2";\r
this.panel2.Size = new System.Drawing.Size(394, 20);\r
this.panel2.TabIndex = 14;\r
// metadataInfoBindingSource\r
// \r
this.metadataInfoBindingSource.DataSource = typeof(Maestro.Metadata.MetadataInfo);\r
+ // \r
+ // lbSourceTitle\r
+ // \r
+ this.lbSourceTitle.Dock = System.Windows.Forms.DockStyle.Top;\r
+ this.lbSourceTitle.Location = new System.Drawing.Point(10, 23);\r
+ this.lbSourceTitle.Name = "lbSourceTitle";\r
+ this.lbSourceTitle.Size = new System.Drawing.Size(394, 13);\r
+ this.lbSourceTitle.TabIndex = 15;\r
+ this.lbSourceTitle.Text = " sklj jgja gjfldjg fdljg fdkljg fldkjg jfdg sklj jgja gjfldjg fdljg fdkljg fldkjg" +\r
+ " jfdg sklj jgja gjfldjg fdljg fdkljg fldkjg jfdg";\r
// \r
// MaestroForm\r
// \r
private System.Windows.Forms.DataGridViewTextBoxColumn columnInput;\r
private System.Windows.Forms.DataGridViewTextBoxColumn columnOutput;\r
private System.Windows.Forms.DataGridViewTextBoxColumn columnKillDate;\r
+ private System.Windows.Forms.Label lbSourceTitle;\r
}\r
}\r
\r
private ISource source;\r
private SourceInfo selectedSource;\r
private string startingName;\r
- private List<DataGridViewRow> selectedRows = new List<DataGridViewRow>();\r
+ private List<DataGridViewRow> selectedSourceRows = new List<DataGridViewRow>();\r
\r
public IDTypes IDType { get; set; }\r
\r
}\r
\r
private void InitializeSource() {\r
- Uri address = Configuration?.Source?.Local?.Address;\r
+ Uri localAddress = Configuration?.Source?.Local?.Address;\r
+ Uri remoteAddress = Configuration?.Source?.Remote?.Address;\r
+ if (String.IsNullOrEmpty(remoteAddress?.ToString())) {\r
+ if (!String.IsNullOrEmpty(localAddress?.ToString()))\r
+ SetSourceTitle(localAddress?.ToString());\r
+ } else\r
+ SetSourceTitle(remoteAddress?.ToString());\r
\r
if (Configuration?.Source is UNCSource) {\r
logger.Debug("UNC source initialization");\r
MessageBus.Subscribe<CreateFileActionMsg>(OnFileInvolved);\r
MessageBus.Subscribe<ModifyFileActionMsg>(OnFileInvolved);\r
\r
- source.Startup(address);\r
+ source.Startup(localAddress);\r
bindingSource.DataSource = source;\r
dataGridSource.Columns.AddRange(new DataGridViewCheckBoxColumn());\r
dataGridSource.Columns.AddRange(source.Columns);\r
+\r
+\r
+ }\r
+\r
+ private void SetSourceTitle(String text) {\r
+ try {\r
+ lbSourceTitle.Text = text;\r
+ Size sz = new Size(lbSourceTitle.Width, Int32.MaxValue);\r
+ sz = TextRenderer.MeasureText(text, lbSourceTitle.Font, sz, TextFormatFlags.WordBreak);\r
+ lbSourceTitle.Height = sz.Height;\r
+ }\r
+ finally {\r
+ }\r
}\r
\r
private void OnFileInvolved(FileActionMsg m) {\r
else\r
checkBoxCell.Value = (checkBoxCell.Value == null || checkBoxCell.Value.Equals(false)) ? true : false;\r
if (checkBoxCell.Value.Equals(false))\r
- this.selectedRows.Remove(actualRow);\r
+ this.selectedSourceRows.Remove(actualRow);\r
else {\r
- if (!this.selectedRows.Contains(actualRow))\r
- this.selectedRows.Add(actualRow);\r
+ if (!this.selectedSourceRows.Contains(actualRow))\r
+ this.selectedSourceRows.Add(actualRow);\r
}\r
SetTextSelectedSourceTextFromCheckBoxes();\r
SetMetadataButtonEnabled((bool)checkBoxCell.Value);\r
\r
private void SetMetadataButtonEnabled(bool checkBox) {\r
SetStartingName(checkBox);\r
- if (selectedRows == null || selectedRows.Count == 0) {\r
+ if (selectedSourceRows == null || selectedSourceRows.Count == 0) {\r
buttonMetadata.Enabled = false;\r
IsSelectedFileAnID();\r
return;\r
}\r
- if (selectedRows.Count == 1) {\r
+ if (selectedSourceRows.Count == 1) {\r
buttonMetadata.Enabled = true;\r
IsSelectedFileAnID();\r
return;\r
}\r
int index = dataGridSource.Columns.Cast<DataGridViewColumn>().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index;\r
- foreach (DataGridViewRow actual in selectedRows) {\r
+ foreach (DataGridViewRow actual in selectedSourceRows) {\r
string name = actual.Cells[index].Value as string;\r
if (!name.StartsWith(String.Format("{0}-", startingName)) &&\r
!name.StartsWith(String.Format("{0}_", startingName)) &&\r
\r
private void SetStartingName(bool checkBox) {\r
if (!checkBox)\r
- if (selectedRows == null || selectedRows.Count == 0) {\r
+ if (selectedSourceRows == null || selectedSourceRows.Count == 0) {\r
startingName = null;\r
return;\r
}\r
int index = dataGridSource.Columns.Cast<DataGridViewColumn>().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index;\r
- string query = selectedRows[0].Cells[index].Value as string;\r
+ string query = selectedSourceRows[0].Cells[index].Value as string;\r
int separatorPosition = query.IndexOf("-");\r
int separatorPosition2 = query.IndexOf("_");\r
int realseparatorPosition = 0;\r
private void SetTextSelectedSourceTextFromCheckBoxes() {\r
String selectedNames = "";\r
int index = dataGridSource.Columns.Cast<DataGridViewColumn>().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index;\r
- foreach (DataGridViewRow actual in selectedRows) \r
+ foreach (DataGridViewRow actual in selectedSourceRows) \r
selectedNames += actual.Cells[index].Value + " ";\r
SelectedSource = new SourceInfo() {\r
Name = selectedNames\r
private void SetSelectedSourceFileInfo(SourceInfo selectedSource) {\r
if (Configuration.Source.GetType() == typeof(NEXIOSource))\r
selectedSource.FileInfo = null;\r
- else if (selectedRows.Count == 1) {\r
+ else if (selectedSourceRows.Count == 1) {\r
int index = dataGridSource.Columns.Cast<DataGridViewColumn>().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index;\r
- string name = selectedRows[0].Cells[index].Value as string;\r
+ string name = selectedSourceRows[0].Cells[index].Value as string;\r
Uri inputUri = new Uri(String.Format("{0}/{1}", Configuration.Source.Local.Address.LocalPath, name));\r
selectedSource.FileInfo = new System.IO.FileInfo(inputUri.LocalPath);\r
}\r
\r
public void SourceDeleted(String fileName) {\r
int index = dataGridSource.Columns.Cast<DataGridViewColumn>().Where(x => x.HeaderText == StringResources.NEV).SingleOrDefault().Index;\r
- foreach (DataGridViewRow actual in selectedRows) {\r
+ foreach (DataGridViewRow actual in selectedSourceRows) {\r
String actualName = actual.Cells[index].Value as string;\r
if (fileName.Equals(actualName)) {\r
- selectedRows.Remove(actual);\r
+ selectedSourceRows.Remove(actual);\r
if (textSelectedSource.InvokeRequired) {\r
SetTextCallback d = new SetTextCallback(SetTextSelectedSourceAndMetadataButtonEnabled);\r
Invoke(d);\r
\r
private void SetTextSelectedSourceAndMetadataButtonEnabled() {\r
SetTextSelectedSourceTextFromCheckBoxes();\r
- SetMetadataButtonEnabled(selectedRows.Count > 0);\r
+ SetMetadataButtonEnabled(selectedSourceRows.Count > 0);\r
}\r
\r
private void dataGridSource_KeyDown(object sender, KeyEventArgs e) {\r
return;\r
if (checkBox.Checked) {\r
List<ITargetProcessor> processors = new List<ITargetProcessor>();\r
- foreach (DataGridViewRow actualRow in selectedRows) {\r
-\r
- string fileName = actualRow.Cells[1].Value as string;\r
+ foreach (DataGridViewRow actualRow in selectedSourceRows) {\r
+ ISourceItem sourceItem = actualRow.DataBoundItem as ISourceItem;\r
+ if (sourceItem == null)\r
+ continue;\r
string typeName = string.Format("{0}.{1}", typeof(ITargetProcessor).Namespace, target.Processor);\r
Type type = Type.GetType(typeName);\r
- ISourceItem selectedFile = GetSourceItemFromBindingSource(fileName);\r
string id = selectedMetadata == null ? textSelectedMetadata.Text : selectedMetadata.ID;\r
if (segments == null) {\r
if (target.SaveSegments) {\r
ArchiveMetadata = ArchiveMetadata.DeepClone(archiveMetadatamodel),\r
Client = trafficIDSelector.trafficAPI,\r
ID = id,\r
- InputFileName = selectedFile.Name,\r
+ InputFileName = sourceItem.Name,\r
MediaCubeApi = mediaCubeApi,\r
Segments = new List<Segment>(segments),\r
SourceConfig = Configuration.Source,\r
}\r
\r
private void ApplyMetaDataButtonLogic() {\r
- if (selectedRows.Count <= 0) {\r
+ if (selectedSourceRows.Count <= 0) {\r
buttonMetadata.Enabled = false;\r
return;\r
}\r
- if (selectedRows.Count == 1)\r
+ if (selectedSourceRows.Count == 1)\r
buttonMetadata.Enabled = true;\r
else {\r
- String calculatedHouseID = selectedRows[0].Cells[1].Value as String;\r
- foreach (DataGridViewRow actual in selectedRows) {\r
- string actualName = actual.Cells[2].Value as string;\r
+ foreach (DataGridViewRow actualRow in selectedSourceRows) {\r
+ string actualName = (actualRow as ISourceItem).Name;\r
if (!actualName.StartsWith(startingName))\r
buttonMetadata.Enabled = false;\r
}\r
}\r
\r
private void IsSelectedFileAnID() {\r
+ IDType = IDTypes.None;\r
if (String.IsNullOrEmpty(startingName))\r
return;\r
- string pattern = "[A-Z]{1}[0-9]{6}[A-Z]{1}";\r
- Match match = Regex.Match(startingName, pattern);\r
+ Match match = Regex.Match(startingName, "[A-Z]{1}[0-9]{6}[A-Z]{1}");\r
if (match.Success) {\r
IDType = IDTypes.TrafficID;\r
return;\r
- } else {\r
- pattern = "[0-9]";\r
- match = Regex.Match(startingName, pattern);\r
- IDType = match.Success ? IDTypes.OctopusID : IDTypes.None;\r
}\r
+\r
+ match = Regex.Match(startingName, "[0-9]");\r
+ if (match.Success)\r
+ IDType = IDTypes.OctopusID;\r
+ \r
buttonMetadata.Enabled = IDType != IDTypes.None;\r
}\r
\r
using NLog;\r
using JobEngineClient;\r
using System.Collections.Generic;\r
+using System.Collections.Concurrent;\r
\r
namespace Maestro.Sources {\r
class NexioRESTSource : BindingList<NexioSourceItem>, ISource {\r
private const string DURATION = "duration";\r
private const string MODIFIED = "modifiedtimestamp";\r
private List<String> acceptableAgencies = new List<string>();\r
- private List<NexioSourceItem> cache = new List<NexioSourceItem>();\r
+ //private ConcurrentBag<NexioSourceItem> cache = new ConcurrentBag<NexioSourceItem>();\r
private IMessageBus messageBus;\r
private Control parent;\r
private NexioAPI dataClient;\r
\r
public string Filter {\r
get => filter; set {\r
- if (cache.Count == 0)\r
- cache.AddRange(this);\r
filter = value;\r
- Clear();\r
- cache.Where(i => i.Name.ToLower().Contains(filter.ToLower())).ToList().ForEach(i => Add(i));\r
+ if (String.IsNullOrEmpty(value)) {\r
+ RemoveFilter();\r
+ } else {\r
+ Clear();\r
+ //cache.Where(i => i.Name.ToLower().Contains(filter.ToLower())).ToList().ForEach(i => Add(i));\r
+ }\r
}\r
}\r
\r
}\r
\r
private void CreateWatch(string path) {\r
- logger.Info("info");\r
- logger.Error("error");\r
dataClient = new NexioAPI(path) { ErrorReporter = errorReporter };\r
dataClient.Open(OnResponse);\r
}\r
item.ID = token[ID].ToString();\r
item.Name = token[LONGNAMEID].ToString() + ".mxf";\r
//item.Created = DateTime.Parse(token[RECORDDATE].ToString());\r
- item.Agency = token[EXTAGENCY].ToString();\r
+\r
+ item.Agency = token[EXTAGENCY]?.ToString();\r
if (token[MODIFIED] != null && String.IsNullOrEmpty(token[MODIFIED].ToString()))\r
item.Modified = DateTime.Parse(token[MODIFIED].ToString());\r
if (DateTime.MinValue.Equals(item.Modified))\r
string id = token[ID].ToString();\r
var item = Items.Where(x => x.ID == id).SingleOrDefault();\r
if (item == null) {\r
- var newItem = CreateItem(token, true);\r
- item = newItem;\r
- }\r
- SetItem(ref item, token);\r
- if (!item.CanHandle(acceptableAgencies)) {\r
- if (Contains(item)) {\r
- parent.SafeCall(() => {\r
- Remove(item);\r
- cache.Remove(item);\r
+ item = CreateItem(token, true);\r
+ if (!item.CanHandle(acceptableAgencies))\r
+ return;\r
+ parent.SafeCall(() => {\r
+ Add(item);\r
+ messageBus.Send(new ModifyFileActionMsg() {\r
+ FileName = item.Name,\r
+ Source = parent\r
});\r
- }\r
- return;\r
- }\r
- parent.SafeCall(() => {\r
- messageBus.Send(new ModifyFileActionMsg() {\r
- FileName = item.Name,\r
- Source = parent\r
});\r
- });\r
- if (!Contains(item))\r
+ } else {\r
parent.SafeCall(() => {\r
- Add(item);\r
- cache.Add(item);\r
+ SetItem(ref item, token);\r
+ if (item.CanHandle(acceptableAgencies))\r
+ return;\r
+ Remove(item);\r
+ messageBus.Send(new RemoveFileActionMsg() {\r
+ FileName = item.Name,\r
+ Source = parent\r
+ });\r
});\r
+ }\r
Debug.WriteLine(string.Format("Changed {0}", item.Name));\r
}\r
\r
private void OnCreated(JToken token) {\r
var item = CreateItem(token, true);\r
- if (item.CanHandle(acceptableAgencies)) {\r
- parent.SafeCall(() => {\r
- Insert(0, item);\r
- messageBus.Send(new CreateFileActionMsg() {\r
- FileName = item.Name,\r
- Source = parent\r
- });\r
+ if (!item.CanHandle(acceptableAgencies))\r
+ return;\r
+ parent.SafeCall(() => {\r
+ Insert(0, item);\r
+ messageBus.Send(new CreateFileActionMsg() {\r
+ FileName = item.Name,\r
+ Source = parent\r
});\r
- Debug.WriteLine(string.Format("Created {0}", item.Name));\r
- }\r
+ });\r
+ Debug.WriteLine(string.Format("Created {0}", item.Name));\r
}\r
\r
private void OnDeleted(JToken d) {\r
\r
public void RemoveFilter() {\r
Clear();\r
- cache.ForEach(i => Add(i));\r
+ //cache.ToList().ForEach(i => Add(i));\r
}\r
+\r
+\r
}\r
}\r
TerminateClient(targetFTP);\r
}\r
\r
-\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
+ try {\r
+ CopyStream(istream, inputFile.Length, ostream);\r
+ }\r
+ catch (Exception e) {\r
+ logger.Error(e.Message);\r
+ }\r
+ finally {\r
+ ostream.Close();\r
+ }\r
+ }\r
+ }\r
+ if (parameters.TargetConfig.NexioServer)\r
+ Thread.Sleep(500);\r
+ }\r
+\r
+ protected override void UploadContent(string outputPath, byte[] content) {\r
+ using (Stream ostream = targetFTP.OpenWrite(outputPath)) {\r
+ try {\r
+ ostream.Write(content, 0, content.Length);\r
}\r
+ catch (Exception e) {\r
+ logger.Error(e.Message);\r
+ } finally{\r
+ ostream.Close();\r
+ } \r
}\r
+ if (parameters.TargetConfig.NexioServer)\r
+ Thread.Sleep(500);\r
}\r
\r
protected override bool FileExists(string path) {\r
\r
protected void TerminateClient(FtpClient ftpClient) {\r
if (ftpClient != null) {\r
- Thread.Sleep(500);\r
ftpClient.Disconnect();\r
ftpClient.Dispose();\r
}\r
using Model;\r
using System.Text;\r
using Maestro.Commons;\r
+using Commons;\r
\r
namespace Maestro.Targets {\r
\r
return result;\r
}\r
\r
+\r
+ private string GetOutputName() {\r
+ if (String.IsNullOrEmpty(OutputName))\r
+ return null;\r
+ string result = OutputName;\r
+ if (result.Contains("."))\r
+ result = result.Substring(0, result.LastIndexOf("."));\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 (parameters.TargetConfig.KillDateDays > 0)\r
- UploadKillDateFile();\r
+ if (parameters.TargetConfig.NexioServer)\r
+ UploadNexioMetadata();\r
+ else {\r
+ if (parameters.TargetConfig.KillDateDays > 0)\r
+ UploadKillDateFile();\r
+ }\r
+\r
if (parameters.TargetConfig.CreateMetadata && parameters.ArchiveMetadata != null)\r
CreateMetadata();\r
if (parameters.TargetConfig.SaveSegments && parameters.Segments != null) {\r
SendEmail(parameters.TargetConfig.SuccessEmailRecipient, parameters.TargetConfig.SuccessEmailPattern);\r
}\r
\r
+ private void UploadNexioMetadata() {\r
+ String xml = null;\r
+ string name = GetOutputName();\r
+ string description = parameters.ArchiveMetadata?.mediaTitle == null ? parameters.ArchiveMetadata?.itemTitle : parameters.ArchiveMetadata?.mediaTitle;\r
+ if (parameters.TargetConfig.KillDateDays > 0) {\r
+ KillDate = GetKillDate();\r
+ xml = NexioXML.ToXML(name, KillDate, description, parameters.TargetConfig.Agency);\r
+ }\r
+ else\r
+ xml = NexioXML.ToXML(name, null, description, parameters.TargetConfig.Agency);\r
+ byte[] content = Encoding.Unicode.GetBytes(xml);\r
+ UploadContent(name + ".xml", content);\r
+ }\r
+\r
private void SendEmail(string to, string messagePattern) {\r
try {\r
string message = messagePattern.Replace("%TARGETNAME%", Output);\r
}\r
}\r
\r
- private String DetermineWorkingDirectory(Connection connection) {\r
+ protected String DetermineWorkingDirectory(Connection connection) {\r
string result = null;\r
if (parameters.TargetConfig.CreateSubFolder)\r
result = Path.Combine(connection.Address.LocalPath, ID);\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 = DateTime.Now;\r
- date = date.AddDays(parameters.TargetConfig.KillDateDays);\r
+ DateTime date = GetKillDate();\r
string fileName = String.Format(KILLDATE_FILE, OutputName, date.ToString("yyyyMMdd"));\r
logger.Debug("Creating KILLDATE status file {0}", fileName);\r
KillDatePath = Path.Combine(statusWorkDir, fileName);\r
public TrafficIDSelector() {\r
InitializeComponent();\r
InitializeTexts();\r
- //test();\r
panel1.Dock = DockStyle.Fill;\r
-\r
- }\r
-\r
- private void test() {\r
- TableLayoutRowStyleCollection coll = tableLayoutPanelSearch.RowStyles;\r
- coll[1].SizeType = SizeType.Percent;\r
}\r
\r
private void InitializeTexts() {\r