private void btnRender_Click(object sender, EventArgs e) { ED ed = new ED(); // Set the content type ed.MediaType = txtContentType.Text; // Set a file if possible if (txtFileName.Text != String.Empty) ed.Data = File.ReadAllBytes(txtFileName.Text); // Set the integrity check. This is done before the compressing as we want the hash to // represent the data prior to compression if (cbxIntegrityCheck.SelectedItem != null && !cbxIntegrityCheck.SelectedItem.Equals("None")) switch (cbxIntegrityCheck.SelectedItem.ToString()) { case "SHA1": ed.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA1; ed.IntegrityCheck = ed.ComputeIntegrityCheck(); // Set the integrity check break; case "SHA256": ed.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA256; ed.IntegrityCheck = ed.ComputeIntegrityCheck(); // Set the integrity check break; } // Set the representation if (cbxRepresentation.SelectedItem != null) switch (cbxRepresentation.SelectedItem.ToString()) { case "Text": ed.Representation = EncapsulatedDataRepresentation.TXT; break; case "Base64": ed.Representation = EncapsulatedDataRepresentation.B64; break; case "Xml": ed.Representation = EncapsulatedDataRepresentation.XML; break; } // Set the compression if (cbxCompression.SelectedItem != null && !cbxCompression.SelectedItem.Equals("None")) switch (cbxCompression.SelectedItem.ToString()) { case "GZip": ed.Data = ed.Compress(EncapsulatedDataCompression.GZ); // Compress the data ed.Representation = EncapsulatedDataRepresentation.B64; // must be set to B64 break; case "Deflate": ed.Data = ed.Compress(EncapsulatedDataCompression.DF); // compress the data ed.Representation = EncapsulatedDataRepresentation.B64; // must be set to B64 break; } // Set the thumbnail if (txtThumbnailFileName.Text != string.Empty) ed.Thumbnail = new ED(File.ReadAllBytes(txtThumbnailFileName.Text), txtContentType.Text); txtXml.Text = FormatterHelper.FormatDataType(ed, "ED"); }
public ExternalDocument() { this.classCode = new CSImpl(); this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.id = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.code = new CDImpl(); this.text = new EDImpl <EncapsulatedData>(); this.setId = new IIImpl(); this.versionNumber = new INTImpl(); }
public void R2EDContentBinFlavorParseTest() { var ved = new ED(System.Text.Encoding.UTF8.GetBytes("This is binary"), "bin/plain") { Flavor = "ED.DOC" }; String actualXml = R2SerializationHelper.SerializeAsString(ved); var ved2 = R2SerializationHelper.ParseString <ED>(actualXml); Assert.AreEqual(ved, ved2); }
public void R2EDContentTextLanguageParseTest() { var ved = new ED("this is my test") { Flavor = "ED.TEXT" }; String actualXml = R2SerializationHelper.SerializeAsString(ved); var ved2 = R2SerializationHelper.ParseString <ED>(actualXml); Assert.AreEqual(ved, ved2); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Filter = "Lithtech Dedit World|*.ed"; if (fileDialog.ShowDialog() != DialogResult.Cancel) { // If the file name is not an empty string open it for saving. if (fileDialog.FileName != "") { //Clear the message box resultText.Clear(); //Load the .ed file editorFile = new ED(); //Setup our class with this handle editorFile.file = (System.IO.FileStream)fileDialog.OpenFile(); //Read the header of the file editorFile.ReadHeader(); editorFile.ReadDataBlockSizes(); editorFile.UncompressDataBlocks(); //Update our richtext box string tempString = "Lithtech .ed World Reader \n"; tempString += "Header Info:\n"; tempString += "World Version: " + editorFile.FileHeader.version.ToString() + "\n"; tempString += "Compressed: " + editorFile.FileHeader.compressed.ToString() + "\n"; tempString += "World String: " + editorFile.FileHeader.worldString + "\n"; tempString += "Compressed Blocks: " + editorFile.FileHeader.compressedBlocks + "\n"; tempString += " Datablock layout:\n\n"; int i = 1; foreach (DataBlock temp in editorFile.dataBlocks) { tempString += "\n DataBlockID: " + i.ToString(); tempString += "\n DataLength: " + temp.compressedDataLength.ToString(); tempString += "\n Uncompressed Size: " + temp.uncompressedData.Length.ToString(); i++; } resultText.Text = tempString; } } }
public CoveredPartyParticipantParticipantRole() { this.id = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.code = new CE_R2Impl <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Domainvalue.CoverageRoleType>(); this.addr = new ADImpl(); this.playingEntityClassCode = new CS_R2Impl <EntityClassRoot>(); this.playingEntityTypeId = new IIImpl(); this.playingEntityTemplateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.playingEntityCode = new CE_R2Impl <Code>(); this.playingEntityQuantity = new LISTImpl <PQ, PhysicalQuantity>(typeof(PQImpl)); this.playingEntityName = new PNImpl(); this.playingEntityBirthTime = new TS_R2Impl(); this.playingEntityDesc = new EDImpl <EncapsulatedData>(); }
public DocumentInformation() { this.id = new IIImpl(); this.code = new CVImpl(); this.title = new STImpl(); this.text = new EDImpl <EncapsulatedData>(); this.statusCode = new CSImpl(); this.effectiveTime = new TSImpl(); this.confidentialityCode = new CVImpl(); this.versionNumber = new INTImpl(); this.custodianAssignedCustodianRepresentedRepositoryId = new IIImpl(); this.informationRecipient = new List <Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_shr.Common.Merged.ToBeSentTo>(); this.documentationOfServiceEventCode = new CVImpl(); }
public Section() { this.iD = new STImpl(); this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.id = new IIImpl(); this.title = new STImpl(); this.text = new EDImpl <EncapsulatedData>(); this.confidentialityCode = new CE_R2Impl <Code>(); this.languageCode = new CS_R2Impl <Code>(); this.author = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Author_1>(); this.informant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Informant12>(); this.component = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Component5>(); }
public Reference() { this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.seperatableInd = new BLImpl(); this.externalDocumentClassCode = new CSImpl(); this.externalDocumentTypeId = new IIImpl(); this.externalDocumentTemplateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.externalDocumentId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.externalDocumentCode = new CDImpl(); this.externalDocumentText = new EDImpl <EncapsulatedData>(); this.externalDocumentSetId = new IIImpl(); this.externalDocumentVersionNumber = new INTImpl(); }
public CoveredPartyParticipantParticipantRole() { this.id = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.code = new CEImpl(); this.addr = new ADImpl(); this.playingEntityClassCode = new CSImpl(); this.playingEntityTypeId = new IIImpl(); this.playingEntityTemplateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.playingEntityCode = new CEImpl(); this.playingEntityQuantity = new LISTImpl <PQ, PhysicalQuantity>(typeof(PQImpl)); this.playingEntityName = new PNImpl(); this.playingEntityBirthTime = new TSCDAR1Impl(); this.playingEntityDesc = new EDImpl <EncapsulatedData>(); }
public Reference() { this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.seperatableInd = new BLImpl(); this.externalDocumentClassCode = new CS_R2Impl <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Domainvalue.ActClassDocument>(); this.externalDocumentTypeId = new IIImpl(); this.externalDocumentTemplateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.externalDocumentId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.externalDocumentCode = new CD_R2Impl <Code>(); this.externalDocumentText = new EDImpl <EncapsulatedData>(); this.externalDocumentSetId = new IIImpl(); this.externalDocumentVersionNumber = new INTImpl(); }
public Section() { this.iD = new STImpl(); this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.id = new IIImpl(); this.title = new STImpl(); this.text = new EDImpl <EncapsulatedData>(); this.confidentialityCode = new CEImpl(); this.languageCode = new CSImpl(); this.author = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Author_1>(); this.informant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Informant12>(); this.entry = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Postprocedurediagnosissection.IEntryChoice>(); this.component = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Component5>(); }
public void EDByteSetToContentOfEDTest() { byte[] content = new ED("Test"); byte[] expected = Encoding.ASCII.GetBytes("Test"); Boolean passed = true; for (int i = 0; i < expected.Length; i++) { if (content[i] != expected[i]) { passed = false; } } Assert.AreEqual(true, passed && content.Length == expected.Length); }
public Section() { this.iD = new STImpl(); this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.id = new IIImpl(); this.title = new STImpl(); this.text = new EDImpl <EncapsulatedData>(); this.confidentialityCode = new CEImpl(); this.languageCode = new CSImpl(); this.author = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Author_1>(); this.informant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Informant12>(); this.entry = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Dicomobjectcatalogsectiondcm121181.Entry>(); this.component = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Component5>(); }
public void R2EDContentBinThumbnailTranslationParseTest() { ED ved = new ED(Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation"), "text/plain"); ved.Thumbnail = ved.Compress(EncapsulatedDataCompression.GZ); ved.Translation = new SET <ED>( new ED[] { "this is translation 1", "this is translation 2" } ); String actualXml = R2SerializationHelper.SerializeAsString(ved); var ved2 = R2SerializationHelper.ParseString <ED>(actualXml); Assert.AreEqual(ved, ved2); }
public void R2EDContentBinThumbnailTranslationSerializationTest() { ED edInstance = new ED(Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation"), "text/plain"); edInstance.Thumbnail = edInstance.Compress(EncapsulatedDataCompression.GZ); edInstance.Translation = new SET <ED>( new ED[] { "this is translation 1", "this is translation 2" } ); String expectedXml = String.Format(@"<test xmlns=""urn:hl7-org:v3"" mediaType=""text/plain""><data>{0}</data><thumbnail mediaType=""text/plain"" compression=""GZ""><data>{1}</data></thumbnail><translation value=""this is translation 1"" language=""en-US""/><translation language=""en-US"" value=""this is translation 2""/></test>", Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation")), edInstance.Thumbnail.Base64Data); String actualXml = R2SerializationHelper.SerializeAsString(edInstance); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void EDThumbnailCheck() { byte[] b = new byte[1024]; RandomNumberGenerator random = new RNGCryptoServiceProvider(); random.GetBytes(b); ED edt = new ED((TEL)"http://www.google.ca"); edt.Thumbnail = new ED(b, "image/png"); byte[] checker = edt.Thumbnail; Assert.AreEqual(checker.Length, b.Length); for (int i = 0; i < b.Length; i++) { Assert.AreEqual(checker[i], b[i]); } }
public void EDContentsOfEDSetToStringTest() { ED edInstance = "Test"; byte[] expected = Encoding.ASCII.GetBytes("Test"); Boolean passed = true; for (int i = 0; i < expected.Length; i++) { if (edInstance.Data[i] != expected[i]) { passed = false; } } Assert.AreEqual(true, passed && edInstance.Data.Length == expected.Length); }
public ReportHeader() { this.id = new IIImpl(); this.code = new CDImpl(); this.title = new STImpl(); this.text = new EDImpl <EncapsulatedData>(); this.statusCode = new CSImpl(); this.effectiveTime = new TSImpl(); this.confidentialityCode = new SETImpl <CV, Code>(typeof(CVImpl)); this.receiverRoleChoice = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_05_00.Lab.Merged.IRoleChoice>(); this.performer = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_05_00.Lab.Merged.WasPerformedBy>(); this.inFulfillmentOfFulfillmentChoice = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_05_00.Lab.Merged.IFulfillmentChoice>(); this.pertinentInformation2SupportingClinicalObservationEvent = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_05_00.Lab.Merged.SupportingClinicalInformation>(); this.component1Culture = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_05_00.Lab.Polb_mt004100ca.CultureGrouperObservation>(); this.component2ReportableTestIndicator = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_05_00.Lab.Merged.ReportableHealthIndicator>(); this.subjectOf2 = new List <Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_05_00.Merged.Includes>(); }
public void EDCompressionTest() { byte[] filebytes = new byte[1024]; RandomNumberGenerator random = new RNGCryptoServiceProvider(); random.GetBytes(filebytes); ED t = new ED(filebytes, "application/bin"); t.Compression = EncapsulatedDataCompression.GZ; t.Data = t.Compress(EncapsulatedDataCompression.GZ); t.Data = t.UnCompress(); Assert.AreEqual(filebytes.Length, t.Data.Length); for (int i = 0; i < filebytes.Length; i++) { Assert.AreEqual(filebytes[i], t.Data[i]); } }
public void EDBase64EncodedEDTest() { string lazyString = "The quick brown fox jumps over the lazy dog"; // Create and ED object with the value equal to the lazyString above. ED edInstance = new ED(); edInstance.Value = lazyString; // Ste the Representation of the ED object to Base64 Encoded edInstance.Representation = EncapsulatedDataRepresentation.B64; // Converts string to Bytes Byte[] testBytes = System.Text.Encoding.UTF8.GetBytes(lazyString); // True if we can convert the testBytes to a Base64 String. Assert.AreEqual(edInstance.Base64Data, Convert.ToBase64String(testBytes)); }
public string RedirectLogin(string RedirectUrl) { string userid; string Password; string Year; string companyname; string Yearid; string Qr = ""; userid = ED.EncryptData(txtuser.Text.Trim()); Password = ED.EncryptData(txtpwd.Text.Trim()); Year = ED.EncryptData(ddlFinancialYear.SelectedItem.Text.Trim()); Yearid = ED.EncryptData(ddlFinancialYear.SelectedValue.Trim()); companyname = ED.EncryptData(ddlChetanaCompanyName.SelectedValue.ToLower()); Qr = "?resu=" + Server.UrlEncode(userid) + "&dwsp=" + Server.UrlEncode(Password) + "&cmp=" + Server.UrlEncode(companyname) + "&rea=" + Server.UrlEncode(Year) + "&reai=" + Server.UrlEncode(Yearid); return(RedirectUrl + Qr); }
public void R2EDContentBinThumbnailTranslationSerializationIntegrityCheckTest() { ED edInstance = new ED(Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation"), "text/plain"); edInstance.Thumbnail = edInstance.Compress(EncapsulatedDataCompression.GZ); edInstance.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA256; edInstance.IntegrityCheck = edInstance.ComputeIntegrityCheck(); edInstance.Translation = new SET <ED>( new ED[] { "this is translation 1", "this is translation 2" } ); String expectedXml = String.Format(@"<test xmlns=""urn:hl7-org:v3"" mediaType=""text/plain"" integrityCheckAlgorithm=""SHA-256""><data>{0}</data><integrityCheck>2sv8IRiWNYypBMLqJxAl79Yl2YJGBz3dtG3f3aNIIEg=</integrityCheck><thumbnail mediaType=""text/plain"" compression=""GZ""><data>{1}</data></thumbnail><translation value=""this is translation 1"" language=""en-US""/><translation language=""en-US"" value=""this is translation 2""/></test>", Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation")), edInstance.Thumbnail.Base64Data); String actualXml = R2SerializationHelper.SerializeAsString(edInstance); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void GetSelection() { var sOptions = new PromptSelectionOptions() { PrepareOptionalDetails = true, SelectEverythingInAperture = true, AllowDuplicates = false, }; var sectionViewName = DBDictionary.GetClass(typeof(Line)).DxfName; var filter = new SelectionFilter(new[] { new TypedValue((int)DxfCode.Start, sectionViewName), }); ED.WriteMessage("Select First Section View Group"); var selection1 = ED.GetSelection(sOptions, filter); if (selection1.Status != PromptStatus.OK) { return; } var ids1 = selection1.Value.GetObjectIds(); var selection2 = ED.GetSelection(sOptions, filter); if (selection2.Status != PromptStatus.OK) { return; } var ids2 = selection2.Value.GetObjectIds(); TInvoke(t => { for (var i = 0; i < Math.Min(ids1.Length, ids2.Length); i++) { var view1 = (SectionView)t.GetObject(ids1[i], OpenMode.ForRead); var view2 = (SectionView)t.GetObject(ids2[i], OpenMode.ForRead); } }); }
public ObservationMedia() { this.iD = new STImpl(); this.classCode = new CSImpl(); this.moodCode = new CSImpl(); this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.id = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.languageCode = new CSImpl(); this.value = new EDImpl <EncapsulatedData>(); this.specimen = new List <Ca.Infoway.Messagebuilder.Model.Pcs_cda_r1_2.Basemodel.Specimen>(); this.performer = new List <Ca.Infoway.Messagebuilder.Model.Pcs_cda_r1_2.Merged.Performer2>(); this.author = new List <Ca.Infoway.Messagebuilder.Model.Pcs_cda_r1_2.Basemodel.Author>(); this.informant = new List <Ca.Infoway.Messagebuilder.Model.Pcs_cda_r1_2.Merged.Informant12>(); this.participant = new List <Ca.Infoway.Messagebuilder.Model.Pcs_cda_r1_2.Merged.Participant2>(); this.entryRelationship = new List <Ca.Infoway.Messagebuilder.Model.Pcs_cda_r1_2.Basemodel.EntryRelationship>(); this.reference = new List <Ca.Infoway.Messagebuilder.Model.Pcs_cda_r1_2.Basemodel.Reference>(); this.precondition = new List <Ca.Infoway.Messagebuilder.Model.Pcs_cda_r1_2.Basemodel.Precondition>(); }
public Act() { this.negationInd = new BLImpl(); this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.id = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.text = new EDImpl <EncapsulatedData>(); this.effectiveTime = new IVLTSCDAR1Impl(); this.priorityCode = new CEImpl(); this.languageCode = new CSImpl(); this.specimen = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Specimen>(); this.performer = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Performer2_1>(); this.author = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Author_1>(); this.informant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Informant12>(); this.participant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Merged.Participant2_2>(); this.entryRelationship = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Coverageactivity.IEntryRelationshipChoice>(); this.reference = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Basemodel.Reference>(); this.precondition = new List <Ca.Infoway.Messagebuilder.Model.Ccda_pcs_r1_1.Basemodel.Precondition>(); }
public void EDXmlEncodedDataTest() { string testString = "<test />"; // create instance and set the value ED edInstance = new ED(); edInstance.Value = testString; // Ste the Representation of the ED object to XML edInstance.Representation = EncapsulatedDataRepresentation.XML; // Checks to see if there is one and only one Root Element XmlNode parentNode = edInstance.XmlData.ParentNode; XmlNodeList nodeList = edInstance.XmlData.ParentNode.ChildNodes; //Parent is the document itself Assert.IsTrue(parentNode.NodeType == XmlNodeType.Document && nodeList.Count == 1 && nodeList[0].LocalName == "test"); }
public void IntegrityCheckTest03() { try { // Create first ED instance ED edInstance1 = new ED(File.ReadAllBytes(@"C:\Test Files\testData.txt"), "text/xml"); edInstance1.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA1; edInstance1.IntegrityCheck = edInstance1.ComputeIntegrityCheck(); // Create second ED instance ED edInstance2 = new ED(File.ReadAllBytes(@"C:\Test Files\testData.txt"), "text/xml"); edInstance2.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA256; edInstance2.IntegrityCheck = edInstance2.ComputeIntegrityCheck(); // Corrput the data edInstance1.Data[10] = 0; edInstance2.Data[10] = 0; if (!edInstance1.ValidateIntegrityCheck() && !edInstance2.ValidateIntegrityCheck()) { Console.WriteLine("Integrity check worked!"); Console.WriteLine("Check 1:"); foreach (Byte bytes in edInstance1.IntegrityCheck) { Console.Write("{0}", bytes); } Console.WriteLine(""); Console.WriteLine("Check 2: "); foreach (Byte bytes in edInstance2.IntegrityCheck) { Console.Write("{0}", bytes); } } Assert.AreNotEqual(edInstance1.IntegrityCheck, edInstance2.IntegrityCheck); } catch (Exception e) { // Don't handle } }
public Act() { this.negationInd = new BLImpl(); this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.id = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.code = new CD_R2Impl <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Domainvalue.PatientEducation>(); this.text = new EDImpl <EncapsulatedData>(); this.effectiveTime = new IVL_TSImpl(); this.priorityCode = new CE_R2Impl <Code>(); this.languageCode = new CS_R2Impl <Code>(); this.specimen = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Specimen>(); this.performer = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Performer2_1>(); this.author = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Author_1>(); this.informant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Informant12>(); this.participant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Participant2_2>(); this.entryRelationship = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.EntryRelationship_2>(); this.reference = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Basemodel.Reference>(); this.precondition = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Basemodel.Precondition>(); }
public void SetEditable(EditableData[] DataSet) { Tree.Nodes.Clear(); foreach (EditableData ED in DataSet) { Type EDType = ED.GetType(); DesignerCategoryAttribute Cat = EDType.GetCustomAttribute <DesignerCategoryAttribute>(); DisplayNameAttribute DispName = EDType.GetCustomAttribute <DisplayNameAttribute>() ?? new DisplayNameAttribute(EDType.Name); TreeNode CatNode = FindOrCreateCategory(Cat.Category); CatNode.Tag = null; TreeNode EditNode = CatNode.Nodes.Add(DispName.DisplayName); EditNode.Tag = ED; } Tree.ExpandAll(); }
public HasComponentEncounter() { this.typeId = new IIImpl(); this.templateId = new LISTImpl <II, Identifier>(typeof(IIImpl)); this.id = new IIImpl(); this.code = new CD_R2Impl <Code>(); this.text = new EDImpl <EncapsulatedData>(); this.statusCode = new CS_R2Impl <Code>(); this.effectiveTime = new IVL_TSImpl(); this.dischargeDispositionCode = new CE_R2Impl <Code>(); this.priorityCode = new CE_R2Impl <Code>(); this.specimen = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Specimen>(); this.performer = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Performer2_1>(); this.author = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Author_1>(); this.informant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Informant12>(); this.participant = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.Participant2_2>(); this.entryRelationship = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Merged.EntryRelationship_2>(); this.reference = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Basemodel.Reference>(); this.precondition = new List <Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Basemodel.Precondition>(); }
public void EDValueNullFlavorTest() { ED ed = new ED("This is the content of ED"); ed.NullFlavor = NullFlavor.UnEncoded; Assert.IsFalse(ed.Validate(), "Validation succeeded but should have failed with both a value and NullFlavor"); }
public void EDValueValidationTest() { ED ed = new ED("This is the content of ED"); ed.NullFlavor = null; ed.MediaType = ""; Assert.IsTrue(ed.Validate(), "Validation with a Value and no NullFlavor failed. The validation should succeed."); }
public void EDNullFlavorValidationTest() { ED ed = new ED(); ed.NullFlavor = NullFlavor.NotAsked; Assert.IsTrue(ed.Validate(), "Validation with a NullFlavor and no data failed. The validation should succeed."); }
public void EDThumbnailCheck() { byte[] b = new byte[1024]; RandomNumberGenerator random = new RNGCryptoServiceProvider(); random.GetBytes(b); ED edt = new ED((TEL)"http://www.google.ca"); edt.Thumbnail = new ED(b, "image/png"); byte[] checker = edt.Thumbnail; Assert.AreEqual(checker.Length, b.Length); for (int i = 0; i < b.Length; i++) Assert.AreEqual(checker[i], b[i]); }
public void EDValidateHash() { byte[] filebyte = new byte[1024]; ED edTest = new ED(filebyte, "application/pdf"); edTest.Representation = EncapsulatedDataRepresentation.B64; edTest.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA1; edTest.IntegrityCheck = edTest.ComputeIntegrityCheck(); Assert.IsTrue(edTest.ValidateIntegrityCheck()); }
public void IntegrityCheckTest03() { try { // Create first ED instance ED edInstance1 = new ED(File.ReadAllBytes(@"C:\Test Files\testData.txt"), "text/xml"); edInstance1.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA1; edInstance1.IntegrityCheck = edInstance1.ComputeIntegrityCheck(); // Create second ED instance ED edInstance2 = new ED(File.ReadAllBytes(@"C:\Test Files\testData.txt"), "text/xml"); edInstance2.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA256; edInstance2.IntegrityCheck = edInstance2.ComputeIntegrityCheck(); // Corrput the data edInstance1.Data[10] = 0; edInstance2.Data[10] = 0; if (!edInstance1.ValidateIntegrityCheck() && !edInstance2.ValidateIntegrityCheck()) { Console.WriteLine("Integrity check worked!"); Console.WriteLine("Check 1:"); foreach (Byte bytes in edInstance1.IntegrityCheck) Console.Write("{0}", bytes); Console.WriteLine(""); Console.WriteLine("Check 2: "); foreach (Byte bytes in edInstance2.IntegrityCheck) Console.Write("{0}", bytes); } Assert.AreNotEqual(edInstance1.IntegrityCheck, edInstance2.IntegrityCheck); } catch (Exception e) { // Don't handle } }
public void EDNullTest() { ED ed = new ED(); ed.Value = string.Empty; ed.Data = null; Assert.IsFalse(ed.Validate(), "Validation succeeded but should have failed with no value or NullFlavor"); }
public void EDByteSetToContentOfEDTest() { byte[] content = new ED("Test"); byte[] expected = Encoding.ASCII.GetBytes("Test"); Boolean passed = true; for (int i = 0; i < expected.Length; i++) if (content[i] != expected[i]) passed = false; Assert.AreEqual(true, passed && content.Length == expected.Length); }
public void R2EDContentTextCompressionSerializationTest() { ED edInstance = new ED("this is my test"); String expectedXml = String.Format(@"<test xmlns=""urn:hl7-org:v3"" mediaType=""text/plain"" compression=""GZ""><data>{1}</data></test>", CultureInfo.CurrentCulture.Name, edInstance.Compress(EncapsulatedDataCompression.GZ).Base64Data); edInstance = edInstance.Compress(EncapsulatedDataCompression.GZ); String actualXml = R2SerializationHelper.SerializeAsString(edInstance); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void R2EDContentBinThumbnailTranslationSerializationIntegrityCheckTest() { ED edInstance = new ED(Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation"), "text/plain"); edInstance.Thumbnail = edInstance.Compress(EncapsulatedDataCompression.GZ); edInstance.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA256; edInstance.IntegrityCheck = edInstance.ComputeIntegrityCheck(); edInstance.Translation = new SET<ED>( new ED[] { "this is translation 1", "this is translation 2" } ); String expectedXml = String.Format(@"<test xmlns=""urn:hl7-org:v3"" mediaType=""text/plain"" integrityCheckAlgorithm=""SHA-256""><data>{0}</data><integrityCheck>2sv8IRiWNYypBMLqJxAl79Yl2YJGBz3dtG3f3aNIIEg=</integrityCheck><thumbnail mediaType=""text/plain"" compression=""GZ""><data>{1}</data></thumbnail><translation value=""this is translation 1"" language=""en-US""/><translation language=""en-US"" value=""this is translation 2""/></test>", Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation")), edInstance.Thumbnail.Base64Data); String actualXml = R2SerializationHelper.SerializeAsString(edInstance); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void R2EDContentBinThumbnailTranslationSerializationTest() { ED edInstance = new ED(Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation"), "text/plain"); edInstance.Thumbnail = edInstance.Compress(EncapsulatedDataCompression.GZ); edInstance.Translation = new SET<ED>( new ED[] { "this is translation 1", "this is translation 2" } ); String expectedXml = String.Format(@"<test xmlns=""urn:hl7-org:v3"" mediaType=""text/plain""><data>{0}</data><thumbnail mediaType=""text/plain"" compression=""GZ""><data>{1}</data></thumbnail><translation value=""this is translation 1"" language=""en-US""/><translation language=""en-US"" value=""this is translation 2""/></test>", Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation")), edInstance.Thumbnail.Base64Data); String actualXml = R2SerializationHelper.SerializeAsString(edInstance); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void IntegrityCheckTest02() { try { // create new instance of ED and store xml data ED edInstance = new ED(File.ReadAllBytes(@"C:\Test Files\mydata.xml"), "text/xml"); // assign integrity checking algorithm edInstance.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA1; edInstance.IntegrityCheck = edInstance.ComputeIntegrityCheck(); // Do NOT corrput the data if (edInstance.ValidateIntegrityCheck()) { Console.WriteLine("Integrity check found no corruption."); } else { Console.WriteLine("Integrity check found corruption when data was not corrupted."); } Assert.AreEqual(edInstance.ValidateIntegrityCheck(), true); } catch (Exception e) { // Don't handle } }
public void R2EDContentTextLanguageParseTest() { var ved = new ED("this is my test") { Flavor = "ED.TEXT" }; String actualXml = R2SerializationHelper.SerializeAsString(ved); var ved2 = R2SerializationHelper.ParseString<ED>(actualXml); Assert.AreEqual(ved, ved2); }
public void EDSetStringToContentsOfEDTest() { string content = new ED("Test"); Assert.AreEqual("Test", content); }
public void R2EDContentBinThumbnailTranslationParseTest() { ED ved = new ED(Encoding.UTF8.GetBytes("this is a binary with thumbnail and translation"), "text/plain"); ved.Thumbnail = ved.Compress(EncapsulatedDataCompression.GZ); ved.Translation = new SET<ED>( new ED[] { "this is translation 1", "this is translation 2" } ); String actualXml = R2SerializationHelper.SerializeAsString(ved); var ved2 = R2SerializationHelper.ParseString<ED>(actualXml); Assert.AreEqual(ved, ved2); }
public void ThumbExampleTest02() { //build array of bytes for "ed.data" byte[] value = new byte[50]; for (int i = 0; i < 50; i++) { value[i] = 0; } ED ed = new ED((TEL)"http://s.hhs.on.ca/media/loops/loop01.avi"); // creates a new thumbnail ED thumbnail = new ED(System.Text.Encoding.UTF8.GetBytes("Hello, this is a test"), "image/gif"); // Set the thumbnail to a compressed version of the image //ed.Compression = EncapsulatedDataCompression.GZ; ed.Thumbnail = thumbnail.Compress(EncapsulatedDataCompression.GZ); ed.Reference = null; ed.NullFlavor = NullFlavor.NoInformation; ed.Data = value; Assert.IsFalse(ed.Validate()); }
public void EDConstructorTest() { byte[] data = new byte[0]; // TODO: Initialize to an appropriate value string mediaType = "text/plain"; // TODO: Initialize to an appropriate value ED target = new ED(data, mediaType); Assert.AreEqual(target.Data, data); Assert.AreEqual(target.MediaType, "text/plain"); }
public void R2EDContentTextCompressionParseTest() { ED ved = new ED("this is my test"); ved = ved.Compress(EncapsulatedDataCompression.GZ); String actualXml = R2SerializationHelper.SerializeAsString(ved); var ved2 = R2SerializationHelper.ParseString<ED>(actualXml); Assert.AreEqual(ved, ved2); }
public void EDCompressionTest() { byte[] filebytes = new byte[1024]; RandomNumberGenerator random = new RNGCryptoServiceProvider(); random.GetBytes(filebytes); ED t = new ED(filebytes, "application/bin"); t.Compression = EncapsulatedDataCompression.GZ; t.Data = t.Compress(EncapsulatedDataCompression.GZ); t.Data = t.UnCompress(); Assert.AreEqual(filebytes.Length, t.Data.Length); for (int i = 0; i < filebytes.Length; i++) Assert.AreEqual(filebytes[i], t.Data[i]); }
public void IntegrityCheckTest01() { try { // create new instance of ED and store xml data ED edInstance = new ED(File.ReadAllBytes(@"C:\Test Files\mydata.xml"), "text/xml"); // assign integrity checking algorithm edInstance.IntegrityCheckAlgorithm = EncapsulatedDataIntegrityAlgorithm.SHA1; edInstance.IntegrityCheck = edInstance.ComputeIntegrityCheck(); // Corrupt the data, validate integrity check should fail edInstance.Data[20] = 0; if (!edInstance.ValidateIntegrityCheck()) Console.WriteLine("Integrity check worked!"); Assert.AreEqual(edInstance.ValidateIntegrityCheck(), false); } catch (Exception e) { // Don't handle } }
public EFS() { ED = new ED(); FS = new FS(); IFG = new IFG(); }
public void R2EDContentBinFlavorParseTest() { var ved = new ED(System.Text.Encoding.UTF8.GetBytes("This is binary"), "bin/plain") { Flavor = "ED.DOC" }; String actualXml = R2SerializationHelper.SerializeAsString(ved); var ved2 = R2SerializationHelper.ParseString<ED>(actualXml); Assert.AreEqual(ved, ved2); }