コード例 #1
0
        /// <summary>
        /// Unmarshals and deallocates an OPCHDA_ANNOTATION structure.
        /// </summary>
        internal static AnnotationValueCollection GetAnnotationValueCollection(OpcRcw.Hda.OPCHDA_ANNOTATION input, bool deallocate)
        {
            AnnotationValueCollection output = new AnnotationValueCollection();

            output.ClientHandle = input.hClient;

            DateTime[] timestamps    = OpcCom.Interop.GetFILETIMEs(ref input.ftTimeStamps, input.dwNumValues, deallocate);
            string[]   annotations   = OpcCom.Interop.GetUnicodeStrings(ref input.szAnnotation, input.dwNumValues, deallocate);
            DateTime[] creationTimes = OpcCom.Interop.GetFILETIMEs(ref input.ftAnnotationTime, input.dwNumValues, deallocate);
            string[]   users         = OpcCom.Interop.GetUnicodeStrings(ref input.szUser, input.dwNumValues, deallocate);

            for (int ii = 0; ii < input.dwNumValues; ii++)
            {
                AnnotationValue value = new AnnotationValue();

                value.Timestamp    = timestamps[ii];
                value.Annotation   = annotations[ii];
                value.CreationTime = creationTimes[ii];
                value.User         = users[ii];

                output.Add(value);
            }

            return(output);
        }
