/[AnywhereTS-MSSQL]/trunk/Tools/ATSClientManager/ATSClientManager/ATSClientFile.cs
ViewVC logotype

Contents of /trunk/Tools/ATSClientManager/ATSClientManager/ATSClientFile.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 341 - (show annotations) (download)
Mon Aug 27 22:56:48 2012 UTC (7 years, 10 months ago) by william
File size: 1737 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace AnywhereTS.ATSClientManager
7 {
8 public interface IATSClientFile
9 {
10 ATSClientFileTypes Type { get; }
11 string Name { get; }
12 string ToString();
13 }
14
15 public class ATSClientFileList : List<IATSClientFile>
16 {
17 public ATSClientFileList() { this.Clear(); }
18 public ATSClientFileList(IEnumerable<IATSClientFile> collection) : this() { collection.ToList().ForEach(t => this.Add(t)); }
19
20 private IATSClientFile GetFileByType(ATSClientFileTypes type)
21 {
22 IATSClientFile file = this.Where(t => t.Type == type).ToList().First();
23 return file;
24 }
25
26 public IATSClientFile this[ATSClientFileTypes type]
27 {
28 get { return GetFileByType(type); }
29 }
30 }
31
32 internal class ATSClientFile : IATSClientFile
33 {
34 public static IATSClientFile Create() { return new ATSClientFile(); }
35 public static IATSClientFile Create(ATSClientFileTypes type, string filename) { return new ATSClientFile(type, filename); }
36 protected ATSClientFile() : this(ATSClientFileTypes.ClientUnknown, string.Empty) { }
37 protected ATSClientFile(ATSClientFileTypes type, string filename)
38 {
39 Type = type;
40 Name = filename;
41 }
42 #region IATSClientFile members
43 public ATSClientFileTypes Type { get; private set; }
44 public string Name { get; private set; }
45 public override string ToString()
46 {
47 return string.Format("{0}{2}{1}:{0}{3}{1}", "{", "}", Type, Name);
48 }
49 #endregion
50 }
51 }

  ViewVC Help
Powered by ViewVC 1.1.22