private void ClearChangesOverviewCache(string modelPath) { if (string.IsNullOrEmpty(modelPath)) { return; } var overviewFile = PathManager.GetModelTempCacheOverviewFilePath(modelPath); if (File.Exists(overviewFile)) { File.Delete(overviewFile); } }
private void OnModelContentUpdated(string msg, object callback) { if (!this.IsActiveEditoInstance()) { return; } if (string.IsNullOrEmpty(msg)) { return; } string data = Utility.FromBase64(msg); int index = data.IndexOf("?"); if (index == -1) { return; } string modelPath = data.Substring(0, index); string content = data.Substring(index + 1); if (!File.Exists(modelPath)) { return; } // Append To total changes file File.AppendAllText(PathManager.GetModelTempCacheOverviewFilePath(modelPath), content + "\n"); // trigger update SyncEditorActionInOtherEditorInstances(window => { if (window == null || window.CommunicateServices == null) { return; } window.CommunicateServices.TriggerModelUpdate(modelPath, content); }); }
private void GetChangesOfModelSinceLastSave(string modelPath, object callback) { wrap = new CallbackWrapper(callback); if (!string.IsNullOrEmpty(modelPath)) { var overviewFile = PathManager.GetModelTempCacheOverviewFilePath(modelPath); if (File.Exists(overviewFile)) { wrap.Send(File.ReadAllText(overviewFile)); } else { wrap.Send(""); } } else { wrap.Send(""); } }