Skip to content

Allow Trizbort to detect if file version > app version #353

@andrewschultz

Description

@andrewschultz

It seems like it would be useful to make a popup box to warn the user information may be lost, and I already wrote code to put something out there, but I wanted to make an issue before dropping a pull request out of the blue.

If this is a good feature, I'd be open to changing what we should put in the popup box e.g. a link to Trizbort.com etc.

Line 186 in project.cs: checkDocVersion();

    public void checkDocVersion()
   {
        var AppVers = Version.Parse(Application.ProductVersion);
        var infoList = $"Executable Version = {Application.ProductVersion}{Environment.NewLine}Document Version = {Version.ToString()}{Environment.NewLine}";

        if (Version.Major < AppVers.Major) return;
        if (Version.Major > AppVers.Major)
        {
          MessageBox.Show(Program.MainForm,
            string.Format($"{infoList}The document is ahead a major version. Information is very likely to be lost."), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
          return;
        }

        if (Version.Minor < AppVers.Minor) return;
        if (Version.Minor > AppVers.Minor)
        {
          MessageBox.Show(Program.MainForm,
            string.Format($"{infoList}The document is ahead a minor version. Information is likely to be lost."), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
          return;
        }

        if (Version.Build < AppVers.Build) return;
        if (Version.Build > AppVers.Build)
        {
            MessageBox.Show(Program.MainForm,
            string.Format($"{infoList}The document is ahead a build. Information is somewhat likely to be lost."), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
        }

        if (Version.MinorRevision < AppVers.MinorRevision) return;
        if (Version.MinorRevision > AppVers.MinorRevision)
        {
            MessageBox.Show(Program.MainForm,
            string.Format($"{infoList}The document is ahead a minor revision. Information may possibly be lost."), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
        }
    }

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions