/// <summary>
        /// Gets all tasks from ProjectFile instance.
        /// </summary>
        /// <param name="projectFile">ProjectFile instance.</param>
        /// <returns>List of tasks.</returns>
        protected Task[] getAllProjectTasks(ProjectFile projectFile)
        {
            //get tasks
            java.util.List taskList = projectFile.AllTasks;

            //convert to array
            object[] allTaskObjs = taskList.toArray();

            //create alternate storage
            Task[] allTasks = new Task[allTaskObjs.Length];

            //then cast each object to a Task
            for(int o = 0; o < allTaskObjs.Length; o++)
            {
                //cast
                allTasks[o] = (Task)allTaskObjs[o];
                //then nullify the initial value, be nice to your memory and it WILL return the favor
                allTaskObjs[o] = null;
            }

            //nullify primary storage
            allTaskObjs = null;

            //then return the secondary list, otherwise permit a run-time exception
            //this is a wild bunch of magic anyways
            return allTasks;
        }
Exemple #2
0
        /// <summary>
        /// This method lists all resource assignments defined in the file.
        /// </summary>
        /// <param name="file">project file</param>
        private static void listAssignments(ProjectFile file)
        {
            Task task;
            Resource resource;
            String taskName;
            String resourceName;

            foreach (ResourceAssignment assignment in file.AllResourceAssignments.ToIEnumerable())
            {
                task = assignment.Task;
                if (task == null)
                {
                    taskName = "(null task)";
                }
                else
                {
                    taskName = task.Name;
                }

                resource = assignment.Resource;
                if (resource == null)
                {
                    resourceName = "(null resource)";
                }
                else
                {
                    resourceName = resource.Name;
                }

                System.Console.WriteLine("Assignment: Task=" + taskName + " Resource=" + resourceName);
            }

            System.Console.WriteLine();
        }
Exemple #3
0
 private static void ProcessProjectFile(CommandLine commandLine)
 {
     Log.Info("Converting VS project to target .NET 3.5");
     Log.DebugFormat("Will convert {0} to {1}", commandLine.ProjectFile, commandLine.OutputFile);
     var projectFile = new ProjectFile(commandLine.ProjectFile);
     projectFile.TransformToNet35();
     Log.InfoFormat("{0} -> {1}", commandLine.ProjectFile, commandLine.OutputFile);
     projectFile.SaveTo(commandLine.OutputFile);
 }
Exemple #4
0
 internal StandardCompileEntry(Solution solution, Project project, ProjectFile file, int line, int col, string message)
 {
     p_Solution = solution;
     p_Project = project;
     p_File = file;
     p_Line = line;
     p_Column = col;
     p_Message = message;
 }
 private void RemoveDeviceSpecificWithCorrespondingDesktop(ProjectFile file, Dictionary<string, ProjectFile> views) {
     string path = file.RelativePath;
     if (path.EndsWith(DeviceSpecificExtension, StringComparison.OrdinalIgnoreCase)) {
         int preSuffixIndex = path.Length - DeviceSpecificExtension.Length;
         string desktopPath = path.Substring(0, preSuffixIndex) + ".cshtml";
         if (views.ContainsKey(desktopPath)) {
             views.Remove(desktopPath);
             views.Remove(path);
         }
     }
 }
 private bool IsMobileWithCorrespondingDesktop(ProjectFile file, Dictionary<string, ProjectFile> views) {
     string path = file.RelativePath;
     if (path.EndsWith(".mobile.cshtml", StringComparison.OrdinalIgnoreCase)) {
         int preMobileIndex = path.Length - ".mobile.cshtml".Length;
         string desktopPath = path.Substring(0, preMobileIndex) + ".cshtml";
         if (views.ContainsKey(desktopPath)) {
             views.Remove(desktopPath);
             return true;
         }
     }
     return false;
 }
 public void Save(ProjectFile file)
 {
     string key = CreateProjectFileKey(file.ProjectId, file.FilePath);
     if (_files.ContainsKey(key))
     {
         // Update the existing file.
         _files[key] = file;
     }
     else
     {
         file.Id = _files.Count + 1;
         _files.Add(key, file);
     }
 }
Exemple #8
0
        /// <summary>
        /// Perform the conversion, writing data to the provided output path
        /// </summary>
        /// <param name="outputFilePath">Path of output xml file (should have the extension .xml so the MPXJ library automatically infers the file type)</param>
        public void Convert(string outputFilePath)
        {
            // Open and parse dPOW file
            pow = PlanOfWork.OpenJson(inputFilePath);

            // Create project file
            project = new ProjectFile();

            // Insert data to project file
            InsertDataToProject();

            // Write file to mpx
            ProjectWriter mpxWriter = ProjectWriterUtility.getProjectWriter(outputFilePath);
            mpxWriter.write(project, outputFilePath);
        }
Exemple #9
0
        public void CreateProject(string name, string path, string Template)
        {
            var d = new DirectoryInfo(path + "\\" + name);
            Directory.CreateDirectory(d.FullName );
            ZipFile.ExtractToDirectory("./Templates/" + Template + ".zip", d.FullName);
            var z = new ProjectFile();
            z.Name = name;

            foreach (var i in File.ReadAllLines(Path.Combine(d.FullName, "index.dat")))
            {
                if (i != "")
                {
                    z.Files.Add(i);

                }
            }

            File.WriteAllText(Path.Combine(d.FullName, name + ".proj"), JsonConvert.SerializeObject(z));
            Global.CurrentProjectFile = z;
            Global.CurrentProjectFilePath = d.FullName;
            this.Close();
        }
Exemple #10
0
    public Project(string filename)
    {
        p_Filename = filename;

        //perform restore (if needed)
        Helpers.Restore(filename);

        //open the file
        FileStream fileStream = new FileStream(filename, FileMode.Open);

        //read the header
        p_Header = new header();
        p_Header.load(fileStream, this);

        //read the project name
        p_ProjectName = Helpers.ReadString255(fileStream);

        //read the build directory
        p_BuildDirectory = Helpers.ReadString(fileStream);

        //read the directories
        int directoryLength = Helpers.DecodeInt32(fileStream);
        p_Directories = new ProjectEntity[directoryLength];
        for (int c = 0; c < directoryLength; c++) {
            p_Directories[c] = new ProjectDirectory(null, this);
            p_Directories[c].Load(fileStream);
        }

        //read the files
        int fileLength = Helpers.DecodeInt32(fileStream);
        p_Files = new ProjectEntity[fileLength];
        for (int c = 0; c < fileLength; c++) {
            p_Files[c] = new ProjectFile(null, this);
            p_Files[c].Load(fileStream);
        }

        //clean up
        fileStream.Close();
    }
        public static void GetBuildParams(ProjectFile proj)
        {
            ConsoleLogger logger = new ConsoleLogger(LoggerVerbosity.Normal);
            BuildManager manager = BuildManager.DefaultBuildManager;

            ProjectInstance projectInstance = new ProjectInstance(proj.ProjectPath.FullName);

            var result = manager.Build(
                new BuildParameters() {
                    DetailedSummary = true,
                    Loggers = new List<ILogger>() { logger }
                },
                new BuildRequestData(projectInstance, new string[]
                {
                    "ResolveProjectReferences",
                    "ResolveAssemblyReferences"
                })
            );

            proj.ReferenceCompileArg = string.Empty;
            proj.ReferencePaths = new List<FileInfo>();
            var projRefs = PrintResultItems(proj, result, "ResolveProjectReferences");
            var projAssemRefs = PrintResultItems(proj, result, "ResolveAssemblyReferences");
        }
        private void WriteFilesAsync(List<FileToCreate> files)
        {
            var project = new ProjectFile(files, AddNewFilesToProject, UseTfsToCheckoutFiles ? TfsWorkspace: null);

            if (Debugger.IsAttached)
            {
                foreach (var file in files)
                {
                    WriteFileIfDifferent(project, file);
                }
            }
            else
            {
                Parallel.ForEach(files, f => WriteFileIfDifferent(project, f));  
            }

            if (AddNewFilesToProject && !project.ProjectFound)
            {
                Log("Unable to find a Project file to add newly created files to.  Either output the files into a directory that has a single project in it's path, or uncheck the \"Add New Files to Project\" Setting");
            }

            if (project.ProjectUpdated)
            {
                WriteFileIfDifferent(new ProjectFile(null, false, null), new FileToCreate(project.ProjectPath, project.GetContents()));
            }
        }
 public FileCompletionData(ProjectFile file, Func <ProjectFile, string> pathFunc)
 {
     this.file     = file;
     this.pathFunc = pathFunc;
 }
Exemple #14
0
        ProjectItemInformation CreateDirectoryProjectItemInformationIfDirectoryNotAlreadyIncluded(ProjectFile fileItem)
        {
            string directory = fileItem.FilePath;

            if (!IsDirectoryIncludedAlready(directory))
            {
                AddIncludedDirectory(directory);
                return(fileItem.ToProjectItemInformation());
            }
            return(null);
        }
Exemple #15
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {

                var sel = treeView1.SelectedNode.FullPath.Replace(Global.CurrentProjectFile.Name + "\\", "");

                if (!sel.Contains("."))
                {
                    foreach (var i in Global.CurrentProjectFile.Files.ToArray().ToList())
                    {
                        if (new FileInfo(i).Directory.Name == sel)
                        {
                            Global.CurrentProjectFile.Files.RemoveAt(Global.CurrentProjectFile.Files.IndexOf(i));
                        }
                    }
                    foreach (var i in Directory.EnumerateFiles(Path.Combine(Global.CurrentProjectFilePath, "files", sel)))
                    {
                        File.Delete(i);
                    }

                    Directory.Delete(Path.Combine(Global.CurrentProjectFilePath, "files", sel));
                }
                else
                {
                    foreach (var i in Global.CurrentProjectFile.Files.ToArray().ToList())
                    {
                        if (i == sel)
                        {
                            Global.CurrentProjectFile.Files.RemoveAt(Global.CurrentProjectFile.Files.IndexOf(i));
                            File.Delete(Path.Combine(Global.CurrentProjectFilePath, "files", i));
                        }
                    }

                }
            }
            catch (Exception ee)
            {

            }
            Global.Save();
            buffer = null;
        }
