public void DecodeBase64(string xmlfilepatch, string outputFolder) { Folderman folman = new Folderman(); folman.CreateApplicationfolder(outputFolder); folman.SaveUserFilePatch(outputFolder); Base64Ripper ripper = new Base64Ripper(); ToFile tofile = new ToFile(); Base64Element base64object = ripper.FindBase64Code(xmlfilepatch); for (int i = 0; i < base64object.ObjectExtensionCodeList.Count; i++) { tofile.Base64ToImage(base64object.Object_Base64EncodedList[i].InnerXml.ToString(), base64object.ObjectExtensionCodeList[i].InnerXml.ToString(), base64object.ObjectCodeList[i].InnerXml.ToString(), outputFolder); } }
public Base64Element FindBase64Code(string filepatch) { //Create the XmlDocument. XmlDocument doc = new XmlDocument(); doc.Load(filepatch); //(@"c:\Temp\XBIN_fundus.xml"); //create base64 object for XmlNodeList Object_Base64EncodedList = doc.GetElementsByTagName("Object_Base64Encoded"); XmlNodeList ObjectCodeList = doc.GetElementsByTagName("ObjectCode"); XmlNodeList ObjectExtensionCodeList = doc.GetElementsByTagName("ObjectExtensionCode"); //create base64 object for fnx filer format XmlNodeList Object_Base64EncodedListFNX = doc.GetElementsByTagName("FilIndholdData"); XmlNodeList ObjectCodeListFNX = doc.GetElementsByTagName("ObjectReference"); XmlNodeList ObjectExtensionCodeListFNX = doc.GetElementsByTagName("FilTypeKode"); //create base64 object for fnx filer ploformat XmlNodeList Object_Base64EncodedListPLO = doc.GetElementsByTagName("plo:FilIndholdData"); XmlNodeList ObjectCodeListPLO = doc.GetElementsByTagName("plo:ObjectReference"); XmlNodeList ObjectExtensionCodeListPLO = doc.GetElementsByTagName("plo:FilTypeKode"); //create base64 object for xml Fødselsanmeldelse XmlNodeList Object_Base64Encodedfoedselsan = doc.GetElementsByTagName("Data"); XmlNodeList ObjectCodeListfoedselsan = doc.GetElementsByTagName("Identifier"); XmlNodeList ObjectExtensionCodeListfoedselsan = doc.GetElementsByTagName("Format"); //Eksempel med ny XML tag indeholdende BASE64 element XmlNodeList Object_Base64EncodedNyyEksempel = doc.GetElementsByTagName("Nybase64eksempel"); XmlNodeList ObjectCodeListNyyEksempel = doc.GetElementsByTagName("Identifier"); XmlNodeList ObjectExtensionCodeListNyyEksempel = doc.GetElementsByTagName("Format"); Base64Element Base64ele = new Base64Element(); //Retur fil with 3 lists //Eksempel med ny XML tag indeholdende BASE64 element if (Object_Base64EncodedNyyEksempel.Count > 0) { Base64ele = new Base64Element(Object_Base64EncodedNyyEksempel, ObjectCodeListNyyEksempel, ObjectExtensionCodeListNyyEksempel); } if (Object_Base64EncodedList.Count > 0) { Base64ele = new Base64Element(Object_Base64EncodedList, ObjectCodeList, ObjectExtensionCodeList); } if (Object_Base64EncodedListFNX.Count > 0) { Base64ele = new Base64Element(Object_Base64EncodedListFNX, ObjectCodeListFNX, ObjectExtensionCodeListFNX); } if (Object_Base64EncodedListPLO.Count > 0) { Base64ele = new Base64Element(Object_Base64EncodedListPLO, ObjectCodeListPLO, ObjectExtensionCodeListPLO); } if (Object_Base64Encodedfoedselsan.Count > 0) { Base64ele = new Base64Element(Object_Base64Encodedfoedselsan, ObjectCodeListfoedselsan, ObjectExtensionCodeListfoedselsan); } return(Base64ele); }