Ejemplo n.º 1
0
        internal static ITextBuffer LoadReference(DocumentReference documentReference, ITextBufferService textBufferService, out Encoding encoding)
        {
            encoding = (Encoding)null;
            string text;

            using (Stream stream = documentReference.GetStream(FileAccess.Read))
            {
                if (stream == null)
                {
                    return((ITextBuffer)null);
                }
                try
                {
                    text = DocumentReference.ReadDocumentContents(stream, out encoding);
                }
                catch (IOException ex)
                {
                    return((ITextBuffer)null);
                }
            }
            ITextBuffer textBuffer = textBufferService.CreateTextBuffer();

            textBuffer.SetText(0, textBuffer.Length, text);
            return(textBuffer);
        }
Ejemplo n.º 2
0
        private static ITextBuffer LoadResourceFromStream(ITextBufferService textBufferService, Stream stream, out Encoding encoding)
        {
            ITextBuffer textBuffer;

            using (StreamReader streamReader = new StreamReader(stream))
            {
                string end = streamReader.ReadToEnd();
                encoding = streamReader.CurrentEncoding;
                ITextBuffer textBuffer1 = textBufferService.CreateTextBuffer();
                textBuffer1.SetText(0, textBuffer1.Length, end);
                textBuffer = textBuffer1;
            }
            return(textBuffer);
        }
Ejemplo n.º 3
0
 public SceneXamlDocument(IDocumentContext documentContext, IUndoService undoService, ITextBufferService textBufferService)
     : this(documentContext, undoService, PlatformTypes.Object, textBufferService.CreateTextBuffer(), DocumentEncodingHelper.DefaultEncoding)
 {
 }