コード例 #2
0
 /// <summary>Serves as the default hash function. </summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = IsValid.GetHashCode();
         hashCode = (hashCode * 397) ^ (RelativeLocation?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (AbsoluteLocation?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (InstanceLocation?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (AnnotationValue?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Keyword?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (AdditionalInfo?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (NestedResults?.GetCollectionHashCode() ?? 0);
         return(hashCode);
     }
 }
コード例 #3
0
        internal static AnnotationValueCollection GetAnnotationValueCollection(OPCHDA_ANNOTATION input, bool deallocate)
        {
            AnnotationValueCollection values = new AnnotationValueCollection {
                ClientHandle = input.hClient
            };

            DateTime[] timeArray  = OpcCom.Interop.GetFILETIMEs(ref input.ftTimeStamps, input.dwNumValues, deallocate);
            string[]   strArray   = OpcCom.Interop.GetUnicodeStrings(ref input.szAnnotation, input.dwNumValues, deallocate);
            DateTime[] timeArray2 = OpcCom.Interop.GetFILETIMEs(ref input.ftAnnotationTime, input.dwNumValues, deallocate);
            string[]   strArray2  = OpcCom.Interop.GetUnicodeStrings(ref input.szUser, input.dwNumValues, deallocate);
            for (int i = 0; i < input.dwNumValues; i++)
            {
                AnnotationValue value2 = new AnnotationValue {
                    Timestamp    = timeArray[i],
                    Annotation   = strArray[i],
                    CreationTime = timeArray2[i],
                    User         = strArray2[i]
                };
                values.Add(value2);
            }
            return(values);
        }
コード例 #4
0
        private void annotation(AnnotationValue a, String indent, StringBuilder sb)
        {
            sb.append(a.Type.FullName);
            if (a.ArgumentNames.any())
            {
                sb.append("(");
                var first = true;
                foreach (var argName in a.ArgumentNames)
                {
                    var arg = a.getArgument(argName);
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        sb.append(", ");
                    }
                    sb.append(arg.Name).append(" = ");
                    switch (arg.AnnotationArgumentKind)
                    {
                    case Annotation:
                        annotation((AnnotationValue)arg, indent, sb);
                        break;

                    case Boolean:
                        sb.append(arg.Value);
                        break;

                    default:
                        throw new RuntimeException("Unhandled annotation argument kind: " + arg.getAnnotationArgumentKind());
                    }
                }
                sb.append(")");
            }
        }
コード例 #5
0
 public void setDefaultValue(AnnotationValue defaultValue)
 {
     checkCreated();
     this.defaultValue = defaultValue;
 }
コード例 #6
0
 public void setDefaultValue(AnnotationValue defaultValue) {
     checkCreated();
     this.defaultValue = defaultValue;
 }
コード例 #7
0
 public static String getPropertySetName(MethodInfo method, AnnotationValue annotation) {
     var nameArg = annotation.getArgument("name");
     var result = "";
     if (nameArg == null || nameArg.Value == null || nameArg.Value.equals("")) {
         if (method.Name.startsWith("set")) {
             result = method.Name.substring(3);
         }
     } else {
         result = (String)nameArg.Value;
     }
     return result;
 }
コード例 #8
0
 public static bool isPropertySet(AnnotationValue annotation) {
     return annotation.Type.FullName.equals("stab/lang/PropertySet");
 }
コード例 #9
0
 public static String getPropertyGetName(MethodInfo method, AnnotationValue annotation) {
     var nameArg = annotation.getArgument("name");
     var result = "";
     if (nameArg == null || nameArg.Value == null || nameArg.Value.equals("")) {
         if (method.Name.startsWith("get")) {
             result = method.Name.substring(3);
         } else if (method.ReturnType.IsBoolean
                 && method.Name.length() > 2
                 && method.Name.startsWith("is")
                 && Character.isUpperCase(method.Name[2])) {
             result = Character.toUpperCase(method.Name[0]) + method.Name.substring(1);
         }
     } else {
         result = (String)nameArg.Value;
     }
     return result;
 }
コード例 #10
0
		private void annotation(AnnotationValue a, String indent, StringBuilder sb) {
			sb.append(a.Type.FullName);
			if (a.ArgumentNames.any()) {
				sb.append("(");
				var first = true;
				foreach (var argName in a.ArgumentNames) {
					var arg = a.getArgument(argName);
					if (first) {
						first = false;
					} else {
						sb.append(", ");
					}
					sb.append(arg.Name).append(" = ");
					switch (arg.AnnotationArgumentKind) {
					case Annotation:
						annotation((AnnotationValue)arg, indent, sb);
						break;
						
					case Boolean:
						sb.append(arg.Value);
						break;
						
					default:
						throw new RuntimeException("Unhandled annotation argument kind: " + arg.getAnnotationArgumentKind());
					}
				}
				sb.append(")");
			}
		}
コード例 #11
0
 public static bool isExtensionMethod(AnnotationValue annotation) {
     return annotation.Type.FullName.equals("stab/lang/ExtensionMethod");
 }
コード例 #12
0
 public static bool isDispose(AnnotationValue annotation) {
     return annotation.Type.FullName.equals("stab/lang/Dispose");
 }
コード例 #13
0
 public static bool isStaticClass(AnnotationValue annotation) {
     return annotation.Type.FullName.equals("stab/lang/StaticClass");
 }
コード例 #14
0
 public static bool isConditional(AnnotationValue annotation) {
     return annotation.Type.FullName.equals("stab/lang/Conditional");
 }
コード例 #15
0
		private static void cloneAnnotationValue(AnnotationValue value, Library targetTypeSystem,
				AnnotationValueBuilder builder, Scope<String, TypeInfo> genericArgs) {
			foreach (var s in value.ArgumentNames) {
				var a = value.getArgument(s);
				switch (a.AnnotationArgumentKind) {
				case Annotation:
					cloneAnnotationValue((AnnotationValue)a, targetTypeSystem,
							builder.setAnnotationArgument(s, a.Type, a.IsRuntimeVisible), genericArgs);
					break;
				case Array:
					var aab = builder.setArrayArgument(s);
					foreach (var aa in a.Elements) {
						cloneAnnotationArgument(aa, targetTypeSystem, aab, genericArgs);
					}
					break;
				case Boolean:
					builder.setBooleanArgument(s, (Boolean)a.Value);
					break;
				case Byte:
					builder.setByteArgument(s, (Byte)a.Value);
					break;
				case Char:
					builder.setCharArgument(s, (Character)a.Value);
					break;
				case Double:
					builder.setDoubleArgument(s, (Double)a.Value);
					break;
				case Enum:
					builder.setEnumArgument(s, a.getType(), a.Name);
					break;
				case Float:
					builder.setFloatArgument(s, (Float)a.Value);
					break;
				case Int:
					builder.setIntArgument(s, (Integer)a.Value);
					break;
				case Long:
					builder.setLongArgument(s, (Long)a.Value);
					break;
				case Short:
					builder.setShortArgument(s, (Short)a.Value);
					break;
				case String:
					builder.setStringArgument(s, (String)a.Value);
					break;
				case Type:
					builder.setTypeArgument(s, a.Type);
					break;
				}
			}
		}
コード例 #16
0
        private static void cloneAnnotationValue(AnnotationValue value, Library targetTypeSystem,
                                                 AnnotationValueBuilder builder, Scope <String, TypeInfo> genericArgs)
        {
            foreach (var s in value.ArgumentNames)
            {
                var a = value.getArgument(s);
                switch (a.AnnotationArgumentKind)
                {
                case Annotation:
                    cloneAnnotationValue((AnnotationValue)a, targetTypeSystem,
                                         builder.setAnnotationArgument(s, a.Type, a.IsRuntimeVisible), genericArgs);
                    break;

                case Array:
                    var aab = builder.setArrayArgument(s);
                    foreach (var aa in a.Elements)
                    {
                        cloneAnnotationArgument(aa, targetTypeSystem, aab, genericArgs);
                    }
                    break;

                case Boolean:
                    builder.setBooleanArgument(s, (Boolean)a.Value);
                    break;

                case Byte:
                    builder.setByteArgument(s, (Byte)a.Value);
                    break;

                case Char:
                    builder.setCharArgument(s, (Character)a.Value);
                    break;

                case Double:
                    builder.setDoubleArgument(s, (Double)a.Value);
                    break;

                case Enum:
                    builder.setEnumArgument(s, a.getType(), a.Name);
                    break;

                case Float:
                    builder.setFloatArgument(s, (Float)a.Value);
                    break;

                case Int:
                    builder.setIntArgument(s, (Integer)a.Value);
                    break;

                case Long:
                    builder.setLongArgument(s, (Long)a.Value);
                    break;

                case Short:
                    builder.setShortArgument(s, (Short)a.Value);
                    break;

                case String:
                    builder.setStringArgument(s, (String)a.Value);
                    break;

                case Type:
                    builder.setTypeArgument(s, a.Type);
                    break;
                }
            }
        }
コード例 #17
0
 public static bool isIndexerSet(AnnotationValue annotation) {
     return annotation.Type.FullName.equals("stab/lang/IndexerSet");
 }