예제 #1
0
 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);
     });
 }
예제 #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);
         }
     });
 }
예제 #3
0
 public void DisableCallback()
 {
     try
     {
         var project = currentProjectFinder.GetCurrentProject();
         if (UnsaveProjectChecker.HasUnsavedPendingChanges(project))
         {
             return;
         }
         errorDisplayer.ShowInfo(string.Format("Costura: Removed from the project '{0}'. However no binary files will be removed in case they are being used by other projects.", project.Name));
         new ProjectRemover(project.FullName);
     }
     catch (COMException exception)
     {
         exceptionDialog.HandleException(exception);
     }
     catch (Exception exception)
     {
         exceptionDialog.HandleException(exception);
     }
 }