public void RemoveProject(string projectFilePath) { RecentProjectList recentProjects = JsonConvert.DeserializeObject <RecentProjectList>(ProjectHistory); recentProjects.projectPaths.Remove(projectFilePath); ProjectHistory = JsonConvert.SerializeObject(recentProjects); }
public void CreateProject(string parentFolderFilePath, string projectFolderName) { if (String.IsNullOrEmpty(parentFolderFilePath)) { parentFolderFilePath = Application.persistentDataPath; } if (!parentFolderFilePath.EndsWith("\\") && !parentFolderFilePath.EndsWith("/")) { parentFolderFilePath += "/"; } string projectPath = parentFolderFilePath + projectFolderName + "/"; ProjectScene.StartupProjectPath = projectPath; RecentProjectList recentProjects = JsonConvert.DeserializeObject <RecentProjectList>(ProjectHistory); if (recentProjects.projectPaths.Contains(projectPath)) { recentProjects.projectPaths.Remove(projectPath); } recentProjects.projectPaths.Add(projectPath); ProjectHistory = JsonConvert.SerializeObject(recentProjects); SceneManager.LoadScene("Project Scene"); }
/// <summary> /// 移除最近打开记录 /// </summary> /// <param name="file">打开文件</param> public void Preference_RemoveRecentRecord(FileInfo file) { List <string> list = RecentProjectList.ToList(); string path = file.FullName; if (list.Contains(path)) { list.Remove(path); } RecentProjectList = list.ToArray(); }
public StartPageWebBrowser(String pageUrl, String rssUrl) { this.rssUrl = rssUrl; this.pageUrl = pageUrl; this.InitializeDragDrop(); this.InitializeComponent(); this.startPageActions = new StartPageActions(); this.recentProjectList = new RecentProjectList(); this.webBrowser.ObjectForScripting = this.startPageActions; this.startPageActions.DocumentCompleted += new EventHandler(WebBrowserDocumentCompleted); this.ShowStartPage(); }
public void AddProject(string projectFilePath) { // DialogResult dialogResult = MessageBox.Show("Not Implemented Yet...", "Error!"); RecentProjectList recentProjects = JsonConvert.DeserializeObject <RecentProjectList>(ProjectHistory); if (recentProjects.projectPaths.Contains(projectFilePath)) { recentProjects.projectPaths.Remove(projectFilePath); } recentProjects.projectPaths.Add(projectFilePath); ProjectHistory = JsonConvert.SerializeObject(recentProjects); UpdateOpenProjectPanel(); }
/// <summary> /// 增加最近打开记录 /// </summary> /// <param name="file">打开文件</param> public void Preference_AddRecentRecord(FileInfo file) { List <string> list = RecentProjectList.ToList(); string path = file.FullName; if (list.Contains(path)) { list.Remove(path); } list.Insert(0, path); while (list.Count > Prefrence_MaxRecentProjectCount) { list.RemoveAt(list.Count - 1); } RecentProjectList = list.ToArray(); }
public void UpdateOpenProjectPanel() { foreach (GameObject openProjectButton in OpenProjectPanelButtons) { Destroy(openProjectButton); } OpenProjectPanelButtons.Clear(); RecentProjectList recentProjects = JsonConvert.DeserializeObject <RecentProjectList>(ProjectHistory); bool noProjects = recentProjects.projectPaths.Count == 0; ProjectListEmptyMessage.SetActive(noProjects); ProjectListScrollArea.SetActive(!noProjects); List <string> removedProjects = new List <string>(); if (!noProjects) { foreach (string recentProjectPath in recentProjects.projectPaths) { if (!Directory.Exists(recentProjectPath) || !File.Exists(recentProjectPath + "/manifest.json")) { removedProjects.Add(recentProjectPath); continue; } GameObject newObject = Instantiate(OpenProjectButtonPrefab, ProjectListContentArea); OpenProjectPanelButtons.Add(newObject); OpenProjectButton openProjectButton = newObject.GetComponent <OpenProjectButton>(); openProjectButton.Setup(this, recentProjectPath); } if (removedProjects.Count > 0) { foreach (string removedProjectPath in removedProjects) { recentProjects.projectPaths.Remove(removedProjectPath); } ProjectHistory = JsonConvert.SerializeObject(recentProjects); } } }