Changeset 16
- Timestamp:
- Nov 16, 2004, 9:28:08 PM (19 years ago)
- Location:
- trunk/MacFaceLibrary
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MacFaceLibrary/FaceDef.cs
r13 r16 11 11 namespace MacFace 12 12 { 13 13 14 /// <summary> 14 15 /// FaceDef ÌTvÌà¾Å·B … … 16 17 public class FaceDef 17 18 { 18 public static readonly string FaceDefName = "faceDef.plist"; 19 public static readonly int PatternCols = 11; 20 public static readonly int PatternRows = 3; 19 public enum PatternSuite 20 { 21 Normal = 0, 22 MemoryDecline = 1, 23 MemoryInsufficient = 2 24 } 25 26 public enum MarkerBitMask 27 { 28 None = 0x00, 29 PageIn = 0x01, 30 PageOut = 0x02 31 } 32 33 private const string FaceDefName = "faceDef.plist"; 34 private const int PatternCols = 11; 35 private const int PatternRows = 3; 21 36 22 37 private string _path = ""; 23 38 private string _title = ""; 24 private string _auth er = "";39 private string _author = ""; 25 40 private string _version = ""; /*Version*/ 26 41 private Uri _webSite = null; 27 42 28 43 internal PartList _parts = new PartList(); 29 //protected int[][,] patterns;44 internal PartList[][] _patternSuites; 30 45 internal PartList _makers = new PartList(); 31 internal FacePattern _patterns;32 46 33 47 34 48 // ctor 35 public FaceDef() {} 36 37 // properties 38 public FacePattern FacePattern 39 { 40 get { return _patterns; } 41 } 42 public PartList Markers 43 { 44 get { return _makers; } 45 } 46 public PartList Parts 47 { 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 } 75 76 // methods 77 public static FaceDef CreateFaceDefFromFile(string path) 78 { 79 FaceDef faceDef = new FaceDef(); 80 49 public FaceDef(string path) 50 { 81 51 string defFile = System.IO.Path.Combine(path, FaceDefName); 82 52 Hashtable def = PropertyList.Load(defFile); 83 53 84 54 // îñ 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;55 _path = path; 56 _title = (def.ContainsKey("title") ? def["title"] as string : String.Empty); 57 _author = (def.ContainsKey("author") ? def["author"] as string : String.Empty); 58 _version = (def.ContainsKey("version") ? def["version"] as string : String.Empty); 89 59 90 60 if (def.ContainsKey("web site")) … … 92 62 try 93 63 { 94 faceDef.WebSite = new Uri(def["web site"] as string);64 _webSite = new Uri(def["web site"] as string); 95 65 } 96 66 catch (UriFormatException) {} … … 103 73 { 104 74 // throw new IOException(); 105 return null;106 75 } 107 76 … … 112 81 int x = (int)partDef["pos x"]; 113 82 int y = (int)partDef["pos y"]; 114 faceDef.Parts.Add(new Part(System.IO.Path.Combine(path, filename), x, y));83 _parts.Add(new Part(System.IO.Path.Combine(path, filename), x, y)); 115 84 } 116 85 117 // TODO: pattern ðÇÝÞB 118 faceDef._patterns = new FacePattern(faceDef.Parts, def["pattern"] as ArrayList); 119 120 return faceDef; 121 } 122 } 123 124 public enum MarkerBitMask 125 { 126 None = 0x0000, 127 PageIn = 0x0001, 128 PageOut = 0x0002 86 _patternSuites = new PartList[PatternCols][]; 87 ArrayList patternDefSuites = def["pattern"] as ArrayList; 88 for (int i = 0; i < PatternRows; i++) 89 { 90 PartList[] suite = new PartList[PatternCols]; 91 ArrayList patternDefList = patternDefSuites[i] as ArrayList; 92 for (int j = 0; j < PatternCols; j++) 93 { 94 PartList pattern = new PartList(); 95 foreach (int partNo in (ArrayList)patternDefList[j]) 96 { 97 pattern.Add(_parts[partNo]); 98 } 99 suite[j] = pattern; 100 } 101 _patternSuites[i] = suite; 102 } 103 } 104 105 public PartList Markers 106 { 107 get { return _makers; } 108 } 109 110 public PartList Parts 111 { 112 get { return _parts; } 113 } 114 115 public Uri WebSite 116 { 117 get { return _webSite; } 118 } 119 120 public string /*Version*/ Version 121 { 122 get { return _version; } 123 } 124 125 public string Author 126 { 127 get { return _author; } 128 } 129 130 public string Title 131 { 132 get { return _title; } 133 } 134 135 public string Path 136 { 137 get { return _path; } 138 } 139 140 public PartList Pattern(PatternSuite suite, int no) 141 { 142 return _patternSuites[(int)suite][no]; 143 } 129 144 } 130 145 -
trunk/MacFaceLibrary/MacFaceLibrary.csproj
r13 r16 105 105 /> 106 106 <File 107 RelPath = "FacePattern.cs"108 SubType = "Code"109 BuildAction = "Compile"110 />111 <File112 107 RelPath = "HostStatistics.cs" 113 108 SubType = "Code"
Note: See TracChangeset
for help on using the changeset viewer.