public static TodoData LoadData() { string serializedData = EditorPrefs.GetString("PHL.ToDo.Data." + Application.dataPath, ""); TodoData todoData = new TodoData(); todoData.autoScan = true; if (!string.IsNullOrEmpty(serializedData)) { EditorJsonUtility.FromJsonOverwrite(serializedData, todoData); } return(todoData); }
private void RefreshFiles() { if (_data == null) { _data = new TodoData(); } _data.entries = new List <TodoEntry>(); var assetsDir = new DirectoryInfo(Application.dataPath); _files = assetsDir.GetFiles("*.cs", SearchOption.AllDirectories) .Concat(assetsDir.GetFiles("*.js", SearchOption.AllDirectories)) .ToArray(); }
private void OnGUI() { if (_data == null) { _data = new TodoData(); GUILayout.Label("No data loaded", EditorStyles.centeredGreyMiniLabel); return; } Toolbar(); using (new HorizontalBlock()) { Sidebar(); MainArea(); } }
private void OnEnable() { if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } RefreshFiles(); _data = LoadData(); RefreshEntriesToShow(); if (_data.autoScan) { _watcher = new FileSystemWatcher(Application.dataPath, "*.cs"); _watcher.Changed += OnChanged; _watcher.Deleted += OnDeleted; _watcher.Renamed += OnRenamed; _watcher.Created += OnCreated; _watcher.EnableRaisingEvents = true; _watcher.IncludeSubdirectories = true; } }
public static void SaveData(TodoData data) { EditorPrefs.SetString("PHL.ToDo.Data." + Application.dataPath, EditorJsonUtility.ToJson(data)); }