Exemple #16
0
 bool IsDirectory(ProjectFile fileItem)
 {
     return(fileItem.FilePath.IsDirectory);
 }
Exemple #17
0
        public object Build(
            CSharp.Assembly moduleToBuild,
            out System.Boolean success)
        {
            var assemblyModule = moduleToBuild as Bam.Core.BaseModule;
            var node = assemblyModule.OwningNode;
            var target = node.Target;
            var options = assemblyModule.Options as CSharp.OptionCollection;

            var moduleName = node.ModuleName;

            string platformName;
            switch ((options as CSharp.IOptions).Platform)
            {
                case CSharp.EPlatform.AnyCpu:
                    platformName = "AnyCPU";
                    break;

                case CSharp.EPlatform.X86:
                    platformName = "x86";
                    break;

                case CSharp.EPlatform.X64:
                case CSharp.EPlatform.Itanium:
                    platformName = "x64";
                    break;

                default:
                    throw new Bam.Core.Exception("Unrecognized platform");
            }

            ICSProject projectData = null;
            // TODO: want to remove this
            lock (this.solutionFile.ProjectDictionary)
            {
                if (this.solutionFile.ProjectDictionary.ContainsKey(moduleName))
                {
                    projectData = this.solutionFile.ProjectDictionary[moduleName] as ICSProject;
                }
                else
                {
                    var solutionType = Bam.Core.State.Get("VSSolutionBuilder", "SolutionType") as System.Type;
                    var SolutionInstance = System.Activator.CreateInstance(solutionType);
                    var ProjectExtensionProperty = solutionType.GetProperty("ProjectExtension");
                    var projectExtension = ProjectExtensionProperty.GetGetMethod().Invoke(SolutionInstance, null) as string;

                    var projectDir = node.GetModuleBuildDirectoryLocation().GetSinglePath();
                    var projectPathName = System.IO.Path.Combine(projectDir, moduleName);
                    projectPathName += projectExtension;

                    var projectType = VSSolutionBuilder.GetProjectClassType();
                    projectData = System.Activator.CreateInstance(projectType, new object[] { moduleName, projectPathName, node.Package.Identifier, assemblyModule.ProxyPath }) as ICSProject;

                    this.solutionFile.ProjectDictionary.Add(moduleName, projectData);
                }
            }

            {
                if (!projectData.Platforms.Contains(platformName))
                {
                    projectData.Platforms.Add(platformName);
                }
            }

            // solution folder
            {
                var groups = moduleToBuild.GetType().GetCustomAttributes(typeof(Bam.Core.ModuleGroupAttribute), true);
                if (groups.Length > 0)
                {
                    projectData.GroupName = (groups as Bam.Core.ModuleGroupAttribute[])[0].GroupName;
                }
            }

            if (node.ExternalDependents != null)
            {
                foreach (var dependentNode in node.ExternalDependents)
                {
                    if (dependentNode.ModuleName == moduleName)
                    {
                        continue;
                    }

                    // TODO: want to remove this
                    lock (this.solutionFile.ProjectDictionary)
                    {
                        if (this.solutionFile.ProjectDictionary.ContainsKey(dependentNode.ModuleName))
                        {
                            var dependentProject = this.solutionFile.ProjectDictionary[dependentNode.ModuleName];
                            projectData.DependentProjects.Add(dependentProject);
                        }
                    }
                }
            }

            // references
            // TODO: convert to var
            foreach (Bam.Core.Location location in (options as CSharp.IOptions).References)
            {
                var reference = location.GetSinglePath();
                projectData.References.Add(reference);
            }

            var configurationName = VSSolutionBuilder.GetConfigurationNameFromTarget(target, platformName);

            ProjectConfiguration configuration;
            lock (projectData.Configurations)
            {
                if (!projectData.Configurations.Contains(configurationName))
                {
                    // TODO: fix me?
                    configuration = new ProjectConfiguration(configurationName, projectData);
                    configuration.CharacterSet = EProjectCharacterSet.NotSet;
                    projectData.Configurations.Add((Bam.Core.BaseTarget)target, configuration);
                }
                else
                {
                    configuration = projectData.Configurations[configurationName];
                    projectData.Configurations.AddExistingForTarget((Bam.Core.BaseTarget)target, configuration);
                }
            }

            var fields = moduleToBuild.GetType().GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic);
            foreach (var field in fields)
            {
                // C# files
                {
                    var sourceFileAttributes = field.GetCustomAttributes(typeof(Bam.Core.SourceFilesAttribute), false);
                    if (null != sourceFileAttributes && sourceFileAttributes.Length > 0)
                    {
                        var sourceField = field.GetValue(moduleToBuild);
                        if (sourceField is Bam.Core.Location)
                        {
                            var file = sourceField as Bam.Core.Location;
                            var absolutePath = file.GetSinglePath();
                            if (!System.IO.File.Exists(absolutePath))
                            {
                                throw new Bam.Core.Exception("Source file '{0}' does not exist", absolutePath);
                            }

                            ProjectFile sourceFile;
                            lock (projectData.SourceFiles)
                            {
                                if (!projectData.SourceFiles.Contains(absolutePath))
                                {
                                    sourceFile = new ProjectFile(absolutePath);
                                    sourceFile.FileConfigurations = new ProjectFileConfigurationCollection();
                                    projectData.SourceFiles.Add(sourceFile);
                                }
                                else
                                {
                                    sourceFile = projectData.SourceFiles[absolutePath];
                                }
                            }
                        }
                        else if (sourceField is Bam.Core.FileCollection)
                        {
                            var sourceCollection = sourceField as Bam.Core.FileCollection;
                            // TODO: convert to var
                            foreach (Bam.Core.Location location in sourceCollection)
                            {
                                var absolutePath = location.GetSinglePath();
                                if (!System.IO.File.Exists(absolutePath))
                                {
                                    throw new Bam.Core.Exception("Source file '{0}' does not exist", absolutePath);
                                }

                                ProjectFile sourceFile;
                                lock (projectData.SourceFiles)
                                {
                                    if (!projectData.SourceFiles.Contains(absolutePath))
                                    {
                                        sourceFile = new ProjectFile(absolutePath);
                                        sourceFile.FileConfigurations = new ProjectFileConfigurationCollection();
                                        projectData.SourceFiles.Add(sourceFile);
                                    }
                                    else
                                    {
                                        sourceFile = projectData.SourceFiles[absolutePath];
                                    }
                                }
                            }
                        }
                        else
                        {
                            throw new Bam.Core.Exception("Field '{0}' of '{1}' should be of type Bam.Core.File or Bam.Core.FileCollection, not '{2}'", field.Name, node.ModuleName, sourceField.GetType().ToString());
                        }
                    }
                }

                // WPF application definition .xaml file
                {
                    var xamlFileAttributes = field.GetCustomAttributes(typeof(CSharp.ApplicationDefinitionAttribute), false);
                    if (null != xamlFileAttributes && xamlFileAttributes.Length > 0)
                    {
                        var sourceField = field.GetValue(moduleToBuild);
                        if (sourceField is Bam.Core.Location)
                        {
                            var file = sourceField as Bam.Core.Location;
                            var absolutePath = file.GetSinglePath();
                            if (!System.IO.File.Exists(absolutePath))
                            {
                                throw new Bam.Core.Exception("Application definition file '{0}' does not exist", absolutePath);
                            }

            #if false
                            // TODO: in theory, this file should be generated in VS, but it doesn't seem to
                            string csPath = absolutePath + ".cs";
                            if (!System.IO.File.Exists(csPath))
                            {
                                throw new Bam.Core.Exception("Associated source file '{0}' to application definition file '{1}' does not exist", csPath, absolutePath);
                            }
            #endif

                            projectData.ApplicationDefinition = new ProjectFile(absolutePath);
                        }
                        else if (sourceField is Bam.Core.FileCollection)
                        {
                            var sourceCollection = sourceField as Bam.Core.FileCollection;
                            if (sourceCollection.Count != 1)
                            {
                                throw new Bam.Core.Exception("There can be only one application definition");
                            }

                            // TODO: convert to var
                            foreach (string absolutePath in sourceCollection)
                            {
                                if (!System.IO.File.Exists(absolutePath))
                                {
                                    throw new Bam.Core.Exception("Application definition file '{0}' does not exist", absolutePath);
                                }

            #if false
                                // TODO: in theory, this file should be generated in VS, but it doesn't seem to
                                string csPath = absolutePath + ".cs";
                                if (!System.IO.File.Exists(csPath))
                                {
                                    throw new Bam.Core.Exception("Associated source file '{0}' to application definition file '{1}' does not exist", csPath, absolutePath));
                                }
            #endif

                                projectData.ApplicationDefinition = new ProjectFile(absolutePath);
                            }
                        }
                        else
                        {
                            throw new Bam.Core.Exception("Field '{0}' of '{1}' should be of type Bam.Core.File or Bam.Core.FileCollection, not '{2}'", field.Name, node.ModuleName, sourceField.GetType().ToString());
                        }
                    }
                }

                // WPF page .xaml files
                {
                    var xamlFileAttributes = field.GetCustomAttributes(typeof(CSharp.PagesAttribute), false);
                    if (null != xamlFileAttributes && xamlFileAttributes.Length > 0)
                    {
                        var sourceField = field.GetValue(moduleToBuild);
                        if (sourceField is Bam.Core.Location)
                        {
                            var file = sourceField as Bam.Core.Location;
                            var absolutePath = file.GetSinglePath();
                            if (!System.IO.File.Exists(absolutePath))
                            {
                                throw new Bam.Core.Exception("Page file '{0}' does not exist", absolutePath);
                            }

                            lock (projectData.Pages)
                            {
                                if (!projectData.Pages.Contains(absolutePath))
                                {
                                    projectData.Pages.Add(new ProjectFile(absolutePath));
                                }
                            }
                        }
                        else if (sourceField is Bam.Core.FileCollection)
                        {
                            var sourceCollection = sourceField as Bam.Core.FileCollection;
                            // TODO: convert to var
                            foreach (string absolutePath in sourceCollection)
                            {
                                if (!System.IO.File.Exists(absolutePath))
                                {
                                    throw new Bam.Core.Exception("Page file '{0}' does not exist", absolutePath);
                                }

                                var csPath = absolutePath + ".cs";
                                if (!System.IO.File.Exists(csPath))
                                {
                                    throw new Bam.Core.Exception("Associated source file '{0}' to page file '{1}' does not exist", csPath, absolutePath);
                                }

                                lock (projectData.Pages)
                                {
                                    if (!projectData.Pages.Contains(absolutePath))
                                    {
                                        projectData.Pages.Add(new ProjectFile(absolutePath));
                                    }
                                }
                            }
                        }
                        else
                        {
                            throw new Bam.Core.Exception("Field '{0}' of '{1}' should be of type Bam.Core.File or Bam.Core.FileCollection, not '{2}'", field.Name, node.ModuleName, sourceField.GetType().ToString());
                        }
                    }
                }
            }

            configuration.Type = EProjectConfigurationType.Application;

            var toolName = "VCSCompiler";
            var vcsCompiler = configuration.GetTool(toolName);
            if (null == vcsCompiler)
            {
                vcsCompiler = new ProjectTool(toolName);
                configuration.AddToolIfMissing(vcsCompiler);
                configuration.OutputDirectory = moduleToBuild.Locations[CSharp.Assembly.OutputDir];

                if (options is VisualStudioProcessor.IVisualStudioSupport)
                {
                    var visualStudioProjectOption = options as VisualStudioProcessor.IVisualStudioSupport;
                    var settingsDictionary = visualStudioProjectOption.ToVisualStudioProjectAttributes(target);

                    foreach (var setting in settingsDictionary)
                    {
                        vcsCompiler[setting.Key] = setting.Value;
                    }
                }
                else
                {
                    throw new Bam.Core.Exception("Assembly options does not support VisualStudio project translation");
                }
            }

            success = true;
            return projectData;
        }
        private void OpenProject(ProjectFile<VideoCloudPoints> projectFile)
        {
            _projectFile = projectFile;

            RaisePropertyChanged("IsProjectOpened");
            RaisePropertyChanged("IsProjectSaved");

            RaisePropertyChanged("SaveProjectCommand");
            RaisePropertyChanged("SaveAsProjectCommand");
            RaisePropertyChanged("CloseProjectCommand");

            _capture = new Capture(projectFile.Model.VideoPath);
            _capture.ImageGrabbed += CaptureOnImageGrabbed;

            VideoInformation = GetVideoInformation(_capture);
            Progress = 0;
            RaisePropertyChanged("PlayPauseCommand");
            RaisePropertyChanged("StopCommand");
        }
 private void RunCorrectExecuteCommand(ProjectFile proj, int projIndex)
 {
     //ExecuteCommandCSharp(proj);
 }
		public void OnOpenWith (object ob)
		{
			ProjectFile finfo = (ProjectFile) CurrentNode.DataItem;
			((FileViewer)ob).OpenFile (finfo.Name);
		}
