Example #1
0
 private void LoadBadFile(out string title, out Fixer fixer)
 {
     fixer = null;
     title = null;
     try
     {
         var badXml       = File.ReadAllText(FilePath);
         var badMsProject = badXml.ParseProject();
         fixer = new Fixer(badMsProject);
         title = badMsProject.Title;
     }
     catch (Exception ex)
     {
         logger.Error(ex);
         Result = string.Format("Error: {0}\nSee log file for details.", ex.Message);
     }
 }
Example #2
0
        private void DoFixing(string title, Fixer fixer)
        {
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += bw_DoWork;
            bw.RunWorkerCompleted += (s, e) =>
            {
                if (e.Result is Exception)
                {
                    var ex = e.Result as Exception;
                    logger.Error(ex);
                    if (ex is RetryLimitException)
                    {
                        Result = "Retry Limit: " + ex.Message.ToString();
                    }
                    else
                    {
                        Result = string.Format("Error: {0}\nSee log file for details.", ex.Message);
                    }
                    IsWorking = false;
                    return;
                }
                var project = e.Result as TwProject;
                if (project == null)
                {
                    logger.Warn("project '{0}' not found", title);
                    Result = string.Format("project '{0}' not found on server", title);
                }
                else
                {
                    var result   = fixer.Fix(project);
                    var filename = FileManager.GetResultFilename(FilePath);
                    result.Save(filename);
                    Result = "Saved to " + filename;
                }
                IsWorking = false;
            };
            bw.RunWorkerAsync(title);
        }
Example #3
0
 private void LoadBadFile(out string title, out Fixer fixer)
 {
     fixer = null;
     title = null;
     try
     {
         var badXml = File.ReadAllText(FilePath);
         var badMsProject = badXml.ParseProject();
         fixer = new Fixer(badMsProject);
         title = badMsProject.Title;
     }
     catch (Exception ex)
     {
         logger.Error(ex);
         Result = string.Format("Error: {0}\nSee log file for details.", ex.Message);
     }
 }
Example #4
0
 private void DoFixing(string title, Fixer fixer)
 {
     BackgroundWorker bw = new BackgroundWorker();
     bw.DoWork += bw_DoWork;
     bw.RunWorkerCompleted += (s, e) =>
     {
         if (e.Result is Exception)
         {
             var ex = e.Result as Exception;
             logger.Error(ex);
             if (ex is RetryLimitException)
             {
                 Result = "Retry Limit: " + ex.Message.ToString();
             }
             else
             {
                 Result = string.Format("Error: {0}\nSee log file for details.", ex.Message);
             }
             IsWorking = false;
             return;
         }
         var project = e.Result as TwProject;
         if (project == null)
         {
             logger.Warn("project '{0}' not found", title);
             Result = string.Format("project '{0}' not found on server", title);
         }
         else
         {
             var result = fixer.Fix(project);
             var filename = FileManager.GetResultFilename(FilePath);
             result.Save(filename);
             Result = "Saved to " + filename;
         }
         IsWorking = false;
     };
     bw.RunWorkerAsync(title);
 }