Exemplo n.º 1
0
        public TextWindow(FileElement element) : this()
        {
            this.element = element;
            MemoryStream ms = new MemoryStream();

            element.SaveTo(ms);
            TextRange textRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);

            ms.Position = 0;
            textRange.Load(ms, DataFormats.Text);
            textRange.ApplyPropertyValue(Paragraph.MarginProperty, new Thickness(0));

            //Получаємо хеш файла
            ms.Position = 0;
            textRange   = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
            textRange.Save(ms, DataFormats.Text);
            ms.Position = 0;
            textHash    = Crypto.GetMD5(ms);
            ms.Dispose();

            richTextBox.Focus();
        }