Exemple #21
0
 public string GetDefaultCustomToolForFileName(ProjectFile projectItem)
 {
     return(String.Empty);
     //return CustomToolsService.GetCompatibleCustomToolNames(projectItem).FirstOrDefault();
 }
		public override void DeleteMultipleItems ()
		{
			bool hasChildren = false;
			List<ProjectFile> files = new List<ProjectFile> ();
			Set<SolutionEntityItem> projects = new Set<SolutionEntityItem> ();
			foreach (ITreeNavigator node in CurrentNodes) {
				ProjectFile pf = (ProjectFile) node.DataItem;
				projects.Add (pf.Project);
				if (pf.HasChildren)
					hasChildren = true;
				files.Add (pf);
			}
			
			AlertButton removeFromProject = new AlertButton (GettextCatalog.GetString ("_Remove from Project"), Gtk.Stock.Remove);
			
			string question, secondaryText;
			
			secondaryText = GettextCatalog.GetString ("The Delete option permanently removes the file from your hard disk. " +
				"Click Remove from Project if you only want to remove it from your current solution.");
			
			if (hasChildren) {
				if (files.Count == 1)
					question = GettextCatalog.GetString ("Are you sure you want to remove the file {0} and " + 
					                                     "its code-behind children from project {1}?",
					                                     Path.GetFileName (files[0].Name), files[0].Project.Name);
				else
					question = GettextCatalog.GetString ("Are you sure you want to remove the selected files and " + 
					                                     "their code-behind children from the project?");
			} else {
				if (files.Count == 1)
					question = GettextCatalog.GetString ("Are you sure you want to remove file {0} from project {1}?",
					                                     Path.GetFileName (files[0].Name), files[0].Project.Name);
				else
					question = GettextCatalog.GetString ("Are you sure you want to remove the selected files from the project?");
			}
			
			AlertButton result = MessageService.AskQuestion (question, secondaryText,
			                                                 AlertButton.Delete, AlertButton.Cancel, removeFromProject);
			if (result != removeFromProject && result != AlertButton.Delete) 
				return;
			   
			foreach (ProjectFile file in files) {
				Project project = file.Project;
				var inFolder = project.Files.GetFilesInVirtualPath (file.ProjectVirtualPath.ParentDirectory).ToList ();
				if (inFolder.Count == 1 && inFolder [0] == file) {
					// This is the last project file in the folder. Make sure we keep
					// a reference to the folder, so it is not deleted from the tree.
					ProjectFile folderFile = new ProjectFile (project.BaseDirectory.Combine (file.ProjectVirtualPath.ParentDirectory));
					folderFile.Subtype = Subtype.Directory;
					project.Files.Add (folderFile);
				}
				
				if (file.HasChildren) {
					foreach (ProjectFile f in file.DependentChildren) {
						project.Files.Remove (f);
						if (result == AlertButton.Delete)
							FileService.DeleteFile (f.Name);
					}
				}
			
				project.Files.Remove (file);
				if (result == AlertButton.Delete && !file.IsLink)
					FileService.DeleteFile (file.Name);
			}

			IdeApp.ProjectOperations.Save (projects);
		}
		public override void ActivateItem ()
		{
			ProjectFile file = (ProjectFile) CurrentNode.DataItem;
			IdeApp.Workbench.OpenDocument (file.FilePath);
		}
		public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
		{
			ProjectFile file = (ProjectFile) dataObject;
			return file.HasChildren;
		}
        public static List<string> PrintResultItems(ProjectFile proj,BuildResult result, string targetName)
        {
            List<string> ret = new List<string>();
            var buildResult = result.ResultsByTarget[targetName];
            var buildResultItems = buildResult.Items;

            if (buildResultItems.Length == 0)
            {
                return ret;
            }

            //var buildResList = buildResultItems.Select(x => new FileInfo(x.ItemSpec)).ToList();//Where( fInfo => fInfo.FullName

            //List<string> buildResTempList = new List<string>();
            //int listSize = buildResList.Count;
            //for (int i = 0; i < listSize; i ++)
            //{
            //    var item = buildResList.RemoveAndGet(0);
            //    buildResList.RemoveAll(x => x.Name.Equals(item.Name));
            //    buildResList.Add(item);
            //}

            //foreach (var item in buildResList)
            //{
            //    proj.ReferenceCompileArg += " /r:" + "\"" + item.FullName + "\"";
            //    proj.ReferencePaths.Add(new FileInfo(item.FullName));
            //}

            //string heyup = "lakjdsfjdlsk";

            //foreach (var item in buildResTempList)
            //{
            //    ret.Add(string.Format("{0}", item.));
            //    proj.ReferenceCompileArg += " /r:" + "\"" + item.ItemSpec + "\"";
            //    proj.ReferencePaths.Add(new FileInfo(item.ItemSpec));
            //    //Console.WriteLine("{0} reference: {1}", targetName, item.ItemSpec);
            //}

            foreach (var item in buildResultItems)
            {
                ret.Add(string.Format("{0}", item.ItemSpec));
                proj.ReferenceCompileArg += " /r:" + "\"" + item.ItemSpec + "\"";
                proj.ReferencePaths.Add(new FileInfo(item.ItemSpec));
                //Console.WriteLine("{0} reference: {1}", targetName, item.ItemSpec);
            }

            return ret;
        }
 static bool IsTemplate(ProjectFile pf)
 {
     return(pf.Generator == typeof(TextTemplatingFileGenerator).Name ||
            pf.Generator == typeof(TextTemplatingFilePreprocessor).Name);
 }
        public void ExecuteCommandCSharp(ProjectFile proj)
        {
            Console.WriteLine("starting to build " + proj.ProjectPath.Name);

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.WorkingDirectory = proj.ProjectPath.DirectoryName;
            startInfo.FileName = @"C:\Users\tacke\Documents\visual studio 2015\Projects\JustBuild\JustBuild\bin\Debug\JustBuild.exe";
            startInfo.Arguments = "\"" + proj.ProjectPath.FullName + "\"";
            startInfo.UseShellExecute = false;
            process.StartInfo = startInfo;

            process.Start();
            process.WaitForExit();

            proj.NeedsToBeBuilt = false;
            proj.HasBuilt = true;
            lock (this.listLock) { COUNTER++; }
        }
Exemple #28
0
 public static void TryFindByName(string name)
 {
     Assert.AreEqual(true, ProjectFile.TryFind(name, out var projectFile));
     Assert.AreEqual(name, projectFile !.Name);
 }
 public override bool OnFileComplete(ProjectFile projectFile, IMultiFileConverter multiFileConverter)
 {
     return(true);
 }
