Пример #1
0
        /// <summary>
        /// When converting a list of headers to an <see cref="ExtensibleObject"/>, this
        /// method sets the common attributes on the object.
        /// </summary>
        /// <param name="obj">The <see cref="ExtensibleObject"/> to be populated</param>
        /// <param name="headers">The <see cref="HeaderCollection"/> containing the list of headers</param>
        protected static void SetCommonAttributesFromHeaders(ExtensibleObject obj, HeaderCollection headers)
        {
            if (obj != null && headers != null)
            {
                Header hMachineName = headers.Get(Header.ORIGIN_MACHINE_NAME);
                if (hMachineName != null && !String.IsNullOrEmpty(hMachineName.Value))
                {
                    obj.machineName = hMachineName.Value;
                }

                Header hSoftwareName = headers.Get(Header.ORIGIN_SOFTWARE_NAME);
                if (hSoftwareName != null && !String.IsNullOrEmpty(hSoftwareName.Value))
                {
                    obj.softwareName = hSoftwareName.Value;
                }

                Header hSoftwareVersion = headers.Get(Header.ORIGIN_SOFTWARE_VERSION);
                if (hSoftwareVersion != null && !String.IsNullOrEmpty(hSoftwareVersion.Value))
                {
                    obj.softwareVersion = hSoftwareVersion.Value;
                }

                Header hPlatformName = headers.Get(Header.ORIGIN_PLATFORM_NAME);
                if (hPlatformName != null && !String.IsNullOrEmpty(hPlatformName.Value))
                {
                    obj.platformName = hPlatformName.Value;
                }

                Header hPlatoformVersion = headers.Get(Header.ORIGIN_PLATFORM_VERSION);
                if (hPlatoformVersion != null && !String.IsNullOrEmpty(hPlatoformVersion.Value))
                {
                    obj.platformVersion = hPlatoformVersion.Value;
                }
            }
        }