Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SerializablePatch"/> class.
 /// </summary>
 public SerializablePatch()
 {
     Release = new SerializableRelease();
     m_releases = new Collection<SerializableRelease>();
     m_datafiles = new Collection<SerializableDatafile>();
     m_changedDatafiles = new Collection<SerializableDatafile>();
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SerializablePatch"/> class.
 /// </summary>
 public SerializablePatch()
 {
     Release            = new SerializableRelease();
     m_releases         = new Collection <SerializableRelease>();
     m_datafiles        = new Collection <SerializableDatafile>();
     m_changedDatafiles = new Collection <SerializableDatafile>();
 }
        /// <summary>
        /// Serializes the releases info for the patch file.
        /// </summary>
        /// <param name="serialReleases">The serial releases.</param>
        private void ExportReleases(IList<SerializableRelease> serialReleases)
        {
            SerializablePatch patch = TryDeserializePatchXml();
            if (patch == null)
                return;

            foreach (SerializableRelease release in patch.Releases
                .Where(release => Version.Parse(release.Version).Major != GetAssemblyVersion().ProductMajorPart))
            {
                serialReleases.Add(release);
            }

            if (patch.Releases.Any() && patch.Releases.All(release => Version.Parse(release.Version).Major != GetAssemblyVersion().ProductMajorPart))
                return;

            var serialRelease = new SerializableRelease
            {
                Date = dtpRelease.Value.ToString(DateTimeFormat, s_enUsCulture),
                Version = lblEVEMonVersion.Text,
                TopicAddress = rtbTopicUrl.Text,
                PatchAddress = String.Concat(rtbReleaseUrl.Text,
                    String.Format(CultureConstants.InvariantCulture, InstallerFilename, GetAssemblyVersion().ProductVersion)),
                MD5Sum = lblMD5Sum.Text,
                InstallerArgs = InstallerArgs,
                AdditionalArgs = AdditionalArgs,
                Message = rtbReleaseMessage.Text.Trim()
            };
            serialReleases.Add(serialRelease);
            serialReleases.StableSort((release, serializableRelease)
                => String.Compare(release.Version, serializableRelease.Version, StringComparison.Ordinal));
        }
        /// <summary>
        /// Serializes the release info for the patch file.
        /// </summary>
        /// <param name="serialRelease">The serial release.</param>
        private void ExportRelease(SerializableRelease serialRelease)
        {
            if (GetAssemblyVersion().FileMajorPart == 2)
            {
                serialRelease.Date = dtpRelease.Value.ToString(DateTimeFormat, s_enUsCulture);
                serialRelease.Version = lblEVEMonVersion.Text;
                serialRelease.TopicAddress = rtbTopicUrl.Text;
                serialRelease.PatchAddress = String.Concat(rtbReleaseUrl.Text,
                    String.Format(CultureConstants.InvariantCulture, InstallerFilename, GetAssemblyVersion().ProductVersion));
                serialRelease.MD5Sum = lblMD5Sum.Text;
                serialRelease.InstallerArgs = InstallerArgs;
                serialRelease.AdditionalArgs = AdditionalArgs;
                serialRelease.Message = rtbReleaseMessage.Text.Trim();
                return;
            }

            SerializablePatch patch = TryDeserializePatchXml();
            if (patch == null)
                return;

            serialRelease.Date = patch.Release.Date;
            serialRelease.Version = patch.Release.Version;
            serialRelease.TopicAddress = patch.Release.TopicAddress;
            serialRelease.PatchAddress = patch.Release.PatchAddress;
            serialRelease.MD5Sum = patch.Release.MD5Sum;
            serialRelease.InstallerArgs = patch.Release.InstallerArgs;
            serialRelease.AdditionalArgs = patch.Release.AdditionalArgs;
            serialRelease.Message = patch.Release.Message;
        }