Exemple #30
0
        ProjectItemInformation CreateDirectoryProjectItemInformation(string directoryName, string fullPath)
        {
            var directoryItem = new ProjectFile(fullPath);

            return(directoryItem.ToProjectItemInformation());
        }
 protected override string OnGetDefaultResourceId(ProjectFile projectFile)
 {
     return(VBNetResourceIdBuilder.GetDefaultResourceId(projectFile) ?? base.OnGetDefaultResourceId(projectFile));
 }
        protected override void ConfigureConverter(ProjectFile projectFile, IMultiFileConverter multiFileConverter)
        {
            SegmentProcessor segProcessor = new SegmentProcessor(settings);

            segProcessor.Run(multiFileConverter, Project, projectFile, reportGenerator);
        }
Exemple #33
0
 public FileSearchResult(string match, string matchedString, int rank, ProjectFile file, bool useFileName)
     : base(match, matchedString, rank)
 {
     this.file        = file;
     this.useFileName = useFileName;
 }
 public void Run(IMultiFileConverter multiFileConverter, IProject project, ProjectFile projectFile, IXmlReportGenerator reportGenerator)
 {
     reportGenerator.AddFile(projectFile.LocalFilePath);
     multiFileConverter.AddBilingualProcessor(new BilingualContentHandlerAdapter(new SegmentContentHandler(_settings, project, reportGenerator)));
 }
 public void AddFile(ProjectFile file)
 {
     _files.Add(file);
 }
Exemple #36
0
        public ActionResult Create(NewProjectViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var path     = Server.MapPath("~/App_Data/Files");
                var fileName = Path.GetFileName(viewModel.ProjectFile.FileName);
                fileName = DateTime.Now.ToString("yyMMddHHmmss") + fileName;

                var fullPath = Path.Combine(path, fileName);

                //saving the file in the server at "full path"
                viewModel.ProjectFile.SaveAs(fullPath);

                //now we need to save the details to the database
                var project = new Project
                {
                    GroupId        = viewModel.GroupId,
                    Title          = viewModel.Title,
                    SubmissionDate = viewModel.SubmissionDate,
                    ProjectType    = viewModel.ProjectType,
                    Status         = "Proposal Submitted"
                };

                var projectFile = new ProjectFile
                {
                    FileName  = fileName,
                    ProjectId = project.ProjectId,
                    FilePath  = fullPath,
                    FileType  = "Proposal"
                };

                var group = _context.Groups.Include(g => g.Student1.Student).Include(g => g.Student2.Student).Single(g => g.Id == viewModel.GroupId);
                group.Student1.Student.CanSubmitProposal = false;
                group.Student2.Student.CanSubmitProposal = false;


                _context.Projects.Add(project);
                _context.ProjectFiles.Add(projectFile);
                _context.SaveChanges();
                var changes = new Change
                {
                    ProjectId = project.ProjectId
                };
                _context.Changes.Add(changes);

                _context.SaveChanges();
                var presentation = new Presentation
                {
                    ProjectId = project.ProjectId,
                    Status    = "NotScheduled"
                };
                _context.Presentations.Add(presentation);

                var marking = new Marking
                {
                    ProjectId = project.ProjectId
                };
                _context.Markings.Add(marking);


                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            IEnumerable <SelectListItem> ProjectTypes = new List <SelectListItem>
            {
                new SelectListItem()
                {
                    Value = "Research", Text = "Research"
                },
                new SelectListItem()
                {
                    Value = "Development", Text = "Development"
                }
            };

            ViewBag.ProjectType = ProjectTypes;

            return(View(viewModel));
        }
        public VersionControlItem CreateItem(object obj, bool projRecurse = true)
        {
            string           path;
            bool             isDir;
            IWorkspaceObject pentry;
            Repository       repo;
            VersionInfo      versionInfo = null;

            if (obj is ProjectFile)
            {
                ProjectFile file = (ProjectFile)obj;
                path        = file.FilePath;
                isDir       = false;
                pentry      = file.Project;
                versionInfo = file.ExtendedProperties [typeof(VersionInfo)] as VersionInfo;
            }
            else if (obj is SystemFile)
            {
                SystemFile file = (SystemFile)obj;
                path   = file.Path;
                isDir  = false;
                pentry = file.ParentWorkspaceObject;
            }
            else if (obj is ProjectFolder)
            {
                ProjectFolder f = (ProjectFolder)obj;
                path   = f.Path;
                isDir  = true;
                pentry = f.ParentWorkspaceObject;
            }
            else if (!projRecurse && obj is Solution)
            {
                Solution sol = (Solution)obj;
                path   = sol.FileName;
                isDir  = false;
                pentry = sol;
            }
            else if (!projRecurse && obj is Project)
            {
                Project proj = (Project)obj;
                path   = proj.FileName;
                isDir  = false;
                pentry = proj;
            }
            else if (obj is IWorkspaceObject)
            {
                pentry = ((IWorkspaceObject)obj);
                path   = pentry.BaseDirectory;
                isDir  = true;
            }
            else
            {
                return(null);
            }

            if (pentry == null)
            {
                return(null);
            }

            repo = VersionControlService.GetRepository(pentry);
            return(new VersionControlItem(repo, pentry, path, isDir, versionInfo));
        }
