Changeset 2737


Ignore:
Timestamp:
6/29/2012 10:22:26 AM (22 months ago)
Author:
lowjoel
Message:

Updated to r2734 of trunk.

Location:
branches/eraser6/EraserService
Files:
60 edited
6 copied

Legend:

Unmodified
Added
Removed
  • branches/eraser6/EraserService

  • branches/eraser6/EraserService/Eraser.BlackBox/BlackBox.cs

    r2621 r2737  
    2626using System.Windows.Forms; 
    2727using System.IO; 
    28 using System.Runtime.InteropServices; 
    2928using System.Diagnostics; 
    3029using System.Reflection; 
     
    3231using System.Drawing; 
    3332using System.Drawing.Imaging; 
    34 using System.Collections.ObjectModel; 
    3533using System.Globalization; 
    3634 
    37 using System.Net; 
    38 using System.Xml; 
    3935using System.ComponentModel; 
    4036 
    41 using SevenZip; 
    42 using SevenZip.Compression.LZMA; 
    43 using ICSharpCode.SharpZipLib.Tar; 
    44 using ICSharpCode.SharpZipLib.BZip2; 
    45 using Microsoft.Win32.SafeHandles; 
    4637using Microsoft.VisualBasic.Devices; 
    4738 
    4839using Eraser.Util; 
    4940using Eraser.Util.ExtensionMethods; 
    50 using Eraser.Plugins; 
    51 using ProgressChangedEventHandler = Eraser.Plugins.ProgressChangedEventHandler; 
    52 using ProgressChangedEventArgs = Eraser.Plugins.ProgressChangedEventArgs; 
    5341 
    5442namespace Eraser.BlackBox 
     
    370358        internal static readonly string ScreenshotFileName = "Screenshot.png"; 
    371359    } 
    372  
    373     /// <summary> 
    374     /// Represents one BlackBox crash report. 
    375     /// </summary> 
    376     public class BlackBoxReport 
    377     { 
    378         /// <summary> 
    379         /// Constructor. 
    380         /// </summary> 
    381         /// <param name="path">Path to the folder containing the memory dump, screenshot and 
    382         /// debug log.</param> 
    383         internal BlackBoxReport(string path) 
    384         { 
    385             Path = path; 
    386  
    387             string stackTracePath = System.IO.Path.Combine(Path, StackTraceFileName); 
    388             if (!File.Exists(stackTracePath)) 
    389             { 
    390                 Delete(); 
    391                 throw new InvalidDataException("The BlackBox report is corrupt."); 
    392             } 
    393  
    394             string[] stackTrace = null; 
    395             using (StreamReader reader = new StreamReader(stackTracePath)) 
    396                 stackTrace = reader.ReadToEnd().Split(new char[] { '\n' }); 
    397  
    398             //Parse the lines in the file. 
    399             StackTraceCache = new List<BlackBoxExceptionEntry>(); 
    400             List<string> currentException = new List<string>(); 
    401             string exceptionType = null; 
    402             foreach (string str in stackTrace) 
    403             { 
    404                 if (str.StartsWith("Exception ")) 
    405                 { 
    406                     //Add the current exception to the list of exceptions. 
    407                     if (currentException.Count != 0) 
    408                     { 
    409                         StackTraceCache.Add(new BlackBoxExceptionEntry(exceptionType, 
    410                             new List<string>(currentException))); 
    411                         currentException.Clear(); 
    412                     } 
    413  
    414                     //Set the exception type for the next exception. 
    415                     exceptionType = str.Substring(str.IndexOf(':') + 1).Trim(); 
    416                 } 
    417                 else if (!string.IsNullOrEmpty(str.Trim())) 
    418                 { 
    419                     currentException.Add(str.Trim()); 
    420                 } 
    421             } 
    422  
    423             if (currentException.Count != 0) 
    424                 StackTraceCache.Add(new BlackBoxExceptionEntry(exceptionType, currentException)); 
    425         } 
    426  
    427         /// <summary> 
    428         /// Deletes the report and its contents. 
    429         /// </summary> 
    430         public void Delete() 
    431         { 
    432             Directory.Delete(Path, true); 
    433         } 
    434  
    435         /// <summary> 
    436         /// The name of the report. 
    437         /// </summary> 
    438         public string Name 
    439         { 
    440             get 
    441             { 
    442                 return System.IO.Path.GetFileName(Path); 
    443             } 
    444         } 
    445  
    446         /// <summary> 
    447         /// The timestamp of the report. 
    448         /// </summary> 
    449         public DateTime Timestamp 
    450         { 
    451             get 
    452             { 
    453                 try 
    454                 { 
    455                     return DateTime.ParseExact(Name, BlackBox.CrashReportName, 
    456                         CultureInfo.InvariantCulture).ToLocalTime(); 
    457                 } 
    458                 catch (FormatException) 
    459                 { 
    460                     return DateTime.MinValue; 
    461                 } 
    462             } 
    463         } 
    464  
    465         /// <summary> 
    466         /// The path to the folder containing the report. 
    467         /// </summary> 
    468         public string Path 
    469         { 
    470             get; 
    471             private set; 
    472         } 
    473  
    474         /// <summary> 
    475         /// The files which comprise the error report. 
    476         /// </summary> 
    477         public ReadOnlyCollection<FileInfo> Files 
    478         { 
    479             get 
    480             { 
    481                 List<FileInfo> result = new List<FileInfo>(); 
    482                 DirectoryInfo directory = new DirectoryInfo(Path); 
    483                 foreach (FileInfo file in directory.GetFiles()) 
    484                     if (!InternalFiles.Contains(file.Name)) 
    485                         result.Add(file); 
    486  
    487                 return result.AsReadOnly(); 
    488             } 
    489         } 
    490  
    491         /// <summary> 
    492         /// Gets a read-only stream which reads the Debug log. 
    493         /// </summary> 
    494         public Stream DebugLog 
    495         { 
    496             get 
    497             { 
    498                 return new FileStream(System.IO.Path.Combine(Path, BlackBox.DebugLogFileName), 
    499                     FileMode.Open, FileAccess.Read, FileShare.Read); 
    500             } 
    501         } 
    502  
    503         /// <summary> 
    504         /// Gets the stack trace for this crash report. 
    505         /// </summary> 
    506         public ReadOnlyCollection<BlackBoxExceptionEntry> StackTrace 
    507         { 
    508             get 
    509             { 
    510                 return StackTraceCache.AsReadOnly(); 
    511             } 
    512         } 
    513  
    514         /// <summary> 
    515         /// Gets or sets whether the given report has been uploaded to the server. 
    516         /// </summary> 
    517         public bool Submitted 
    518         { 
    519             get 
    520             { 
    521                 byte[] buffer = new byte[1]; 
    522                 using (FileStream stream = new FileStream(System.IO.Path.Combine(Path, StatusFileName), 
    523                     FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read)) 
    524                 { 
    525                     stream.Read(buffer, 0, buffer.Length); 
    526                 } 
    527  
    528                 return buffer[0] == 1; 
    529             } 
    530  
    531             set 
    532             { 
    533                 byte[] buffer = { Convert.ToByte(value) }; 
    534                 using (FileStream stream = new FileStream(System.IO.Path.Combine(Path, StatusFileName), 
    535                     FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read)) 
    536                 { 
    537                     stream.Write(buffer, 0, buffer.Length); 
    538                 } 
    539             } 
    540         } 
    541  
    542         public override string ToString() 
    543         { 
    544             return Name; 
    545         } 
    546  
    547         /// <summary> 
    548         /// The backing variable for the <see cref="StackTrace"/> field. 
    549         /// </summary> 
    550         private List<BlackBoxExceptionEntry> StackTraceCache; 
    551  
    552         /// <summary> 
    553         /// The file name for the status file. 
    554         /// </summary> 
    555         private static readonly string StatusFileName = "Status.txt"; 
    556  
    557         /// <summary> 
    558         /// The file name of the stack trace. 
    559         /// </summary> 
    560         internal static readonly string StackTraceFileName = "Stack Trace.log"; 
    561  
    562         /// <summary> 
    563         /// The list of files internal to the report. 
    564         /// </summary> 
    565         private static readonly List<string> InternalFiles = new List<string>( 
    566             new string[] { 
    567                  StackTraceFileName, 
    568                  StatusFileName 
    569             } 
    570         ); 
    571     } 
    572  
    573     /// <summary> 
    574     /// Represents one exception which can be chained <see cref="InnerException"/> 
    575     /// to represent the exception handled by BlackBox 
    576     /// </summary> 
    577     public class BlackBoxExceptionEntry 
    578     { 
    579         /// <summary> 
    580         /// Constructor. 
    581         /// </summary> 
    582         /// <param name="exceptionType">The type of the exception.</param> 
    583         /// <param name="stackTrace">The stack trace for this exception.</param> 
    584         internal BlackBoxExceptionEntry(string exceptionType, List<string> stackTrace) 
    585         { 
    586             ExceptionType = exceptionType; 
    587             StackTraceCache = stackTrace; 
    588         } 
    589  
    590         /// <summary> 
    591         /// The type of the exception. 
    592         /// </summary> 
    593         public string ExceptionType 
    594         { 
    595             get; 
    596             private set; 
    597         } 
    598  
    599         /// <summary> 
    600         /// The stack trace for this exception. 
    601         /// </summary> 
    602         public ReadOnlyCollection<string> StackTrace 
    603         { 
    604             get 
    605             { 
    606                 return StackTraceCache.AsReadOnly(); 
    607             } 
    608         } 
    609  
    610         /// <summary> 
    611         /// The backing variable for the <see cref="StackTrace"/> property. 
    612         /// </summary> 
    613         private List<string> StackTraceCache; 
    614     } 
    615  
    616     /// <summary> 
    617     /// Uploads <see cref="BlackBoxReport"/>s to the Eraser server. 
    618     /// </summary> 
    619     public class BlackBoxReportUploader 
    620     { 
    621         private class SevenZipProgressCallback : ICodeProgress 
    622         { 
    623             public SevenZipProgressCallback(BlackBoxReportUploader uploader, 
    624                 SteppedProgressManager progress, ProgressManager stepProgress, 
    625                 ProgressChangedEventHandler progressChanged) 
    626             { 
    627                 Uploader = uploader; 
    628                 Progress = progress; 
    629                 StepProgress = stepProgress; 
    630                 EventHandler = progressChanged; 
    631             } 
    632  
    633             #region ICodeProgress Members 
    634  
    635             public void SetProgress(long inSize, long outSize) 
    636             { 
    637                 StepProgress.Completed = inSize; 
    638                 EventHandler(Uploader, new ProgressChangedEventArgs(Progress, null)); 
    639             } 
    640  
    641             #endregion 
    642  
    643             private BlackBoxReportUploader Uploader; 
    644             private SteppedProgressManager Progress; 
    645             private ProgressManager StepProgress; 
    646             private ProgressChangedEventHandler EventHandler; 
    647         } 
    648  
    649         /// <summary> 
    650         /// Constructor. 
    651         /// </summary> 
    652         /// <param name="report">The report to upload.</param> 
    653         public BlackBoxReportUploader(BlackBoxReport report) 
    654         { 
    655             Report = report; 
    656             if (!Directory.Exists(UploadTempDir)) 
    657                 Directory.CreateDirectory(UploadTempDir); 
    658  
    659             ReportBaseName = Path.Combine(UploadTempDir, Report.Name); 
    660         } 
    661  
    662         /// <summary> 
    663         /// Gets from the server based on the stack trace whether this report is 
    664         /// new. 
    665         /// </summary> 
    666         public bool IsNew 
    667         { 
    668             get 
    669             { 
    670                 PostDataBuilder builder = new PostDataBuilder(); 
    671                 builder.AddPart(new PostDataField("action", "status")); 
    672                 AddStackTraceToRequest(Report.StackTrace, builder); 
    673  
    674                 WebRequest reportRequest = HttpWebRequest.Create(BlackBoxServer); 
    675                 reportRequest.ContentType = builder.ContentType; 
    676                 reportRequest.Method = "POST"; 
    677                 using (Stream formStream = builder.Stream) 
    678                 { 
    679                     reportRequest.ContentLength = formStream.Length; 
    680                     using (Stream requestStream = reportRequest.GetRequestStream()) 
    681                     { 
    682                         int lastRead = 0; 
    683                         byte[] buffer = new byte[32768]; 
    684                         while ((lastRead = formStream.Read(buffer, 0, buffer.Length)) != 0) 
    685                             requestStream.Write(buffer, 0, lastRead); 
    686                     } 
    687                 } 
    688  
    689                 try 
    690                 { 
    691                     HttpWebResponse response = reportRequest.GetResponse() as HttpWebResponse; 
    692                     using (Stream responseStream = response.GetResponseStream()) 
    693                     { 
    694                         XmlReader reader = XmlReader.Create(responseStream); 
    695                         reader.ReadToFollowing("crashReport"); 
    696                         string reportStatus = reader.GetAttribute("status"); 
    697                         switch (reportStatus) 
    698                         { 
    699                             case "exists": 
    700                                 Report.Submitted = true; 
    701                                 return false; 
    702  
    703                             case "new": 
    704                                 return true; 
    705  
    706                             default: 
    707                                 throw new InvalidDataException( 
    708                                     "Unknown crash report server response."); 
    709                         } 
    710                     } 
    711                 } 
    712                 catch (WebException e) 
    713                 { 
    714                     if (e.Response == null) 
    715                         throw; 
    716  
    717                     using (Stream responseStream = e.Response.GetResponseStream()) 
    718                     { 
    719                         try 
    720                         { 
    721                             XmlReader reader = XmlReader.Create(responseStream); 
    722                             reader.ReadToFollowing("error"); 
    723                             throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture, 
    724                                 "The server encountered a problem while processing the request: {0}", 
    725                                 reader.ReadString())); 
    726                         } 
    727                         catch (XmlException) 
    728                         { 
    729                         } 
    730                     } 
    731  
    732                     throw new InvalidDataException(((HttpWebResponse)e.Response).StatusDescription); 
    733                 } 
    734             } 
    735         } 
    736  
    737         /// <summary> 
    738         /// Compresses the report for uploading. 
    739         /// </summary> 
    740         /// <param name="progress">The <see cref="ProgressManager"/> instance that the 
    741         /// Upload function is using.</param> 
    742         /// <param name="progressChanged">The progress changed event handler that should 
    743         /// be called for upload progress updates.</param> 
    744         private void Compress(SteppedProgressManager progress, 
    745             ProgressChangedEventHandler progressChanged) 
    746         { 
    747             using (FileStream archiveStream = new FileStream(ReportBaseName + ".tar", 
    748                     FileMode.Create, FileAccess.Write)) 
    749             { 
    750                 //Add the report into a tar file 
    751                 TarArchive archive = TarArchive.CreateOutputTarArchive(archiveStream); 
    752                 foreach (FileInfo file in Report.Files) 
    753                 { 
    754                     TarEntry entry = TarEntry.CreateEntryFromFile(file.FullName); 
    755                     entry.Name = Path.GetFileName(entry.Name); 
    756                     archive.WriteEntry(entry, false); 
    757                 } 
    758                 archive.Close(); 
    759             } 
    760  
    761             ProgressManager step = new ProgressManager(); 
    762             progress.Steps.Add(new SteppedProgressManagerStep(step, 0.5f, "Compressing")); 
    763             CoderPropID[] propIDs =  
    764                 { 
    765                     CoderPropID.DictionarySize, 
    766                     CoderPropID.PosStateBits, 
    767                     CoderPropID.LitContextBits, 
    768                     CoderPropID.LitPosBits, 
    769                     CoderPropID.Algorithm, 
    770                     CoderPropID.NumFastBytes, 
    771                     CoderPropID.MatchFinder, 
    772                     CoderPropID.EndMarker 
    773                 }; 
    774             object[] properties =  
    775                 { 
    776                     (Int32)(1 << 24),           //Dictionary Size 
    777                     (Int32)2,                   //PosState Bits 
    778                     (Int32)0,                   //LitContext Bits 
    779                     (Int32)2,                   //LitPos Bits 
    780                     (Int32)2,                   //Algorithm 
    781                     (Int32)128,                 //Fast Bytes 
    782                     "bt4",                      //Match Finger 
    783                     true                        //Write end-of-stream 
    784                 }; 
    785  
    786             SevenZip.Compression.LZMA.Encoder encoder = new SevenZip.Compression.LZMA.Encoder(); 
    787             encoder.SetCoderProperties(propIDs, properties); 
    788  
    789             using (FileStream sevenZipFile = new FileStream(ReportBaseName + ".tar.7z", 
    790                 FileMode.Create)) 
    791             using (FileStream tarStream = new FileStream(ReportBaseName + ".tar", 
    792                 FileMode.Open, FileAccess.Read, FileShare.Read, 262144, FileOptions.DeleteOnClose)) 
    793             { 
    794                 encoder.WriteCoderProperties(sevenZipFile); 
    795                 Int64 fileSize = -1; 
    796                 for (int i = 0; i < 8; i++) 
    797                     sevenZipFile.WriteByte((Byte)(fileSize >> (8 * i))); 
    798  
    799                 step.Total = tarStream.Length; 
    800                 ICodeProgress callback = progressChanged == null ? null : 
    801                     new SevenZipProgressCallback(this, progress, step, progressChanged); 
    802                 encoder.Code(tarStream, sevenZipFile, -1, -1, callback); 
    803             } 
    804         } 
    805  
    806         /// <summary> 
    807         /// Compresses the report, then uploads it to the server. 
    808         /// </summary> 
    809         /// <param name="progressChanged">The progress changed event handler that should 
    810         /// be called for upload progress updates.</param> 
    811         public void Submit(ProgressChangedEventHandler progressChanged) 
    812         { 
    813             SteppedProgressManager overallProgress = new SteppedProgressManager(); 
    814             Compress(overallProgress, progressChanged); 
    815  
    816             using (FileStream bzipFile = new FileStream(ReportBaseName + ".tar.7z", 
    817                 FileMode.Open, FileAccess.Read, FileShare.Read, 131072, FileOptions.DeleteOnClose)) 
    818             using (Stream logFile = Report.DebugLog) 
    819             { 
    820                 //Build the POST request 
    821                 PostDataBuilder builder = new PostDataBuilder(); 
    822                 builder.AddPart(new PostDataField("action", "upload")); 
    823                 builder.AddPart(new PostDataFileField("crashReport", "Report.tar.7z", bzipFile)); 
    824                 AddStackTraceToRequest(Report.StackTrace, builder); 
    825  
    826                 //Upload the POST request 
    827                 WebRequest reportRequest = HttpWebRequest.Create(BlackBoxServer); 
    828                 reportRequest.ContentType = builder.ContentType; 
    829                 reportRequest.Method = "POST"; 
    830                 reportRequest.Timeout = int.MaxValue; 
    831                 using (Stream formStream = builder.Stream) 
    832                 { 
    833                     ProgressManager progress = new ProgressManager(); 
    834                     overallProgress.Steps.Add(new SteppedProgressManagerStep( 
    835                         progress, 0.5f, "Uploading")); 
    836                     reportRequest.ContentLength = formStream.Length; 
    837  
    838                     using (Stream requestStream = reportRequest.GetRequestStream()) 
    839                     { 
    840                         int lastRead = 0; 
    841                         byte[] buffer = new byte[32768]; 
    842                         while ((lastRead = formStream.Read(buffer, 0, buffer.Length)) != 0) 
    843                         { 
    844                             requestStream.Write(buffer, 0, lastRead); 
    845  
    846                             progress.Total = formStream.Length; 
    847                             progress.Completed = formStream.Position; 
    848                             progressChanged(this, new ProgressChangedEventArgs(overallProgress, null)); 
    849                         } 
    850                     } 
    851                 } 
    852  
    853                 try 
    854                 { 
    855                     reportRequest.GetResponse(); 
    856                     Report.Submitted = true; 
    857                 } 
    858                 catch (WebException e) 
    859                 { 
    860                     if (e.Response == null) 
    861                         throw; 
    862  
    863                     using (Stream responseStream = e.Response.GetResponseStream()) 
    864                     { 
    865                         try 
    866                         { 
    867                             XmlReader reader = XmlReader.Create(responseStream); 
    868                             reader.ReadToFollowing("error"); 
    869                             throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture, 
    870                                 "The server encountered a problem while processing the request: {0}", 
    871                                 reader.ReadString())); 
    872                         } 
    873                         catch (XmlException) 
    874                         { 
    875                         } 
    876                     } 
    877  
    878                     throw new InvalidDataException(((HttpWebResponse)e.Response).StatusDescription); 
    879                 } 
    880             } 
    881         } 
    882  
    883         /// <summary> 
    884         /// Adds the stack trace to the given form request. 
    885         /// </summary> 
    886         /// <param name="stackTrace">The stack trace to add.</param> 
    887         /// <param name="builder">The Form request builder to add the stack trace to.</param> 
    888         private static void AddStackTraceToRequest(IList<BlackBoxExceptionEntry> stackTrace, 
    889             PostDataBuilder builder) 
    890         { 
    891             int exceptionIndex = 0; 
    892             foreach (BlackBoxExceptionEntry exceptionStack in stackTrace) 
    893             { 
    894                 foreach (string stackFrame in exceptionStack.StackTrace) 
    895                     builder.AddPart(new PostDataField( 
    896                         string.Format(CultureInfo.InvariantCulture, "stackTrace[{0}][]", exceptionIndex), stackFrame)); 
    897                 builder.AddPart(new PostDataField(string.Format(CultureInfo.InvariantCulture,  
    898                     "stackTrace[{0}][exception]", exceptionIndex), exceptionStack.ExceptionType)); 
    899                 ++exceptionIndex; 
    900             } 
    901         } 
    902  
    903         /// <summary> 
    904         /// The path to where the temporary files are stored before uploading. 
    905         /// </summary> 
    906         private static readonly string UploadTempDir = 
    907             Path.Combine(Path.GetTempPath(), "Eraser Crash Reports"); 
    908  
    909         /// <summary> 
    910         /// The URI to the BlackBox server. 
    911         /// </summary> 
    912         private static readonly Uri BlackBoxServer = 
    913             new Uri("http://eraser.heidi.ie/scripts/blackbox/upload.php"); 
    914  
    915         /// <summary> 
    916         /// The report being uploaded. 
    917         /// </summary> 
    918         private BlackBoxReport Report; 
    919  
    920         /// <summary> 
    921         /// The base name of the report. 
    922         /// </summary> 
    923         private readonly string ReportBaseName; 
    924     } 
    925360} 
  • branches/eraser6/EraserService/Eraser.BlackBox/BlackBoxMainForm.Designer.cs

    r2516 r2737  
    5050        private void InitializeComponent() 
    5151        { 
     52            this.components = new System.ComponentModel.Container(); 
    5253            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BlackBoxMainForm)); 
    5354            this.MainLbl = new System.Windows.Forms.Label(); 
    5455            this.SubmitBtn = new System.Windows.Forms.Button(); 
    55             this.PostponeBtn = new System.Windows.Forms.Button(); 
     56            this.CancelBtn = new System.Windows.Forms.Button(); 
    5657            this.BlackBoxPic = new System.Windows.Forms.PictureBox(); 
    5758            this.ReportsLv = new System.Windows.Forms.ListView(); 
    58             this.ReportsLvTimestampColumn = new System.Windows.Forms.ColumnHeader(); 
    59             this.ReportsLvErrorColumn = new System.Windows.Forms.ColumnHeader(); 
     59            this.ReportsLvTimestampColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 
     60            this.ReportsLvErrorColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 
     61            this.ReportsLvStatusColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 
     62            this.ReportsMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 
     63            this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 
     64            this.DataCollectionPolicyLbl = new System.Windows.Forms.LinkLabel(); 
    6065            ((System.ComponentModel.ISupportInitialize)(this.BlackBoxPic)).BeginInit(); 
     66            this.ReportsMenuStrip.SuspendLayout(); 
    6167            this.SuspendLayout(); 
    6268            //  
     
    7379            this.SubmitBtn.Click += new System.EventHandler(this.SubmitBtn_Click); 
    7480            //  
    75             // PostponeBtn 
     81            // CancelBtn 
    7682            //  
    77             resources.ApplyResources(this.PostponeBtn, "PostponeBtn"); 
    78             this.PostponeBtn.Name = "PostponeBtn"; 
    79             this.PostponeBtn.UseVisualStyleBackColor = true; 
    80             this.PostponeBtn.Click += new System.EventHandler(this.PostponeBtn_Click); 
     83            resources.ApplyResources(this.CancelBtn, "CancelBtn"); 
     84            this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; 
     85            this.CancelBtn.Name = "CancelBtn"; 
     86            this.CancelBtn.UseVisualStyleBackColor = true; 
     87            this.CancelBtn.Click += new System.EventHandler(this.PostponeBtn_Click); 
    8188            //  
    8289            // BlackBoxPic 
     
    93100            this.ReportsLv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 
    94101            this.ReportsLvTimestampColumn, 
    95             this.ReportsLvErrorColumn}); 
     102            this.ReportsLvErrorColumn, 
     103            this.ReportsLvStatusColumn}); 
     104            this.ReportsLv.ContextMenuStrip = this.ReportsMenuStrip; 
    96105            this.ReportsLv.FullRowSelect = true; 
    97106            this.ReportsLv.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; 
     
    109118            resources.ApplyResources(this.ReportsLvErrorColumn, "ReportsLvErrorColumn"); 
    110119            //  
     120            // ReportsLvStatusColumn 
     121            //  
     122            resources.ApplyResources(this.ReportsLvStatusColumn, "ReportsLvStatusColumn"); 
     123            //  
     124            // ReportsMenuStrip 
     125            //  
     126            this.ReportsMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 
     127            this.deleteToolStripMenuItem}); 
     128            this.ReportsMenuStrip.Name = "ReportsMenuStrip"; 
     129            resources.ApplyResources(this.ReportsMenuStrip, "ReportsMenuStrip"); 
     130            this.ReportsMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.ReportsMenuStrip_Opening); 
     131            //  
     132            // deleteToolStripMenuItem 
     133            //  
     134            this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; 
     135            resources.ApplyResources(this.deleteToolStripMenuItem, "deleteToolStripMenuItem"); 
     136            this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); 
     137            //  
     138            // DataCollectionPolicyLbl 
     139            //  
     140            resources.ApplyResources(this.DataCollectionPolicyLbl, "DataCollectionPolicyLbl"); 
     141            this.DataCollectionPolicyLbl.Name = "DataCollectionPolicyLbl"; 
     142            this.DataCollectionPolicyLbl.TabStop = true; 
     143            this.DataCollectionPolicyLbl.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DataCollectionPolicyLbl_LinkClicked); 
     144            //  
    111145            // BlackBoxMainForm 
    112146            //  
     147            this.AcceptButton = this.SubmitBtn; 
    113148            resources.ApplyResources(this, "$this"); 
    114149            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 
     150            this.CancelButton = this.CancelBtn; 
     151            this.Controls.Add(this.DataCollectionPolicyLbl); 
    115152            this.Controls.Add(this.ReportsLv); 
    116153            this.Controls.Add(this.BlackBoxPic); 
    117             this.Controls.Add(this.PostponeBtn); 
     154            this.Controls.Add(this.CancelBtn); 
    118155            this.Controls.Add(this.SubmitBtn); 
    119156            this.Controls.Add(this.MainLbl); 
     
    123160            this.Name = "BlackBoxMainForm"; 
    124161            this.ShowInTaskbar = false; 
    125             this.TopMost = true; 
     162            this.Load += new System.EventHandler(this.BlackBoxMainForm_Load); 
    126163            ((System.ComponentModel.ISupportInitialize)(this.BlackBoxPic)).EndInit(); 
     164            this.ReportsMenuStrip.ResumeLayout(false); 
    127165            this.ResumeLayout(false); 
     166            this.PerformLayout(); 
    128167 
    129168        } 
     
    133172        private System.Windows.Forms.Label MainLbl; 
    134173        private System.Windows.Forms.Button SubmitBtn; 
    135         private System.Windows.Forms.Button PostponeBtn; 
     174        private System.Windows.Forms.Button CancelBtn; 
    136175        private System.Windows.Forms.PictureBox BlackBoxPic; 
    137176        private System.Windows.Forms.ListView ReportsLv; 
    138177        private System.Windows.Forms.ColumnHeader ReportsLvTimestampColumn; 
    139178        private System.Windows.Forms.ColumnHeader ReportsLvErrorColumn; 
     179        private System.Windows.Forms.LinkLabel DataCollectionPolicyLbl; 
     180        private System.Windows.Forms.ContextMenuStrip ReportsMenuStrip; 
     181        private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem; 
     182        private System.Windows.Forms.ColumnHeader ReportsLvStatusColumn; 
    140183    } 
    141184} 
  • branches/eraser6/EraserService/Eraser.BlackBox/BlackBoxMainForm.cs

    r2516 r2737  
    2222using System; 
    2323using System.Collections.Generic; 
     24using System.Linq; 
     25 
    2426using System.ComponentModel; 
    2527using System.Data; 
     
    3537    public partial class BlackBoxMainForm : Form 
    3638    { 
    37         public BlackBoxMainForm() 
     39        #region Singleton instance 
     40        public static BlackBoxMainForm Get() 
     41        { 
     42            if (Instance == null) 
     43                Instance = new BlackBoxMainForm(); 
     44            return Instance; 
     45        } 
     46 
     47        private static BlackBoxMainForm Instance; 
     48        #endregion 
     49 
     50        private BlackBoxMainForm() 
    3851        { 
    3952            InitializeComponent(); 
     53        } 
     54 
     55        private void BlackBoxMainForm_Load(object sender, EventArgs e) 
     56        { 
    4057            Theming.ApplyTheme(this); 
    41  
    42             ReportsLv.BeginUpdate(); 
    43             foreach (BlackBoxReport report in BlackBox.GetDumps()) 
    44             { 
    45                 if (report.Submitted) 
    46                     continue; 
    47  
    48                 ListViewItem item = ReportsLv.Items.Add(report.Timestamp.ToString( 
    49                     "F", CultureInfo.CurrentCulture)); 
    50                 if (report.StackTrace.Count != 0) 
    51                     item.SubItems.Add(report.StackTrace[0].ExceptionType); 
    52                 item.Tag = report; 
    53                 item.Checked = true; 
    54             } 
    55             ReportsLv.EndUpdate(); 
     58            RefreshReports(); 
    5659        } 
    5760 
     
    6467        } 
    6568 
     69        private void ReportsMenuStrip_Opening(object sender, CancelEventArgs e) 
     70        { 
     71            if (ReportsLv.SelectedItems.Count == 0) 
     72            { 
     73                e.Cancel = true; 
     74            } 
     75        } 
     76 
     77        private void deleteToolStripMenuItem_Click(object sender, EventArgs e) 
     78        { 
     79            List<ListViewItem> selection = new List<ListViewItem>( 
     80                ReportsLv.SelectedItems.Cast<ListViewItem>()); 
     81            foreach (ListViewItem item in selection) 
     82            { 
     83                try 
     84                { 
     85                    ((BlackBoxReport)item.Tag).Delete(); 
     86                    item.Remove(); 
     87                } 
     88                catch (UnauthorizedAccessException ex) 
     89                { 
     90                    MessageBox.Show(this, S._("Could not delete report {0} because of " + 
     91                        "the following error: {1}", item.Text, ex.Message), S._("BlackBox"), 
     92                        MessageBoxButtons.OK, MessageBoxIcon.Error); 
     93                } 
     94            } 
     95        } 
     96 
     97        private void DataCollectionPolicyLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 
     98        { 
     99            Process.Start("http://eraser.heidi.ie/trac/wiki/DataCollectionPolicy"); 
     100        } 
     101 
    66102        private void SubmitBtn_Click(object sender, EventArgs e) 
    67103        { 
     
    70106                if (item.Checked) 
    71107                    reports.Add((BlackBoxReport)item.Tag); 
    72                 else 
    73                     ((BlackBoxReport)item.Tag).Delete(); 
    74108 
    75109            if (reports.Count != 0) 
     
    87121        } 
    88122 
     123        private void RefreshReports() 
     124        { 
     125            ReportsLv.BeginUpdate(); 
     126            ReportsLv.Items.Clear(); 
     127            foreach (BlackBoxReport report in BlackBox.GetDumps()) 
     128            { 
     129                ListViewItem item = ReportsLv.Items.Add(report.Timestamp.ToString( 
     130                    "g", CultureInfo.CurrentCulture)); 
     131                if (report.StackTrace.Count != 0) 
     132                    item.SubItems.Add(report.StackTrace[0].ExceptionType); 
     133                else 
     134                    item.SubItems.Add(string.Empty); 
     135                item.SubItems.Add(report.Status == BlackBoxReportStatus.New ? 
     136                    S._("Not submitted") : 
     137                    S._("Submitted (Report ID {0})", report.ID)); 
     138                item.Tag = report; 
     139                item.Checked = true; 
     140            } 
     141            ReportsLv.EndUpdate(); 
     142        } 
     143 
    89144        /// <summary> 
    90145        /// The global BlackBox instance. 
  • branches/eraser6/EraserService/Eraser.BlackBox/BlackBoxMainForm.resx

    r1988 r2737  
    113113  </resheader> 
    114114  <resheader name="reader"> 
    115     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     115    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    116116  </resheader> 
    117117  <resheader name="writer"> 
    118     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    119119  </resheader> 
    120   <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     120  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
    121121  <data name="MainLbl.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
    122122    <value>Top, Left, Right</value> 
    123123  </data> 
    124   <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
     124  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
    125125  <data name="MainLbl.Location" type="System.Drawing.Point, System.Drawing"> 
    126126    <value>82, 9</value> 
    127127  </data> 
    128128  <data name="MainLbl.Size" type="System.Drawing.Size, System.Drawing"> 
    129     <value>467, 304</value> 
    130   </data> 
    131   <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     129    <value>467, 130</value> 
     130  </data> 
     131  <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
    132132  <data name="MainLbl.TabIndex" type="System.Int32, mscorlib"> 
    133133    <value>0</value> 
    134134  </data> 
    135135  <data name="MainLbl.Text" xml:space="preserve"> 
    136     <value>Eraser has encountered problems while running earlier. 
     136    <value>Eraser has encountered problems while running earlier. The list below shows the reports which have been automatically generated containing information about the error. 
    137137 
    138 The program's state and and a screenshot at the time of the error, as well as the state of your computer, have been stored on your computer as reports and can be sent to the Eraser developers for review. The recorded information was gathered automatically, as a result, the information contained therein may contain potentially sensitive information and you are advised to go through the report before uploading it. Data will be stored on a server which only Eraser developers have access to and personally identifiable data, if any, will be kept confidential and will not be used to identify the reporter. Reports will be completely erased upon the completion of bug fixing. 
    139  
    140 Select the reports you wish to submit by checking the name of the report below; the contents of each report can be viewed by double-clicking on the report name below. Editing the contents of the report will result in a modified report being uploaded: deleted files in the report will not be uploaded, and modified files will be uploaded as you have modified them. Do note that by doing so, you are reducing the usefulness of the crash report in fixing the bug. 
    141  
    142 Reports not selected for submission will be discarded after the rest have been submitted.</value> 
     138Eraser can send the information contained here to Eraser's developers and also check whether the problems have since been fixed. Select the reports you wish to submit by checking the name of the report below; the contents of the report can be viewed by double-clicking on the report.</value> 
    143139  </data> 
    144140  <data name="&gt;&gt;MainLbl.Name" xml:space="preserve"> 
     
    146142  </data> 
    147143  <data name="&gt;&gt;MainLbl.Type" xml:space="preserve"> 
    148     <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     144    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    149145  </data> 
    150146  <data name="&gt;&gt;MainLbl.Parent" xml:space="preserve"> 
     
    152148  </data> 
    153149  <data name="&gt;&gt;MainLbl.ZOrder" xml:space="preserve"> 
    154     <value>4</value> 
     150    <value>6</value> 
    155151  </data> 
    156152  <data name="SubmitBtn.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
     
    158154  </data> 
    159155  <data name="SubmitBtn.Location" type="System.Drawing.Point, System.Drawing"> 
    160     <value>343, 524</value> 
     156    <value>328, 524</value> 
    161157  </data> 
    162158  <data name="SubmitBtn.Size" type="System.Drawing.Size, System.Drawing"> 
    163     <value>100, 23</value> 
     159    <value>140, 23</value> 
    164160  </data> 
    165161  <data name="SubmitBtn.TabIndex" type="System.Int32, mscorlib"> 
     
    167163  </data> 
    168164  <data name="SubmitBtn.Text" xml:space="preserve"> 
    169     <value>Submit Now</value> 
     165    <value>Check for Solutions</value> 
    170166  </data> 
    171167  <data name="&gt;&gt;SubmitBtn.Name" xml:space="preserve"> 
     
    173169  </data> 
    174170  <data name="&gt;&gt;SubmitBtn.Type" xml:space="preserve"> 
    175     <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     171    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    176172  </data> 
    177173  <data name="&gt;&gt;SubmitBtn.Parent" xml:space="preserve"> 
     
    179175  </data> 
    180176  <data name="&gt;&gt;SubmitBtn.ZOrder" xml:space="preserve"> 
    181     <value>3</value> 
    182   </data> 
    183   <data name="PostponeBtn.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
     177    <value>5</value> 
     178  </data> 
     179  <data name="CancelBtn.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
    184180    <value>Bottom, Right</value> 
    185181  </data> 
    186   <data name="PostponeBtn.Location" type="System.Drawing.Point, System.Drawing"> 
    187     <value>449, 524</value> 
    188   </data> 
    189   <data name="PostponeBtn.Size" type="System.Drawing.Size, System.Drawing"> 
    190     <value>100, 23</value> 
    191   </data> 
    192   <data name="PostponeBtn.TabIndex" type="System.Int32, mscorlib"> 
     182  <data name="CancelBtn.Location" type="System.Drawing.Point, System.Drawing"> 
     183    <value>474, 524</value> 
     184  </data> 
     185  <data name="CancelBtn.Size" type="System.Drawing.Size, System.Drawing"> 
     186    <value>75, 23</value> 
     187  </data> 
     188  <data name="CancelBtn.TabIndex" type="System.Int32, mscorlib"> 
    193189    <value>4</value> 
    194190  </data> 
    195   <data name="PostponeBtn.Text" xml:space="preserve"> 
    196     <value>Submit Later</value> 
    197   </data> 
    198   <data name="&gt;&gt;PostponeBtn.Name" xml:space="preserve"> 
    199     <value>PostponeBtn</value> 
    200   </data> 
    201   <data name="&gt;&gt;PostponeBtn.Type" xml:space="preserve"> 
    202     <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    203   </data> 
    204   <data name="&gt;&gt;PostponeBtn.Parent" xml:space="preserve"> 
     191  <data name="CancelBtn.Text" xml:space="preserve"> 
     192    <value>Cancel</value> 
     193  </data> 
     194  <data name="&gt;&gt;CancelBtn.Name" xml:space="preserve"> 
     195    <value>CancelBtn</value> 
     196  </data> 
     197  <data name="&gt;&gt;CancelBtn.Type" xml:space="preserve"> 
     198    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     199  </data> 
     200  <data name="&gt;&gt;CancelBtn.Parent" xml:space="preserve"> 
    205201    <value>$this</value> 
    206202  </data> 
    207   <data name="&gt;&gt;PostponeBtn.ZOrder" xml:space="preserve"> 
    208     <value>2</value> 
     203  <data name="&gt;&gt;CancelBtn.ZOrder" xml:space="preserve"> 
     204    <value>4</value> 
    209205  </data> 
    210206  <data name="BlackBoxPic.Location" type="System.Drawing.Point, System.Drawing"> 
     
    221217  </data> 
    222218  <data name="&gt;&gt;BlackBoxPic.Type" xml:space="preserve"> 
    223     <value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     219    <value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    224220  </data> 
    225221  <data name="&gt;&gt;BlackBoxPic.Parent" xml:space="preserve"> 
     
    227223  </data> 
    228224  <data name="&gt;&gt;BlackBoxPic.ZOrder" xml:space="preserve"> 
    229     <value>1</value> 
     225    <value>3</value> 
    230226  </data> 
    231227  <data name="ReportsLv.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
     
    236232  </data> 
    237233  <data name="ReportsLvTimestampColumn.Width" type="System.Int32, mscorlib"> 
    238     <value>280</value> 
     234    <value>130</value> 
    239235  </data> 
    240236  <data name="ReportsLvErrorColumn.Text" xml:space="preserve"> 
     
    242238  </data> 
    243239  <data name="ReportsLvErrorColumn.Width" type="System.Int32, mscorlib"> 
    244     <value>250</value> 
     240    <value>240</value> 
     241  </data> 
     242  <data name="ReportsLvStatusColumn.Text" xml:space="preserve"> 
     243    <value>Status</value> 
     244  </data> 
     245  <data name="ReportsLvStatusColumn.Width" type="System.Int32, mscorlib"> 
     246    <value>160</value> 
     247  </data> 
     248  <metadata name="ReportsMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
     249    <value>17, 17</value> 
     250  </metadata> 
     251  <data name="ReportsMenuStrip.Size" type="System.Drawing.Size, System.Drawing"> 
     252    <value>108, 26</value> 
     253  </data> 
     254  <data name="&gt;&gt;ReportsMenuStrip.Name" xml:space="preserve"> 
     255    <value>ReportsMenuStrip</value> 
     256  </data> 
     257  <data name="&gt;&gt;ReportsMenuStrip.Type" xml:space="preserve"> 
     258    <value>System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    245259  </data> 
    246260  <data name="ReportsLv.Location" type="System.Drawing.Point, System.Drawing"> 
    247     <value>12, 316</value> 
     261    <value>12, 142</value> 
    248262  </data> 
    249263  <data name="ReportsLv.Size" type="System.Drawing.Size, System.Drawing"> 
    250     <value>537, 202</value> 
     264    <value>537, 376</value> 
    251265  </data> 
    252266  <data name="ReportsLv.TabIndex" type="System.Int32, mscorlib"> 
     
    257271  </data> 
    258272  <data name="&gt;&gt;ReportsLv.Type" xml:space="preserve"> 
    259     <value>System.Windows.Forms.ListView, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     273    <value>System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    260274  </data> 
    261275  <data name="&gt;&gt;ReportsLv.Parent" xml:space="preserve"> 
     
    263277  </data> 
    264278  <data name="&gt;&gt;ReportsLv.ZOrder" xml:space="preserve"> 
    265     <value>0</value> 
    266   </data> 
    267   <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     279    <value>2</value> 
     280  </data> 
     281  <data name="deleteToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
     282    <value>152, 22</value> 
     283  </data> 
     284  <data name="deleteToolStripMenuItem.Text" xml:space="preserve"> 
     285    <value>Delete</value> 
     286  </data> 
     287  <data name="DataCollectionPolicyLbl.AutoSize" type="System.Boolean, mscorlib"> 
     288    <value>True</value> 
     289  </data> 
     290  <data name="DataCollectionPolicyLbl.Location" type="System.Drawing.Point, System.Drawing"> 
     291    <value>12, 528</value> 
     292  </data> 
     293  <data name="DataCollectionPolicyLbl.Size" type="System.Drawing.Size, System.Drawing"> 
     294    <value>123, 15</value> 
     295  </data> 
     296  <data name="DataCollectionPolicyLbl.TabIndex" type="System.Int32, mscorlib"> 
     297    <value>5</value> 
     298  </data> 
     299  <data name="DataCollectionPolicyLbl.Text" xml:space="preserve"> 
     300    <value>Data Collection Policy</value> 
     301  </data> 
     302  <data name="&gt;&gt;DataCollectionPolicyLbl.Name" xml:space="preserve"> 
     303    <value>DataCollectionPolicyLbl</value> 
     304  </data> 
     305  <data name="&gt;&gt;DataCollectionPolicyLbl.Type" xml:space="preserve"> 
     306    <value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     307  </data> 
     308  <data name="&gt;&gt;DataCollectionPolicyLbl.Parent" xml:space="preserve"> 
     309    <value>$this</value> 
     310  </data> 
     311  <data name="&gt;&gt;DataCollectionPolicyLbl.ZOrder" xml:space="preserve"> 
     312    <value>1</value> 
     313  </data> 
     314  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
    268315    <value>True</value> 
    269316  </metadata> 
     
    18441891  </data> 
    18451892  <data name="&gt;&gt;ReportsLvTimestampColumn.Type" xml:space="preserve"> 
    1846     <value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     1893    <value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    18471894  </data> 
    18481895  <data name="&gt;&gt;ReportsLvErrorColumn.Name" xml:space="preserve"> 
     
    18501897  </data> 
    18511898  <data name="&gt;&gt;ReportsLvErrorColumn.Type" xml:space="preserve"> 
    1852     <value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     1899    <value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     1900  </data> 
     1901  <data name="&gt;&gt;ReportsLvStatusColumn.Name" xml:space="preserve"> 
     1902    <value>ReportsLvStatusColumn</value> 
     1903  </data> 
     1904  <data name="&gt;&gt;ReportsLvStatusColumn.Type" xml:space="preserve"> 
     1905    <value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     1906  </data> 
     1907  <data name="&gt;&gt;deleteToolStripMenuItem.Name" xml:space="preserve"> 
     1908    <value>deleteToolStripMenuItem</value> 
     1909  </data> 
     1910  <data name="&gt;&gt;deleteToolStripMenuItem.Type" xml:space="preserve"> 
     1911    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    18531912  </data> 
    18541913  <data name="&gt;&gt;$this.Name" xml:space="preserve"> 
     
    18561915  </data> 
    18571916  <data name="&gt;&gt;$this.Type" xml:space="preserve"> 
    1858     <value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     1917    <value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    18591918  </data> 
    18601919</root> 
  • branches/eraser6/EraserService/Eraser.BlackBox/BlackBoxUploadForm.Designer.cs

    r2516 r2737  
    5050        private void InitializeComponent() 
    5151        { 
    52             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BlackBoxUploadForm)); 
    53             this.ButtonsBevel = new Trustbridge.Windows.Controls.BevelLine(); 
    54             this.ButtonsPnl = new System.Windows.Forms.Panel(); 
    55             this.CancelBtn = new System.Windows.Forms.Button(); 
    56             this.TitleLbl = new System.Windows.Forms.Label(); 
    57             this.ProgressPb = new System.Windows.Forms.ProgressBar(); 
    58             this.UploadWorker = new System.ComponentModel.BackgroundWorker(); 
    59             this.ProgressLbl = new System.Windows.Forms.Label(); 
    60             this.ButtonsPnl.SuspendLayout(); 
    61             this.SuspendLayout(); 
    62             //  
    63             // ButtonsBevel 
    64             //  
    65             this.ButtonsBevel.AccessibleDescription = null; 
    66             this.ButtonsBevel.AccessibleName = null; 
    67             resources.ApplyResources(this.ButtonsBevel, "ButtonsBevel"); 
    68             this.ButtonsBevel.Angle = 90; 
    69             this.ButtonsBevel.BackgroundImage = null; 
    70             this.ButtonsBevel.Font = null; 
    71             this.ButtonsBevel.Name = "ButtonsBevel"; 
    72             //  
    73             // ButtonsPnl 
    74             //  
    75             this.ButtonsPnl.AccessibleDescription = null; 
    76             this.ButtonsPnl.AccessibleName = null; 
    77             resources.ApplyResources(this.ButtonsPnl, "ButtonsPnl"); 
    78             this.ButtonsPnl.BackColor = System.Drawing.SystemColors.Control; 
    79             this.ButtonsPnl.BackgroundImage = null; 
    80             this.ButtonsPnl.Controls.Add(this.ButtonsBevel); 
    81             this.ButtonsPnl.Controls.Add(this.CancelBtn); 
    82             this.ButtonsPnl.Font = null; 
    83             this.ButtonsPnl.Name = "ButtonsPnl"; 
    84             //  
    85             // CancelBtn 
    86             //  
    87             this.CancelBtn.AccessibleDescription = null; 
    88             this.CancelBtn.AccessibleName = null; 
    89             resources.ApplyResources(this.CancelBtn, "CancelBtn"); 
    90             this.CancelBtn.BackgroundImage = null; 
    91             this.CancelBtn.Font = null; 
    92             this.CancelBtn.Name = "CancelBtn"; 
    93             this.CancelBtn.UseVisualStyleBackColor = true; 
    94             this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click); 
    95             //  
    96             // TitleLbl 
    97             //  
    98             this.TitleLbl.AccessibleDescription = null; 
    99             this.TitleLbl.AccessibleName = null; 
    100             resources.ApplyResources(this.TitleLbl, "TitleLbl"); 
    101             this.TitleLbl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(51)))), ((int)(((byte)(153))))); 
    102             this.TitleLbl.Name = "TitleLbl"; 
    103             //  
    104             // ProgressPb 
    105             //  
    106             this.ProgressPb.AccessibleDescription = null; 
    107             this.ProgressPb.AccessibleName = null; 
    108             resources.ApplyResources(this.ProgressPb, "ProgressPb"); 
    109             this.ProgressPb.BackgroundImage = null; 
    110             this.ProgressPb.Font = null; 
    111             this.ProgressPb.Name = "ProgressPb"; 
    112             //  
    113             // UploadWorker 
    114             //  
    115             this.UploadWorker.WorkerReportsProgress = true; 
    116             this.UploadWorker.WorkerSupportsCancellation = true; 
    117             this.UploadWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.UploadWorker_DoWork); 
    118             this.UploadWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.UploadWorker_RunWorkerCompleted); 
    119             this.UploadWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.UploadWorker_ProgressChanged); 
    120             //  
    121             // ProgressLbl 
    122             //  
    123             this.ProgressLbl.AccessibleDescription = null; 
    124             this.ProgressLbl.AccessibleName = null; 
    125             resources.ApplyResources(this.ProgressLbl, "ProgressLbl"); 
    126             this.ProgressLbl.Font = null; 
    127             this.ProgressLbl.Name = "ProgressLbl"; 
    128             //  
    129             // BlackBoxUploadForm 
    130             //  
    131             this.AccessibleDescription = null; 
    132             this.AccessibleName = null; 
    133             resources.ApplyResources(this, "$this"); 
    134             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 
    135             this.BackColor = System.Drawing.SystemColors.Window; 
    136             this.BackgroundImage = null; 
    137             this.Controls.Add(this.ProgressLbl); 
    138             this.Controls.Add(this.ProgressPb); 
    139             this.Controls.Add(this.TitleLbl); 
    140             this.Controls.Add(this.ButtonsPnl); 
    141             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 
    142             this.MaximizeBox = false; 
    143             this.Name = "BlackBoxUploadForm"; 
    144             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BlackBoxUploadForm_FormClosing); 
    145             this.ButtonsPnl.ResumeLayout(false); 
    146             this.ResumeLayout(false); 
    147             this.PerformLayout(); 
     52            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BlackBoxUploadForm)); 
     53            this.ButtonsBevel = new Trustbridge.Windows.Controls.BevelLine(); 
     54            this.ButtonsPnl = new System.Windows.Forms.Panel(); 
     55            this.CancelBtn = new System.Windows.Forms.Button(); 
     56            this.TitleLbl = new System.Windows.Forms.Label(); 
     57            this.ProgressPb = new System.Windows.Forms.ProgressBar(); 
     58            this.UploadWorker = new System.ComponentModel.BackgroundWorker(); 
     59            this.ProgressLbl = new System.Windows.Forms.Label(); 
     60            this.ButtonsPnl.SuspendLayout(); 
     61            this.SuspendLayout(); 
     62            //  
     63            // ButtonsBevel 
     64            //  
     65            resources.ApplyResources(this.ButtonsBevel, "ButtonsBevel"); 
     66            this.ButtonsBevel.Angle = 90; 
     67            this.ButtonsBevel.Name = "ButtonsBevel"; 
     68            //  
     69            // ButtonsPnl 
     70            //  
     71            resources.ApplyResources(this.ButtonsPnl, "ButtonsPnl"); 
     72            this.ButtonsPnl.BackColor = System.Drawing.SystemColors.Control; 
     73            this.ButtonsPnl.Controls.Add(this.ButtonsBevel); 
     74            this.ButtonsPnl.Controls.Add(this.CancelBtn); 
     75            this.ButtonsPnl.Name = "ButtonsPnl"; 
     76            //  
     77            // CancelBtn 
     78            //  
     79            resources.ApplyResources(this.CancelBtn, "CancelBtn"); 
     80            this.CancelBtn.Name = "CancelBtn"; 
     81            this.CancelBtn.UseVisualStyleBackColor = true; 
     82            this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click); 
     83            //  
     84            // TitleLbl 
     85            //  
     86            resources.ApplyResources(this.TitleLbl, "TitleLbl"); 
     87            this.TitleLbl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(51)))), ((int)(((byte)(153))))); 
     88            this.TitleLbl.Name = "TitleLbl"; 
     89            //  
     90            // ProgressPb 
     91            //  
     92            resources.ApplyResources(this.ProgressPb, "ProgressPb"); 
     93            this.ProgressPb.Name = "ProgressPb"; 
     94            //  
     95            // UploadWorker 
     96            //  
     97            this.UploadWorker.WorkerReportsProgress = true; 
     98            this.UploadWorker.WorkerSupportsCancellation = true; 
     99            this.UploadWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.UploadWorker_DoWork); 
     100            this.UploadWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.UploadWorker_ProgressChanged); 
     101            this.UploadWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.UploadWorker_RunWorkerCompleted); 
     102            //  
     103            // ProgressLbl 
     104            //  
     105            resources.ApplyResources(this.ProgressLbl, "ProgressLbl"); 
     106            this.ProgressLbl.Name = "ProgressLbl"; 
     107            //  
     108            // BlackBoxUploadForm 
     109            //  
     110            resources.ApplyResources(this, "$this"); 
     111            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 
     112            this.BackColor = System.Drawing.SystemColors.Window; 
     113            this.Controls.Add(this.ProgressLbl); 
     114            this.Controls.Add(this.ProgressPb); 
     115            this.Controls.Add(this.TitleLbl); 
     116            this.Controls.Add(this.ButtonsPnl); 
     117            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 
     118            this.MaximizeBox = false; 
     119            this.Name = "BlackBoxUploadForm"; 
     120            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BlackBoxUploadForm_FormClosing); 
     121            this.ButtonsPnl.ResumeLayout(false); 
     122            this.ResumeLayout(false); 
     123            this.PerformLayout(); 
    148124 
    149125        } 
  • branches/eraser6/EraserService/Eraser.BlackBox/BlackBoxUploadForm.cs

    r2516 r2737  
    7171                    1.0f / reports.Count)); 
    7272 
    73                 BlackBoxReportUploader uploader = new BlackBoxReportUploader(reports[i]); 
    74  
    75                 //Check that a similar report has not yet been uploaded. 
    76                 UploadWorker.ReportProgress((int)(overallProgress.Progress * 100), 
    77                     S._("Checking for status of report {0}...", reports[i].Name)); 
    78                 if (!uploader.IsNew) 
    79                     continue; 
    80  
     73                //Allow us to bail out. 
    8174                if (UploadWorker.CancellationPending) 
    8275                    throw new OperationCanceledException(); 
    8376 
    84                 //Upload the report. 
    85                 UploadWorker.ReportProgress((int)(overallProgress.Progress * 100), 
    86                     S._("Compressing Report {0}: {1:#0.00%}", reports[i].Name, 0)); 
     77                //If we have not submitted the report before upload it. 
     78                if (reports[i].Status == BlackBoxReportStatus.New) 
     79                    Upload(reports[i], overallProgress, reportProgress); 
    8780 
    88                 uploader.Submit(delegate(object from, EraserProgressChangedEventArgs e2) 
    89                     { 
    90                         reportProgress.Completed = (int)(e2.Progress.Progress * reportProgress.Total); 
    91                         SteppedProgressManager reportSteps = (SteppedProgressManager)e2.Progress; 
    92                         int step = reportSteps.Steps.IndexOf(reportSteps.CurrentStep); 
     81                //Otherwise check for solutions. 
     82                else 
     83                    CheckStatus(reports[i], overallProgress, reportProgress); 
     84            } 
     85        } 
    9386 
    94                         UploadWorker.ReportProgress((int)overallProgress.Progress, 
    95                             step == 0 ?  
    96                                 S._("Compressing Report {0}: {1:#0.00%}", 
    97                                     reports[i].Name, reportSteps.Progress) : 
    98                                 S._("Uploading Report {0}: {1:#0.00%}", 
    99                                     reports[i].Name, reportSteps.Progress)); 
     87        private void Upload(BlackBoxReport report, SteppedProgressManager overallProgress, 
     88            ProgressManager reportProgress) 
     89        { 
     90            //Upload the report. 
     91            UploadWorker.ReportProgress((int)(overallProgress.Progress * 100), 
     92                S._("Compressing Report {0}: {1:#0.00%}", report.Name, 0)); 
    10093 
    101                         if (UploadWorker.CancellationPending) 
    102                             throw new OperationCanceledException(); 
    103                     }); 
    104             } 
     94            BlackBoxReportUploader uploader = new BlackBoxReportUploader(report); 
     95            uploader.Submit(delegate(object from, EraserProgressChangedEventArgs e2) 
     96                { 
     97                    reportProgress.Completed = (int)(e2.Progress.Progress * reportProgress.Total); 
     98                    SteppedProgressManager reportSteps = (SteppedProgressManager)e2.Progress; 
     99                    int step = reportSteps.Steps.IndexOf(reportSteps.CurrentStep); 
     100 
     101                    UploadWorker.ReportProgress((int)overallProgress.Progress, 
     102                        step == 0 ? 
     103                            S._("Compressing Report {0}: {1:#0.00%}", 
     104                                report.Name, reportSteps.Progress) : 
     105                            S._("Uploading Report {0}: {1:#0.00%}", 
     106                                report.Name, reportSteps.Progress)); 
     107 
     108                    if (UploadWorker.CancellationPending) 
     109                        throw new OperationCanceledException(); 
     110                }); 
     111        } 
     112 
     113        private void CheckStatus(BlackBoxReport report, SteppedProgressManager overallProgress, 
     114            ProgressManager reportProgress) 
     115        { 
     116            //Upload the report. 
     117            UploadWorker.ReportProgress((int)(overallProgress.Progress * 100), 
     118                S._("Checking for solution for {0}...", report.Name)); 
     119 
     120            BlackBoxReportUploader uploader = new BlackBoxReportUploader(report); 
     121            report.Status = uploader.Status; 
    105122        } 
    106123 
  • branches/eraser6/EraserService/Eraser.BlackBox/BlackBoxUploadForm.it.resx

    r1973 r2737  
    113113  </resheader> 
    114114  <resheader name="reader"> 
    115     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     115    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    116116  </resheader> 
    117117  <resheader name="writer"> 
    118     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    119119  </resheader> 
    120120  <data name="CancelBtn.Text" xml:space="preserve"> 
    121121    <value>Annulla</value> 
    122122  </data> 
    123   <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
     123  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
    124124  <data name="TitleLbl.Size" type="System.Drawing.Size, System.Drawing"> 
    125125    <value>201, 20</value> 
  • branches/eraser6/EraserService/Eraser.BlackBox/BlackBoxUploadForm.resx

    r1973 r2737  
    113113  </resheader> 
    114114  <resheader name="reader"> 
    115     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     115    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    116116  </resheader> 
    117117  <resheader name="writer"> 
    118     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    119119  </resheader> 
     120  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     121  <data name="ButtonsBevel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
     122    <value>Top, Left, Right</value> 
     123  </data> 
     124  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
     125  <data name="ButtonsBevel.Location" type="System.Drawing.Point, System.Drawing"> 
     126    <value>0, 0</value> 
     127  </data> 
     128  <data name="ButtonsBevel.Size" type="System.Drawing.Size, System.Drawing"> 
     129    <value>345, 2</value> 
     130  </data> 
     131  <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     132  <data name="ButtonsBevel.TabIndex" type="System.Int32, mscorlib"> 
     133    <value>0</value> 
     134  </data> 
     135  <data name="&gt;&gt;ButtonsBevel.Name" xml:space="preserve"> 
     136    <value>ButtonsBevel</value> 
     137  </data> 
     138  <data name="&gt;&gt;ButtonsBevel.Type" xml:space="preserve"> 
     139    <value>Trustbridge.Windows.Controls.BevelLine, BevelLine, Version=1.0.4456.34141, Culture=neutral, PublicKeyToken=3ac89a0351e689b6</value> 
     140  </data> 
     141  <data name="&gt;&gt;ButtonsBevel.Parent" xml:space="preserve"> 
     142    <value>ButtonsPnl</value> 
     143  </data> 
     144  <data name="&gt;&gt;ButtonsBevel.ZOrder" xml:space="preserve"> 
     145    <value>0</value> 
     146  </data> 
     147  <data name="ButtonsPnl.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
     148    <value>Bottom, Left, Right</value> 
     149  </data> 
     150  <data name="CancelBtn.Location" type="System.Drawing.Point, System.Drawing"> 
     151    <value>260, 8</value> 
     152  </data> 
     153  <data name="CancelBtn.Size" type="System.Drawing.Size, System.Drawing"> 
     154    <value>75, 23</value> 
     155  </data> 
     156  <data name="CancelBtn.TabIndex" type="System.Int32, mscorlib"> 
     157    <value>2</value> 
     158  </data> 
     159  <data name="CancelBtn.Text" xml:space="preserve"> 
     160    <value>Cancel</value> 
     161  </data> 
     162  <data name="&gt;&gt;CancelBtn.Name" xml:space="preserve"> 
     163    <value>CancelBtn</value> 
     164  </data> 
     165  <data name="&gt;&gt;CancelBtn.Type" xml:space="preserve"> 
     166    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     167  </data> 
     168  <data name="&gt;&gt;CancelBtn.Parent" xml:space="preserve"> 
     169    <value>ButtonsPnl</value> 
     170  </data> 
     171  <data name="&gt;&gt;CancelBtn.ZOrder" xml:space="preserve"> 
     172    <value>1</value> 
     173  </data> 
     174  <data name="ButtonsPnl.Location" type="System.Drawing.Point, System.Drawing"> 
     175    <value>0, 96</value> 
     176  </data> 
     177  <data name="ButtonsPnl.Size" type="System.Drawing.Size, System.Drawing"> 
     178    <value>345, 38</value> 
     179  </data> 
     180  <data name="ButtonsPnl.TabIndex" type="System.Int32, mscorlib"> 
     181    <value>1</value> 
     182  </data> 
     183  <data name="&gt;&gt;ButtonsPnl.Name" xml:space="preserve"> 
     184    <value>ButtonsPnl</value> 
     185  </data> 
     186  <data name="&gt;&gt;ButtonsPnl.Type" xml:space="preserve"> 
     187    <value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     188  </data> 
     189  <data name="&gt;&gt;ButtonsPnl.Parent" xml:space="preserve"> 
     190    <value>$this</value> 
     191  </data> 
     192  <data name="&gt;&gt;ButtonsPnl.ZOrder" xml:space="preserve"> 
     193    <value>3</value> 
     194  </data> 
     195  <data name="TitleLbl.AutoSize" type="System.Boolean, mscorlib"> 
     196    <value>True</value> 
     197  </data> 
     198  <data name="TitleLbl.Font" type="System.Drawing.Font, System.Drawing"> 
     199    <value>Microsoft Sans Serif, 12pt</value> 
     200  </data> 
     201  <data name="TitleLbl.Location" type="System.Drawing.Point, System.Drawing"> 
     202    <value>9, 9</value> 
     203  </data> 
     204  <data name="TitleLbl.Size" type="System.Drawing.Size, System.Drawing"> 
     205    <value>168, 20</value> 
     206  </data> 
     207  <data name="TitleLbl.TabIndex" type="System.Int32, mscorlib"> 
     208    <value>2</value> 
     209  </data> 
     210  <data name="TitleLbl.Text" xml:space="preserve"> 
     211    <value>Checking for Solutions</value> 
     212  </data> 
     213  <data name="&gt;&gt;TitleLbl.Name" xml:space="preserve"> 
     214    <value>TitleLbl</value> 
     215  </data> 
     216  <data name="&gt;&gt;TitleLbl.Type" xml:space="preserve"> 
     217    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     218  </data> 
    120219  <data name="&gt;&gt;TitleLbl.Parent" xml:space="preserve"> 
    121220    <value>$this</value> 
    122221  </data> 
    123   <data name="&gt;&gt;$this.Type" xml:space="preserve"> 
    124     <value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    125   </data> 
    126   <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
    127   <data name="CancelBtn.Location" type="System.Drawing.Point, System.Drawing"> 
    128     <value>260, 8</value> 
     222  <data name="&gt;&gt;TitleLbl.ZOrder" xml:space="preserve"> 
     223    <value>2</value> 
     224  </data> 
     225  <data name="ProgressPb.Location" type="System.Drawing.Point, System.Drawing"> 
     226    <value>13, 70</value> 
     227  </data> 
     228  <data name="ProgressPb.Size" type="System.Drawing.Size, System.Drawing"> 
     229    <value>321, 17</value> 
     230  </data> 
     231  <data name="ProgressPb.TabIndex" type="System.Int32, mscorlib"> 
     232    <value>3</value> 
     233  </data> 
     234  <data name="&gt;&gt;ProgressPb.Name" xml:space="preserve"> 
     235    <value>ProgressPb</value> 
     236  </data> 
     237  <data name="&gt;&gt;ProgressPb.Type" xml:space="preserve"> 
     238    <value>System.Windows.Forms.ProgressBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     239  </data> 
     240  <data name="&gt;&gt;ProgressPb.Parent" xml:space="preserve"> 
     241    <value>$this</value> 
     242  </data> 
     243  <data name="&gt;&gt;ProgressPb.ZOrder" xml:space="preserve"> 
     244    <value>1</value> 
     245  </data> 
     246  <metadata name="UploadWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
     247    <value>17, 17</value> 
     248  </metadata> 
     249  <data name="ProgressLbl.AutoSize" type="System.Boolean, mscorlib"> 
     250    <value>True</value> 
     251  </data> 
     252  <data name="ProgressLbl.Location" type="System.Drawing.Point, System.Drawing"> 
     253    <value>11, 52</value> 
     254  </data> 
     255  <data name="ProgressLbl.Size" type="System.Drawing.Size, System.Drawing"> 
     256    <value>130, 15</value> 
     257  </data> 
     258  <data name="ProgressLbl.TabIndex" type="System.Int32, mscorlib"> 
     259    <value>4</value> 
     260  </data> 
     261  <data name="ProgressLbl.Text" xml:space="preserve"> 
     262    <value>Compressing reports...</value> 
     263  </data> 
     264  <data name="&gt;&gt;ProgressLbl.Name" xml:space="preserve"> 
     265    <value>ProgressLbl</value> 
     266  </data> 
     267  <data name="&gt;&gt;ProgressLbl.Type" xml:space="preserve"> 
     268    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     269  </data> 
     270  <data name="&gt;&gt;ProgressLbl.Parent" xml:space="preserve"> 
     271    <value>$this</value> 
    129272  </data> 
    130273  <data name="&gt;&gt;ProgressLbl.ZOrder" xml:space="preserve"> 
    131274    <value>0</value> 
    132275  </data> 
    133   <data name="ProgressPb.Size" type="System.Drawing.Size, System.Drawing"> 
    134     <value>321, 17</value> 
    135   </data> 
    136   <data name="&gt;&gt;ProgressPb.Type" xml:space="preserve"> 
    137     <value>System.Windows.Forms.ProgressBar, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    138   </data> 
    139   <data name="ProgressLbl.Location" type="System.Drawing.Point, System.Drawing"> 
    140     <value>11, 52</value> 
    141   </data> 
    142   <data name="&gt;&gt;UploadWorker.Type" xml:space="preserve"> 
    143     <value>System.ComponentModel.BackgroundWorker, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    144   </data> 
    145   <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
    146   <data name="ButtonsBevel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
    147     <value>Top, Left, Right</value> 
    148   </data> 
    149   <data name="ProgressPb.Location" type="System.Drawing.Point, System.Drawing"> 
    150     <value>13, 70</value> 
    151   </data> 
    152   <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
    153   <data name="ButtonsBevel.TabIndex" type="System.Int32, mscorlib"> 
    154     <value>0</value> 
    155   </data> 
    156   <data name="&gt;&gt;ButtonsPnl.ZOrder" xml:space="preserve"> 
    157     <value>3</value> 
    158   </data> 
    159   <data name="CancelBtn.Size" type="System.Drawing.Size, System.Drawing"> 
    160     <value>75, 23</value> 
    161   </data> 
    162   <data name="&gt;&gt;UploadWorker.Name" xml:space="preserve"> 
    163     <value>UploadWorker</value> 
    164   </data> 
    165   <data name="ProgressLbl.Text" xml:space="preserve"> 
    166     <value>Compressing reports...</value> 
    167   </data> 
    168   <data name="&gt;&gt;CancelBtn.Type" xml:space="preserve"> 
    169     <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    170   </data> 
    171   <data name="ButtonsPnl.TabIndex" type="System.Int32, mscorlib"> 
    172     <value>1</value> 
    173   </data> 
    174   <data name="ProgressLbl.AutoSize" type="System.Boolean, mscorlib"> 
     276  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
    175277    <value>True</value> 
    176   </data> 
    177   <data name="&gt;&gt;ButtonsBevel.Name" xml:space="preserve"> 
    178     <value>ButtonsBevel</value> 
    179   </data> 
    180   <data name="ProgressLbl.TabIndex" type="System.Int32, mscorlib"> 
    181     <value>4</value> 
    182   </data> 
    183   <data name="&gt;&gt;TitleLbl.Name" xml:space="preserve"> 
    184     <value>TitleLbl</value> 
    185   </data> 
    186   <data name="&gt;&gt;ProgressLbl.Type" xml:space="preserve"> 
    187     <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    188   </data> 
    189   <data name="&gt;&gt;ButtonsPnl.Name" xml:space="preserve"> 
    190     <value>ButtonsPnl</value> 
    191   </data> 
    192   <data name="TitleLbl.Text" xml:space="preserve"> 
    193     <value>Uploading Crash Report</value> 
    194   </data> 
    195   <data name="CancelBtn.TabIndex" type="System.Int32, mscorlib"> 
    196     <value>2</value> 
    197   </data> 
    198   <data name="&gt;&gt;ProgressLbl.Parent" xml:space="preserve"> 
    199     <value>$this</value> 
    200   </data> 
    201   <data name="&gt;&gt;ButtonsPnl.Type" xml:space="preserve"> 
    202     <value>System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    203   </data> 
    204   <data name="CancelBtn.Text" xml:space="preserve"> 
    205     <value>Cancel</value> 
    206   </data> 
    207   <data name="&gt;&gt;ButtonsBevel.Parent" xml:space="preserve"> 
    208     <value>ButtonsPnl</value> 
    209   </data> 
    210   <data name="TitleLbl.Location" type="System.Drawing.Point, System.Drawing"> 
    211     <value>9, 9</value> 
    212   </data> 
    213   <data name="&gt;&gt;CancelBtn.Name" xml:space="preserve"> 
    214     <value>CancelBtn</value> 
    215   </data> 
    216   <data name="&gt;&gt;TitleLbl.Type" xml:space="preserve"> 
    217     <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    218   </data> 
    219   <data name="&gt;&gt;ButtonsBevel.ZOrder" xml:space="preserve"> 
    220     <value>0</value> 
     278  </metadata> 
     279  <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing"> 
     280    <value>96, 96</value> 
    221281  </data> 
    222282  <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> 
    223283    <value>344, 132</value> 
    224284  </data> 
    225   <data name="&gt;&gt;ButtonsBevel.Type" xml:space="preserve"> 
    226     <value>Trustbridge.Windows.Controls.BevelLine, BevelLine, Version=1.0.3589.29437, Culture=neutral, PublicKeyToken=77979e16578a2d88</value> 
    227   </data> 
    228   <data name="ProgressLbl.Size" type="System.Drawing.Size, System.Drawing"> 
    229     <value>130, 15</value> 
    230   </data> 
    231   <data name="&gt;&gt;ProgressPb.Parent" xml:space="preserve"> 
    232     <value>$this</value> 
    233   </data> 
    234   <data name="&gt;&gt;ProgressPb.Name" xml:space="preserve"> 
    235     <value>ProgressPb</value> 
    236   </data> 
    237   <data name="TitleLbl.TabIndex" type="System.Int32, mscorlib"> 
    238     <value>2</value> 
    239   </data> 
    240   <data name="ButtonsPnl.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> 
    241     <value>Bottom, Left, Right</value> 
    242   </data> 
    243   <data name="ButtonsPnl.Size" type="System.Drawing.Size, System.Drawing"> 
    244     <value>345, 38</value> 
    245   </data> 
    246   <data name="&gt;&gt;ProgressPb.ZOrder" xml:space="preserve"> 
    247     <value>1</value> 
    248   </data> 
    249   <data name="&gt;&gt;ProgressLbl.Name" xml:space="preserve"> 
    250     <value>ProgressLbl</value> 
    251   </data> 
    252   <data name="$this.Text" xml:space="preserve"> 
    253     <value>Eraser Crash Assistant</value> 
    254   </data> 
    255   <data name="&gt;&gt;CancelBtn.Parent" xml:space="preserve"> 
    256     <value>ButtonsPnl</value> 
    257   </data> 
    258   <data name="ButtonsBevel.Location" type="System.Drawing.Point, System.Drawing"> 
    259     <value>0, 0</value> 
    260   </data> 
    261   <data name="TitleLbl.AutoSize" type="System.Boolean, mscorlib"> 
    262     <value>True</value> 
    263   </data> 
    264   <data name="TitleLbl.Size" type="System.Drawing.Size, System.Drawing"> 
    265     <value>180, 20</value> 
    266   </data> 
    267   <data name="ButtonsPnl.Location" type="System.Drawing.Point, System.Drawing"> 
    268     <value>0, 96</value> 
    269   </data> 
    270285  <data name="$this.Font" type="System.Drawing.Font, System.Drawing"> 
    271286    <value>Microsoft Sans Serif, 9pt</value> 
    272   </data> 
    273   <data name="&gt;&gt;ButtonsPnl.Parent" xml:space="preserve"> 
    274     <value>$this</value> 
    275   </data> 
    276   <data name="&gt;&gt;TitleLbl.ZOrder" xml:space="preserve"> 
    277     <value>2</value> 
    278   </data> 
    279   <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing"> 
    280     <value>96, 96</value> 
    281   </data> 
    282   <data name="ProgressPb.TabIndex" type="System.Int32, mscorlib"> 
    283     <value>3</value> 
    284287  </data> 
    285288  <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 
     
    18431846</value> 
    18441847  </data> 
     1848  <data name="$this.Text" xml:space="preserve"> 
     1849    <value>Eraser Crash Assistant</value> 
     1850  </data> 
     1851  <data name="&gt;&gt;UploadWorker.Name" xml:space="preserve"> 
     1852    <value>UploadWorker</value> 
     1853  </data> 
     1854  <data name="&gt;&gt;UploadWorker.Type" xml:space="preserve"> 
     1855    <value>System.ComponentModel.BackgroundWorker, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     1856  </data> 
    18451857  <data name="&gt;&gt;$this.Name" xml:space="preserve"> 
    18461858    <value>BlackBoxUploadForm</value> 
    18471859  </data> 
    1848   <data name="&gt;&gt;CancelBtn.ZOrder" xml:space="preserve"> 
    1849     <value>1</value> 
    1850   </data> 
    1851   <data name="ButtonsBevel.Size" type="System.Drawing.Size, System.Drawing"> 
    1852     <value>345, 2</value> 
    1853   </data> 
    1854   <data name="TitleLbl.Font" type="System.Drawing.Font, System.Drawing"> 
    1855     <value>Microsoft Sans Serif, 12pt</value> 
    1856   </data> 
    1857   <metadata name="UploadWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
    1858     <value>17, 17</value> 
    1859   </metadata> 
    1860   <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
    1861     <value>True</value> 
    1862   </metadata> 
    1863   <metadata name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
    1864     <value>Italian</value> 
    1865   </metadata> 
     1860  <data name="&gt;&gt;$this.Type" xml:space="preserve"> 
     1861    <value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
     1862  </data> 
    18661863</root> 
  • branches/eraser6/EraserService/Eraser.BlackBox/Eraser.BlackBox.csproj

    r2621 r2737  
    8484    </Compile> 
    8585    <Compile Include="BlackBox.cs" /> 
     86    <Compile Include="BlackBoxClientTool.cs" /> 
    8687    <Compile Include="BlackBoxMainForm.cs"> 
    8788      <SubType>Form</SubType> 
     
    9091      <DependentUpon>BlackBoxMainForm.cs</DependentUpon> 
    9192    </Compile> 
     93    <Compile Include="BlackBoxNotifier.cs" /> 
     94    <Compile Include="BlackBoxReport.cs" /> 
    9295    <Compile Include="BlackBoxUploadForm.cs"> 
    9396      <SubType>Form</SubType> 
     
    9699      <DependentUpon>BlackBoxUploadForm.cs</DependentUpon> 
    97100    </Compile> 
     101    <Compile Include="BlackBoxReportUploader.cs" /> 
    98102    <Compile Include="Plugin.cs" /> 
    99103    <Compile Include="Properties\Resources.Designer.cs"> 
  • branches/eraser6/EraserService/Eraser.BlackBox/Plugin.cs

    r2516 r2737  
    3636            BlackBox blackBox = BlackBox.Get(); 
    3737 
    38             //Hook the Application's idle loop to display the form 
    39             Application.Idle += OnGUIIdle; 
     38            //Register our client tools 
     39            Host.Instance.ClientTools.Add(new BlackBoxClientTool()); 
     40 
     41            bool allSubmitted = true; 
     42            foreach (BlackBoxReport report in blackBox.GetDumps()) 
     43                if (report.Status == BlackBoxReportStatus.New) 
     44                { 
     45                    allSubmitted = false; 
     46                    break; 
     47                } 
     48 
     49            if (!allSubmitted) 
     50            { 
     51                Host.Instance.Notifiers.Add(new BlackBoxNotifier()); 
     52            } 
    4053        } 
    4154 
     
    6881        { 
    6982            Application.Idle -= OnGUIIdle; 
    70             BlackBox blackBox = BlackBox.Get(); 
    71  
    72             bool allSubmitted = true; 
    73             foreach (BlackBoxReport report in blackBox.GetDumps()) 
    74                 if (!report.Submitted) 
    75                 { 
    76                     allSubmitted = false; 
    77                     break; 
    78                 } 
    79  
    80             if (allSubmitted) 
    81                 return; 
    82  
    83             BlackBoxMainForm form = new BlackBoxMainForm(); 
    84             form.Show(); 
     83             
    8584        } 
    8685    } 
  • branches/eraser6/EraserService/Eraser.BlackBox/Strings.en.resx

    r1973 r2737  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    119119  </resheader> 
    120   <data name="Checking for status of report {0}..." xml:space="preserve"> 
    121     <value>Checking for status of report {0}...</value> 
     120  <data name="Manage BlackBox Reports" xml:space="preserve"> 
     121    <value>Manage BlackBox Reports</value> 
     122  </data> 
     123  <data name="Could not delete report {0} because of the following error: {1}" xml:space="preserve"> 
     124    <value>Could not delete report {0} because of the following error: {1}</value> 
     125  </data> 
     126  <data name="BlackBox" xml:space="preserve"> 
     127    <value>BlackBox</value> 
     128  </data> 
     129  <data name="Not submitted" xml:space="preserve"> 
     130    <value>Not submitted</value> 
     131  </data> 
     132  <data name="Submitted (Report ID {0})" xml:space="preserve"> 
     133    <value>Submitted (Report ID {0})</value> 
     134  </data> 
     135  <data name="Eraser BlackBox: Crash Reports Collected" xml:space="preserve"> 
     136    <value>Eraser BlackBox: Crash Reports Collected</value> 
     137  </data> 
     138  <data name="There are crash reports which have yet to be submitted. Click on this balloon to see the list of reports." xml:space="preserve"> 
     139    <value>There are crash reports which have yet to be submitted. Click on this balloon to see the list of reports.</value> 
    122140  </data> 
    123141  <data name="Compressing Report {0}: {1:#0.00%}" xml:space="preserve"> 
     
    126144  <data name="Uploading Report {0}: {1:#0.00%}" xml:space="preserve"> 
    127145    <value>Uploading Report {0}: {1:#0.00%}</value> 
     146  </data> 
     147  <data name="Checking for solution for {0}..." xml:space="preserve"> 
     148    <value>Checking for solution for {0}...</value> 
    128149  </data> 
    129150  <data name="Reports submitted successfully." xml:space="preserve"> 
  • branches/eraser6/EraserService/Eraser.BlackBox/Strings.it.resx

    r1973 r2737  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    119119  </resheader> 
    120   <data name="Checking for status of report {0}..." xml:space="preserve"> 
    121     <value>Verifica dello stato del report {0}...</value> 
     120  <data name="Manage BlackBox Reports" xml:space="preserve"> 
     121    <value>(Untranslated)</value> 
     122  </data> 
     123  <data name="Could not delete report {0} because of the following error: {1}" xml:space="preserve"> 
     124    <value>(Untranslated)</value> 
     125  </data> 
     126  <data name="BlackBox" xml:space="preserve"> 
     127    <value>(Untranslated)</value> 
     128  </data> 
     129  <data name="Not submitted" xml:space="preserve"> 
     130    <value>(Untranslated)</value> 
     131  </data> 
     132  <data name="Submitted (Report ID {0})" xml:space="preserve"> 
     133    <value>(Untranslated)</value> 
     134  </data> 
     135  <data name="Eraser BlackBox: Crash Reports Collected" xml:space="preserve"> 
     136    <value>(Untranslated)</value> 
     137  </data> 
     138  <data name="There are crash reports which have yet to be submitted. Click on this balloon to see the list of reports." xml:space="preserve"> 
     139    <value>(Untranslated)</value> 
    122140  </data> 
    123141  <data name="Compressing Report {0}: {1:#0.00%}" xml:space="preserve"> 
     
    126144  <data name="Uploading Report {0}: {1:#0.00%}" xml:space="preserve"> 
    127145    <value>Trasmissione Report {0}: {1:#0.00%}</value> 
     146  </data> 
     147  <data name="Checking for solution for {0}..." xml:space="preserve"> 
     148    <value>(Untranslated)</value> 
    128149  </data> 
    129150  <data name="Reports submitted successfully." xml:space="preserve"> 
  • branches/eraser6/EraserService/Eraser.BlackBox/Strings.nl.resx

    r1973 r2737  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    119119  </resheader> 
    120   <data name="Checking for status of report {0}..." xml:space="preserve"> 
     120  <data name="Manage BlackBox Reports" xml:space="preserve"> 
     121    <value>(Untranslated)</value> 
     122  </data> 
     123  <data name="Could not delete report {0} because of the following error: {1}" xml:space="preserve"> 
     124    <value>(Untranslated)</value> 
     125  </data> 
     126  <data name="BlackBox" xml:space="preserve"> 
     127    <value>(Untranslated)</value> 
     128  </data> 
     129  <data name="Not submitted" xml:space="preserve"> 
     130    <value>(Untranslated)</value> 
     131  </data> 
     132  <data name="Submitted (Report ID {0})" xml:space="preserve"> 
     133    <value>(Untranslated)</value> 
     134  </data> 
     135  <data name="Eraser BlackBox: Crash Reports Collected" xml:space="preserve"> 
     136    <value>(Untranslated)</value> 
     137  </data> 
     138  <data name="There are crash reports which have yet to be submitted. Click on this balloon to see the list of reports." xml:space="preserve"> 
    121139    <value>(Untranslated)</value> 
    122140  </data> 
     
    125143  </data> 
    126144  <data name="Uploading Report {0}: {1:#0.00%}" xml:space="preserve"> 
     145    <value>(Untranslated)</value> 
     146  </data> 
     147  <data name="Checking for solution for {0}..." xml:space="preserve"> 
    127148    <value>(Untranslated)</value> 
    128149  </data> 
  • branches/eraser6/EraserService/Eraser.BlackBox/Strings.pl.resx

    r1973 r2737  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    119119  </resheader> 
    120   <data name="Checking for status of report {0}..." xml:space="preserve"> 
    121     <value>Sprawdznie stanu raportu {0}...</value> 
     120  <data name="Manage BlackBox Reports" xml:space="preserve"> 
     121    <value>(Untranslated)</value> 
     122  </data> 
     123  <data name="Could not delete report {0} because of the following error: {1}" xml:space="preserve"> 
     124    <value>(Untranslated)</value> 
     125  </data> 
     126  <data name="BlackBox" xml:space="preserve"> 
     127    <value>(Untranslated)</value> 
     128  </data> 
     129  <data name="Not submitted" xml:space="preserve"> 
     130    <value>(Untranslated)</value> 
     131  </data> 
     132  <data name="Submitted (Report ID {0})" xml:space="preserve"> 
     133    <value>(Untranslated)</value> 
     134  </data> 
     135  <data name="Eraser BlackBox: Crash Reports Collected" xml:space="preserve"> 
     136    <value>(Untranslated)</value> 
     137  </data> 
     138  <data name="There are crash reports which have yet to be submitted. Click on this balloon to see the list of reports." xml:space="preserve"> 
     139    <value>(Untranslated)</value> 
    122140  </data> 
    123141  <data name="Compressing Report {0}: {1:#0.00%}" xml:space="preserve"> 
     
    126144  <data name="Uploading Report {0}: {1:#0.00%}" xml:space="preserve"> 
    127145    <value>Wysyłanie raportu {0}: {1:#0.00%}</value> 
     146  </data> 
     147  <data name="Checking for solution for {0}..." xml:space="preserve"> 
     148    <value>(Untranslated)</value> 
    128149  </data> 
    129150  <data name="Reports submitted successfully." xml:space="preserve"> 
  • branches/eraser6/EraserService/Eraser.BlackBox/Strings.resx

    r1973 r2737  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 
    119119  </resheader> 
    120   <data name="Checking for status of report {0}..." xml:space="preserve"> 
    121     <value>Checking for status of report {0}...</value> 
     120  <data name="Manage BlackBox Reports" xml:space="preserve"> 
     121    <value>Manage BlackBox Reports</value> 
     122  </data> 
     123  <data name="Could not delete report {0} because of the following error: {1}" xml:space="preserve"> 
     124    <value>Could not delete report {0} because of the following error: {1}</value> 
     125  </data> 
     126  <data name="BlackBox" xml:space="preserve"> 
     127    <value>BlackBox</value> 
     128  </data> 
     129  <data name="Not submitted" xml:space="preserve"> 
     130    <value>Not submitted</value> 
     131  </data> 
     132  <data name="Submitted (Report ID {0})" xml:space="preserve"> 
     133    <value>Submitted (Report ID {0})</value> 
     134  </data> 
     135  <data name="Eraser BlackBox: Crash Reports Collected" xml:space="preserve"> 
     136    <value>Eraser BlackBox: Crash Reports Collected</value> 
     137  </data> 
     138  <data name="There are crash reports which have yet to be submitted. Click on this balloon to see the list of reports." xml:space="preserve"> 
     139    <value>There are crash reports which have yet to be submitted. Click on this balloon to see the list of reports.</value> 
    122140  </data> 
    123141  <data name="Compressing Report {0}: {1:#0.00%}" xml:space="preserve"> 
     
    126144  <data name="Uploading Report {0}: {1:#0.00%}" xml:space="preserve"> 
    127145    <value>Uploading Report {0}: {1:#0.00%}</value> 
     146  </data> 
     147  <data name="Checking for solution for {0}..." xml:space="preserve"> 
     148    <value>Checking for solution for {0}...</value> 
    128149  </data> 
    129150  <data name="Reports submitted successfully." xml:space="preserve"> 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/EntropySources/KernelEntropySource.cs

    r2622 r2737  
    105105            //Currently running threads (dynamic, but not very) 
    106106            Process currProcess = Process.GetCurrentProcess(); 
    107             foreach (ProcessThread thread in currProcess.Threads) 
    108                 result.AddRange(StructToBuffer(thread.Id)); 
     107            try 
     108            { 
     109                foreach (ProcessThread thread in currProcess.Threads) 
     110                    result.AddRange(StructToBuffer(thread.Id)); 
     111            } 
     112            catch (InvalidOperationException) 
     113            { 
     114                //Swallow, this doesn't mean anything to us. 
     115            } 
    109116 
    110117            //Various process statistics 
     
    199206                    //This happens if a drive is ejected while the loop is running. 
    200207                } 
     208                catch (NotSupportedException) 
     209                { 
     210                    //Don't bother if this drive doesn't count statistics. 
     211                } 
    201212            } 
    202213 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/ErasureTargets/DriveErasureTarget.cs

    r2609 r2737  
    230230                    stepProgress.Total = PhysicalDrive.Size; 
    231231                    PhysicalDrive.DeleteDriveLayout(); 
    232                     stream = PhysicalDrive.Open(FileAccess.ReadWrite, FileShare.ReadWrite); 
     232                    if (PhysicalDrive.Volumes.Count == 1) 
     233                    { 
     234                        //This could be a removable device where Windows sees an oversized floppy. 
     235                        stream = PhysicalDrive.Volumes[0].Open(FileAccess.ReadWrite, FileShare.ReadWrite); 
     236                    } 
     237                    else if (PhysicalDrive.Volumes.Count > 0) 
     238                    { 
     239                        throw new InvalidOperationException(S._("The partition table on the drive " + 
     240                            "could not be erased.")); 
     241                    } 
     242                    else 
     243                    { 
     244                        stream = PhysicalDrive.Open(FileAccess.ReadWrite, FileShare.ReadWrite); 
     245                    } 
    233246                } 
    234247                else 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/ErasureTargets/DriveErasureTargetConfigurer.cs

    r2517 r2737  
    5858                            new FileSize(PhysicalDrive.Size)); 
    5959                    } 
     60                    catch (IOException) 
     61                    { 
     62                        Cache = S._("Hard disk {0}", PhysicalDrive.Index); 
     63                    } 
    6064                    catch (UnauthorizedAccessException) 
    6165                    { 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/ErasureTargets/FileErasureTarget.cs

    r2606 r2737  
    7676            FileInfo fileInfo = new FileInfo(Path); 
    7777 
    78             if (fileInfo.Exists) 
     78            try 
    7979            { 
    8080                result.AddRange(GetPathADSes(fileInfo)); 
    8181                result.Add(new StreamInfo(Path)); 
     82            } 
     83            catch (SharingViolationException) 
     84            { 
     85                Logger.Log(S._("Could not list the Alternate Data Streams for file {0} " + 
     86                    "because the file is being used by another process. The file will not " + 
     87                    "be erased.", fileInfo.FullName), LogLevel.Error); 
     88            } 
     89            catch (FileNotFoundException) 
     90            { 
     91            } 
     92            catch (DirectoryNotFoundException) 
     93            { 
    8294            } 
    8395 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/ErasureTargets/FileSystemObjectErasureTarget.cs

    r2606 r2737  
    129129                        info.FullName, e.Message), LogLevel.Error); 
    130130                } 
     131                catch (IOException e) 
     132                { 
     133                    //We can get IOExceptions if the drive was disconnected during traversal. 
     134                    //Such an occurrance would be when the user disconnects from a network share. 
     135                    Logger.Log(S._("Could not erase files and subfolders in {0} because {1}", 
     136                        info.FullName, e.Message), LogLevel.Error); 
     137                } 
    131138            } 
    132139 
     
    135142 
    136143        /// <summary> 
    137         /// Adds ADSes of the given file to the list, forcing the open handles to the 
    138         /// files closed if necessary. 
    139         /// </summary> 
    140         /// <param name="file">The file to look for ADSes</param> 
     144        /// Returns the ADSes of the given file, forcing open handles to the files closed 
     145        /// if necessary. 
     146        /// </summary> 
     147        /// <param name="file">The file to look for ADSes.</param> 
     148        /// <exception cref="SharingViolationException">Thrown when the file cannot be unlocked 
     149        /// and enumerated for ADSes.</exception> 
    141150        protected static StreamInfo[] GetPathADSes(FileInfo file) 
    142151        { 
     152            int attempts = 1; 
     153            return GetPathADSes(file, ref attempts); 
     154        } 
     155 
     156        /// <summary> 
     157        /// Returns the ADSes of the given file, forcing open handles to the files closed 
     158        /// if necessary. 
     159        /// </summary> 
     160        /// <param name="file">The file to look for ADSes.</param> 
     161        /// <param name="attempts">The number of tries to close open handles. Abort after a 
     162        /// large number of tries (currently 10 attempts)</param> 
     163        /// <returns>The list of ADSes the file contains.</returns> 
     164        private static StreamInfo[] GetPathADSes(FileInfo file, ref int attempts) 
     165        { 
    143166            try 
    144167            { 
     
    147170            catch (FileNotFoundException) 
    148171            { 
     172                return new StreamInfo[0]; 
    149173            } 
    150174            catch (SharingViolationException) 
     
    154178                    throw; 
    155179 
    156                 StringBuilder processStr = new StringBuilder(); 
    157                 foreach (OpenHandle handle in OpenHandle.Close(file.FullName)) 
    158                 { 
    159                     try 
    160                     { 
    161                         processStr.AppendFormat( 
    162                             System.Globalization.CultureInfo.InvariantCulture, 
    163                             "{0}, ", handle.Process.MainModule.FileName); 
    164                     } 
    165                     catch (System.ComponentModel.Win32Exception) 
    166                     { 
    167                         processStr.AppendFormat( 
    168                             System.Globalization.CultureInfo.InvariantCulture, 
    169                             "Process ID {0}, ", handle.Process.Id); 
    170                     } 
    171                 } 
    172  
    173                 if (processStr.Length == 0) 
    174                     return GetPathADSes(file); 
     180                //Retry closing the file 10 times. If we can't do that, we should abort 
     181                //since we may not be able to get the process information of processes 
     182                //running with higher privileges. 
     183                if (OpenHandle.Close(file.FullName).Count == 0 && ++attempts <= 10) 
     184                    return GetPathADSes(file, ref attempts); 
    175185                else 
    176186                    throw; 
     
    217227            //Retrieve the list of files to erase. 
    218228            List<StreamInfo> paths = GetPaths(); 
    219             long dataTotal = paths.Sum(x => x.Length); 
     229            long dataTotal = paths.Sum(delegate(StreamInfo x) { 
     230                try 
     231                { 
     232                    return x.Length; 
     233                } 
     234                catch (DirectoryNotFoundException) 
     235                { 
     236                    return 0; 
     237                } 
     238                catch (FileNotFoundException) 
     239                { 
     240                    return 0; 
     241                } 
     242            }); 
    220243 
    221244            //Set the event's current target status. 
     
    342365                    else 
    343366                        Logger.Log(S._("The file {0} is a hard link or a symbolic link thus the " + 
    344                             "contents of the file was not erased.", LogLevel.Notice)); 
     367                            "contents of the file was not erased.", info.FullName), LogLevel.Notice); 
    345368                    return; 
     369                } 
     370                catch (FileNotFoundException) 
     371                { 
     372                    Logger.Log(S._("The file {0} was not erased because it was " + 
     373                        "deleted before it could be erased.", info.FullName), LogLevel.Information); 
     374                } 
     375                catch (DirectoryNotFoundException) 
     376                { 
     377                    Logger.Log(S._("The file {0} was not erased because the containing " + 
     378                        "directory was deleted before it could be erased.", info.FullName), 
     379                        LogLevel.Information); 
    346380                } 
    347381                catch (SharingViolationException) 
     
    359393                    //Either we could not close all instances, or we already tried twice. Report 
    360394                    //the error. 
    361                     StringBuilder processStr = new StringBuilder(); 
    362                     foreach (OpenHandle handle in remainingHandles) 
     395                    string processes = string.Empty; 
    363396                    { 
    364                         try 
     397                        StringBuilder processStr = new StringBuilder(); 
     398                        foreach (OpenHandle handle in remainingHandles) 
    365399                        { 
    366                             processStr.AppendFormat( 
    367                                 System.Globalization.CultureInfo.InvariantCulture, 
    368                                 "{0}, ", handle.Process.MainModule.FileName); 
     400                            try 
     401                            { 
     402                                processStr.AppendFormat( 
     403                                    System.Globalization.CultureInfo.InvariantCulture, 
     404                                    "{0}, ", handle.Process.MainModule.FileName); 
     405                            } 
     406                            catch (System.ComponentModel.Win32Exception) 
     407                            { 
     408                                processStr.AppendFormat( 
     409                                    System.Globalization.CultureInfo.InvariantCulture, 
     410                                    "Process ID {0}, ", handle.Process.Id); 
     411                            } 
    369412                        } 
    370                         catch (System.ComponentModel.Win32Exception) 
     413 
     414                        if (processStr.Length > 2) 
    371415                        { 
    372                             processStr.AppendFormat( 
    373                                 System.Globalization.CultureInfo.InvariantCulture, 
    374                                 "Process ID {0}, ", handle.Process.Id); 
     416                            processes = processStr.ToString().Remove(processStr.Length - 2).Trim(); 
     417                        } 
     418                        else 
     419                        { 
     420                            processes = S._("(unknown)"); 
    375421                        } 
    376422                    } 
     
    378424                    throw new SharingViolationException(S._( 
    379425                        "Could not force closure of file \"{0}\" {1}", info.FileName, 
    380                         S._("(locked by {0})", 
    381                             processStr.ToString().Remove(processStr.Length - 2)).Trim()), 
    382                         info.FileName); 
     426                        S._("(locked by {0})", processes))); 
    383427                } 
    384428            } 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/ErasureTargets/FolderErasureTarget.cs

    r2606 r2737  
    147147                    continue; 
    148148 
    149                 //Add the size of the file and its alternate data streams 
    150                 result.AddRange(GetPathADSes(file)); 
    151  
    152                 //And the file itself 
    153                 result.Add(new StreamInfo(file.FullName)); 
     149                try 
     150                { 
     151                    //Add the size of the file and its alternate data streams 
     152                    result.AddRange(GetPathADSes(file)); 
     153 
     154                    //And the file itself 
     155                    result.Add(new StreamInfo(file.FullName)); 
     156                } 
     157                catch (FileNotFoundException) 
     158                { 
     159                    Logger.Log(S._("The file {0} was not erased because it was deleted " + 
     160                        "before it could be erased.", file.FullName), LogLevel.Information); 
     161                } 
     162                catch (DirectoryNotFoundException) 
     163                { 
     164                    Logger.Log(S._("The file {0} was not erased because the containing " + 
     165                        "directory was deleted before it could be erased.", file.FullName), 
     166                        LogLevel.Information); 
     167                } 
     168                catch (SharingViolationException) 
     169                { 
     170                    Logger.Log(S._("Could not list the Alternate Data Streams for file {0} " + 
     171                        "because the file is being used by another process. The file will not " + 
     172                        "be erased.", file.FullName), LogLevel.Error); 
     173                } 
    154174            } 
    155175 
     
    266286                        DeleteFolder(info, true); 
    267287                } 
     288                catch (DirectoryNotFoundException) 
     289                { 
     290                    Logger.Log(new LogEntry(S._("The folder {0} was not erased because " + 
     291                        "the containing directory was deleted before it could be erased.", 
     292                        info.FullName), LogLevel.Information)); 
     293                } 
    268294                catch (UnauthorizedAccessException) 
    269295                { 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/ErasureTargets/RecycleBinErasureTarget.cs

    r2606 r2737  
    141141                foreach (FileInfo file in GetFiles(directory)) 
    142142                { 
    143                     //Add the ADSes 
    144                     result.AddRange(GetPathADSes(file)); 
    145  
    146                     //Then the file itself 
    147                     result.Add(new StreamInfo(file.FullName)); 
     143                    try 
     144                    { 
     145                        //Add the ADSes 
     146                        result.AddRange(GetPathADSes(file)); 
     147 
     148                        //Then the file itself 
     149                        result.Add(new StreamInfo(file.FullName)); 
     150                    } 
     151                    catch (FileNotFoundException) 
     152                    { 
     153                        Logger.Log(S._("The file {0} was not erased because it was deleted " + 
     154                            "before it could be erased.", file.FullName), LogLevel.Information); 
     155                    } 
     156                    catch (DirectoryNotFoundException) 
     157                    { 
     158                        Logger.Log(S._("The file {0} was not erased because the containing " + 
     159                            "directory was deleted before it could be erased.", file.FullName), 
     160                            LogLevel.Information); 
     161                    } 
     162                    catch (SharingViolationException) 
     163                    { 
     164                        Logger.Log(S._("Could not list the Alternate Data Streams for file {0} " + 
     165                            "because the file is being used by another process. The file will not " + 
     166                            "be erased.", file.FullName), LogLevel.Error); 
     167                    } 
    148168                } 
    149169 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/ErasureTargets/SecureMoveErasureTarget.cs

    r2606 r2737  
    123123            foreach (FileInfo info in files) 
    124124            { 
    125                 //Add the alternate data streams 
    126                 result.AddRange(GetPathADSes(info)); 
    127  
    128                 //And the file itself 
    129                 result.Add(new StreamInfo(info.FullName)); 
     125                try 
     126                { 
     127                    //Add the alternate data streams 
     128                    result.AddRange(GetPathADSes(info)); 
     129 
     130                    //And the file itself 
     131                    result.Add(new StreamInfo(info.FullName)); 
     132                } 
     133                catch (SharingViolationException) 
     134                { 
     135                    Logger.Log(S._("Could not list the Alternate Data Streams for file {0} " + 
     136                        "because the file is being used by another process. The file will not " + 
     137                        "be erased.", info.FullName), LogLevel.Error); 
     138                } 
     139                catch (FileNotFoundException) 
     140                { 
     141                } 
     142                catch (DirectoryNotFoundException) 
     143                { 
     144                } 
    130145            } 
    131146 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/FileSystems/Fat.cs

    r2516 r2737  
    7575        { 
    7676            using (FileStream stream = info.Open(FileAccess.ReadWrite, FileShare.ReadWrite)) 
     77            using (FatApi api = GetFatApi(info, stream)) 
    7778            { 
    7879                int directoriesCleaned = 0; 
    79                 FatApi api = GetFatApi(info, stream); 
    8080                HashSet<uint> eraseQueueClusters = new HashSet<uint>(); 
    8181                List<FatDirectoryEntry> eraseQueue = new List<FatDirectoryEntry>(); 
    82                 { 
    83                     FatDirectoryEntry entry = api.LoadDirectory(string.Empty); 
    84                     eraseQueue.Add(entry); 
    85                     eraseQueueClusters.Add(entry.Cluster); 
    86                 } 
    8782 
    8883                try 
    8984                { 
     85                    { 
     86                        FatDirectoryEntry entry = api.LoadDirectory(string.Empty); 
     87                        eraseQueue.Add(entry); 
     88                        eraseQueueClusters.Add(entry.Cluster); 
     89                    } 
     90 
    9091                    while (eraseQueue.Count != 0) 
    9192                    { 
     
    9495 
    9596                        FatDirectoryBase currentDir = api.LoadDirectory(eraseQueue[0].FullName); 
     97                        eraseQueue[0].Dispose(); 
    9698                        eraseQueue.RemoveAt(0); 
    9799 
     
    118120                        "the volume is currently in use.")); 
    119121                } 
     122                finally 
     123                { 
     124                    foreach (FatDirectoryEntry entry in eraseQueue) 
     125                        entry.Dispose(); 
     126                } 
    120127            } 
    121128        } 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/FileSystems/Windows.cs

    r2559 r2737  
    139139                                } 
    140140 
    141                                 StringBuilder processStr = new StringBuilder(); 
    142                                 foreach (OpenHandle handle in OpenHandle.Close(info.FullName)) 
     141                                //Either we could not close all instances, or we already tried twice. Report 
     142                                //the error. 
     143                                string processes = string.Empty; 
    143144                                { 
    144                                     try 
     145                                    StringBuilder processStr = new StringBuilder(); 
     146                                    foreach (OpenHandle handle in OpenHandle.Close(info.FullName)) 
    145147                                    { 
    146                                         processStr.AppendFormat( 
    147                                             System.Globalization.CultureInfo.InvariantCulture, 
    148                                             "{0}, ", handle.Process.MainModule.FileName); 
     148                                        try 
     149                                        { 
     150                                            processStr.AppendFormat( 
     151                                                System.Globalization.CultureInfo.InvariantCulture, 
     152                                                "{0}, ", handle.Process.MainModule.FileName); 
     153                                        } 
     154                                        catch (System.ComponentModel.Win32Exception) 
     155                                        { 
     156                                            processStr.AppendFormat( 
     157                                                System.Globalization.CultureInfo.InvariantCulture, 
     158                                                "Process ID {0}, ", handle.Process.Id); 
     159                                        } 
    149160                                    } 
    150                                     catch (System.ComponentModel.Win32Exception) 
     161 
     162                                    if (processStr.Length > 2) 
    151163                                    { 
    152                                         processStr.AppendFormat( 
    153                                             System.Globalization.CultureInfo.InvariantCulture, 
    154                                             "Process ID {0}, ", handle.Process.Id); 
     164                                        processes = processStr.ToString().Remove(processStr.Length - 2).Trim(); 
     165                                    } 
     166                                    else 
     167                                    { 
     168                                        processes = S._("(unknown)"); 
    155169                                    } 
    156170                                } 
    157171 
    158                                 if (processStr.Length != 0) 
    159                                     Logger.Log(S._("Could not force closure of file \"{0}\" {1}", 
    160                                             info.FullName, S._("(locked by {0})", 
    161                                                 processStr.ToString().Remove(processStr.Length - 2)).Trim()), 
    162                                         LogLevel.Error); 
     172                                throw new SharingViolationException(S._( 
     173                                    "Could not force closure of file \"{0}\" {1}", info.FullName, 
     174                                    S._("(locked by {0})", processes))); 
    163175                            } 
    164176 
     
    262274            long amountToCopy = Math.Min(stream.Length, 
    263275                Math.Min(4 * 1024 * 1024, shadowFileInfo.Length)); 
    264             using (FileStream shadowFileStream = shadowFileInfo.OpenRead()) 
     276            using (FileStream shadowFileStream = shadowFileInfo.Open( 
     277                    FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) 
    265278            { 
    266279                while (stream.Position < amountToCopy) 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/Strings.en.resx

    r2615 r2737  
    166166    <value>The file {0} is currently in use and cannot be removed.</value> 
    167167  </data> 
     168  <data name="(unknown)" xml:space="preserve"> 
     169    <value>(unknown)</value> 
     170  </data> 
    168171  <data name="Could not force closure of file \&quot;{0}\&quot; {1}(locked by {0})" xml:space="preserve"> 
    169172    <value>Could not force closure of file \"{0}\" {1}(locked by {0})</value> 
     
    220223    <value>The program does not have the required permissions to erase the disk.</value> 
    221224  </data> 
     225  <data name="The partition table on the drive could not be erased." xml:space="preserve"> 
     226    <value>The partition table on the drive could not be erased.</value> 
     227  </data> 
    222228  <data name="The Drive erasure target requires a volume or physical drive selected for erasure." xml:space="preserve"> 
    223229    <value>The Drive erasure target requires a volume or physical drive selected for erasure.</value> 
     
    247253    <value>File</value> 
    248254  </data> 
     255  <data name="Could not list the Alternate Data Streams for file {0} because the file is being used by another process. The file will not be erased." xml:space="preserve"> 
     256    <value>Could not list the Alternate Data Streams for file {0} because the file is being used by another process. The file will not be erased.</value> 
     257  </data> 
    249258  <data name="Invalid file path" xml:space="preserve"> 
    250259    <value>Invalid file path</value> 
     
    265274    <value>The file {0} is a hard link or a symbolic link thus the contents of the file was not erased.</value> 
    266275  </data> 
     276  <data name="The file {0} was not erased because it was deleted before it could be erased." xml:space="preserve"> 
     277    <value>The file {0} was not erased because it was deleted before it could be erased.</value> 
     278  </data> 
     279  <data name="The file {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     280    <value>The file {0} was not erased because the containing directory was deleted before it could be erased.</value> 
     281  </data> 
    267282  <data name="Files in Folder" xml:space="preserve"> 
    268283    <value>Files in Folder</value> 
     
    271286    <value>Removing folders...</value> 
    272287  </data> 
     288  <data name="The folder {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     289    <value>The folder {0} was not erased because the containing directory was deleted before it could be erased.</value> 
     290  </data> 
    273291  <data name="The folder {0} could not be deleted because the folder's permissions prevents the deletion of the folder." xml:space="preserve"> 
    274292    <value>The folder {0} could not be deleted because the folder's permissions prevents the deletion of the folder.</value> 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/Strings.it.resx

    r2615 r2737  
    166166    <value>Il file {0} è attualmente in uso e non può essere rimosso.</value> 
    167167  </data> 
     168  <data name="(unknown)" xml:space="preserve"> 
     169    <value>(Untranslated)</value> 
     170  </data> 
    168171  <data name="Could not force closure of file \&quot;{0}\&quot; {1}(locked by {0})" xml:space="preserve"> 
    169172    <value>Impossibile forzare la chiusura del file \"{0}\" {1}(in uso da {0})</value> 
     
    220223    <value>(Untranslated)</value> 
    221224  </data> 
     225  <data name="The partition table on the drive could not be erased." xml:space="preserve"> 
     226    <value>(Untranslated)</value> 
     227  </data> 
    222228  <data name="The Drive erasure target requires a volume or physical drive selected for erasure." xml:space="preserve"> 
    223229    <value>(Untranslated)</value> 
     
    247253    <value>(Untranslated)</value> 
    248254  </data> 
     255  <data name="Could not list the Alternate Data Streams for file {0} because the file is being used by another process. The file will not be erased." xml:space="preserve"> 
     256    <value>(Untranslated)</value> 
     257  </data> 
    249258  <data name="Invalid file path" xml:space="preserve"> 
    250259    <value>Percorso del file non valido</value> 
     
    265274    <value>(Untranslated)</value> 
    266275  </data> 
     276  <data name="The file {0} was not erased because it was deleted before it could be erased." xml:space="preserve"> 
     277    <value>(Untranslated)</value> 
     278  </data> 
     279  <data name="The file {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     280    <value>(Untranslated)</value> 
     281  </data> 
    267282  <data name="Files in Folder" xml:space="preserve"> 
    268283    <value>File in cartella</value> 
     
    271286    <value>Pulizia cartelle...</value> 
    272287  </data> 
     288  <data name="The folder {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     289    <value>(Untranslated)</value> 
     290  </data> 
    273291  <data name="The folder {0} could not be deleted because the folder's permissions prevents the deletion of the folder." xml:space="preserve"> 
    274292    <value>(Untranslated)</value> 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/Strings.nl.resx

    r2615 r2737  
    166166    <value>(Untranslated)</value> 
    167167  </data> 
     168  <data name="(unknown)" xml:space="preserve"> 
     169    <value>(Untranslated)</value> 
     170  </data> 
    168171  <data name="Could not force closure of file \&quot;{0}\&quot; {1}(locked by {0})" xml:space="preserve"> 
    169172    <value>(Untranslated)</value> 
     
    220223    <value>(Untranslated)</value> 
    221224  </data> 
     225  <data name="The partition table on the drive could not be erased." xml:space="preserve"> 
     226    <value>(Untranslated)</value> 
     227  </data> 
    222228  <data name="The Drive erasure target requires a volume or physical drive selected for erasure." xml:space="preserve"> 
    223229    <value>(Untranslated)</value> 
     
    247253    <value>(Untranslated)</value> 
    248254  </data> 
     255  <data name="Could not list the Alternate Data Streams for file {0} because the file is being used by another process. The file will not be erased." xml:space="preserve"> 
     256    <value>(Untranslated)</value> 
     257  </data> 
    249258  <data name="Invalid file path" xml:space="preserve"> 
    250259    <value>(Untranslated)</value> 
     
    265274    <value>(Untranslated)</value> 
    266275  </data> 
     276  <data name="The file {0} was not erased because it was deleted before it could be erased." xml:space="preserve"> 
     277    <value>(Untranslated)</value> 
     278  </data> 
     279  <data name="The file {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     280    <value>(Untranslated)</value> 
     281  </data> 
    267282  <data name="Files in Folder" xml:space="preserve"> 
    268283    <value>(Untranslated)</value> 
     
    271286    <value>(Untranslated)</value> 
    272287  </data> 
     288  <data name="The folder {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     289    <value>(Untranslated)</value> 
     290  </data> 
    273291  <data name="The folder {0} could not be deleted because the folder's permissions prevents the deletion of the folder." xml:space="preserve"> 
    274292    <value>(Untranslated)</value> 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/Strings.pl.resx

    r2615 r2737  
    166166    <value>Plik {0} jest w użyciu i nie można go usunąć.</value> 
    167167  </data> 
     168  <data name="(unknown)" xml:space="preserve"> 
     169    <value>(Untranslated)</value> 
     170  </data> 
    168171  <data name="Could not force closure of file \&quot;{0}\&quot; {1}(locked by {0})" xml:space="preserve"> 
    169172    <value>Nie można wymusić zamknięcia pliku \"{0}\" {1}(zablokowany przez {0})</value> 
     
    220223    <value>(Untranslated)</value> 
    221224  </data> 
     225  <data name="The partition table on the drive could not be erased." xml:space="preserve"> 
     226    <value>(Untranslated)</value> 
     227  </data> 
    222228  <data name="The Drive erasure target requires a volume or physical drive selected for erasure." xml:space="preserve"> 
    223229    <value>(Untranslated)</value> 
     
    247253    <value>(Untranslated)</value> 
    248254  </data> 
     255  <data name="Could not list the Alternate Data Streams for file {0} because the file is being used by another process. The file will not be erased." xml:space="preserve"> 
     256    <value>(Untranslated)</value> 
     257  </data> 
    249258  <data name="Invalid file path" xml:space="preserve"> 
    250259    <value>(Untranslated)</value> 
     
    265274    <value>(Untranslated)</value> 
    266275  </data> 
     276  <data name="The file {0} was not erased because it was deleted before it could be erased." xml:space="preserve"> 
     277    <value>(Untranslated)</value> 
     278  </data> 
     279  <data name="The file {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     280    <value>(Untranslated)</value> 
     281  </data> 
    267282  <data name="Files in Folder" xml:space="preserve"> 
    268283    <value>(Untranslated)</value> 
    269284  </data> 
    270285  <data name="Removing folders..." xml:space="preserve"> 
     286    <value>(Untranslated)</value> 
     287  </data> 
     288  <data name="The folder {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
    271289    <value>(Untranslated)</value> 
    272290  </data> 
  • branches/eraser6/EraserService/Eraser.DefaultPlugins/Strings.resx

    r2615 r2737  
    166166    <value>The file {0} is currently in use and cannot be removed.</value> 
    167167  </data> 
     168  <data name="(unknown)" xml:space="preserve"> 
     169    <value>(unknown)</value> 
     170  </data> 
    168171  <data name="Could not force closure of file \&quot;{0}\&quot; {1}(locked by {0})" xml:space="preserve"> 
    169172    <value>Could not force closure of file \"{0}\" {1}(locked by {0})</value> 
     
    220223    <value>The program does not have the required permissions to erase the disk.</value> 
    221224  </data> 
     225  <data name="The partition table on the drive could not be erased." xml:space="preserve"> 
     226    <value>The partition table on the drive could not be erased.</value> 
     227  </data> 
    222228  <data name="The Drive erasure target requires a volume or physical drive selected for erasure." xml:space="preserve"> 
    223229    <value>The Drive erasure target requires a volume or physical drive selected for erasure.</value> 
     
    247253    <value>File</value> 
    248254  </data> 
     255  <data name="Could not list the Alternate Data Streams for file {0} because the file is being used by another process. The file will not be erased." xml:space="preserve"> 
     256    <value>Could not list the Alternate Data Streams for file {0} because the file is being used by another process. The file will not be erased.</value> 
     257  </data> 
    249258  <data name="Invalid file path" xml:space="preserve"> 
    250259    <value>Invalid file path</value> 
     
    265274    <value>The file {0} is a hard link or a symbolic link thus the contents of the file was not erased.</value> 
    266275  </data> 
     276  <data name="The file {0} was not erased because it was deleted before it could be erased." xml:space="preserve"> 
     277    <value>The file {0} was not erased because it was deleted before it could be erased.</value> 
     278  </data> 
     279  <data name="The file {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     280    <value>The file {0} was not erased because the containing directory was deleted before it could be erased.</value> 
     281  </data> 
    267282  <data name="Files in Folder" xml:space="preserve"> 
    268283    <value>Files in Folder</value> 
     
    271286    <value>Removing folders...</value> 
    272287  </data> 
     288  <data name="The folder {0} was not erased because the containing directory was deleted before it could be erased." xml:space="preserve"> 
     289    <value>The folder {0} was not erased because the containing directory was deleted before it could be erased.</value> 
     290  </data> 
    273291  <data name="The folder {0} could not be deleted because the folder's permissions prevents the deletion of the folder." xml:space="preserve"> 
    274292    <value>The folder {0} could not be deleted because the folder's permissions prevents the deletion of the folder.</value> 
  • branches/eraser6/EraserService/Eraser.Manager/Strings.en.resx

    r2572 r2737  
    119119  </resheader> 
    120120  <data name="No suitable hash algorithms were found on this computer." xml:space="preserve"> 
    121     <value>(Untranslated)</value> 
     121    <value>No suitable hash algorithms were found on this computer.</value> 
    122122  </data> 
    123123  <data name="Running on restart" xml:space="preserve"> 
  • branches/eraser6/EraserService/Eraser.Manager/Task.cs

    r2736 r2737  
    471471                        throw; 
    472472                    } 
     473                    catch (NotSupportedException e) 
     474                    { 
     475                        //This is thrown whenever we try to erase files on an unsupported 
     476                        //filesystem. 
     477                        Logger.Log(e.Message, LogLevel.Error); 
     478                    } 
     479                    catch (UnauthorizedAccessException e) 
     480                    { 
     481                        //The OS denied us access to erasing the file. 
     482                        Logger.Log(e.Message, LogLevel.Error); 
     483                    } 
     484                    catch (PathTooLongException e) 
     485                    { 
     486                        //Until we have code to deal with paths using NT names, we can't 
     487                        //do much about it. 
     488                        Logger.Log(e.Message, LogLevel.Error); 
     489                    } 
    473490                    catch (SharingViolationException) 
    474491                    { 
  • branches/eraser6/EraserService/Eraser.Plugins/Eraser.Plugins.csproj

    r2506 r2737  
    5757    <Compile Include="ExtensionPoints\IErasureTarget.cs" /> 
    5858    <Compile Include="ExtensionPoints\IFileSystem.cs" /> 
     59    <Compile Include="ExtensionPoints\INotifier.cs" /> 
    5960    <Compile Include="ExtensionPoints\IPrng.cs" /> 
    6061    <Compile Include="IConfigurer.cs" /> 
     
    7576    <Compile Include="Registrars\ErasureTargetFactoryRegistrar.cs" /> 
    7677    <Compile Include="Registrars\FileSystemRegistrar.cs" /> 
     78    <Compile Include="Registrars\NotifierRegistrar.cs" /> 
    7779    <Compile Include="Registrars\PrngRegistrar.cs" /> 
    7880    <Compile Include="Settings.cs" /> 
  • branches/eraser6/EraserService/Eraser.Plugins/Host.cs

    r2516 r2737  
    9696            FileSystems = new FileSystemRegistrar(); 
    9797            ClientTools = new ClientToolRegistrar(); 
     98            Notifiers = new NotifierRegistrar(); 
    9899        } 
    99100 
     
    232233 
    233234        /// <summary> 
    234         /// The global instance of the Client Tools 
     235        /// The global instance of the Client Tools Registrar. 
    235236        /// </summary> 
    236237        public ClientToolRegistrar ClientTools 
     238        { 
     239            get; 
     240            private set; 
     241        } 
     242 
     243        /// <summary> 
     244        /// The global instance of the Notifier Registrar. 
     245        /// </summary> 
     246        public NotifierRegistrar Notifiers 
    237247        { 
    238248            get; 
     
    283293                if (!LoadPlugin(new AssemblyName(name))) 
    284294                    throw new FileLoadException(S._("The required Core plugin {0} could not be " + 
    285                         "loaded. Repair the Eraser installation and try again.")); 
     295                        "loaded. Repair the Eraser installation and try again.", name)); 
    286296            } 
    287297 
  • branches/eraser6/EraserService/Eraser.Plugins/Registrars/FileSystemRegistrar.cs

    r2518 r2737  
    4545            get 
    4646            { 
     47                if (volume == null) 
     48                    throw new ArgumentNullException("volume"); 
     49 
    4750                foreach (IFileSystem filesystem in this) 
    4851                    if (filesystem.Name.ToUpperInvariant() == 
  • branches/eraser6/EraserService/Eraser.Shell/CtxMenu.cpp

    r2531 r2737  
    301301 
    302302        //Insert the submenu into the Context menu provided by Explorer. 
     303        if (GetMenuItemCount(hSubmenu) > 0) 
    303304        { 
    304305            MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; 
  • branches/eraser6/EraserService/Eraser.Shell/CtxMenu.h

    r2516 r2737  
    4242    { 
    4343    public: 
    44         CCtxMenu() 
    45         { 
    46         } 
     44        CCtxMenu() {} 
     45        virtual ~CCtxMenu() {} 
    4746 
    4847        /// The place where the context menu extension was invoked. 
  • branches/eraser6/EraserService/Eraser.Util.Native/Fat12Or16Api.cpp

    r2516 r2737  
    4040        if (info->VolumeFormat != L"FAT12" && info->VolumeFormat != "FAT16") 
    4141            throw gcnew ArgumentException(S::_(L"The volume provided is not a FAT12 or FAT16 volume.")); 
     42    } 
     43 
     44    Fat12Or16Api::!Fat12Or16Api() 
     45    { 
     46        if (Fat != NULL) 
     47        { 
     48            delete[] Fat; 
     49            Fat = NULL; 
     50        } 
    4251    } 
    4352 
     
    126135    } 
    127136 
     137    Fat12Or16Api::RootDirectory::!RootDirectory() 
     138    { 
     139        if (Directory != NULL) 
     140        { 
     141            delete[] Directory; 
     142            Directory = NULL; 
     143            DirectorySize = 0; 
     144        } 
     145    } 
     146 
    128147    void Fat12Or16Api::RootDirectory::ReadDirectory() 
    129148    { 
  • branches/eraser6/EraserService/Eraser.Util.Native/Fat32Api.cpp

    r2516 r2737  
    4040        if (info->VolumeFormat != L"FAT32") 
    4141            throw gcnew ArgumentException(S::_(L"The volume provided is not a FAT32 volume.")); 
     42    } 
     43 
     44    Fat32Api::!Fat32Api() 
     45    { 
     46        if (Fat != NULL) 
     47        { 
     48            delete[] Fat; 
     49            Fat = NULL; 
     50        } 
    4251    } 
    4352 
  • branches/eraser6/EraserService/Eraser.Util.Native/FatApi.cpp

    r2516 r2737  
    7070    } 
    7171 
     72    FatApi::!FatApi() 
     73    { 
     74        if (BootSector != NULL) 
     75        { 
     76            delete BootSector; 
     77            BootSector = NULL; 
     78        } 
     79    } 
     80 
    7281    FatDirectoryBase^ FatApi::LoadDirectory(String^ directory) 
    7382    { 
     
    344353    } 
    345354 
     355    FatDirectory::!FatDirectory() 
     356    { 
     357        if (Directory != NULL) 
     358        { 
     359            delete[] Directory; 
     360            Directory = NULL; 
     361            DirectorySize = 0; 
     362        } 
     363    } 
     364 
    346365    void FatDirectory::ReadDirectory() 
    347366    { 
  • branches/eraser6/EraserService/Eraser.Util.Native/FatApi.h

    r2516 r2737  
    5151        FatApi(IO::Stream^ stream); 
    5252 
     53        /// Destructor. 
     54        virtual ~FatApi() { this->!FatApi(); } 
     55 
     56        /// Finalizer. 
     57        !FatApi(); 
     58 
    5359    public: 
    5460        /// <summary> 
     
    175181    public ref class FatDirectoryEntry 
    176182    { 
     183    public: 
     184        virtual ~FatDirectoryEntry() {} 
     185 
    177186    public: 
    178187        /// <summary> 
     
    257266        FatDirectoryBase(String^ name, FatDirectoryBase^ parent, unsigned cluster); 
    258267 
     268        virtual ~FatDirectoryBase() {} 
     269 
    259270    public: 
    260271        /// <summary> 
     
    345356        FatDirectory(String^ name, FatDirectoryBase^ parent, unsigned cluster, FatApi^ api); 
    346357 
     358        /// Destructor. 
     359        virtual ~FatDirectory() { this->!FatDirectory(); } 
     360 
     361        /// Finalizer. 
     362        !FatDirectory(); 
     363 
    347364        virtual void ReadDirectory() override; 
    348365        virtual void WriteDirectory() override; 
     
    357374        Fat12Or16Api(VolumeInfo^ info); 
    358375        Fat12Or16Api(VolumeInfo^ info, IO::Stream^ stream); 
     376 
     377        virtual ~Fat12Or16Api() { this->!Fat12Or16Api(); } 
     378        !Fat12Or16Api(); 
    359379 
    360380    public: 
     
    372392        public: 
    373393            RootDirectory(Fat12Or16Api^ api); 
     394 
     395            virtual ~RootDirectory() { this->!RootDirectory(); } 
     396            !RootDirectory(); 
    374397 
    375398        protected: 
     
    430453        Fat32Api(VolumeInfo^ info); 
    431454        Fat32Api(VolumeInfo^ info, IO::Stream^ stream); 
     455 
     456        virtual ~Fat32Api() { this->!Fat32Api(); } 
     457        !Fat32Api(); 
    432458 
    433459    public: 
  • branches/eraser6/EraserService/Eraser.Util.Native/OpenHandle.cpp

    r2516 r2737  
    4343            while (!NT_SUCCESS(result)); 
    4444 
    45             if (!NT_SUCCESS(result)) 
     45            if (!NT_SUCCESS(result) || handlesBuffer.size() < sizeof(SYSTEM_HANDLES)) 
    4646                throw gcnew InvalidOperationException("The list of open system handles could not be retrieved."); 
    4747        } 
  • branches/eraser6/EraserService/Eraser.Util/ExtensionClasses/SharingViolationException.cs

    r2516 r2737  
    3131    /// A file sharing violation exception. 
    3232    /// </summary> 
    33     public class SharingViolationException : IOException 
     33    public class SharingViolationException : FileLoadException 
    3434    { 
    3535        /// <summary> 
  • branches/eraser6/EraserService/Eraser.Util/PostDataBuilder.cs

    r2516 r2737  
    8787        } 
    8888 
     89        public void AddParts(ICollection<PostDataField> fields) 
     90        { 
     91            foreach (PostDataField field in fields) 
     92                AddPart(field); 
     93        } 
     94 
    8995        /// <summary> 
    9096        /// Gets a stream with which to read the data from. 
  • branches/eraser6/EraserService/Eraser.Util/Strings.en.resx

    r2558 r2737  
    149149  </data> 
    150150  <data name="The folder {0} cannot be opened for writing." xml:space="preserve"> 
    151     <value>(Untranslated)</value> 
     151    <value>The folder {0} cannot be opened for writing.</value> 
    152152  </data> 
    153153</root> 
  • branches/eraser6/EraserService/Eraser.Util/VolumeInfo.cs

    r2560 r2737  
    590590        public bool IsMounted 
    591591        { 
    592             get { return MountPoints.Count != 0; } 
     592            get 
     593            { 
     594                try 
     595                { 
     596                    return MountPoints.Count != 0; 
     597                } 
     598                catch (FileNotFoundException) 
     599                { 
     600                    return false; 
     601                } 
     602            } 
    593603        } 
    594604 
     
    612622                    NativeMethods.VOLUME_DISK_EXTENTS header; 
    613623 
    614                     if (!NativeMethods.DeviceIoControl(handle, 
     624                    while (!NativeMethods.DeviceIoControl(handle, 
    615625                        NativeMethods.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, IntPtr.Zero, 0, 
    616626                        buffer, (uint)bufferSize, out returnSize, IntPtr.Zero)) 
    617627                    { 
    618628                        int error = Marshal.GetLastWin32Error(); 
    619                         if (error == Win32ErrorCode.InvalidFunction) 
     629                        if (error == Win32ErrorCode.InvalidFunction || 
     630                            error == Win32ErrorCode.NotSupported) 
    620631                            return null; 
    621632                        else if (error != Win32ErrorCode.MoreData) 
    622633                            throw Win32ErrorCode.GetExceptionForWin32Error(error); 
    623634 
    624                         //Calculate the size of the buffer required 
    625                         header = (NativeMethods.VOLUME_DISK_EXTENTS) 
    626                             Marshal.PtrToStructure(buffer, 
    627                                 typeof(NativeMethods.VOLUME_DISK_EXTENTS)); 
    628                         Marshal.FreeHGlobal(buffer); 
    629                         bufferSize += (int)(header.NumberOfDiskExtents - 1) * 
    630                             Marshal.SizeOf(typeof(NativeMethods.DISK_EXTENT)); 
    631                         buffer = Marshal.AllocHGlobal(bufferSize); 
    632  
    633                         if (!NativeMethods.DeviceIoControl(handle, 
    634                             NativeMethods.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, IntPtr.Zero, 0, 
    635                             buffer, (uint)bufferSize, out returnSize, IntPtr.Zero)) 
    636                         { 
    637                             throw Win32ErrorCode.GetExceptionForWin32Error( 
    638                                 Marshal.GetLastWin32Error()); 
    639                         } 
     635                        buffer = Marshal.ReAllocHGlobal(buffer, (IntPtr)(bufferSize *= 2)); 
    640636                    } 
    641637 
     
    881877                IntPtr.Zero, 0, IntPtr.Zero, 0, out result, IntPtr.Zero)) 
    882878            { 
    883                 throw new IOException("Could not unlock volume."); 
     879                throw new IOException("Could not unlock volume.", 
     880                    new Win32Exception(Marshal.GetLastWin32Error())); 
    884881            } 
    885882 
  • branches/eraser6/EraserService/Eraser.Util/Win32ErrorCodes.cs

    r2516 r2737  
    6767                case RequestAborted:    return new OperationCanceledException(); 
    6868                case SharingViolation:  return new SharingViolationException(); 
     69                case BadCommand:        return new NotSupportedException(); 
     70                case BadArguments:      return new ArgumentException(); 
    6971            } 
    7072 
     
    9698        public const int RequestAborted = 1235; 
    9799        public const int NotAReparsePoint = 4390; 
     100        public const int BadCommand = 22; 
     101        public const int NotSupported = 50; 
     102        public const int BadArguments = 160; 
    98103    } 
    99104} 
  • branches/eraser6/EraserService/Eraser/MainForm.Designer.cs

    r2516 r2737  
    7070            this.tbTools = new System.Windows.Forms.ToolStripMenuItem(); 
    7171            this.tbToolsDropDown = new System.Windows.Forms.ToolStripMenuItem(); 
     72            this.tbToolsMenu = new System.Windows.Forms.ContextMenuStrip(this.components); 
    7273            this.tbSettings = new System.Windows.Forms.ToolStripMenuItem(); 
    7374            this.tbHelp = new System.Windows.Forms.ToolStripMenuItem(); 
     
    7879            this.checkForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 
    7980            this.eraserLogo = new System.Windows.Forms.PictureBox(); 
    80             this.tbToolsMenu = new System.Windows.Forms.ContextMenuStrip(this.components); 
    8181            this.notificationMenu.SuspendLayout(); 
    8282            this.ToolBar.SuspendLayout(); 
     
    104104            this.notificationIcon.ContextMenuStrip = this.notificationMenu; 
    105105            resources.ApplyResources(this.notificationIcon, "notificationIcon"); 
     106            this.notificationIcon.BalloonTipClicked += new System.EventHandler(this.notificationIcon_BalloonTipClicked); 
     107            this.notificationIcon.BalloonTipClosed += new System.EventHandler(this.notificationIcon_BalloonTipClosed); 
     108            this.notificationIcon.BalloonTipShown += new System.EventHandler(this.notificationIcon_BalloonTipShown); 
    106109            this.notificationIcon.DoubleClick += new System.EventHandler(this.openToolStripMenuItem_Click); 
    107110            //  
     
    178181            this.importTaskListToolStripMenuItem}); 
    179182            this.tbScheduleMenu.Name = "tbScheduleMenu"; 
     183            this.tbScheduleMenu.OwnerItem = this.tbScheduleDropDown; 
    180184            resources.ApplyResources(this.tbScheduleMenu, "tbScheduleMenu"); 
    181185            //  
     
    217221            this.tbToolsDropDown.Name = "tbToolsDropDown"; 
    218222            //  
     223            // tbToolsMenu 
     224            //  
     225            this.tbToolsMenu.Name = "tbToolsMenu"; 
     226            this.tbToolsMenu.OwnerItem = this.tbToolsDropDown; 
     227            resources.ApplyResources(this.tbToolsMenu, "tbToolsMenu"); 
     228            //  
    219229            // tbSettings 
    220230            //  
     
    249259            this.aboutEraserToolStripMenuItem}); 
    250260            this.tbHelpMenu.Name = "tbHelpMenu"; 
     261            this.tbHelpMenu.OwnerItem = this.tbHelpDropDown; 
    251262            resources.ApplyResources(this.tbHelpMenu, "tbHelpMenu"); 
    252263            //  
     
    278289            this.eraserLogo.TabStop = false; 
    279290            this.eraserLogo.Click += new System.EventHandler(this.eraserLogo_Click); 
    280             //  
    281             // tbToolsMenu 
    282             //  
    283             this.tbToolsMenu.Name = "tbToolsMenu"; 
    284             resources.ApplyResources(this.tbToolsMenu, "tbToolsMenu"); 
    285291            //  
    286292            // MainForm 
  • branches/eraser6/EraserService/Eraser/MainForm.cs

    r2606 r2737  
    4343namespace Eraser 
    4444{ 
    45     public partial class MainForm : Form 
     45    public partial class MainForm : Form, INotificationSink 
    4646    { 
    4747        private BasePanel CurrPage; 
     
    7272            } 
    7373 
     74            //We also need to see if we have any notifier classes we need to register 
     75            foreach (INotifier notifier in Host.Instance.Notifiers) 
     76                notifier.Sink = this; 
     77            Host.Instance.Notifiers.Registered += Notifier_Registered; 
     78 
    7479            //For every task we need to register the Task Started and Task Finished 
    7580            //event handlers for progress notifications 
     
    98103        } 
    99104 
     105        #region Notifications handling code 
     106        /// <summary> 
     107        /// Stores information about pending notifications. 
     108        /// </summary> 
     109        private struct NotificationInfo 
     110        { 
     111            public INotifier Source; 
     112            public int Timeout; 
     113            public ToolTipIcon Icon; 
     114            public string Title; 
     115            public string Message; 
     116        } 
     117 
    100118        /// <summary> 
    101119        /// Diplays the given title, message and icon as a system notification area balloon. 
     
    106124        public void ShowNotificationBalloon(string title, string message, ToolTipIcon icon) 
    107125        { 
    108             notificationIcon.BalloonTipTitle = title; 
    109             notificationIcon.BalloonTipText = message; 
    110             notificationIcon.BalloonTipIcon = icon; 
    111             notificationIcon.ShowBalloonTip(0); 
    112         } 
     126            NotificationInfo info; 
     127            info.Source = null; 
     128            info.Timeout = 0; 
     129            info.Icon = icon; 
     130            info.Title = title; 
     131            info.Message = message; 
     132 
     133            NotificationsQueue.Add(info); 
     134 
     135            //Can we show the notification immediately? 
     136            if (NotificationsQueue.Count == 1) 
     137                ShowNextNotification(); 
     138        } 
     139 
     140        public void ShowNotification(INotifier source, int timeout, ToolTipIcon icon, 
     141            string title, string message) 
     142        { 
     143            NotificationInfo info; 
     144            info.Source = source; 
     145            info.Timeout = timeout; 
     146            info.Icon = icon; 
     147            info.Title = title; 
     148            info.Message = message; 
     149 
     150            NotificationsQueue.Add(info); 
     151 
     152            //Can we show the notification immediately? 
     153            if (NotificationsQueue.Count == 1) 
     154                ShowNextNotification(); 
     155        } 
     156 
     157        private void Notifier_Registered(object sender, EventArgs e) 
     158        { 
     159            ((INotifier)sender).Sink = this; 
     160        } 
     161 
     162        private void ShowNextNotification() 
     163        { 
     164            Debug.Assert(NotificationsQueue.Count != 0); 
     165            NotificationInfo info = NotificationsQueue[0]; 
     166            notificationIcon.ShowBalloonTip(info.Timeout, info.Title, info.Message, info.Icon); 
     167        } 
     168 
     169        private void notificationIcon_BalloonTipShown(object sender, EventArgs e) 
     170        { 
     171            Debug.Assert(NotificationsQueue.Count != 0); 
     172            if (NotificationsQueue[0].Source != null) 
     173                NotificationsQueue[0].Source.Shown(sender, e); 
     174        } 
     175 
     176        private void notificationIcon_BalloonTipClosed(object sender, EventArgs e) 
     177        { 
     178            Debug.Assert(NotificationsQueue.Count != 0); 
     179 
     180            if (NotificationsQueue[0].Source != null) 
     181                NotificationsQueue[0].Source.Closed(sender, e); 
     182            NotificationsQueue.RemoveAt(0); 
     183 
     184            if (NotificationsQueue.Count > 0) 
     185                ShowNextNotification(); 
     186        } 
     187 
     188        private void notificationIcon_BalloonTipClicked(object sender, EventArgs e) 
     189        { 
     190            Debug.Assert(NotificationsQueue.Count != 0); 
     191            if (NotificationsQueue[0].Source != null) 
     192                NotificationsQueue[0].Source.Clicked(sender, e); 
     193        } 
     194 
     195        /// <summary> 
     196        /// The queue holding the list of notifications to be displayed sequentially. 
     197        /// The notification being displayed is the first item in the list. 
     198        /// </summary> 
     199        private List<NotificationInfo> NotificationsQueue = new List<NotificationInfo>(); 
     200        #endregion 
    113201 
    114202        /// <summary> 
  • branches/eraser6/EraserService/Eraser/MainForm.resx

    r2511 r2737  
    160160    <value>801, 17</value> 
    161161  </metadata> 
    162   <data name="openEraserToolStripMenuItem.Font" type="System.Drawing.Font, System.Drawing"> 
    163     <value>Microsoft Sans Serif, 9pt, style=Bold</value> 
    164   </data> 
    165   <data name="openEraserToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
    166     <value>192, 22</value> 
    167   </data> 
    168   <data name="openEraserToolStripMenuItem.Text" xml:space="preserve"> 
    169     <value>Open Eraser</value> 
    170   </data> 
    171   <data name="toolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing"> 
    172     <value>189, 6</value> 
    173   </data> 
    174   <data name="hideWhenMinimisedToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
    175     <value>192, 22</value> 
    176   </data> 
    177   <data name="hideWhenMinimisedToolStripMenuItem.Text" xml:space="preserve"> 
    178     <value>Hide When Minimised</value> 
    179   </data> 
    180   <data name="exitToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
    181     <value>192, 22</value> 
    182   </data> 
    183   <data name="exitToolStripMenuItem.Text" xml:space="preserve"> 
    184     <value>E&amp;xit Eraser</value> 
    185   </data> 
    186162  <data name="notificationMenu.Size" type="System.Drawing.Size, System.Drawing"> 
    187163    <value>193, 76</value> 
     
    17591735    <value>True</value> 
    17601736  </data> 
     1737  <data name="openEraserToolStripMenuItem.Font" type="System.Drawing.Font, System.Drawing"> 
     1738    <value>Microsoft Sans Serif, 9pt, style=Bold</value> 
     1739  </data> 
     1740  <data name="openEraserToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
     1741    <value>192, 22</value> 
     1742  </data> 
     1743  <data name="openEraserToolStripMenuItem.Text" xml:space="preserve"> 
     1744    <value>Open Eraser</value> 
     1745  </data> 
     1746  <data name="toolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing"> 
     1747    <value>189, 6</value> 
     1748  </data> 
     1749  <data name="hideWhenMinimisedToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
     1750    <value>192, 22</value> 
     1751  </data> 
     1752  <data name="hideWhenMinimisedToolStripMenuItem.Text" xml:space="preserve"> 
     1753    <value>Hide When Minimised</value> 
     1754  </data> 
     1755  <data name="exitToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
     1756    <value>192, 22</value> 
     1757  </data> 
     1758  <data name="exitToolStripMenuItem.Text" xml:space="preserve"> 
     1759    <value>E&amp;xit Eraser</value> 
     1760  </data> 
    17611761  <metadata name="notificationIconTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
    17621762    <value>634, 17</value> 
     
    17681768    <value>None</value> 
    17691769  </data> 
     1770  <data name="ToolBar.Location" type="System.Drawing.Point, System.Drawing"> 
     1771    <value>10, 27</value> 
     1772  </data> 
     1773  <data name="ToolBar.Size" type="System.Drawing.Size, System.Drawing"> 
     1774    <value>392, 32</value> 
     1775  </data> 
     1776  <data name="ToolBar.TabIndex" type="System.Int32, mscorlib"> 
     1777    <value>1</value> 
     1778  </data> 
     1779  <data name="ToolBar.Text" xml:space="preserve"> 
     1780    <value>ToolBar</value> 
     1781  </data> 
     1782  <data name="&gt;&gt;ToolBar.Name" xml:space="preserve"> 
     1783    <value>ToolBar</value> 
     1784  </data> 
     1785  <data name="&gt;&gt;ToolBar.Type" xml:space="preserve"> 
     1786    <value>Eraser.ToolBar, Eraser, Version=6.1.0.2532, Culture=neutral, PublicKeyToken=3ac89a0351e689b6</value> 
     1787  </data> 
     1788  <data name="&gt;&gt;ToolBar.Parent" xml:space="preserve"> 
     1789    <value>$this</value> 
     1790  </data> 
     1791  <data name="&gt;&gt;ToolBar.ZOrder" xml:space="preserve"> 
     1792    <value>6</value> 
     1793  </data> 
    17701794  <metadata name="tbScheduleMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
    17711795    <value>110, 17</value> 
    17721796  </metadata> 
     1797  <data name="newTaskToolStripMenuItem.ShortcutKeys" type="System.Windows.Forms.Keys, System.Windows.Forms"> 
     1798    <value>Ctrl+N</value> 
     1799  </data> 
     1800  <data name="newTaskToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
     1801    <value>168, 22</value> 
     1802  </data> 
     1803  <data name="newTaskToolStripMenuItem.Text" xml:space="preserve"> 
     1804    <value>New Task</value> 
     1805  </data> 
     1806  <data name="toolStripMenuItem2.Size" type="System.Drawing.Size, System.Drawing"> 
     1807    <value>165, 6</value> 
     1808  </data> 
     1809  <data name="exportTaskListToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
     1810    <value>168, 22</value> 
     1811  </data> 
     1812  <data name="exportTaskListToolStripMenuItem.Text" xml:space="preserve"> 
     1813    <value>Export Task List</value> 
     1814  </data> 
     1815  <data name="importTaskListToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
     1816    <value>168, 22</value> 
     1817  </data> 
     1818  <data name="importTaskListToolStripMenuItem.Text" xml:space="preserve"> 
     1819    <value>Import Task List</value> 
     1820  </data> 
    17731821  <data name="tbScheduleMenu.Size" type="System.Drawing.Size, System.Drawing"> 
    17741822    <value>169, 76</value> 
     
    18691917  <data name="tbHelpDropDown.Text" xml:space="preserve"> 
    18701918    <value>Help</value> 
    1871   </data> 
    1872   <data name="ToolBar.Location" type="System.Drawing.Point, System.Drawing"> 
    1873     <value>10, 27</value> 
    1874   </data> 
    1875   <data name="ToolBar.Size" type="System.Drawing.Size, System.Drawing"> 
    1876     <value>392, 32</value> 
    1877   </data> 
    1878   <data name="ToolBar.TabIndex" type="System.Int32, mscorlib"> 
    1879     <value>1</value> 
    1880   </data> 
    1881   <data name="ToolBar.Text" xml:space="preserve"> 
    1882     <value>ToolBar</value> 
    1883   </data> 
    1884   <data name="&gt;&gt;ToolBar.Name" xml:space="preserve"> 
    1885     <value>ToolBar</value> 
    1886   </data> 
    1887   <data name="&gt;&gt;ToolBar.Type" xml:space="preserve"> 
    1888     <value>Eraser.ToolBar, Eraser, Version=6.1.0.2112, Culture=neutral, PublicKeyToken=ab8c5acb8db9a36b</value> 
    1889   </data> 
    1890   <data name="&gt;&gt;ToolBar.Parent" xml:space="preserve"> 
    1891     <value>$this</value> 
    1892   </data> 
    1893   <data name="&gt;&gt;ToolBar.ZOrder" xml:space="preserve"> 
    1894     <value>6</value> 
    1895   </data> 
    1896   <data name="newTaskToolStripMenuItem.ShortcutKeys" type="System.Windows.Forms.Keys, System.Windows.Forms"> 
    1897     <value>Ctrl+N</value> 
    1898   </data> 
    1899   <data name="newTaskToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
    1900     <value>168, 22</value> 
    1901   </data> 
    1902   <data name="newTaskToolStripMenuItem.Text" xml:space="preserve"> 
    1903     <value>New Task</value> 
    1904   </data> 
    1905   <data name="toolStripMenuItem2.Size" type="System.Drawing.Size, System.Drawing"> 
    1906     <value>165, 6</value> 
    1907   </data> 
    1908   <data name="exportTaskListToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
    1909     <value>168, 22</value> 
    1910   </data> 
    1911   <data name="exportTaskListToolStripMenuItem.Text" xml:space="preserve"> 
    1912     <value>Export Task List</value> 
    1913   </data> 
    1914   <data name="importTaskListToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
    1915     <value>168, 22</value> 
    1916   </data> 
    1917   <data name="importTaskListToolStripMenuItem.Text" xml:space="preserve"> 
    1918     <value>Import Task List</value> 
    19191919  </data> 
    19201920  <data name="checkForUpdatesToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> 
  • branches/eraser6/EraserService/Eraser/Program.ConsoleProgram.cs

    r2516 r2737  
    100100            public void Run() 
    101101            { 
     102                //Check that we've got an action corresponding to one the user requested. 
     103                if (!Handlers.ContainsKey(Arguments.Action)) 
     104                    throw new ArgumentException(S._("Unknown action {0}", Arguments.Action)); 
     105 
    102106                //Re-parse the command line arguments as arguments for the given action. 
    103107                ConsoleActionData data = Handlers[Arguments.Action]; 
  • branches/eraser6/EraserService/Eraser/Program.GuiProgram.cs

    r2538 r2737  
    5757 
    5858                //Check if there already is another instance of the program. 
    59                 bool isFirstInstance = false; 
    60                 GlobalMutex = new Mutex(true, instanceID, out isFirstInstance); 
    61                 IsFirstInstance = isFirstInstance; 
     59                try 
     60                { 
     61                    bool isFirstInstance = false; 
     62                    GlobalMutex = new Mutex(true, instanceID, out isFirstInstance); 
     63                    IsFirstInstance = isFirstInstance; 
     64                } 
     65                catch (UnauthorizedAccessException) 
     66                { 
     67                    //If we get here, the mutex exists but we cannot modify it. That 
     68                    //would imply that this is not the first instance. 
     69                    //See http://msdn.microsoft.com/en-us/library/bwe34f1k.aspx 
     70                    IsFirstInstance = false; 
     71                } 
    6272            } 
    6373 
  • branches/eraser6/EraserService/Eraser/Program.cs

    r2735 r2737  
    325325                        new ConsoleActionData(CommandHelp, new ConsoleArguments())); 
    326326                    program.Handlers.Add("erase", 
    327                         new ConsoleActionData(CommandErase, new EraseArguments()));  
     327                        new ConsoleActionData(CommandErase, new EraseArguments())); 
    328328                    program.Handlers.Add("addtask", 
    329329                        new ConsoleActionData(CommandAddTask, new TaskArguments())); 
     
    343343                    Console.WriteLine(e.Message); 
    344344                    return e.ErrorCode; 
     345                } 
     346                catch (ArgumentException e) 
     347                { 
     348                    Console.WriteLine(e.Message); 
     349                    return Win32ErrorCode.BadArguments; 
    345350                } 
    346351                catch (Exception e) 
  • branches/eraser6/EraserService/Eraser/Strings.en.resx

    r2609 r2737  
    154154    <value>Processing:</value> 
    155155  </data> 
     156  <data name="Unknown action {0}" xml:space="preserve"> 
     157    <value>Unknown action {0}</value> 
     158  </data> 
    156159  <data name="Eraser cannot connect to the running instance for erasures." xml:space="preserve"> 
    157160    <value>Eraser cannot connect to the running instance for erasures.</value> 
     
    296299  </data> 
    297300  <data name="Default drive erasure method" xml:space="preserve"> 
    298     <value>(Untranslated)</value> 
     301    <value>Default drive erasure method</value> 
    299302  </data> 
    300303  <data name="Randomness data source" xml:space="preserve"> 
     
    317320  </data> 
    318321  <data name="An invalid drive erasure method was selected." xml:space="preserve"> 
    319     <value>(Untranslated)</value> 
     322    <value>An invalid drive erasure method was selected.</value> 
    320323  </data> 
    321324  <data name="An invalid randomness data source was selected." xml:space="preserve"> 
     
    335338  </data> 
    336339  <data name="The erasure method selected does not support erasing the erasure target." xml:space="preserve"> 
    337     <value>(Untranslated)</value> 
     340    <value>The erasure method selected does not support erasing the erasure target.</value> 
    338341  </data> 
    339342  <data name="{0}, " xml:space="preserve"> 
     
    397400    <value>{0} of {1} downloaded</value> 
    398401  </data> 
     402  <data name="Installation failed with exit code {0}" xml:space="preserve"> 
     403    <value>Installation failed with exit code {0}</value> 
     404  </data> 
     405  <data name="Installation cancelled" xml:space="preserve"> 
     406    <value>Installation cancelled</value> 
     407  </data> 
    399408</root> 
  • branches/eraser6/EraserService/Eraser/Strings.it.resx

    r2609 r2737  
    154154    <value>Elaborazione:</value> 
    155155  </data> 
     156  <data name="Unknown action {0}" xml:space="preserve"> 
     157    <value>(Untranslated)</value> 
     158  </data> 
    156159  <data name="Eraser cannot connect to the running instance for erasures." xml:space="preserve"> 
    157160    <value>Eraser non riesce a collegarsi alla istanza di pulizia in esecuzione.</value> 
     
    397400    <value>scaricato {0} di {1}</value> 
    398401  </data> 
     402  <data name="Installation failed with exit code {0}" xml:space="preserve"> 
     403    <value>(Untranslated)</value> 
     404  </data> 
     405  <data name="Installation cancelled" xml:space="preserve"> 
     406    <value>(Untranslated)</value> 
     407  </data> 
    399408</root> 
  • branches/eraser6/EraserService/Eraser/Strings.nl.resx

    r2609 r2737  
    154154    <value>(Untranslated)</value> 
    155155  </data> 
     156  <data name="Unknown action {0}" xml:space="preserve"> 
     157    <value>(Untranslated)</value> 
     158  </data> 
    156159  <data name="Eraser cannot connect to the running instance for erasures." xml:space="preserve"> 
    157160    <value>(Untranslated)</value> 
     
    397400    <value>(Untranslated)</value> 
    398401  </data> 
     402  <data name="Installation failed with exit code {0}" xml:space="preserve"> 
     403    <value>(Untranslated)</value> 
     404  </data> 
     405  <data name="Installation cancelled" xml:space="preserve"> 
     406    <value>(Untranslated)</value> 
     407  </data> 
    399408</root> 
  • branches/eraser6/EraserService/Eraser/Strings.pl.resx

    r2609 r2737  
    154154    <value>Przetwarzanie:</value> 
    155155  </data> 
     156  <data name="Unknown action {0}" xml:space="preserve"> 
     157    <value>(Untranslated)</value> 
     158  </data> 
    156159  <data name="Eraser cannot connect to the running instance for erasures." xml:space="preserve"> 
    157160    <value>(Untranslated)</value> 
     
    397400    <value>pobrano {0} z {1}</value> 
    398401  </data> 
     402  <data name="Installation failed with exit code {0}" xml:space="preserve"> 
     403    <value>(Untranslated)</value> 
     404  </data> 
     405  <data name="Installation cancelled" xml:space="preserve"> 
     406    <value>(Untranslated)</value> 
     407  </data> 
    399408</root> 
  • branches/eraser6/EraserService/Eraser/Strings.resx

    r2609 r2737  
    154154    <value>Processing:</value> 
    155155  </data> 
     156  <data name="Unknown action {0}" xml:space="preserve"> 
     157    <value>Unknown action {0}</value> 
     158  </data> 
    156159  <data name="Eraser cannot connect to the running instance for erasures." xml:space="preserve"> 
    157160    <value>Eraser cannot connect to the running instance for erasures.</value> 
     
    397400    <value>{0} of {1} downloaded</value> 
    398401  </data> 
     402  <data name="Installation failed with exit code {0}" xml:space="preserve"> 
     403    <value>Installation failed with exit code {0}</value> 
     404  </data> 
     405  <data name="Installation cancelled" xml:space="preserve"> 
     406    <value>Installation cancelled</value> 
     407  </data> 
    399408</root> 
  • branches/eraser6/EraserService/Eraser/UpdateForm.cs

    r2516 r2737  
    3434using System.Net.Mime; 
    3535using System.Globalization; 
     36using System.ComponentModel; 
    3637 
    3738using Eraser.Util; 
     
    3940 
    4041using DoWorkEventArgs = System.ComponentModel.DoWorkEventArgs; 
     42using ProgressChangedEventArgs = Eraser.Plugins.ProgressChangedEventArgs; 
    4143using ProgressChangedEventHandler = Eraser.Plugins.ProgressChangedEventHandler; 
    4244using RunWorkerCompletedEventArgs = System.ComponentModel.RunWorkerCompletedEventArgs; 
     
    715717            try 
    716718            { 
    717                 //Request the download. 
    718                 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Link); 
    719                 using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) 
    720                 { 
    721                     //Do the progress calculations 
    722                     progress.Total = response.ContentLength; 
    723  
    724                     //Check for a suggested filename. 
    725                     ContentDisposition contentDisposition = null; 
    726                     foreach (string header in response.Headers.AllKeys) 
    727                         if (header.ToUpperInvariant() == "CONTENT-DISPOSITION") 
    728                             contentDisposition = new ContentDisposition(response.Headers[header]); 
    729  
    730                     //Create the file name. 
    731                     DownloadedFile = new FileInfo(Path.Combine( 
    732                         TempPath.FullName, string.Format(CultureInfo.InvariantCulture, 
    733                             "{0:00}-{1}", ++DownloadFileIndex, contentDisposition == null ? 
    734                                 Path.GetFileName(Link.GetComponents(UriComponents.Path, UriFormat.Unescaped)) : 
    735                                 contentDisposition.FileName))); 
    736  
    737                     using (Stream responseStream = response.GetResponseStream()) 
    738                     using (FileStream fileStream = DownloadedFile.OpenWrite()) 
     719                Uri downloadLink = Link; 
     720                ContentDisposition contentDisposition = null; 
     721                for (int redirects = 0; redirects < 20; ++redirects) 
     722                { 
     723                    //Request the download. 
     724                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(downloadLink); 
     725                    request.AllowAutoRedirect = false; 
     726                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) 
    739727                    { 
    740                         //Copy the information into the file stream 
    741                         int lastRead = 0; 
    742                         byte[] buffer = new byte[16384]; 
    743                         while ((lastRead = responseStream.Read(buffer, 0, buffer.Length)) != 0) 
     728                        //Check for a suggested filename. Store this until we get the final URI. 
     729                        foreach (string header in response.Headers.AllKeys) 
     730                            if (header.ToUpperInvariant() == "CONTENT-DISPOSITION") 
     731                                contentDisposition = new ContentDisposition(response.Headers[header]); 
     732 
     733                        //Handle 3xx series response codes. 
     734                        if ((int)response.StatusCode >= 300 && (int)response.StatusCode <= 399) 
    744735                        { 
    745                             fileStream.Write(buffer, 0, lastRead); 
    746  
    747                             //Compute progress 
    748                             progress.Completed = fileStream.Position; 
    749  
    750                             //Call the progress handler 
    751                             if (handler != null) 
    752                                 handler(this, new ProgressChangedEventArgs(progress, null)); 
     736                            //Redirect. 
     737                            bool locationHeader = false; 
     738                            foreach (string header in response.Headers.AllKeys) 
     739                                if (header.ToUpperInvariant() == "LOCATION") 
     740                                { 
     741                                    locationHeader = true; 
     742                                    downloadLink = new Uri(response.Headers[header]); 
     743                                    break; 
     744                                } 
     745 
     746                            if (!locationHeader) 
     747                                throw new WebException("A redirect response was received but no redirection" + 
     748                                    "URI was provided."); 
     749 
     750                            continue; 
    753751                        } 
     752 
     753                        //Do the progress calculations 
     754                        progress.Total = response.ContentLength; 
     755 
     756                        //Create the file name. 
     757                        DownloadedFile = new FileInfo(Path.Combine( 
     758                            TempPath.FullName, string.Format(CultureInfo.InvariantCulture, 
     759                                "{0:00}-{1}", ++DownloadFileIndex, contentDisposition == null ? 
     760                                    Path.GetFileName(downloadLink.GetComponents(UriComponents.Path, UriFormat.Unescaped)) : 
     761                                    contentDisposition.FileName))); 
     762 
     763                        using (Stream responseStream = response.GetResponseStream()) 
     764                        using (FileStream fileStream = DownloadedFile.OpenWrite()) 
     765                        { 
     766                            //Copy the information into the file stream 
     767                            int lastRead = 0; 
     768                            byte[] buffer = new byte[16384]; 
     769                            while ((lastRead = responseStream.Read(buffer, 0, buffer.Length)) != 0) 
     770                            { 
     771                                fileStream.Write(buffer, 0, lastRead); 
     772 
     773                                //Compute progress 
     774                                progress.Completed = fileStream.Position; 
     775 
     776                                //Call the progress handler 
     777                                if (handler != null) 
     778                                    handler(this, new ProgressChangedEventArgs(progress, null)); 
     779                            } 
     780                        } 
     781 
     782                        //Let the event handler know the download is complete. 
     783                        progress.MarkComplete(); 
     784                        if (handler != null) 
     785                            handler(this, new ProgressChangedEventArgs(progress, null)); 
     786                        return; 
    754787                    } 
    755788 
    756                     //Let the event handler know the download is complete. 
    757                     progress.MarkComplete(); 
    758                     if (handler != null) 
    759                         handler(this, new ProgressChangedEventArgs(progress, null)); 
     789                    throw new WebException("The server is not redirecting properly."); 
    760790                } 
    761791            } 
     
    781811            info.UseShellExecute = true; 
    782812 
    783             Process process = Process.Start(info); 
    784             process.WaitForExit(Int32.MaxValue); 
     813            try 
     814            { 
     815                Process process = Process.Start(info); 
     816                process.WaitForExit(Int32.MaxValue); 
     817 
     818                if (process.ExitCode != 0) 
     819                    throw new ApplicationException(S._("Installation failed with exit code {0}", 
     820                        process.ExitCode)); 
     821            } 
     822            catch (Win32Exception e) 
     823            { 
     824                if (e.ErrorCode != 1223) 
     825                    throw; 
     826 
     827                throw new OperationCanceledException(S._("Installation cancelled"), e); 
     828            } 
     829 
    785830        } 
    786831 
Note: See TracChangeset for help on using the changeset viewer.