void nuGenPercentMemoryTimeGraph1_ValueChanged(object sender, Genetibase.Shared.NuGenTargetEventArgs e) { System.Diagnostics.PerformanceCounter counter = new System.Diagnostics.PerformanceCounter("Memory", "Available KBytes"); this.label6.Text = "Free Memory: " + counter.NextValue().ToString() + " KBytes"; counter = new System.Diagnostics.PerformanceCounter("System", "Processes"); this.label8.Text = "Running Processes :" + counter.NextValue().ToString(); }
/// <summary> Copies data from a group object into the corresponding group element, creating any /// necessary child nodes. /// </summary> private void encode(Genetibase.NuGenHL7.model.Group groupObject, System.Xml.XmlElement groupElement) { System.String[] childNames = groupObject.Names; System.String messageName = groupObject.Message.getName(); try { for (int i = 0; i < childNames.Length; i++) { Structure[] reps = groupObject.getAll(childNames[i]); for (int j = 0; j < reps.Length; j++) { System.Xml.XmlElement childElement = groupElement.OwnerDocument.CreateElement(makeGroupElementName(messageName, childNames[i])); groupElement.AppendChild(childElement); if (reps[j] is Group) { encode((Group) reps[j], childElement); } else if (reps[j] is Segment) { encode((Segment) reps[j], childElement); } } } } catch (System.Exception e) { throw new NuGenHL7Exception("Can't encode group " + groupObject.GetType().FullName, NuGenHL7Exception.APPLICATION_INTERNAL_ERROR, e); } }
/// <summary> Copies data from the "from" Type into the "to" Type. Either Type may be /// a Primitive, Composite, or Varies. If a Varies is provided, the operation is /// performed on the result of calling its getData() method. A Primitive may be /// copied into a Composite, in which case the value is copied into the first /// component of the Composite. A Composite may be copied into a Primitive, /// in which case the first component is copied. Given Composites with different /// numbers of components, the first components are copied, up to the length /// of the smaller one. /// </summary> public static void copy(Genetibase.NuGenHL7.model.Type from, Genetibase.NuGenHL7.model.Type to) { for (int i = 1; i <= NuGenTerser.numComponents(from); i++) { for (int j = 1; j <= NuGenTerser.numSubComponents(from, i); j++) { System.String val = NuGenTerser.getPrimitive(from, i, j).Value; NuGenTerser.getPrimitive(to, i, j).Value = val; } } }
private void httpServer_OnCommandGet(Genetibase.Network.Sockets.ContextRFC Sender, Genetibase.Network.Web.HttpRequestInfo ARequestInfo, Genetibase.Network.Web.HttpResponseInfo AResponseInfo, ref bool OHandled) { Log("GET Request. Sender:{0}. Request URI:{1}", ARequestInfo.RemoteIP, ARequestInfo.RequestURI); OHandled = true; switch (ARequestInfo.Document) { case "/gettime": AResponseInfo.ContentText = DateTime.Now.ToShortTimeString(); AResponseInfo.ResponseNo = 200; break; case "/getfile": if (ARequestInfo.Params.ContainsKey("name")) { string filename = ""; Invoke (new MethodInvoker( delegate { Activate(); openFileDialog.Title = string.Format("Select a source file for requested file {0}", ARequestInfo.Params["name"]); if (openFileDialog.ShowDialog() == DialogResult.OK) { filename = openFileDialog.FileName; } })); if (filename != string.Empty) { //MemoryStream mem = new MemoryStream(File.ReadAllBytes(openFileDialog.FileName)); //using (StreamWriter sw = new StreamWriter(mem)) //{ // sw.Write(File.ReadAllText(openFileDialog.FileName)); //} AResponseInfo.ContentStream = new FileStream(filename, FileMode.Open); ; //AResponseInfo.ContentStream.Position = 0; AResponseInfo.ResponseNo = 200; } } else { AResponseInfo.ResponseNo = 404; } break; default : OHandled = false; break; } }
/// <summary>This method will build a primitive conformance class (ST, NM, etc) which is /// a Component or Subcomponent. /// </summary> public virtual void buildClass(Genetibase.NuGenHL7.conf.spec.message.AbstractComponent primitive, int profileType) { GeneratedPrimitive genClass = new GeneratedPrimitive(); ProfileName profileName = new ProfileName(primitive.Name, profileType); // Set up class genClass.ClassPackage = packageName; genClass.addClassImport("Genetibase.NuGenHL7.model.*"); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*"); genClass.Properties = "extends AbstractConformanceDataType"; genClass.Name = profileName.ClassName; docBuilder.decorateConstructor(genClass.Constructor, profileName.ClassName); if (primitive.ConstantValue != null && primitive.ConstantValue.Length > 0) { // Add constant value constraints if there are any genClass.addConstantValue(primitive.ConstantValue); } else { // if no constant value, then we add a setter method GeneratedMethod setter = new GeneratedMethod(); setter.addParam("java.lang.String value"); setter.addToThrows("ConfDataException"); setter.addToBody("super.setValue( value );"); setter.ReturnType = "void"; setter.Visibility = "public"; setter.Name = "setValue"; docBuilder.decorateSetValue(setter, primitive.Length); genClass.addMethod(setter); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*"); } genClass.addMaxLength(primitive.Length); // Decorate with comments docBuilder.decoratePrimitive(genClass, primitive); if (depManager.Verbose) System.Console.Out.WriteLine("Generating Primitive: " + packageName + "." + genClass.Name); depManager.generateFile(genClass, packageName, genClass.Name); }
private void InitBlock(Genetibase.NuGenHL7.parser.NuGenParser parser, System.String outText, Genetibase.NuGenHL7.app.NuGenInitiator initiator) { this.parser = parser; this.outText = outText; this.initiator = initiator; }
private void InitBlock(Genetibase.NuGenHL7.protocol.impl.NuGenHL7Server server, System.String theAddress, NuGenHL7Server enclosingInstance) { this.server = server; this.theAddress = theAddress; this.enclosingInstance = enclosingInstance; }
/// <summary> Tests a Type against the corresponding section of a profile.</summary> /// <param name="encoded">optional encoded form of type (if you want to specify this -- if null, /// default pipe-encoded form is used to check length and constant val) /// </param> public virtual NuGenHL7Exception[] testType(Genetibase.NuGenHL7.model.Type type, AbstractComponent profile, System.String encoded, System.String profileID) { System.Collections.ArrayList exList = new System.Collections.ArrayList(); if (encoded == null) encoded = NuGenPipeParser.encode(type, this.enc); NuGenHL7Exception ue = testUsage(encoded, profile.Usage, profile.Name); if (ue != null) exList.Add(ue); if (!profile.Usage.Equals("X")) { //check datatype System.String typeClass = type.GetType().FullName; if (typeClass.IndexOf("." + profile.Datatype) < 0) { typeClass = typeClass.Substring(typeClass.LastIndexOf('.') + 1); exList.Add(new NuGenProfileNotHL7CompliantException("HL7 datatype " + typeClass + " doesn't match profile datatype " + profile.Datatype)); } //check length if (encoded.Length > profile.Length) exList.Add(new NuGenProfileNotFollowedException("The type " + profile.Name + " has length " + encoded.Length + " which exceeds max of " + profile.Length)); //check constant value if (profile.ConstantValue != null && profile.ConstantValue.Length > 0) { if (!encoded.Equals(profile.ConstantValue)) exList.Add(new NuGenProfileNotFollowedException("'" + encoded + "' doesn't equal constant value of '" + profile.ConstantValue + "'")); } NuGenHL7Exception[] te = testTypeAgainstTable(type, profile, profileID); for (int i = 0; i < te.Length; i++) { exList.Add(te[i]); } } return this.toArray(exList); }
public AnonymousClassRunnable(Genetibase.NuGenHL7.parser.NuGenParser parser, System.String outText, Genetibase.NuGenHL7.app.NuGenInitiator initiator) { InitBlock(parser, outText, initiator); }
internal void AddButton(Genetibase.NuGenMediImage.UI.Controls.RibbonButton button) { button.SizeChanged += new EventHandler(button_SizeChanged); this.flowLayoutPanel1.Controls.Add(button); }
public TableNode(Genetibase.Debug.FileViewer.Table t) { _bRaw = false; _data = t; Text = t.ToString(); _desc = t.ToString(); SelectedImageIndex = IconTable; ImageIndex = IconTable; }
public AnonymousClassRunnable(Genetibase.NuGenHL7.protocol.impl.NuGenHL7Server server, System.String theAddress, NuGenHL7Server enclosingInstance) { InitBlock(server, theAddress, enclosingInstance); }
private void dashboard_OnDashboardItemChange(object sender, Genetibase.MathX.NugenCCalc.Design.StringArgs s) { SelectView(s.Data); }
public virtual NuGenHL7Exception[] testComponent(Genetibase.NuGenHL7.model.Type type, Component profile, System.String profileID) { System.Collections.ArrayList exList = new System.Collections.ArrayList(20); addToList(testType(type, profile, null, profileID), exList); //test children if (profile.SubComponents > 0 && !profile.Usage.Equals("X") && hasContent(type)) { if (typeof(Composite).IsAssignableFrom(type.GetType())) { Composite comp = (Composite) type; for (int i = 1; i <= profile.SubComponents; i++) { SubComponent childProfile = profile.getSubComponent(i); try { Genetibase.NuGenHL7.model.Type child = comp.getComponent(i - 1); addToList(testType(child, childProfile, null, profileID), exList); } catch (DataTypeException de) { exList.Add(new NuGenProfileNotHL7CompliantException("More subcomponents in profile than allowed in message: " + de.Message)); } } addToList(checkExtraComponents(comp, profile.SubComponents), exList); } else { exList.Add(new NuGenProfileNotFollowedException("A component has primitive type " + type.GetType().FullName + " but the profile defines subcomponents")); } } return toArray(exList); }
/// <summary>Returns true is there is content in the given type </summary> private bool hasContent(Genetibase.NuGenHL7.model.Type type) { bool has = false; System.String encoded = NuGenPipeParser.encode(type, enc); if (encoded != null && encoded.Length > 0) has = true; return has; }
public virtual NuGenHL7Exception[] testField(Genetibase.NuGenHL7.model.Type type, Field profile, bool escape, System.String profileID) { System.Collections.ArrayList exList = new System.Collections.ArrayList(20); //account for MSH 1 & 2 which aren't escaped System.String encoded = null; if (!escape && typeof(Primitive).IsAssignableFrom(type.GetType())) encoded = ((Primitive) type).Value; addToList(testType(type, profile, encoded, profileID), exList); //test children if (profile.Components > 0 && !profile.Usage.Equals("X")) { if (typeof(Composite).IsAssignableFrom(type.GetType())) { Composite comp = (Composite) type; for (int i = 1; i <= profile.Components; i++) { Component childProfile = profile.getComponent(i); try { Genetibase.NuGenHL7.model.Type child = comp.getComponent(i - 1); addToList(testComponent(child, childProfile, profileID), exList); } catch (DataTypeException de) { exList.Add(new NuGenProfileNotHL7CompliantException("More components in profile than allowed in message: " + de.Message)); } } addToList(checkExtraComponents(comp, profile.Components), exList); } else { exList.Add(new NuGenProfileNotHL7CompliantException("A field has type primitive " + type.GetType().FullName + " but the profile defines components")); } } return toArray(exList); }
/// <summary> Tests table values for ID, IS, and CE types. An empty list is returned for /// all other types or if the table name or number is missing. /// </summary> private NuGenHL7Exception[] testTypeAgainstTable(Genetibase.NuGenHL7.model.Type type, AbstractComponent profile, System.String profileID) { System.Collections.ArrayList exList = new System.Collections.ArrayList(); if (profile.Table != null && type.Name.Equals("IS") || type.Name.Equals("ID")) { System.String codeSystem = makeTableName(profile.Table); System.String value_Renamed = ((Primitive) type).Value; addTableTestResult(exList, profileID, codeSystem, value_Renamed); } else if (type.Name.Equals("CE")) { System.String value_Renamed = Terser.getPrimitive(type, 1, 1).Value; System.String codeSystem = Terser.getPrimitive(type, 3, 1).Value; addTableTestResult(exList, profileID, codeSystem, value_Renamed); value_Renamed = Terser.getPrimitive(type, 4, 1).Value; codeSystem = Terser.getPrimitive(type, 6, 1).Value; addTableTestResult(exList, profileID, codeSystem, value_Renamed); } return this.toArray(exList); }
/// <summary> Tests whether the given type falls within a maximum length. </summary> /// <returns> null of OK, an HL7Exception otherwise /// </returns> public virtual NuGenHL7Exception testLength(Genetibase.NuGenHL7.model.Type type, int maxLength) { NuGenHL7Exception e = null; System.String encoded = NuGenPipeParser.encode(type, this.enc); if (encoded.Length > maxLength) { e = new NuGenProfileNotFollowedException("Length of " + encoded.Length + " exceeds maximum of " + maxLength); } return e; }
public AnonymousClassPredicate1(Genetibase.NuGenHL7.parser.NuGenEncodingCharacters ec) { InitBlock(ec); }
/// <summary>This method will build a primitive conformance class (ST, NM, etc) which is /// a Field. /// </summary> public virtual void buildClass(Genetibase.NuGenHL7.conf.spec.message.Field primitive, System.String parentUnderlyingType, ProfileName profileName) { GeneratedPrimitive genClass = new GeneratedPrimitive(); // Check for possible snags in the Runtime Profile Component if (primitive.Name == null || primitive.Name.Length < 1) throw new ConformanceError("Error building ConformanceSegment: Runtime AbstractComponent does not contain a name."); GeneratedMethod theConstructor = new GeneratedMethod(); genClass.Constructor = theConstructor; genClass.addClassImport("Genetibase.NuGenHL7.model.*"); UnderlyingAccessor underlyingAccessor = new UnderlyingAccessor(parentUnderlyingType, profileName.AccessorName); theConstructor.addParam(parentUnderlyingType + " parentSeg", "The parent underlying data type"); theConstructor.addParam("int rep", "The desired repetition"); theConstructor.Name = profileName.ClassName; theConstructor.Visibility = "public "; theConstructor.addToThrows("Genetibase.NuGenHL7.HL7Exception"); theConstructor.addToBody("super( (Primitive)parentSeg." + underlyingAccessor + " );"); theConstructor.addToBody("if ( parentSeg." + underlyingAccessor + " == null )"); theConstructor.addToBody(" throw new Genetibase.NuGenHL7.HL7Exception( \"Error accussing underlying object. This is a bug.\", 0 );"); // Set up class genClass.ClassPackage = packageName; //genClass.addClassImport("Genetibase.NuGenHL7.model.*"); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*"); //genClass.addClassImport( "Genetibase.NuGenHL7.conf.classes.exceptions.*" ); genClass.Properties = "extends AbstractConformanceDataType implements Repeatable"; // Add min and max reps stuff genClass.setMinMaxReps(primitive.Min, primitive.Max); genClass.Name = profileName.ClassName; docBuilder.decorateConstructor(genClass.Constructor, profileName.ClassName); // Add constant value constraints if there are any, if not, add a setter method if (primitive.ConstantValue != null && primitive.ConstantValue.Length > 0) { genClass.addConstantValue(primitive.ConstantValue); } else { GeneratedMethod setter = new GeneratedMethod(); setter.addParam("java.lang.String value"); setter.addToThrows("ConfDataException"); setter.addToBody("super.setValue( value );"); setter.ReturnType = "void"; setter.Visibility = "public"; setter.Name = "setValue"; docBuilder.decorateSetValue(setter, primitive.Length); genClass.addMethod(setter); genClass.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*"); } genClass.addMaxLength(primitive.Length); // Decorate with comments docBuilder.decoratePrimitive(genClass, primitive); if (depManager.Verbose) System.Console.Out.WriteLine("Generating Primitive: " + packageName + "." + genClass.Name); depManager.generateFile(genClass, packageName, genClass.Name); }
private void InitBlock(Genetibase.NuGenHL7.parser.NuGenEncodingCharacters ec) { this.ec = ec; }
/// <summary> Populates the given group object with data from the given group element, ignoring /// any unrecognized nodes. /// </summary> private void parse(Genetibase.NuGenHL7.model.Group groupObject, System.Xml.XmlElement groupElement) { System.String[] childNames = groupObject.Names; System.String messageName = groupObject.Message.getName(); System.Xml.XmlNodeList allChildNodes = groupElement.ChildNodes; System.Collections.ArrayList unparsedElementList = new System.Collections.ArrayList(); for (int i = 0; i < allChildNodes.Count; i++) { System.Xml.XmlNode node = allChildNodes.Item(i); System.String name = node.Name; if (System.Convert.ToInt16(node.NodeType) == (short) System.Xml.XmlNodeType.Element && !unparsedElementList.Contains(name)) { unparsedElementList.Add(name); } } //we're not too fussy about order here (all occurances get parsed as repetitions) ... for (int i = 0; i < childNames.Length; i++) { SupportClass.ICollectionSupport.Remove(unparsedElementList, childNames[i]); parseReps(groupElement, groupObject, messageName, childNames[i], childNames[i]); } for (int i = 0; i < unparsedElementList.Count; i++) { System.String segName = (System.String) unparsedElementList[i]; System.String segIndexName = groupObject.addNonstandardSegment(segName); parseReps(groupElement, groupObject, messageName, segName, segIndexName); } }
private void httpServer_OnSessionEnd(Genetibase.Network.Web.HttpSession Sender) { Log("Session ended. Host:{0}\r\n", Sender.RemoteHost); }
private static int numStandardComponents(Genetibase.NuGenHL7.model.Type t) { int n = 0; if (typeof(Varies).IsAssignableFrom(t.GetType())) { n = numStandardComponents(((Varies) t).Data); } else if (typeof(Composite).IsAssignableFrom(t.GetType())) { n = ((Composite) t).Components.Length; } else { n = 1; } return n; }
public MDHeapNode(Genetibase.Debug.FileViewer.MDHeap h) { _data = h; Text = h.ToString(); _desc = h.ToString() + " " + h.Count; SelectedImageIndex = IconHeader; ImageIndex = IconHeader; }
private void InitBlock(Genetibase.NuGenHL7.protocol.impl.NuGenServerSocketStreamSource.Acceptor a, System.Net.Sockets.TcpListener theServer, System.String theAddress, Acceptor enclosingInstance) { this.a = a; this.theServer = theServer; this.theAddress = theAddress; this.enclosingInstance = enclosingInstance; }
public RowNode(Genetibase.Debug.FileViewer.Row r, int i, bool bRaw) { _idx = i; _bRaw = bRaw; _data = r; if (_bRaw) { Text = i.ToString("X8") + " " + r.RawString(); _desc = "Row " + i.ToString("X8") + ": " + r.RawString(); } else { Text = i.ToString("D8") + " " + r.CookedString(); _desc = "Row " + i.ToString("X8") + " (" + i + ") : " + r.CookedString(); } SelectedImageIndex = IconData; ImageIndex = IconData; }
/// <summary> Tests a segment against a segment section of a profile.</summary> public virtual NuGenHL7Exception[] testSegment(Genetibase.NuGenHL7.model.Segment segment, Seg profile, System.String profileID) { System.Collections.ArrayList exList = new System.Collections.ArrayList(20); System.Collections.ArrayList allowedFields = new System.Collections.ArrayList(20); for (int i = 1; i <= profile.Fields; i++) { Field field = profile.getField(i); //only test a field in detail if it isn't X if (!field.Usage.ToUpper().Equals("X".ToUpper())) { allowedFields.Add((System.Int32) i); //see which instances have content try { Genetibase.NuGenHL7.model.Type[] instances = segment.getField(i); System.Collections.ArrayList instancesWithContent = new System.Collections.ArrayList(10); for (int j = 0; j < instances.Length; j++) { if (hasContent(instances[j])) instancesWithContent.Add(instances[j]); } NuGenHL7Exception ce = testCardinality(instancesWithContent.Count, field.Min, field.Max, field.Usage, field.Name); if (ce != null) { ce.FieldPosition = i; exList.Add(ce); } //test field instances with content for (int j = 0; j < instancesWithContent.Count; j++) { Genetibase.NuGenHL7.model.Type s = (Genetibase.NuGenHL7.model.Type) instancesWithContent[j]; bool escape = true; //escape field value when checking length if (profile.Name.ToUpper().Equals("MSH".ToUpper()) && i < 3) { escape = false; } NuGenHL7Exception[] childExceptions = testField(s, field, escape, profileID); for (int k = 0; k < childExceptions.Length; k++) { childExceptions[k].FieldPosition = i; } addToList(childExceptions, exList); } } catch (NuGenHL7Exception) { exList.Add(new NuGenProfileNotHL7CompliantException("Field " + i + " not found in message")); } } } //complain about X fields with content this.addToList(checkForExtraFields(segment, allowedFields), exList); NuGenHL7Exception[] ret = toArray(exList); for (int i = 0; i < ret.Length; i++) { ret[i].SegmentName = profile.Name; } return ret; }
public AnonymousClassRunnable(Genetibase.NuGenHL7.protocol.impl.NuGenServerSocketStreamSource.Acceptor a, System.Net.Sockets.TcpListener theServer, System.String theAddress, Acceptor enclosingInstance) { InitBlock(a, theServer, theAddress, enclosingInstance); }
/// <summary> Returns the number of components in the given type, i.e. the /// number of standard components (e.g. 6 for CE) plus any extra components that /// have been added at runtime. /// </summary> public static int numComponents(Genetibase.NuGenHL7.model.Type type) { if (typeof(Varies).IsAssignableFrom(type.GetType())) { return numComponents(((Varies) type).Data); } else { return numStandardComponents(type) + type.ExtraComponents.numComponents(); } }