borked
[tfs.git] / tools / tf / FileView.cs
blobd2251d520e0e0226f2139d74104477d5a7d678bb
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 Pango;
9 using Microsoft.TeamFoundation.Client;
10 using Microsoft.TeamFoundation.VersionControl.Common;
11 using Microsoft.TeamFoundation.VersionControl.Client;
13 public class FileView : Gtk.ScrolledWindow, IExploreViewChild
15 private Gtk.TextBuffer viewBuffer;
16 private Driver driver;
18 public FileView(Driver driver)
20 this.driver = driver;
21 TfTextView view = new TfTextView();
23 viewBuffer = view.Buffer;
24 Add(view);
27 public void UpdatePath(string path)
29 if (String.IsNullOrEmpty(path)) return;
30 Microsoft.TeamFoundation.VersionControl.Client.Item item = driver.VersionControlServer.GetItem(path, VersionSpec.Latest, 0, true);
32 string tname = System.IO.Path.GetTempFileName();
33 item.DownloadFile(tname);
35 using (StreamReader sr = new StreamReader(tname))
37 viewBuffer.Text = sr.ReadToEnd();
40 File.Delete(tname);