/// <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);
        }
Exemple #2
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);
        }