private void SetFilePath()
        {
            try
            {
                // Configure save file dialog box
                var dlg = new Microsoft.Win32.SaveFileDialog()
                {
                    OverwritePrompt = false,
                    FileName        = this.classGen.ClassNameFull, // Default file name
                    DefaultExt      = ".cs",                       // Default file extension
                    Filter          = "c# files|*.cs"              // Filter files by extension
                };

                // Show save file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process save file dialog box results
                if (result.HasValue && result == true)
                {
                    // set the log file path
                    this.log_file_path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(dlg.FileName),
                                                                ClassGenerator.LOG_FILE_NAME);
                    this.tb_file_path_LOG.Text = this.log_file_path;
                    // load log entries
                    if (this.classGen.ClassRecords.Count == 0 && File.Exists(this.log_file_path))
                    {
                        bool success_reading_logged_records = true;

                        foreach (string line in ClassPreview.ReadLines(this.log_file_path))
                        {
                            success_reading_logged_records &= this.classGen.ReadClassRecord(line);
                            if (!success_gen_class_text)
                            {
                                break;
                            }
                        }
                        if (!success_gen_class_text)
                        {
                            MessageBox.Show("Log File contains duplicates of the currents class records!",
                                            "Error Synchronizing Records",
                                            MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                        this.lv_existing_types.ItemsSource = this.classGen.ClassRecords;
                    }
                    // insert the namespace as subdirectory
                    string path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(dlg.FileName),
                                                         this.tb_namespace.Text,
                                                         System.IO.Path.GetFileName(dlg.FileName));
                    this.tb_file_path.Text = path;
                    this.class_file_path   = path;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Setting File Path", MessageBoxButton.OK, MessageBoxImage.Error);
                // MessageBox.Show(ex.StackTrace, "Error Setting File Path", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void LookForKeyordsInRun(Run _run, string _text)
        {
            if (_run == null || _text == null || this.classGen == null || this.classGen.ClassText == null)
            {
                return;
            }

            // saving tags:
            int sIndex = 0;
            int eIndex = 0;

            for (int i = 0; i < _text.Length; i++)
            {
                if (char.IsWhiteSpace(_text[i]) || ClassPreview.IsReservedChar(_text[i]))
                {
                    if (i > 0 && !(char.IsWhiteSpace(_text[i - 1]) || ClassPreview.IsReservedChar(_text[i - 1])))
                    {
                        eIndex = i - 1;
                        string word = _text.Substring(sIndex, eIndex - sIndex + 1);
                        if (!string.IsNullOrEmpty(word) && !this.csharpCP.IsValidIdentifier(word))
                        {
                            KeyWordPosition kwp = new KeyWordPosition();
                            kwp.start_pos = _run.ContentStart.GetPositionAtOffset(sIndex, LogicalDirection.Forward);
                            kwp.end_pos   = _run.ContentStart.GetPositionAtOffset(eIndex + 1, LogicalDirection.Backward);
                            kwp.keyword   = word;
                            this.keywords.Add(kwp);
                        }
                        else
                        {
                            if (this.IsSpecialWord(word))
                            {
                                KeyWordPosition kwp = new KeyWordPosition();
                                kwp.start_pos = _run.ContentStart.GetPositionAtOffset(sIndex, LogicalDirection.Forward);
                                kwp.end_pos   = _run.ContentStart.GetPositionAtOffset(eIndex + 1, LogicalDirection.Backward);
                                kwp.keyword   = word;
                                this.specialwords.Add(kwp);
                            }
                        }
                    }
                    sIndex = i + 1;
                }
            }

            // look at last word too
            string word_last = _text.Substring(sIndex, _text.Length - sIndex);

            if (!string.IsNullOrEmpty(word_last) && !this.csharpCP.IsValidIdentifier(word_last))
            {
                KeyWordPosition kwp = new KeyWordPosition();
                kwp.start_pos = _run.ContentStart.GetPositionAtOffset(sIndex, LogicalDirection.Forward);
                kwp.end_pos   = _run.ContentStart.GetPositionAtOffset(_text.Length, LogicalDirection.Backward);
                kwp.keyword   = word_last;
                this.keywords.Add(kwp);
            }
            else
            {
                if (this.IsSpecialWord(word_last))
                {
                    KeyWordPosition kwp = new KeyWordPosition();
                    kwp.start_pos = _run.ContentStart.GetPositionAtOffset(sIndex, LogicalDirection.Forward);
                    kwp.end_pos   = _run.ContentStart.GetPositionAtOffset(_text.Length, LogicalDirection.Backward);
                    kwp.keyword   = word_last;
                    this.specialwords.Add(kwp);
                }
            }
        }