public void CheckForFilesToUpdate()
 {
     WrapInMutex(() =>
     {
         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, "Costura.dll");
                 errorDisplayer.ShowInfo(string.Format("Costura: Updated '{0}' to version {1}.", path, CurrentVersion.Version));
             }
             else
             {
                 newStrings.Add(trimmed);
             }
         }
         File.WriteAllLines(taskFilePath, newStrings);
     });
 }
Example #2
0
    void Configure(ConfigureWindowModel model, Project project)
    {
        var directoryInfo = fullPathResolver.GetFullPath(model.ToolsDirectory, project);
        var targetFile    = new FileInfo(Path.Combine(directoryInfo.FullName, "Costura.dll"));

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

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

        defaulter.FromModel(projectInjector, model);
        projectInjector.Execute();
    }