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>();
        }
Exemplo n.º 2
0
        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>();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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);
            }
        }