예제 #1
0
        void LoadPreviewText(PreviewFile preview)
        {
            Stream file = null;

            try
            {
                file = VFS.OpenBinaryStream(preview.Entry).AsStream;
                if (!TextView.IsTextFile(file))
                {
                    ResetPreviewPane();
                    return;
                }
                var enc = EncodingChoice.SelectedItem as Encoding;
                if (null == enc)
                {
                    enc = TextView.GuessEncoding(file);
                    EncodingChoice.SelectedItem = enc;
                }
                TextView.DisplayStream(file, enc);
                ActiveViewer     = TextView;
                CurrentTextInput = file;
                file             = null;
            }
            catch (Exception X)
            {
                SetStatusText(X.Message);
            }
            finally
            {
                if (file != null)
                {
                    file.Dispose();
                }
            }
        }