Exemple #38
0
        private void PrepareReport(int id)
        {
            var project = _context.Projects
                          .Include(pr => pr.Group.Student1)
                          .Include(pr => pr.Group.Student1.Student)
                          .Include(pr => pr.Group.Student1.Department)
                          .Include(pr => pr.Group.Student2)
                          .Include(pr => pr.Group.Student2.Student)
                          .Include(pr => pr.Supervisor)
                          .Single(pr => pr.ProjectId == id);

            if (project == null)
            {
                return;
            }

            var pdfDocument = new Document(PageSize.A4, 50f, 40f, 20f, 20f);


            #region creating file

            var path     = Server.MapPath("~/App_Data/Files");
            var fileName = Path.GetFileName("Project Letter");
            fileName = DateTime.Now.ToString("yyMMddHHmmss-") + fileName + ".pdf";
            var fullPath = Path.Combine(path, fileName);
            PdfWriter.GetInstance(pdfDocument, new FileStream(fullPath, FileMode.Create));
            pdfDocument.Open();

            #endregion

            #region declarations

            //temp declarations
            var projectId     = id;
            var title         = project.Title;
            var student1Name  = project.Group.Student1.Name;
            var student2Name  = project.Group.Student2.Name;
            var professorName = project.Supervisor.Name;
            var regNo1        = project.Group.Student1.Student.RegNo;
            var regNo2        = project.Group.Student2.Student.RegNo;
            var batch         = project.Group.Student1.Student.Batch;
            var single        = regNo1 == regNo2;
            var programme     = project.Group.Student1.Department.Name;
            if (programme == "Software Engineering")
            {
                programme = "BSSE";
            }
            else if (programme == "Computer Science")
            {
                programme = "BSCS";
            }
            else if (programme == "Information Technology")
            {
                programme = "BSIT";
            }
            var chairman = "Dr. Ayyaz Hussain";
            ///////////////

            var bfTimes           = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, false);
            var boldFont          = new Font(bfTimes, 13, Font.BOLD, iTextSharp.text.BaseColor.BLACK);
            var boldItalicFont    = new Font(bfTimes, 13, Font.BOLDITALIC, iTextSharp.text.BaseColor.BLACK);
            var normalFont        = new Font(bfTimes, 12, Font.NORMAL, iTextSharp.text.BaseColor.BLACK);
            var italicFont        = new Font(bfTimes, 12, Font.ITALIC, iTextSharp.text.BaseColor.BLACK);
            var boldUnderlineFont = new Font(bfTimes, 12, Font.BOLD | Font.UNDERLINE, iTextSharp.text.BaseColor.BLACK);


            var imgpath     = Server.MapPath("~/App_Data/Images");
            var imgfileName = Path.GetFileName("logo.png");
            var imgfullPath = Path.Combine(imgpath, imgfileName);
            var img         = Image.GetInstance(imgfullPath);
            img.ScaleAbsolute(60f, 60f);

            #endregion



            #region Header


            //////////////////////////
            //Header of Letter
            /////////////////////////


            //creating at table with 2 columns
            var     headerTable = new PdfPTable(2);
            float[] width       = { 70f, 525f };
            headerTable.SetWidthPercentage(width, PageSize.A4);

            //left column that will have the logo
            var leftCell = new PdfPCell();
            img.Alignment = Element.ALIGN_LEFT;
            leftCell.AddElement(img);
            leftCell.Border = iTextSharp.text.Rectangle.BOTTOM_BORDER;

            //add column to table
            headerTable.AddCell(leftCell);


            //right column that will have header text
            var rightCell = new PdfPCell();
            var p         = new Paragraph();
            p.Alignment = Element.ALIGN_CENTER;
            p.Add(new Phrase("INTERNATIONAL ISLAMIC UNIVERSITY, ISLAMABAD\n", boldFont));
            p.Add(new Phrase("FACULTY OF BASIC AND APPLIED SCIENCES\n", boldFont));
            p.Add(new Phrase("DEPARTMENT OF COMPUTER SCIENCE & SOFTWARE ENGINEERING", boldFont));

            //add text to column
            rightCell.AddElement(p);
            rightCell.Border      = iTextSharp.text.Rectangle.BOTTOM_BORDER;
            rightCell.PaddingLeft = 5f;

            //add column to table
            headerTable.AddCell(rightCell);

            //add header table to document
            pdfDocument.Add(headerTable);

            #endregion


            #region DateAndLetterNum

            var dateNumTable = new PdfPTable(2);

            dateNumTable.SetWidthPercentage(new float[] { 297f, 297f }, PageSize.A4);



            p.Clear();
            p.Add(new Phrase("No. IIU/FBAS/DCS&SE/" + DateTime.Now.Date.Year + "-" + projectId, normalFont));
            p.Alignment = Element.ALIGN_LEFT;
            var left = new PdfPCell();
            left.AddElement(p);
            left.Border = Rectangle.NO_BORDER;


            dateNumTable.AddCell(left);

            p.Clear();

            var date = DateTime.Now.ToString("dd-MM-yyyy");
            p.Add(new Phrase("Date:" + date, normalFont));
            p.Alignment = Element.ALIGN_RIGHT;
            var right = new PdfPCell();
            right.AddElement(p);
            right.Border = Rectangle.NO_BORDER;
            dateNumTable.AddCell(right);


            pdfDocument.Add(dateNumTable);



            #endregion

            p.Clear();
            p.Add(new Phrase("\n", normalFont));
            pdfDocument.Add(p);

            #region subject

            var subjectTable = new PdfPTable(2);

            subjectTable.SetWidthPercentage(new float[] { 60f, 535f }, PageSize.A4);

            p.Clear();
            p.Add(new Phrase("Subject:", normalFont));
            p.Alignment = Element.ALIGN_LEFT;
            var subjectTitle = new PdfPCell();
            subjectTitle.AddElement(p);
            subjectTitle.Border = Rectangle.NO_BORDER;


            subjectTable.AddCell(subjectTitle);

            var subjectData = new PdfPCell();
            p.Clear();
            p.Add(new Phrase("ALLOCATION OF PROVISIONAL SUPERVISION LETTER FOR " + programme + " PROJECT,\n", boldUnderlineFont));
            p.Add(new Phrase("\"" + title + "\"", normalFont));
            p.Alignment = Element.ALIGN_LEFT;
            subjectData.AddElement(p);
            subjectData.Border = Rectangle.NO_BORDER;
            subjectTable.AddCell(subjectData);


            pdfDocument.Add(subjectTable);

            #endregion

            #region Bodytext

            boldItalicFont.Size = 12;
            p.Clear();
            p.Add(new Phrase(@"
        The Department has allocated project titled above to ", normalFont));
            p.Add(new Phrase("Mr. " + student1Name + " Registration No. " + regNo1 + "-" + "FBAS/" + programme + "/" + batch, boldItalicFont));
            if (!single)
            {
                p.Add(new Phrase(" and Mr. " + student2Name + " Registration No. " + regNo2 + "-" + "FBAS/" + programme + "/" + batch, boldItalicFont));
            }

            p.Add(new Phrase(". " + professorName + ",", boldItalicFont));
            p.Add(new Phrase(
                      @" from Department of Computer Science & Software Engineering, Faculty of Basic and Applied Sciences, International Islamic University, Islamabad will supervise the project. The work should be completed within one semester"
                      , normalFont));
            p.Add(new Phrase(
                      @"
        If the project is not completed within the prescribed period then you have to re-register in the next semester with only registration fee. Students failing to complete the project even in this additional duration will have to pay full fee for the subsequent semesters that will include the project fee plus registration fee."
                      , italicFont));
            p.Add(new Phrase(
                      @"
        Weekly progress report duly signed by the supervisor must also be submitted to the Program Coordinator. Project presentation within the concerned SIG after every three weeks is mandatory. Project will be evaluated as per the following criteria:-"
                      , normalFont));

            p.Add(new Phrase("\n", normalFont));
            p.Alignment = Element.ALIGN_JUSTIFIED;
            pdfDocument.Add(p);

            var list = new List(List.UNORDERED);
            list.SetListSymbol("\u2022");
            list.IndentationLeft = 20f;
            list.Add(new ListItem("Scope", normalFont));
            list.Add(new ListItem("Project utility", normalFont));
            list.Add(new ListItem("Innovation", normalFont));
            list.Add(new ListItem("Selection of appropriate technology", normalFont));
            list.Add(new ListItem("Approach/ Implementation", normalFont));
            list.Add(new ListItem("Report write-up", normalFont));
            list.Add(new ListItem("Demo/ Presentation", normalFont));
            pdfDocument.Add(list);

            p.Clear();
            p.Add(new Phrase(
                      @"
        The student must submit the copies of project report within three months after the Viva Voce Exam; otherwise whole process will be done again,"
                      , normalFont));
            p.Alignment = Element.ALIGN_JUSTIFIED;

            pdfDocument.Add(p);
            #endregion

            #region Chairman Name

            var chairmanTable = new PdfPTable(2);
            chairmanTable.SetWidthPercentage(new float[] { 297f, 297f }, PageSize.A4);

            var chairmanLeftCell = new PdfPCell();
            chairmanLeftCell.Border = Rectangle.NO_BORDER;

            chairmanTable.AddCell(chairmanLeftCell);

            var chairmanRightCell = new PdfPCell();
            chairmanRightCell.Border = Rectangle.NO_BORDER;
            p.Clear();
            p.Add(new Phrase("\n\n", normalFont));
            pdfDocument.Add(p);
            p.Clear();

            boldFont.Size = 12;
            p.Add(new Phrase("(" + chairman + ")", boldFont));
            p.Add(new Phrase("\nChairman, DCS&SE, FBAS, IIUI", normalFont));
            p.Alignment = Element.ALIGN_CENTER;
            chairmanRightCell.AddElement(p);
            chairmanRightCell.HorizontalAlignment = Element.ALIGN_CENTER;
            chairmanTable.AddCell(chairmanRightCell);
            pdfDocument.Add(chairmanTable);


            p.Clear();
            p.Add(new Phrase("\n CC to:\n\n", normalFont));
            p.Alignment = Element.ALIGN_LEFT;
            pdfDocument.Add(p);

            var ccList = new List(List.UNORDERED);
            ccList.SetListSymbol("\u2022");
            ccList.IndentationLeft = 20f;
            ccList.Add(new ListItem("Supervisor of Student", normalFont));
            ccList.Add(new ListItem("Concerned Student", normalFont));
            ccList.Add(new ListItem("Program Office", normalFont));

            pdfDocument.Add(ccList);

            #endregion

            #region savefiletoDB

            var projectFile = new ProjectFile
            {
                FileName  = fileName,
                ProjectId = id,
                FilePath  = fullPath,
                FileType  = "Project Letter"
            };
            _context.ProjectFiles.Add(projectFile);
            _context.SaveChanges();


            #endregion

            pdfDocument.Close();
        }
Exemple #39
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Global.CurrentProjectFile != null)
            {
                if (buffer != Global.CurrentProjectFile)
                {
                    treeView1.Nodes.Clear();
                    treeView1.Nodes.Add(Global.CurrentProjectFile.Name);
                    foreach (var i in Global.CurrentProjectFile.Files)
                    {
                        if (!i.Contains("\\"))
                        {
                            treeView1.Nodes[0].Nodes.Add(i);
                        }
                        else
                        {

                            ProcessPath(i.Split('\\'), treeView1.Nodes[0].Nodes);
                        }

                    }
                    buffer = Global.CurrentProjectFile;
                    treeView1.ExpandAll();
                }
            }
        }
 public ProjectFileDescriptor(ProjectFile file)
 {
     this.file = file;
 }
Exemple #41
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {

                AskDlg dlg = new AskDlg();
                dlg.Quiestion = "Name:";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    var sel1 = treeView1.SelectedNode.Parent;
                    var sel2 = treeView1.SelectedNode;
                    var sel = "";
                    if (sel1 != null)
                    {
                        if (dlg.Awnser.Contains("."))
                        {
                            sel = sel2.FullPath.Replace(Global.CurrentProjectFile.Name + "\\", "");

                        }
                        else
                        {
                            sel = sel1.FullPath.Replace(Global.CurrentProjectFile.Name + "\\", "");
                        }
                    }

                    if (sel == "")
                    {
                        Global.CurrentProjectFile.Files.Add(dlg.Awnser);
                    }
                    else
                    {
                        Global.CurrentProjectFile.Files.Add(sel + "\\" + dlg.Awnser);
                    }

                    var p = Path.Combine(Global.CurrentProjectFilePath, "files", sel, dlg.Awnser);

                    if (!dlg.Awnser.Contains("."))
                    {
                        Directory.CreateDirectory(p);
                    }
                    else
                    {
                        File.Create(p);
                    }
                }
                Global.Save();
                buffer = null;
            }
            catch (Exception ee)
            {

            }
        }
