Example #1
0
 // always use primary text editor for loading/saving
 // (the file encoding is stored only there)
 public void Load(Stream stream)
 {
     if (UseFixedEncoding)
     {
         using (StreamReader reader = new StreamReader(stream, primaryTextEditor.Encoding, detectEncodingFromByteOrderMarks: false)) {
             primaryTextEditor.Text = reader.ReadToEnd();
         }
     }
     else
     {
         // do encoding auto-detection
         using (StreamReader reader = FileReader.OpenStream(stream, this.Encoding ?? FileService.DefaultFileEncoding.GetEncoding())) {
             primaryTextEditor.Text = reader.ReadToEnd();
             this.Encoding          = reader.CurrentEncoding;
         }
     }
     // raise event which allows removing existing NewLineConsistencyCheck overlays
     if (LoadedFileContent != null)
     {
         LoadedFileContent(this, EventArgs.Empty);
     }
     NewLineConsistencyCheck.StartConsistencyCheck(this);
 }
        public static void StartConsistencyCheck(CodeEditor editor)
        {
            NewLineConsistencyCheck c = new NewLineConsistencyCheck(editor);

            ThreadPool.QueueUserWorkItem(c.CheckNewLinesForConsistency);
        }