private void UpdateProjectFile(Models.Package[] packages, MonoDevelop.Core.FilePath projectFilePath) { var fallBackString = $@"<PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <AssetTargetFallback>{GetFallbackPlatforms(packages)}</AssetTargetFallback> </PropertyGroup>"; var xmlString = $@"<?xml version=""1.0"" encoding=""utf-8""?> <Project Sdk = ""Microsoft.NET.Sdk"" > <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> </PropertyGroup>{fallBackString} <ItemGroup>"; var packageReferences = String.Empty; var packagesArray = packages.ToArray(); foreach (var package in packagesArray) { packageReferences += $"<PackageReference Include=\"{package.Id}\" Version=\"{package.Version}\" />"; } xmlString = xmlString + packageReferences + "</ItemGroup></Project>"; var currentItem = IdeApp.ProjectOperations.CurrentSelectedSolution.Items.FirstOrDefault(x => x.FileName.ParentDirectory.ToString() == projectFilePath.ToString()); var csprojPath = currentItem.FileName.ToString(); File.Delete(csprojPath); File.WriteAllText(csprojPath, xmlString); }
private void RemoveAssemblyInfoFile(MonoDevelop.Core.FilePath projectFilePath) { var assemblyInfoFilePath = projectFilePath.ParentDirectory.ToString() + "/Properties/AssemblyInfo.cs"; if (File.Exists(assemblyInfoFilePath)) { File.Delete(assemblyInfoFilePath); } }
public bool CanHandle(MonoDevelop.Core.FilePath fileName, string mimeType, MonoDevelop.Projects.Project ownerProject) { if (exclude) { return(false); } if (mimeType != null && mimeType == "application/x-xeto") { return(true); } var info = Eto.Designer.BuilderInfo.Find(fileName); return(info != null); }
private IEnumerable <Models.Package> UpdatePackageConfigFile(MonoDevelop.Core.FilePath solutionPath) { var packageConfigFilePath = String.Empty; FindRecursive(solutionPath.ParentDirectory.ToString(), "packages.config", out packageConfigFilePath); var packages = XElement.Load(packageConfigFilePath).Elements("package"); var root = packages.FirstOrDefault()?.Parent; foreach (var package in packages) { var packageModel = new Models.Package() { Id = package.Attribute("id").Value, TargetFramework = package.Attribute("targetFramework").Value, Version = package.Attribute("version").Value, }; yield return(packageModel); } File.Delete(packageConfigFilePath); }
public override Annotation[] GetAnnotations(MonoDevelop.Core.FilePath repositoryPath) { return(new Annotation[0]); }
public override bool CanGetAnnotations(MonoDevelop.Core.FilePath localPath) { return(IsHistoryAvailable(localPath)); }
protected override void OnRevertToRevision(MonoDevelop.Core.FilePath localPath, Revision revision, MonoDevelop.Core.IProgressMonitor monitor) { throw new NotImplementedException(); }
/// <summary> /// Requests permission for modifying a file /// </summary> /// <param name="fileName">The file to be modified</param> /// <param name="throwIfFails">If set to false, it will catch the exception that would've been thrown.</param> /// <remarks>This method must be called before trying to write any file. It throws an exception if permission is not granted.</remarks> public static bool RequestFileEdit(FilePath fileName, bool throwIfFails = true) { Debug.Assert(!String.IsNullOrEmpty(fileName)); return(RequestFileEdit(new FilePath[] { fileName }, throwIfFails)); }
protected override Repository OnPublish(string serverPath, MonoDevelop.Core.FilePath localPath, MonoDevelop.Core.FilePath[] files, string message, MonoDevelop.Core.IProgressMonitor monitor) { throw new NotImplementedException(); }
protected override VersionInfo[] OnGetDirectoryVersionInfo(MonoDevelop.Core.FilePath localDirectory, bool getRemoteStatus, bool recursive) { throw new NotImplementedException(); }
protected override Revision[] OnGetHistory(MonoDevelop.Core.FilePath localFile, Revision since) { throw new NotImplementedException(); }
public override string GetBaseText(MonoDevelop.Core.FilePath localFile) { return(OnGetTextAtRevision(localFile, new MercurialRevision(this, MercurialRevision.Head))); }
public static void NotifyFileChanged(FilePath fileName, bool autoReload) { NotifyFilesChanged(new FilePath[] { fileName }, autoReload); }
public static void NotifyFileChanged(FilePath fileName) { NotifyFileChanged(fileName, false); }
public bool IsSourceCodeFile(MonoDevelop.Core.FilePath fileName) { return(fileName.Extension == ".coffee"); }
protected override void OnCheckout(MonoDevelop.Core.FilePath targetLocalPath, Revision rev, bool recurse, MonoDevelop.Core.IProgressMonitor monitor) { throw new NotImplementedException(); }
public MonoDevelop.Core.FilePath GetFileName(MonoDevelop.Core.FilePath fileNameWithoutExtension) { var file = new FilePath(fileNameWithoutExtension.FileNameWithoutExtension + ".coffee"); return(file); }
static void HandleUserDataMigration(object sender, ExtensionNodeEventArgs args) { if (args.Change != ExtensionChange.Add) { return; } var node = (UserDataMigrationNode)args.ExtensionNode; if (node.SourceVersion != version) { return; } FilePath source = FilePath.Null; FilePath target = FilePath.Null; try { source = profile.GetLocation(node.Kind).Combine(node.SourcePath); target = PropertyService.Locations.GetLocation(node.Kind).Combine(node.TargetPath); bool sourceIsDirectory = Directory.Exists(source); if (sourceIsDirectory) { if (Directory.Exists(target)) { return; } } else { if (File.Exists(target) || Directory.Exists(target) || !File.Exists(source)) { return; } } LoggingService.LogInfo("Migrating '{0}' to '{1}'", source, target); if (!sourceIsDirectory) { FileService.EnsureDirectoryExists(target.ParentDirectory); } var handler = node.GetHandler(); if (handler != null) { handler.Migrate(source, target); return; } if (sourceIsDirectory) { DirectoryCopy(source, target); } else { File.Copy(source, target); } } catch (Exception ex) { string message = string.Format("{0}: Failed to migrate '{1}' to '{2}'", node.Addin.Id, source.ToString() ?? "", target.ToString() ?? ""); LoggingService.LogError(message, ex); } }