Exemple #42
0
        async System.Threading.Tasks.Task DropNode(HashSet <SolutionItem> projectsToSave, object dataObject, HashSet <ProjectFile> groupedFiles, DragOperation operation)
        {
            FilePath targetDirectory = GetFolderPath(CurrentNode.DataItem);
            FilePath source;
            string   what;
            Project  targetProject = (Project)CurrentNode.GetParentDataItem(typeof(Project), true);
            Project  sourceProject;
            IEnumerable <ProjectFile> groupedChildren = null;

            if (dataObject is ProjectFolder)
            {
                source        = ((ProjectFolder)dataObject).Path;
                sourceProject = ((ProjectFolder)dataObject).Project;
                what          = Path.GetFileName(source);
            }
            else if (dataObject is ProjectFile)
            {
                ProjectFile file = (ProjectFile)dataObject;

                // if this ProjectFile is one of the grouped files being pulled in by a parent being copied/moved, ignore it
                if (groupedFiles.Contains(file))
                {
                    return;
                }

                if (file.DependsOnFile != null && operation == DragOperation.Move)
                {
                    // unlink this file from its parent (since its parent is not being moved)
                    file.DependsOn = null;

                    // if moving a linked file into its containing folder, simply unlink it from its parent
                    if (file.FilePath.ParentDirectory == targetDirectory)
                    {
                        projectsToSave.Add(targetProject);
                        return;
                    }
                }

                sourceProject = file.Project;
                if (sourceProject != null && file.IsLink)
                {
                    source = sourceProject.BaseDirectory.Combine(file.ProjectVirtualPath);
                }
                else
                {
                    source = file.FilePath;
                }
                groupedChildren = file.DependentChildren;
                what            = null;
            }
            else if (dataObject is Gtk.SelectionData)
            {
                SelectionData data = (SelectionData)dataObject;
                if (data.Type != "text/uri-list")
                {
                    return;
                }
                string sources = System.Text.Encoding.UTF8.GetString(data.Data);
                Console.WriteLine("text/uri-list:\n{0}", sources);
                string[] files = sources.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                for (int n = 0; n < files.Length; n++)
                {
                    Uri uri = new Uri(files[n]);
                    if (uri.Scheme != "file")
                    {
                        return;
                    }
                    if (Directory.Exists(uri.LocalPath))
                    {
                        return;
                    }
                    files[n] = uri.LocalPath;
                }

                IdeApp.ProjectOperations.AddFilesToProject(targetProject, files, targetDirectory);
                projectsToSave.Add(targetProject);
                return;
            }
            else if (dataObject is SolutionFolderFileNode)
            {
                var sff = (SolutionFolderFileNode)dataObject;
                sff.Parent.Files.Remove(sff.Path);

                await IdeApp.ProjectOperations.SaveAsync(sff.Parent.ParentSolution);

                source        = ((SolutionFolderFileNode)dataObject).Path;
                sourceProject = null;
                what          = null;
            }
            else
            {
                return;
            }

            var targetPath = targetDirectory.Combine(source.FileName);

            // If copying to the same directory, make a copy with a different name
            if (targetPath == source)
            {
                targetPath = ProjectOperations.GetTargetCopyName(targetPath, dataObject is ProjectFolder);
            }

            var targetChildPaths = groupedChildren != null?groupedChildren.Select(child => {
                var targetChildPath = targetDirectory.Combine(child.FilePath.FileName);

                if (targetChildPath == child.FilePath)
                {
                    targetChildPath = ProjectOperations.GetTargetCopyName(targetChildPath, false);
                }

                return(targetChildPath);
            }).ToList() : null;

            if (dataObject is ProjectFolder)
            {
                string q;
                if (operation == DragOperation.Move)
                {
                    if (targetPath.ParentDirectory == targetProject.BaseDirectory)
                    {
                        q = GettextCatalog.GetString("Do you really want to move the folder '{0}' to the root folder of project '{1}'?", what, targetProject.Name);
                    }
                    else
                    {
                        q = GettextCatalog.GetString("Do you really want to move the folder '{0}' to the folder '{1}'?", what, targetDirectory.FileName);
                    }
                    if (!MessageService.Confirm(q, AlertButton.Move))
                    {
                        return;
                    }
                }
                else
                {
                    if (targetPath.ParentDirectory == targetProject.BaseDirectory)
                    {
                        q = GettextCatalog.GetString("Do you really want to copy the folder '{0}' to the root folder of project '{1}'?", what, targetProject.Name);
                    }
                    else
                    {
                        q = GettextCatalog.GetString("Do you really want to copy the folder '{0}' to the folder '{1}'?", what, targetDirectory.FileName);
                    }
                    if (!MessageService.Confirm(q, AlertButton.Copy))
                    {
                        return;
                    }
                }
            }
            else if (dataObject is ProjectFile)
            {
                var items = Enumerable.Repeat(targetPath, 1);
                if (targetChildPaths != null)
                {
                    items = items.Concat(targetChildPaths);
                }

                foreach (var file in items)
                {
                    if (File.Exists(file))
                    {
                        if (!MessageService.Confirm(GettextCatalog.GetString("The file '{0}' already exists. Do you want to overwrite it?", file.FileName), AlertButton.OverwriteFile))
                        {
                            return;
                        }
                    }
                }
            }

            var filesToSave = new List <Document> ();

            foreach (Document doc in IdeApp.Workbench.Documents)
            {
                if (doc.IsDirty && doc.IsFile)
                {
                    if (doc.Name == source || doc.Name.StartsWith(source + Path.DirectorySeparatorChar))
                    {
                        filesToSave.Add(doc);
                    }
                    else if (groupedChildren != null)
                    {
                        foreach (ProjectFile f in groupedChildren)
                        {
                            if (doc.Name == f.Name)
                            {
                                filesToSave.Add(doc);
                            }
                        }
                    }
                }
            }

            if (filesToSave.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (Document doc in filesToSave)
                {
                    if (sb.Length > 0)
                    {
                        sb.Append(",\n");
                    }
                    sb.Append(Path.GetFileName(doc.Name));
                }

                string question;

                if (operation == DragOperation.Move)
                {
                    if (filesToSave.Count == 1)
                    {
                        question = GettextCatalog.GetString("Do you want to save the file '{0}' before the move operation?", sb.ToString());
                    }
                    else
                    {
                        question = GettextCatalog.GetString("Do you want to save the following files before the move operation?\n\n{0}", sb.ToString());
                    }
                }
                else
                {
                    if (filesToSave.Count == 1)
                    {
                        question = GettextCatalog.GetString("Do you want to save the file '{0}' before the copy operation?", sb.ToString());
                    }
                    else
                    {
                        question = GettextCatalog.GetString("Do you want to save the following files before the copy operation?\n\n{0}", sb.ToString());
                    }
                }
                AlertButton noSave = new AlertButton(GettextCatalog.GetString("Don't Save"));
                AlertButton res    = MessageService.AskQuestion(question, AlertButton.Cancel, noSave, AlertButton.Save);
                if (res == AlertButton.Cancel)
                {
                    return;
                }
                if (res == AlertButton.Save)
                {
                    try {
                        foreach (Document doc in filesToSave)
                        {
                            await doc.Save();
                        }
                    } catch (Exception ex) {
                        MessageService.ShowError(GettextCatalog.GetString("Save operation failed."), ex);
                        return;
                    }
                }
            }

            if (operation == DragOperation.Move && sourceProject != null)
            {
                projectsToSave.Add(sourceProject);
            }
            if (targetProject != null)
            {
                projectsToSave.Add(targetProject);
            }

            bool move   = operation == DragOperation.Move;
            var  opText = move ? GettextCatalog.GetString("Moving files...") : GettextCatalog.GetString("Copying files...");

            using (var monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(opText, Stock.StatusSolutionOperation, true)) {
                // If we drag and drop a node in the treeview corresponding to a directory, do not move
                // the entire directory. We should only move the files which exist in the project. Otherwise
                // we will need a lot of hacks all over the code to prevent us from incorrectly moving version
                // control related files such as .svn directories

                // Note: if we are transferring a ProjectFile, this will copy/move the ProjectFile's DependentChildren as well.
                IdeApp.ProjectOperations.TransferFiles(monitor, sourceProject, source, targetProject, targetPath, move, sourceProject != null);
            }
        }
        private void WriteFileIfDifferent(ProjectFile project, FileToCreate file)
        {
            SetSourceControlInfo(file);
            if (!file.HasChanged)
            {
                if (file.IsMainFile)
                {
                    if (UseTfsToCheckoutFiles)
                    {
                        TfsWorkspace.Undo(file.Path);
                    }
                    Console.WriteLine(file.Path + " was unchanged.");
                }
                return;
            }

            EnsureFileIsAccessible(file.Path);
            project.AddFileIfMissing(file.Path);

            Trace.TraceInformation(Path.GetFileName(file.Path) + " created / updated..");
            Log("Writing file: " + file.Path);
            File.WriteAllText(file.Path, file.Contents);
            Log("Completed file: " + file);
        }
        public override void BuildNode(ITreeBuilder builder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            if (!builder.Options["ShowVersionControlOverlays"])
            {
                return;
            }

            // Add status overlays

            if (dataObject is IWorkspaceObject)
            {
                IWorkspaceObject ce  = (IWorkspaceObject)dataObject;
                Repository       rep = VersionControlService.GetRepository(ce);
                if (rep != null)
                {
                    AddFolderOverlay(rep, ce.BaseDirectory, ref icon, ref closedIcon);
                }
                return;
            }
            else if (dataObject is ProjectFolder)
            {
                ProjectFolder ce = (ProjectFolder)dataObject;
                if (ce.ParentWorkspaceObject != null)
                {
                    Repository rep = VersionControlService.GetRepository(ce.ParentWorkspaceObject);
                    if (rep != null)
                    {
                        AddFolderOverlay(rep, ce.Path, ref icon, ref closedIcon);
                    }
                }
                return;
            }

            IWorkspaceObject prj;
            string           file;

            if (dataObject is ProjectFile)
            {
                ProjectFile pfile = (ProjectFile)dataObject;
                prj  = pfile.Project;
                file = pfile.FilePath;
            }
            else
            {
                SystemFile pfile = (SystemFile)dataObject;
                prj  = pfile.ParentWorkspaceObject;
                file = pfile.Path;
            }

            if (prj == null)
            {
                return;
            }

            Repository repo = VersionControlService.GetRepository(prj);

            if (repo == null)
            {
                return;
            }

            VersionStatus status = GetVersionInfo(repo, file);

            Gdk.Pixbuf overlay = VersionControlService.LoadOverlayIconForStatus(status);
            if (overlay != null)
            {
                AddOverlay(ref icon, overlay);
            }
        }
