internal PackageVersion(global::System.Version version) { Major = (ushort)(version.Major >= 0 ? version.Major : 0); Minor = (ushort)(version.Minor >= 0 ? version.Minor : 0); Build = (ushort)(version.Build >= 0 ? version.Build : 0); Revision = (ushort)(version.Revision >= 0 ? version.Revision : 0); }
/// <summary> /// Checks the version of the file being read. /// </summary> /// <param name="serializationContext">Serialization context.</param> /// <param name="reader">Reader for the file being read. The reader is positioned at the open tag of the root element being read.</param> protected virtual void CheckVersion(DslModeling::SerializationContext serializationContext, global::System.Xml.XmlReader reader) { #region Check Parameters global::System.Diagnostics.Debug.Assert(serializationContext != null); if (serializationContext == null) throw new global::System.ArgumentNullException("serializationContext"); global::System.Diagnostics.Debug.Assert(reader != null); if (reader == null) throw new global::System.ArgumentNullException("reader"); #endregion global::System.Version expectedVersion = new global::System.Version("1.0.0.0"); string dslVersionStr = reader.GetAttribute("dslVersion"); if (dslVersionStr != null) { try { global::System.Version actualVersion = new global::System.Version(dslVersionStr); if (actualVersion != expectedVersion) { HostDesignerSerializationBehaviorSerializationMessages.VersionMismatch(serializationContext, reader, expectedVersion, actualVersion); } } catch (global::System.ArgumentException) { HostDesignerSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); } catch (global::System.FormatException) { HostDesignerSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); } catch (global::System.OverflowException) { HostDesignerSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); } } }
/// <summary> /// Checks the version of the file being read. /// </summary> /// <param name="serializationContext">Serialization context.</param> /// <param name="reader">Reader for the file being read. The reader is positioned at the open tag of the root element being read.</param> private static void CheckVersion(DslModeling::SerializationContext serializationContext, global::System.Xml.XmlReader reader) { global::System.Version expectedVersion = new global::System.Version("1.0.0.0"); string dslVersionStr = reader.GetAttribute("dslVersion"); if (dslVersionStr != null) { try { global::System.Version actualVersion = new global::System.Version(dslVersionStr); if (actualVersion != expectedVersion) { AsyncDslSerializationBehaviorSerializationMessages.VersionMismatch(serializationContext, reader, expectedVersion, actualVersion); } } catch (global::System.ArgumentException) { AsyncDslSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); } catch (global::System.FormatException) { AsyncDslSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); } catch (global::System.OverflowException) { AsyncDslSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); } } }