fileview and dirview
[tfs.git] / tools / tf / FileView.cs
blobc79c1ca7e845c32360207764e4e06730862f6587
1 using System;
2 using System.IO;
3 using System.Collections;
4 using System.Collections.Generic;
5 using System.Net;
6 using System.Text;
7 using Gtk;
8 using Microsoft.TeamFoundation.Client;
9 using Microsoft.TeamFoundation.VersionControl.Common;
10 using Microsoft.TeamFoundation.VersionControl.Client;
12 public class FileView : Gtk.ScrolledWindow, IExploreViewChild
14 private Gtk.TextBuffer viewBuffer;
15 private Driver driver;
17 public FileView(Driver driver)
19 this.driver = driver;
20 Gtk.TextView view = new Gtk.TextView();
21 viewBuffer = view.Buffer;
22 Add(view);
25 public void UpdatePath(string path)
27 if (String.IsNullOrEmpty(path)) return;
28 Microsoft.TeamFoundation.VersionControl.Client.Item item = driver.VersionControlServer.GetItem(path, VersionSpec.Latest, 0, true);
30 string tname = System.IO.Path.GetTempFileName();
31 item.DownloadFile(tname);
33 using (StreamReader sr = new StreamReader(tname))
35 viewBuffer.Text = sr.ReadToEnd();
38 File.Delete(tname);