private string GetCurrentFileContents()
        {
            string parentString = Wrapper.XmlFile.ParentPath ?? "";
            string fileContents = XmlFileManager.GetFileContents(Path.Combine(this.FileLocationPath, parentString), Wrapper.XmlFile.FileName);

            return(fileContents);
        }
        private void HelpMenu_Click(object sender, RoutedEventArgs e)
        {
            string readmeFileContents = XmlFileManager.GetFileContents(Directory.GetCurrentDirectory(), "README.txt");

            if (String.IsNullOrEmpty(readmeFileContents))
            {
                readmeFileContents = "For more information please read the README.txt.\n" +
                                     "It can be found in the archive on downloading the app or on the Nexus. " +
                                     "If you are still having trouble send me a message on the nexus with as much information as possible. " +
                                     "Without enough information I cannot help you. ";
                MessageBox.Show(readmeFileContents, "Help", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                XmlOutputBox.Text = readmeFileContents;
            }
        }
        public DirectEditView(XmlObjectsListWrapper wrapperToUse, string dictionaryKey, bool isGameFile, bool isFirstWindowOpen = true, string title = null, string contentsForXmlOutputBox = null, string fileLocationPath = "", string unchangedStartingFileContents = null)
        {
            InitializeComponent();
            this.Wrapper           = wrapperToUse;
            this.IsGameFile        = isGameFile;
            this.FileLocationPath  = fileLocationPath;
            this.DictionaryKey     = dictionaryKey;
            this.IsFirstWindowOpen = isFirstWindowOpen;
            if (contentsForXmlOutputBox == null)
            {
                string parentString = Wrapper.XmlFile.ParentPath ?? "";
                XmlOutputBox.Text = XmlFileManager.GetFileContents(Path.Combine(this.FileLocationPath, parentString), Wrapper.XmlFile.FileName);
            }
            else
            {
                XmlOutputBox.Text = contentsForXmlOutputBox;
            }
            this.StartingFileContents          = XmlOutputBox.Text;
            this.UnchangedStartingFileContents = unchangedStartingFileContents ?? XmlOutputBox.Text;

            string labelContents = isGameFile
                ? "Game File: " + wrapperToUse.XmlFile.FileName + "\n"
                : "Mod: " + Properties.Settings.Default.ModTagSetting + "\n" + "File: " + wrapperToUse.XmlFile.FileName + "\n";

            this.StartingTitle = isGameFile
                ? "Game File: " + wrapperToUse.XmlFile.FileName
                : wrapperToUse.XmlFile.GetFileNameWithoutExtension() + " : " + Properties.Settings.Default.ModTagSetting;

            this.Title = StartingTitle;

            this.SaveXmlButton.AddToolTip("Click to save all changes");
            this.ReloadFileXmlButton.AddToolTip("Click here to reload the file from disk");
            this.CloseButton.AddToolTip("Click here to close the window");
            this.ValidateXmlButton.AddToolTip("Click here to validate the xml");
            this.UndoAllChangesXmlButton.AddToolTip("Click here to undo any changes made since opening the window");
            this.CodeCompletionKeysHelpButton.AddToolTip("Click here to see the keys used for\nAuto Complete within this window");
            this.CombineTagsXmlButton.AddToolTip("Click here to combine all top level APPEND tags, into a single APPEND tag.\n" +
                                                 "EX: In the file there are completly new RECIPES under seperate APPEND tags that can be combined.");

            SearchPanel.Install(XmlOutputBox);

            FoldingManager  = FoldingManager.Install(this.XmlOutputBox.TextArea);
            FoldingStrategy = new XmlFoldingStrategy
            {
                ShowAttributesWhenFolded = true
            };
            FoldingStrategy.UpdateFoldings(FoldingManager, this.XmlOutputBox.Document);

            TextEditorOptions newOptions = new TextEditorOptions
            {
                EnableRectangularSelection = true,
                EnableTextDragDrop         = true,
                HighlightCurrentLine       = true,
                ShowTabs = true
            };

            this.XmlOutputBox.TextArea.Options = newOptions;

            this.XmlOutputBox.ShowLineNumbers = true;

            this.XmlOutputBox.AddContextMenu(CollapseAllContextMenu_Clicked,
                                             "Collapse All",
                                             "Click here to collapse all nodes in the document.");
            this.XmlOutputBox.AddContextMenu(ExpandAllContextMenu_Clicked,
                                             "Expand All",
                                             "Click here to expand all nodes in the document.");

            this.XmlOutputBox.GotMouseCapture       += XmlOutputBox_GotMouseCapture;
            this.XmlOutputBox.PreviewMouseWheel     += XmlOutputBox_PreviewMouseWheel;
            this.XmlOutputBox.TextChanged           += XmlOutputBox_TextChanged;
            this.XmlOutputBox.TextArea.TextEntering += TextArea_TextEntering;
            this.XmlOutputBox.TextArea.TextEntered  += TextArea_TextEntered;
            this.XmlOutputBox.Focus();
            SetBackgroundColor();
            Closing += new CancelEventHandler(DirectEditView_Closing);
        }