Esempio n. 1
0
        internal static string ImportFile(Project prj, string file)
        {
            ProjectFile pfile = prj.Files.GetFile(file);

            if (pfile == null)
            {
                var files = IdeApp.ProjectOperations.AddFilesToProject(prj, new string[] { file }, prj.BaseDirectory);
                if (files.Count == 0 || files[0] == null)
                {
                    return(null);
                }
                pfile = files [0];
            }
            if (pfile.BuildAction == BuildAction.EmbeddedResource)
            {
                AlertButton embedButton = new AlertButton(GettextCatalog.GetString("_Use as Source"));
                if (MessageService.AskQuestion(GettextCatalog.GetString("You are requesting the file '{0}' to be used as source for an image. However, this file is already added to the project as a resource. Are you sure you want to continue (the file will have to be removed from the resource list)?"), AlertButton.Cancel, embedButton) == embedButton)
                {
                    return(null);
                }
            }
            pfile.BuildAction = BuildAction.Content;
            DeployProperties props = DeployService.GetDeployProperties(pfile);

            props.UseProjectRelativePath = true;
            return(pfile.FilePath);
        }
Esempio n. 2
0
        public void Store()
        {
            DotNetProject project = entry as DotNetProject;

            if (project == null)
            {
                return;
            }

            LinuxDeployData data = LinuxDeployData.GetLinuxDeployData(project);

            data.GenerateScript = checkScript.Active;
            data.ScriptName     = entryScript.Text;
            data.GeneratePcFile = checkPcFile.Active;

            if (checkDesktop.Active)
            {
                DesktopEntry de = new DesktopEntry();
                de.SetEntry("Encoding", "UTF-8");
                de.Type     = DesktopEntryType.Application;
                de.Name     = entry.Name;
                de.Exec     = entryScript.Text;
                de.Terminal = false;
                string file = System.IO.Path.Combine(entry.BaseDirectory, "app.desktop");
                de.Save(file);
                ProjectFile      pfile = project.AddFile(file, BuildAction.Content);
                DeployProperties props = DeployService.GetDeployProperties(pfile);
                props.TargetDirectory = LinuxTargetDirectory.DesktopApplications;
            }
        }
 void OnFileAdded(object o, ProjectFileEventArgs args)
 {
     foreach (ProjectFileEventInfo a in args)
     {
         if (a.ProjectFile.Name.EndsWith(".desktop"))
         {
             DesktopEntry de = new DesktopEntry();
             try {
                 de.Load(a.ProjectFile.Name);
                 a.ProjectFile.BuildAction = BuildAction.Content;
                 DeployProperties props = DeployService.GetDeployProperties(a.ProjectFile);
                 props.TargetDirectory = LinuxTargetDirectory.DesktopApplications;
                 if (string.IsNullOrEmpty(de.Exec))
                 {
                     LinuxDeployData dd = LinuxDeployData.GetLinuxDeployData(a.Project);
                     if (dd.GenerateScript && !string.IsNullOrEmpty(dd.ScriptName))
                     {
                         de.Exec = dd.ScriptName;
                         de.Save(a.ProjectFile.Name);
                     }
                 }
             } catch (Exception ex) {
                 LoggingService.LogError("Could not read .desktop file", ex);
             }
         }
     }
 }
		public ProjectFileWrapper (ProjectFile file)
		{
			props = DeployService.GetDeployProperties (file);
			this.file = file;
		}
Esempio n. 5
0
 public ProjectFileWrapper(ProjectFile file)
 {
     props     = DeployService.GetDeployProperties(file);
     this.file = file;
 }