-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnnotaterNull.cs
80 lines (65 loc) · 2.47 KB
/
AnnotaterNull.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Xml;
namespace YellowSnow
{
public class AnnotaterNull : Annotater
{
public AnnotaterNull()
{
}
public override Annotations GetAnnotationsFile(string filename)
{
var textLines = File.ReadAllLines(filename);
FileAttributes attr = File.GetAttributes(filename);
string editor = File.GetAccessControl(filename).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();
long edited = Epoch.ToLong(File.GetLastAccessTime(filename));
List<Line> lines = new List<Line>();
for (int i = 0; i < textLines.Length; i++)
{
lines.Add(new Line()
{
editor = editor,
line = textLines[i],
time = edited
});
}
return new AnnotationsVCS(lines);
}
public override Annotations GetAnnotationsDir(string filename)
{
List<FSEntry> lines = new List<FSEntry>();
/*
foreach (var entry in Directory.EnumerateFileSystemEntries(filename))
{
QFile file(dir.filePath(entry));
QFileInfo info(file);
string editor = info.owner();
DateTime edited = info.lastModified();
string commitHash, authorName, authorEmail, subject;
// Get the most recent edit
QStringList arguments;
arguments << "info" << "--xml" << file.fileName();
Command command(program, dir.absolutePath(), arguments);
auto xml = command.getXML();
auto commits = xml.elementsByTagName("commit");
if (commits.count() > 0)
{
var commit = commits.item(0);
editor = commit.firstChildElement("author").text();
var dateText = commit.firstChildElement("date").text().left(23);
edited = QDateTime::fromString(dateText, dateFormat);
}
lines.append(File(editor, entry, edited, info));
}
*/
return new AnnotationsFS(lines);
}
public override bool IsInWorkspace(string filename)
{
throw new Exception("The null annotater knows no workspaces");
}
}
}