Changeset 13 for trunk/MacFaceLibrary/FaceDef.cs
- Timestamp:
- Nov 15, 2004, 2:12:03 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MacFaceLibrary/FaceDef.cs
r12 r13 16 16 public class FaceDef 17 17 { 18 public conststring FaceDefName = "faceDef.plist";19 public constint PatternCols = 11;20 public constint PatternRows = 3;21 22 pr otected string path;23 pr otected string title;24 pr otected string auther;25 pr otected string version;26 pr otected string webSite;27 28 protected PartListparts = new PartList();18 public static readonly string FaceDefName = "faceDef.plist"; 19 public static readonly int PatternCols = 11; 20 public static readonly int PatternRows = 3; 21 22 private string _path = ""; 23 private string _title = ""; 24 private string _auther = ""; 25 private string _version = ""; /*Version*/ 26 private Uri _webSite = null; 27 28 internal PartList _parts = new PartList(); 29 29 //protected int[][,] patterns; 30 //protected PartList makers = new PartList(); 30 internal PartList _makers = new PartList(); 31 internal FacePattern _patterns; 31 32 32 33 33 34 // ctor 34 private FaceDef() {} 35 35 public FaceDef() {} 36 36 37 37 // properties 38 public FacePattern FacePattern 39 { 40 get { return _patterns; } 41 } 42 public PartList Markers 43 { 44 get { return _makers; } 45 } 38 46 public PartList Parts 39 47 { 40 get { return parts; } 41 } 42 48 get { return _parts; } 49 } 50 public Uri WebSite 51 { 52 get { return _webSite; } 53 set { _webSite = value; } 54 } 55 public string /*Version*/ Version 56 { 57 get { return _version; } 58 set { _version = value; } 59 } 60 public string Author 61 { 62 get { return _auther; } 63 set { _auther = value; } 64 } 65 public string Title 66 { 67 get { return _title; } 68 set { _title = value; } 69 } 70 public string Path 71 { 72 get { return _path; } 73 set { _path = value; } 74 } 43 75 44 76 // methods … … 47 79 FaceDef faceDef = new FaceDef(); 48 80 49 string defFile = Path.Combine(path, FaceDefName); 50 Hashtable def = PropertyList.Load(path); 81 string defFile = System.IO.Path.Combine(path, FaceDefName); 82 Hashtable def = PropertyList.Load(defFile); 83 84 // îñ 85 faceDef.Title = (def.ContainsKey("title") ? def["title"] as string : String.Empty); 86 faceDef.Author = (def.ContainsKey("author") ? def["author"] as string : String.Empty); 87 faceDef.Version = (def.ContainsKey("version") ? def["version"] as string : String.Empty); 88 faceDef.Path = path; 89 90 if (def.ContainsKey("web site")) 91 { 92 try 93 { 94 faceDef.WebSite = new Uri(def["web site"] as string); 95 } 96 catch (UriFormatException) {} 97 } 98 51 99 52 100 // Part ðÇÝÞB … … 64 112 int x = (int)partDef["pos x"]; 65 113 int y = (int)partDef["pos y"]; 66 faceDef.Parts.Add(new Part( filename, x, y));114 faceDef.Parts.Add(new Part(System.IO.Path.Combine(path, filename), x, y)); 67 115 } 68 116 69 117 // TODO: pattern ðÇÝÞB 118 faceDef._patterns = new FacePattern(faceDef.Parts, def["pattern"] as ArrayList); 70 119 71 120 return faceDef; 72 121 } 73 122 } 123 124 public enum MarkerBitMask 125 { 126 None = 0x0000, 127 PageIn = 0x0001, 128 PageOut = 0x0002 129 } 130 131 public class FaceDefFormatException : ApplicationException 132 { 133 // TODO: tH[}bgªs³¾Á½Æ«É°éExceptionð¢ÄAs³¾Á½Æ«É°éæ¤É·éB 74 134 } 75 135 }
Note: See TracChangeset
for help on using the changeset viewer.