private void WriteLatestToolVersion(string toolName, string version) { try { string path = NGChangeLogWindow.GetToolPath(toolName); File.WriteAllText(path, version); } catch (Exception ex) { InternalNGDebug.LogException(ex); } }
public static void CheckLatestVersion(string toolName) { if (NGEditorPrefs.GetBool(NGChangeLogWindow.DontNotifyNewUpdateKeyPref) == true) { return; } try { // Prevent repeating initialization. foreach (KeyValuePair <string, int> item in NGChangeLogWindow.pendingTools) { if (item.Key == toolName) { return; } } List <ChangeLog> changeLog; if (NGChangeLogWindow.changeLogs.TryGetValue(toolName, out changeLog) == true) { changeLog.Sort((a, b) => a.version.CompareTo(b.version)); string local = NGChangeLogWindow.GetToolPath(toolName); if (File.Exists(local) == true) { string version = File.ReadAllText(local); for (int i = 0; i < changeLog.Count; i++) { if (version.CompareTo(changeLog[i].version) < 0) { NGChangeLogWindow.pendingTools.Enqueue(new KeyValuePair <string, int>(toolName, i)); NGChangeLogWindow.Open(); break; } } } else { File.WriteAllText(local, changeLog[changeLog.Count - 1].version); } } } catch (Exception ex) { InternalNGDebug.LogException(ex); } }
private static void Open() { if (NGChangeLogWindow.updateNotificationWindow == null) { NGChangeLogWindow.updateNotificationWindow = EditorWindow.CreateInstance <NGChangeLogWindow>(); NGChangeLogWindow.updateNotificationWindow.name = NGChangeLogWindow.Title; NGChangeLogWindow.updateNotificationWindow.minSize = new Vector2(400F, 350F); NGChangeLogWindow.updateNotificationWindow.maxSize = NGChangeLogWindow.updateNotificationWindow.minSize; Rect r = Utility.GetEditorMainWindowPos(); r.x += r.width / 2F - 200F; r.y += r.height / 2F - 175F; r.width = 400F; r.height = 350F; NGChangeLogWindow.updateNotificationWindow.position = r; NGChangeLogWindow.updateNotificationWindow.ShowPopup(); } else { NGChangeLogWindow.updateNotificationWindow.Repaint(); } }