ExportTask() public method

public ExportTask ( DirectoryInfo directory ) : bool
directory DirectoryInfo
return bool
    void Configure(ConfigureWindowModel model, Project project)
    {
        var directoryInfo = fullPathResolver.GetFullPath(model.ToolsDirectory, project);
        var targetFile    = new FileInfo(Path.Combine(directoryInfo.FullName, "NotifyPropertyWeaverMsBuildTask.dll"));

        if (!targetFile.Exists || VersionChecker.IsVersionNewer(targetFile))
        {
            if (!fileExporter.ExportTask(directoryInfo))
            {
                taskFileReplacer.AddFile(directoryInfo);
            }
        }

        if (model.IncludeAttributeAssembly)
        {
            var frameworkType = FrameworkTypeReader.GetFrameworkType(project.FullName);
            fileExporter.ExportAttribute(fullPathResolver.GetFullPath(model.DependenciesDirectory, project), frameworkType);
        }

        var defaulter       = new Defaulter();
        var projectInjector = new NotifyPropertyWeaverProjectInjector
        {
            ProjectFile = project.FullName
        };

        defaulter.FromModel(projectInjector, model);
        projectInjector.Execute();
    }
Ejemplo n.º 2
0
 public void CheckForFilesToUpdate()
 {
     ThreadPool.QueueUserWorkItem(x =>
     {
         bool createdNew;
         using (new Mutex(true, typeof(TaskFileReplacer).FullName, out createdNew))
         {
             if (!createdNew)
             {
                 //already being used;
                 return;
             }
             var newStrings = new List <string>();
             foreach (var targetDirectory in File.ReadAllLines(taskFilePath))
             {
                 var trimmed = targetDirectory.Trim();
                 if (trimmed.Length == 0)
                 {
                     continue;
                 }
                 var directoryInfo = new DirectoryInfo(trimmed);
                 if (!directoryInfo.Exists)
                 {
                     continue;
                 }
                 if (fileExporter.ExportTask(directoryInfo))
                 {
                     var path = Path.Combine(trimmed, "NotifyPropertyWeaverMsBuildTask.dll");
                     errorDisplayer.ShowInfo(string.Format("NotifyPropertyWeaver: Updated '{0}' to version {1}.", path, CurrentVersion.Version));
                 }
                 else
                 {
                     newStrings.Add(trimmed);
                 }
             }
             File.WriteAllLines(taskFilePath, newStrings);
         }
     });
 }