diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjData.cs b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjData.cs
index 05578fb6..f57394b6 100644
--- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjData.cs
+++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/DocumentObj/GetIshDocumentObjData.cs
@@ -108,32 +108,52 @@ protected override void ProcessRecord()
// Get language ref
long lngRef = Convert.ToInt64(ishObject.ObjectRef[Enumerations.ReferenceType.Lng]);
long[] lngRefsArray = new long[1] { lngRef };
- var dataObjectResponse = IshSession.DocumentObj25.RetrieveObjectsByIshLngRefs(lngRefsArray, productDefinitionFeatures.ToXml(), "");
- XmlDocument xmlIshDataObject = new XmlDocument();
- xmlIshDataObject.LoadXml(dataObjectResponse);
- XmlElement ishDataObjectElement = (XmlElement)xmlIshDataObject.SelectSingleNode("ishobjects/ishobject/ishdata");
- IshData ishData = new IshData(ishDataObjectElement);
- if (FolderPath != null)
+ using (var stringReader = new StringReader(IshSession.DocumentObj25.RetrieveObjectsByIshLngRefs(lngRefsArray, productDefinitionFeatures.ToXml(), "")))
{
- string tempLocation = Directory.CreateDirectory(FolderPath).FullName;
- WriteDebug($"Writing lngRef[{lngRef}] to [{tempLocation}] {++current}/{ishObjects.Length}");
- //Create the file.
- string tempFilePath = FileNameHelper.GetDefaultObjectFileName(tempLocation, ishObject, ishData.FileExtension);
- using (FileStream fs = File.Create(tempFilePath))
+ byte[] bytearray = null;
+ string edt = "";
+ string fileExtension = "";
+
+ using (XmlTextReader xmlTextReader = new XmlTextReader(stringReader))
+ {
+ while (xmlTextReader.Read())
+ {
+ if (xmlTextReader.NodeType == XmlNodeType.Element && xmlTextReader.Name == "ishdata")
+ {
+ edt = xmlTextReader.GetAttribute("edt");
+ fileExtension = xmlTextReader.GetAttribute("fileextension");
+ }
+
+ if (xmlTextReader.NodeType == XmlNodeType.CDATA)
+ {
+ bytearray = System.Convert.FromBase64String(xmlTextReader.Value);
+ }
+ }
+ }
+ IshData ishData = new IshData(edt, fileExtension, bytearray);
+
+ if (FolderPath != null)
+ {
+ string tempLocation = Directory.CreateDirectory(FolderPath).FullName;
+ WriteDebug($"Writing lngRef[{lngRef}] to [{tempLocation}] {++current}/{ishObjects.Length}");
+ //Create the file.
+ string tempFilePath = FileNameHelper.GetDefaultObjectFileName(tempLocation, ishObject, ishData.FileExtension);
+ using (FileStream fs = File.Create(tempFilePath))
+ {
+ fs.Write(ishData.ByteArray, 0, ishData.Size());
+ }
+ // Append file info list
+ fileInfo.Add(new FileInfo(tempFilePath));
+ WriteObject(fileInfo, true);
+ }
+ else
{
- fs.Write(ishData.ByteArray, 0, ishData.Size());
+ WriteDebug($"Enriching ishObject[{ishObject.ObjectRef[Enumerations.ReferenceType.Lng]}] with IshData {++current}/{IshObject.Length}");
+ ishObject.IshData = ishData;
+ WriteObject(ishObject, true);
}
- // Append file info list
- fileInfo.Add(new FileInfo(tempFilePath));
- WriteObject(fileInfo, true);
}
- else
- {
- WriteDebug($"Enriching ishObject[{ishObject.ObjectRef[Enumerations.ReferenceType.Lng]}] with IshData {++current}/{IshObject.Length}");
- ishObject.IshData = ishData;
- WriteObject(ishObject, true);
- }
}
WriteVerbose("returned file count[" + current + "]");
}
diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshData.cs b/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshData.cs
index 27516554..fa7018c9 100644
--- a/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshData.cs
+++ b/Source/ISHRemote/Trisoft.ISHRemote/Objects/Public/IshData.cs
@@ -63,7 +63,20 @@ public IshData(string edt, byte[] fileContent)
_byteArray = fileContent;
_fileExtension = "";
}
-
+
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The EDT.
+ /// File extension
+ /// Byte array with the file content.
+ public IshData(string edt, string fileExtension, byte[] fileContent)
+ {
+ _edt = (edt == null) ? DefaultEDT : edt;
+ _byteArray = fileContent;
+ _fileExtension = fileExtension;
+ }
+
///
/// Initializing by something that looks like
///