Exemple #45
0
        public void InitializeItem(SolutionItem policyParent, ProjectCreateInformation projectCreateInformation, string defaultLanguage, SolutionEntityItem item)
        {
            MonoDevelop.Projects.Project project = item as MonoDevelop.Projects.Project;

            if (project == null)
            {
                MessageService.ShowError(GettextCatalog.GetString("Can't create project with type: {0}", type));
                return;
            }

            // Set the file before setting the name, to make sure the file extension is kept
            project.FileName = Path.Combine(projectCreateInformation.ProjectBasePath, projectCreateInformation.ProjectName);
            project.Name     = projectCreateInformation.ProjectName;

            var dnp = project as DotNetProject;

            if (dnp != null)
            {
                if (policyParent.ParentSolution != null && !policyParent.ParentSolution.FileFormat.SupportsFramework(dnp.TargetFramework))
                {
                    SetClosestSupportedTargetFramework(policyParent.ParentSolution.FileFormat, dnp);
                }
                var substitution = new string[, ] {
                    { "ProjectName", projectCreateInformation.SolutionName }
                };
                foreach (ProjectReference projectReference in references)
                {
                    if (projectReference.ReferenceType == ReferenceType.Project)
                    {
                        string referencedProjectName = StringParserService.Parse(projectReference.Reference, substitution);
                        var    parsedReference       = ProjectReference.RenameReference(projectReference, referencedProjectName);
                        dnp.References.Add(parsedReference);
                    }
                    else
                    {
                        dnp.References.Add(projectReference);
                    }
                }
            }

            foreach (SingleFileDescriptionTemplate resourceTemplate in resources)
            {
                try
                {
                    ProjectFile projectFile = new ProjectFile(resourceTemplate.SaveFile(policyParent, project, defaultLanguage, project.BaseDirectory, null));
                    projectFile.BuildAction = BuildAction.EmbeddedResource;
                    project.Files.Add(projectFile);
                }
                catch (Exception ex)
                {
                    MessageService.ShowException(ex, GettextCatalog.GetString("File {0} could not be written.", resourceTemplate.Name));
                    LoggingService.LogError(GettextCatalog.GetString("File {0} could not be written.", resourceTemplate.Name), ex);
                }
            }

            foreach (FileDescriptionTemplate fileTemplate in files)
            {
                try
                {
                    fileTemplate.AddToProject(policyParent, project, defaultLanguage, project.BaseDirectory, null);
                }
                catch (Exception ex)
                {
                    MessageService.ShowException(ex, GettextCatalog.GetString("File {0} could not be written.", fileTemplate.Name));
                    LoggingService.LogError(GettextCatalog.GetString("File {0} could not be written.", fileTemplate.Name), ex);
                }
            }
        }
 public string LocalToVirtualPath(ProjectFile file)
 {
     return(LocalToVirtualPath(file.FilePath));
 }
        /// <summary>
        /// Currently not working perfectly. CSC compiler has to be used without msbuild since msbuild does not allow multithreaded building. 
        /// </summary>
        /// <param name="proj"></param>
        public void ExecuteCommand(ProjectFile proj)
        {
            Console.WriteLine("starting to build " + proj.ProjectPath.Name);

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.WorkingDirectory = proj.ProjectPath.Directory.FullName;
            startInfo.FileName = SolutionBuilder.CscBuildPath;
            startInfo.Arguments = proj.ReferenceCompileArg + " " + proj.TargetCompileArg + " /out:\"" + proj.BuildProjectOutputPath + "\" *.cs\"";//string.Join(" ", proj.ProjectClassPaths.Select(x => "\"" + x.FullName + "\""));//" *.cs";//+ " /maxcpucount:4 /p:BuildInParallel=true";
            //startInfo.Arguments = "/c  \"\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\VsDevCmd.bat\"" + " && csc " + " " + proj.ReferenceCompileArg + " " + proj.TargetCompileArg + " /out:\"" + proj.BuildProjectOutputPath + "\" *.cs\"";//string.Join(" ", proj.ProjectClassPaths.Select(x => "\"" + x.FullName + "\""));//" *.cs";//+ " /maxcpucount:4 /p:BuildInParallel=true";
            Console.WriteLine(startInfo.Arguments);

            process.StartInfo = startInfo;
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.Start();
            string output = process.StandardOutput.ReadToEnd();
            process.WaitForExit();

            Console.WriteLine(output);

            proj.NeedsToBeBuilt = false;
            proj.HasBuilt = true;
            lock (this.listLock) { COUNTER++; }
        }
		CompilerError GetResourceId (ExecutionEnvironment env, ProjectFile finfo, ref string fname, string resgen, out string resourceId, IProgressMonitor monitor)
		{
			resourceId = finfo.ResourceId;
			if (resourceId == null) {
				LoggingService.LogDebug (GettextCatalog.GetString ("Error: Unable to build ResourceId for {0}.", fname));
				monitor.Log.WriteLine (GettextCatalog.GetString ("Error: Unable to build ResourceId for {0}.", fname));

				return new CompilerError (fname, 0, 0, String.Empty,
						GettextCatalog.GetString ("Unable to build ResourceId for {0}.", fname));
			}

			if (String.Compare (Path.GetExtension (fname), ".resx", true) != 0)
				return null;

			if (!IsResgenRequired (fname)) {
				fname = Path.ChangeExtension (fname, ".resources");
				return null;
			}
			
			if (resgen == null) {
				string msg = GettextCatalog.GetString ("Unable to find 'resgen' tool.");
				monitor.ReportError (msg, null);
				return new CompilerError (fname, 0, 0, String.Empty, msg);
			}

			using (StringWriter sw = new StringWriter ()) {
				LoggingService.LogDebug ("Compiling resources\n{0}$ {1} /compile {2}", Path.GetDirectoryName (fname), resgen, fname);
				monitor.Log.WriteLine (GettextCatalog.GetString (
					"Compiling resource {0} with {1}", fname, resgen));
				ProcessWrapper pw = null;
				try {
					ProcessStartInfo info = Runtime.ProcessService.CreateProcessStartInfo (
									resgen, String.Format ("/compile \"{0}\"", fname),
									Path.GetDirectoryName (fname), false);

					env.MergeTo (info);
					if (PlatformID.Unix == Environment.OSVersion.Platform)
						info.EnvironmentVariables ["MONO_IOMAP"] = "drive";

					pw = Runtime.ProcessService.StartProcess (info, sw, sw, null);
				} catch (System.ComponentModel.Win32Exception ex) {
					LoggingService.LogDebug (GettextCatalog.GetString (
						"Error while trying to invoke '{0}' to compile resource '{1}' :\n {2}", resgen, fname, ex.ToString ()));
					monitor.Log.WriteLine (GettextCatalog.GetString (
						"Error while trying to invoke '{0}' to compile resource '{1}' :\n {2}", resgen, fname, ex.Message));

					return new CompilerError (fname, 0, 0, String.Empty, ex.Message);
				}

				//FIXME: Handle exceptions
				pw.WaitForOutput ();

				if (pw.ExitCode == 0) {
					fname = Path.ChangeExtension (fname, ".resources");
				} else {
					string output = sw.ToString ();
					LoggingService.LogDebug (GettextCatalog.GetString (
						"Unable to compile ({0}) {1} to .resources. \nReason: \n{2}\n",
						resgen, fname, output));
					monitor.Log.WriteLine (GettextCatalog.GetString (
						"Unable to compile ({0}) {1} to .resources. \nReason: \n{2}\n",
						resgen, fname, output));

					//Try to get the line/pos
					int line = 0;
					int pos = 0;
					Match match = RegexErrorLinePos.Match (output);
					if (match.Success && match.Groups.Count == 3) {
						try {
							line = int.Parse (match.Groups [1].Value);
						} catch (FormatException){
						}

						try {
							pos = int.Parse (match.Groups [2].Value);
						} catch (FormatException){
						}
					}

					return new CompilerError (fname, line, pos, String.Empty, output);
				}
			}

			return null;
		}
        public void ExecuteCommandOld(ProjectFile proj)
        {
            Console.WriteLine("starting to build " + proj.ProjectPath.Name);

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.WorkingDirectory = proj.ProjectPath.Directory.FullName;
            startInfo.FileName = SolutionBuilder.CurPath;//"CMD.exe";
            startInfo.Arguments = proj.ReferenceCompileArg + " " + proj.TargetCompileArg + " /out:" + proj.BuildProjectOutputPath + " /ruleset: \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Team Tools\\Static Analysis Tools\\Rule Sets\\MinimumRecommendedRules.ruleset\" /subsystemversion:6.00 /resource:" + proj.ResourceCompileArg + " *.cs \"C:\\Users\\tacke\\AppData\\Local\\Temp\\.NETFramework,Version=v4.5.2.AssemblyAttributes.cs\"";//string.Join(" ", proj.ProjectClassPaths.Select(x => "\"" + x.FullName + "\""));//" *.cs";//+ " /maxcpucount:4 /p:BuildInParallel=true";
            process.StartInfo = startInfo;
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.Start();
            string output = process.StandardOutput.ReadToEnd();
            process.WaitForExit();

            Console.WriteLine(output);

            proj.NeedsToBeBuilt = false;
            proj.HasBuilt = true;
            lock (this.listLock) { COUNTER++; }
        }
Exemple #50
0
    public ProjectFile CreateFile(string name)
    {
        if (!Helpers.ValidFilename(name)) {
            throw new Exception("Invalid directory name \"" + name + "\"");
        }

        //does the file already exist?
        ProjectFile buffer = GetFile(name);
        if (DirectoryExists(name)) { return null; }
        if (buffer != null) { return buffer; }

        //make sure that the physical directory that contains
        //the physical file exists.
        string parentDirectory = new DirectoryInfo(PhysicalLocation).FullName;
        if (!Directory.Exists(parentDirectory)) {
            Directory.CreateDirectory(parentDirectory);
        }

        Monitor.Enter(p_SyncLock);

        //create it
        buffer = new ProjectFile(name, Project);
        buffer.AssignNewID();
        buffer.p_ParentID = InstanceID;

        //create the physical file on disk
        File.WriteAllText(buffer.PhysicalLocation, "");

        //add it to the file list
        Array.Resize(ref p_ChildFiles, p_ChildFiles.Length + 1);
        p_ChildFiles[p_ChildFiles.Length - 1] = buffer.InstanceID;
        Project.RegisterEntity(buffer, false);

        //clean up
        Monitor.Exit(p_SyncLock);
        Project.Save();
        return buffer;
    }
        private void RunCorrectExecuteCommandT(ProjectFile proj, int projIndex)
        {
            //            Console.WriteLine("starting to MS_build " + proj.ProjectPath.Name);
            //new Microsoft.Build.Evaluation.Project(proj.ProjectPath.FullName).Build();
            //proj.NeedsToBeBuilt = false;
            //proj.HasBuilt = true;
            //lock (this.listLock) { COUNTER++; }
            //return;

            Console.WriteLine(proj.ProjectPath + ": " + Helper.TimeFunction(() => {
                ExecuteCommand(proj);
                /*
                if (Monitor.TryEnter(msLock))
                {
                    Console.WriteLine("starting to MS_build " + proj.ProjectPath.Name);
                    var projToBuild = new Microsoft.Build.Evaluation.Project(proj.ProjectPath.FullName);
                    projToBuild.Build();
                    proj.NeedsToBeBuilt = false;
                    proj.HasBuilt = true;
                    lock (this.listLock) { COUNTER++; }
                }
                else
                {
                    proj.NeedsToBeBuilt = null;
                    //ExecuteCommandOld(proj);
                    ExecuteCommand(SolutionBuilder.CurPath, projIndex);
                }
                */
            }
            ));
        }
