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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 335 - (show annotations) (download)
Mon Aug 27 22:06:40 2012 UTC (7 years, 11 months ago) by william
File size: 1920 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 namespace AnywhereTS.ATSClientManager
6 {
7 public static class ATSClientFilesCollection
8 {
9 private static Dictionary<ATSClientFileTypes, string> collection;
10
11 static ATSClientFilesCollection()
12 {
13 collection = new Dictionary<ATSClientFileTypes, string>
14 {
15 {ATSClientFileTypes.ClientFileSystem, "initrd"},
16 {ATSClientFileTypes.ClientConfig, "network"},
17 {ATSClientFileTypes.ClientBootKernel, "vmlinuz"},
18 };
19 }
20
21 public static string GetClientFileByType(ATSClientFileTypes type)
22 {
23 string file = string.Empty;
24 if (type == ATSClientFileTypes.ClientUnknown)
25 {
26 Logging.ATSClientManagerLog.FatalFormat("ATSClientFilesCollection::detected a request for type: {0}", type.ToString());
27 return string.Empty;
28 }
29 if (collection.ContainsKey(type)) { file = collection[type]; }
30 else
31 {
32 Logging.ATSClientManagerLog.FatalFormat("ATSClientFilesCollection does not contain a client file for type: {0}", type.ToString());
33 file = string.Empty;
34 }
35 return file;
36 }
37 public static ATSClientFileTypes GetClientFileTypeByName(string name)
38 {
39 ATSClientFileTypes found = ATSClientFileTypes.ClientUnknown;
40 foreach (KeyValuePair<ATSClientFileTypes, string> t in collection) { if (t.Value.ToLower() == name.ToLower()) { found = t.Key; break; } }
41 if (found == ATSClientFileTypes.ClientUnknown) { Logging.ATSClientManagerLog.FatalFormat("ATSClientFilesCollection does not contain a client type for file: {0}", name); }
42 return found;
43 }
44 }
45 }

  ViewVC Help
Powered by ViewVC 1.1.22