public void ToggleLibraryAsset(Project project, string[] paths) { foreach (string path in paths) { bool isResource = project.IsLibraryAsset(path); project.SetLibraryAsset(path, !isResource); } project.Save(); OnProjectModified(paths); }
public void AddLibraryAsset(Project project, string inDirectory) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = TextHelper.GetString("Label.AddLibraryAsset"); dialog.Filter = TextHelper.GetString("Info.FileFilter"); dialog.Multiselect = false; if (dialog.ShowDialog() == DialogResult.OK) { string filePath = CopyFile(dialog.FileName, inDirectory); // null means the user cancelled if (filePath == null) return; // add as an asset project.SetLibraryAsset(filePath, true); if (!FileInspector.IsSwc(filePath)) { // ask if you want to keep this file updated string caption = TextHelper.GetString("FlashDevelop.Title.ConfirmDialog"); string message = TextHelper.GetString("Info.ConfirmFileUpdate"); DialogResult result = MessageBox.Show(mainForm, message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { LibraryAsset asset = project.GetAsset(filePath); asset.UpdatePath = project.GetRelativePath(dialog.FileName); } } project.Save(); OnProjectModified(new string[] { filePath }); } }
public void RemoveAllReferences(Project project, string path) { if (project.IsLibraryAsset(path)) project.SetLibraryAsset(path, false); if (project.IsCompileTarget(path)) project.SetCompileTarget(path, false); }