Exemple #52
0
        public static void Find(string name)
        {
            var projectFile = ProjectFile.Find(name);

            Assert.AreEqual(name, projectFile.Name);
        }
        private void CloseProject(Window window)
        {
            if (SaveExistingProjectIfNeeded(window) == MessageBoxResult.Cancel)
                return;

            _projectFile = null;
            RaisePropertyChanged("IsProjectOpened");
            RaisePropertyChanged("IsProjectSaved");

            RaisePropertyChanged("SaveProjectCommand");
            RaisePropertyChanged("SaveAsProjectCommand");
            RaisePropertyChanged("CloseProjectCommand");

            Stop();
            _capture.ImageGrabbed -= CaptureOnImageGrabbed;
            _capture = null;

            RaisePropertyChanged("PlayPauseCommand");
            RaisePropertyChanged("StopCommand");

            VideoInformation = String.Empty;
            PointInformation = String.Empty;
        }
Exemple #54
0
        public void TestProjectName()
        {
            ProjectFile projectFile = CreateProjectFile();

            Assert.AreEqual("DsmSuite.Analyzer.VisualStudio.Test.Data.vcxproj", projectFile.ProjectName);
        }
Exemple #55
0
    public AsmDefCSharpProgram(AsmDefDescription asmDefDescription)
        : base(asmDefDescription.Directory,
               asmDefDescription.IncludedAsmRefs.Select(asmref => asmref.Path.Parent),
               deferConstruction: true)
    {
        AsmDefDescription = asmDefDescription;

        var asmDefReferences = AsmDefDescription.References.Select(asmDefDescription1 => BuildProgram.GetOrMakeDotsRuntimeCSharpProgramFor(asmDefDescription1)).ToList();
        var isExe            = asmDefDescription.DefineConstraints.Contains("UNITY_DOTS_ENTRYPOINT") || asmDefDescription.Name.EndsWith(".Tests");

        Construct(asmDefDescription.Name, isExe);

        ProjectFile.AdditionalFiles.Add(asmDefDescription.Path);

        IncludePlatforms = AsmDefDescription.IncludePlatforms;
        ExcludePlatforms = AsmDefDescription.ExcludePlatforms;
        Unsafe           = AsmDefDescription.AllowUnsafeCode;
        References.Add(config =>
        {
            if (config is DotsRuntimeCSharpProgramConfiguration dotsConfig)
            {
                if (dotsConfig.TargetFramework == TargetFramework.Tiny)
                {
                    return(asmDefReferences.Where(rp => rp.IsSupportedFor(dotsConfig) && !IncompatibleTinyBCLAsmDefs.Contains(rp.FileName)));
                }
                else
                {
                    return(asmDefReferences.Where(rp => rp.IsSupportedFor(dotsConfig)));
                }
            }

            //this codepath will be hit for the bindgem invocation
            return(asmDefReferences);
        });

        if (AsmDefDescription.IsTinyRoot || isExe)
        {
            AsmDefCSharpProgramCustomizer.RunAllAddPlatformImplementationReferences(this);
        }

        if (BuildProgram.UnityTinyBurst != null)
        {
            References.Add(BuildProgram.UnityTinyBurst);
        }
        if (BuildProgram.ZeroJobs != null)
        {
            References.Add(BuildProgram.ZeroJobs);
        }
        if (BuildProgram.UnityLowLevel != null)
        {
            References.Add(BuildProgram.UnityLowLevel);
        }
        if (BuildProgram.TinyIO != null)
        {
            References.Add(BuildProgram.TinyIO);
        }

        // Add in any precompiled references found in the asmdef directory or sub-directory
        foreach (var pcr in asmDefDescription.PrecompiledReferences)
        {
            var files = asmDefDescription.Path.Parent.Files(pcr, true);
            if (files.Any())
            {
                References.Add(files);
            }
        }

        if (IsTestAssembly)
        {
            var nunitLiteMain = BuildProgram.BeeRoot.Combine("CSharpSupport/NUnitLiteMain.cs");
            Sources.Add(nunitLiteMain);

            // Setup for IL2CPP
            var tinyTestFramework = BuildProgram.BeeRoot.Parent.Combine("TinyTestFramework");
            Sources.Add(c => ((DotsRuntimeCSharpProgramConfiguration)c).ScriptingBackend == ScriptingBackend.TinyIl2cpp || ((DotsRuntimeCSharpProgramConfiguration)c).TargetFramework == TargetFramework.Tiny, tinyTestFramework);
            Defines.Add(c => ((DotsRuntimeCSharpProgramConfiguration)c).ScriptingBackend == ScriptingBackend.TinyIl2cpp || ((DotsRuntimeCSharpProgramConfiguration)c).TargetFramework == TargetFramework.Tiny, "UNITY_PORTABLE_TEST_RUNNER");

            // Setup for dotnet
            References.Add(c => ((DotsRuntimeCSharpProgramConfiguration)c).ScriptingBackend == ScriptingBackend.Dotnet && ((DotsRuntimeCSharpProgramConfiguration)c).TargetFramework != TargetFramework.Tiny, BuildProgram.NUnitFramework);
            ProjectFile.AddCustomLinkRoot(nunitLiteMain.Parent, "TestRunner");
            References.Add(c => ((DotsRuntimeCSharpProgramConfiguration)c).ScriptingBackend == ScriptingBackend.Dotnet && ((DotsRuntimeCSharpProgramConfiguration)c).TargetFramework != TargetFramework.Tiny, BuildProgram.NUnitLite);

            // General setup
            References.Add(BuildProgram.GetOrMakeDotsRuntimeCSharpProgramFor(AsmDefConfigFile.AsmDefDescriptionFor("Unity.Entities")));
            References.Add(BuildProgram.GetOrMakeDotsRuntimeCSharpProgramFor(AsmDefConfigFile.AsmDefDescriptionFor("Unity.Tiny.Core")));
            References.Add(BuildProgram.GetOrMakeDotsRuntimeCSharpProgramFor(AsmDefConfigFile.AsmDefDescriptionFor("Unity.Tiny.UnityInstance")));
            References.Add(BuildProgram.GetOrMakeDotsRuntimeCSharpProgramFor(AsmDefConfigFile.AsmDefDescriptionFor("Unity.Collections")));
        }
        else if (IsILPostProcessorAssembly)
        {
            References.Add(BuildProgram.UnityCompilationPipeline);
            References.Add(MonoCecil.Paths);
            References.Add(Il2Cpp.Distribution.Path.Combine("build/deploy/net471/Unity.Cecil.Awesome.dll"));
        }
    }
Exemple #56
0
 protected override void ConfigureConverter(ProjectFile projectFile, IMultiFileConverter multiFileConverter)
 {
     multiFileConverter.AddBilingualProcessor(new BilingualContentHandlerAdapter(errorMsgReporter));
     PrepareForGenerateTarget(projectFile, multiFileConverter);
 }
Exemple #57
0
 public ProjectFile[] GetFiles()
 {
     lock (p_SyncLock) {
         ProjectFile[] buffer = new ProjectFile[p_ChildFiles.Length];
         for (int c = 0; c < buffer.Length; c++) {
             buffer[c] = Project.ResolveFile(p_ChildFiles[c]);
         }
         return buffer;
     }
 }
        public override string GetDefaultResourceId(ProjectFile pf)
        {
            if (String.IsNullOrEmpty(pf.DependsOn))
            {
                return(base.GetDefaultResourceId(pf));
            }

            string ns        = null;
            string classname = null;

            using (StreamReader rdr = new StreamReader(pf.DependsOn))
            {
                while (true)
                {
                    string tok = GetNextToken(rdr);
                    if (tok == null)
                    {
                        break;
                    }

                    if (String.Compare(tok, "namespace", true) == 0)
                    {
                        string t = GetNextToken(rdr);
                        /* 'namespace' can be a attribute param also, */
                        if (t == ":" && GetNextToken(rdr) == "=")
                        {
                            continue;
                        }
                        ns = t;
                    }

                    if (String.Compare(tok, "class", true) == 0)
                    {
                        string t = GetNextToken(rdr);
                        /* 'class' can be a attribute param also, */
                        if (t == ":" && GetNextToken(rdr) == "=")
                        {
                            continue;
                        }
                        classname = t;
                        break;
                    }
                }

                if (classname == null)
                {
                    return(base.GetDefaultResourceId(pf));
                }

                string culture, extn, only_filename;
                if (MSBuildProjectService.TrySplitResourceName(pf.ProjectVirtualPath, out only_filename, out culture, out extn))
                {
                    extn = "." + culture + ".resources";
                }
                else
                {
                    extn = ".resources";
                }

                string rname;
                if (ns == null)
                {
                    rname = classname + extn;
                }
                else
                {
                    rname = ns + '.' + classname + extn;
                }

                DotNetProject dp = pf.Project as DotNetProject;
                if (dp == null || String.IsNullOrEmpty(dp.DefaultNamespace))
                {
                    return(rname);
                }
                else
                {
                    return(dp.DefaultNamespace + "." + rname);
                }
            }
        }
 public void SaveFile(ProjectFile file)
 {
     ProjectSystem.WriteAllText(file.Path, file.Content);
 }
Exemple #60
0
        public void TestSolutionFolder()
        {
            ProjectFile projectFile = CreateProjectFile();

            Assert.AreEqual("Analyzers.VisualStudioAnalyzer", projectFile.SolutionFolder);
        }