Beispiel #1
0
        private void InitializeTextDocument(ITextDocument doc)
        {
            if (!doc.IsLoaded)
            {
                doc.Load();
            }

            var fileName   = doc.Location.LocalPath;
            var isReadOnly = (File.GetAttributes(fileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly;

            Document.ReadOnly = isReadOnly;

            // Setup code highlighting
            var highlighter = SD.HighlightingManager.Manager.FindHighlighterForFile(fileName);

            if (Path.GetExtension(fileName) == ".tfx" || Path.GetExtension(fileName) == ".gsfx")
            {
                this.SetHighlighting("HLSL");
            }
            else
            {
                SetHighlighting(highlighter.Name);
            }

            Document.TextContent = doc.TextContent;
            doc.ContentChanged  += TextDocumentContentChangedCB;
        }