PageRenderTime 78ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/SparkleLib/SparkleChangeSet.cs

http://github.com/hbons/SparkleShare
C# | 77 lines | 43 code | 19 blank | 15 comment | 2 complexity | f726bae18cdcc83078f4d84b3821b49b MD5 | raw file
 1//   SparkleShare, a collaboration and sharing tool.
 2//   Copyright (C) 2010  Hylke Bons <hylkebons@gmail.com>
 3//
 4//   This program is free software: you can redistribute it and/or modify
 5//   it under the terms of the GNU General Public License as published by
 6//   the Free Software Foundation, either version 3 of the License, or
 7//   (at your option) any later version.
 8//
 9//   This program is distributed in the hope that it will be useful,
10//   but WITHOUT ANY WARRANTY; without even the implied warranty of
11//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//   GNU General Public License for more details.
13//
14//   You should have received a copy of the GNU General Public License
15//   along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18using System;
19using System.IO;
20using System.Collections.Generic;
21
22namespace SparkleLib {
23
24    public enum SparkleChangeType {
25        Added,
26        Edited,
27        Deleted,
28        Moved
29    }
30
31
32    public class SparkleChangeSet {
33
34        public SparkleUser User = new SparkleUser ("Unknown", "Unknown");
35
36        public SparkleFolder Folder;
37        public Uri RemoteUrl;
38
39        public string Revision;
40        public DateTime Timestamp;
41        public DateTime FirstTimestamp;
42        public List<SparkleChange> Changes = new List<SparkleChange> ();
43    }
44
45
46    public class SparkleChange {
47
48        public SparkleChangeType Type;
49        public string Path;
50        public string MovedToPath;
51        public DateTime Timestamp;
52    }
53
54
55    public class SparkleFolder {
56
57        public string Name;
58        public Uri RemoteAddress;
59
60        public string FullPath {
61            get {
62                string custom_path = SparkleConfig.DefaultConfig.GetFolderOptionalAttribute (Name, "path");
63
64                if (custom_path != null)
65                    return Path.Combine (custom_path, Name);
66                else
67                    return Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, Name);
68            }
69        }
70
71
72        public SparkleFolder (string name)
73        {
74            Name = name;
75        }
76    }
77}