public ReadWriteTypingBuffer(ReadOnlyTypingBuffer original) { if (original == null) throw new ArgumentNullException("original.", "Original TextBuffer cannot be null."); Original = original; Buffer = new char[original.Length + 1]; Length = 0; RecordedKeys = new KeyBuffer(Buffer.Length); ErrorsUncorrected = new List<int>(); }
public ReadWriteTypingBuffer(ReadOnlyTypingBuffer original) { if (original == null) { throw new ArgumentNullException("original.", "Original TextBuffer cannot be null."); } Original = original; Buffer = new char[original.Length + 1]; Length = 0; RecordedKeys = new KeyBuffer(Buffer.Length); ErrorsUncorrected = new List <int>(); }
public TypistForm(string filePath) { InitializeComponent(); loadWindowPosition(); loadTypingFont(); loadUserSettings(); initializeTypingBox(); initializeContextMenuStrip(); initializeSettingsDialog(); ImportedText = new ReadOnlyTypingBuffer("", userSettings.VisibleNewlines, userSettings.RemoveEndOfLineSpaces, userSettings.RemoveMultipleWhitespace); PracticeMode = false; ImportFile(!string.IsNullOrEmpty(filePath) ? filePath : LastImportedFile); loadStatisticsMode(); }
public void ImportFile(string filePath) { LastImportedFile = ""; try { if (string.IsNullOrEmpty(filePath)) return; FileInfo fileInfo = new FileInfo(filePath); importedFileName = fileInfo.Name; using (StreamReader sr = new StreamReader(filePath, Encoding.Default)) ImportedText = new ReadOnlyTypingBuffer(sr.ReadToEnd(), userSettings.VisibleNewlines, userSettings.RemoveEndOfLineSpaces, userSettings.RemoveMultipleWhitespace); LastImportedFile = fileInfo.FullName; lblStatusBarMain.Text = "Imported"; stopwatch.Reset(); rightAfterImport = true; PracticeMode = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Typist", MessageBoxButtons.OK, MessageBoxIcon.Error); } }