Check-in [1909930a85]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Only update when the version is actually higher. Respect the executable's current caps.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1:1909930a85664c93e745c9e931d3ad10ca3154a7
User & Date: tinus 2018-03-21 21:05:14
Context
2018-03-21
21:42
If a file name is passed, that is interpreted as a zip file; the updater will attempt to update ZTreeWin from that file. check-in: 52618a78f2 user: tinus tags: develop
21:05
Only update when the version is actually higher. Respect the executable's current caps. check-in: 1909930a85 user: tinus tags: develop
20:55
Improved readability, added using(). check-in: fea5f79177 user: tinus tags: develop
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ZTUpdater/ZTUpdater.cs.

40
41
42
43
44
45
46




47
48
49
50
51
52
53
54
...
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
                return _ZTreeHome;
            }
            set
            {
                _ZTreeHome = value;
                if (_ZTreeHome != null)
                {




                    Executable = Path.Combine(ZTreeHome, Executable);

                    // determine version of local executable
                    CurrentVersion = FileVersionInfo.GetVersionInfo(Executable).FileVersion;
                }
            }
        }

................................................................................
            }
        }

        public bool IsVersionNewer(string newVersion, string oldVersion)
        {
            var New = new Version(newVersion);
            var Old = new Version(oldVersion);
            return newVersion.CompareTo(oldVersion) >= 0;
        }

        public async Task<int> Update()
        {
            Log($"ZTreeWin version {CurrentVersion} located in \"{ZTreeHome}\".", TraceLevel.Info);
            if (!Directory.Exists(ZTreeHome))
                throw new DirectoryNotFoundException($"Directory \"{ZTreeHome}\" not found");







>
>
>
>
|







 







|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
                return _ZTreeHome;
            }
            set
            {
                _ZTreeHome = value;
                if (_ZTreeHome != null)
                {
                    var Executables = Directory.GetFiles(ZTreeHome, Executable);
                    if (Executables.Length > 0)
                        Executable = Executables[0];
                    else
                        Executable = Path.Combine(ZTreeHome, Executable);

                    // determine version of local executable
                    CurrentVersion = FileVersionInfo.GetVersionInfo(Executable).FileVersion;
                }
            }
        }

................................................................................
            }
        }

        public bool IsVersionNewer(string newVersion, string oldVersion)
        {
            var New = new Version(newVersion);
            var Old = new Version(oldVersion);
            return newVersion.CompareTo(oldVersion) > 0;
        }

        public async Task<int> Update()
        {
            Log($"ZTreeWin version {CurrentVersion} located in \"{ZTreeHome}\".", TraceLevel.Info);
            if (!Directory.Exists(ZTreeHome))
                throw new DirectoryNotFoundException($"Directory \"{ZTreeHome}\" not found");