Changeset 16


Ignore:
Timestamp:
Nov 16, 2004, 9:28:08 PM (19 years ago)
Author:
altba\rryu
Message:

FacePatternクラスがFaceDefクラスと分かれている意味が無いので統合した。

Location:
trunk/MacFaceLibrary
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MacFaceLibrary/FaceDef.cs

    r13 r16  
    1111namespace MacFace
    1212{
     13
    1314        /// <summary>
    1415        /// FaceDef ‚ÌŠT—v‚Ìà–¾‚Å‚·B
     
    1617        public class FaceDef
    1718        {
    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;
    2136
    2237                private string _path    = "";
    2338                private string _title   = "";
    24                 private string _auther  = "";
     39                private string _author  = "";
    2540                private string _version = ""; /*Version*/
    2641                private Uri    _webSite = null;
    2742
    2843                internal PartList _parts = new PartList();
    29                 //protected int[][,] patterns;
     44                internal PartList[][] _patternSuites;
    3045                internal PartList _makers = new PartList();
    31                 internal FacePattern _patterns;
    3246
    3347
    3448                // 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                {
    8151                        string defFile = System.IO.Path.Combine(path, FaceDefName);
    8252                        Hashtable def = PropertyList.Load(defFile);
    8353
    8454                        // î•ñ
    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);
    8959
    9060                        if (def.ContainsKey("web site"))
     
    9262                                try
    9363                                {
    94                                         faceDef.WebSite = new Uri(def["web site"] as string);
     64                                        _webSite = new Uri(def["web site"] as string);
    9565                                }
    9666                                catch (UriFormatException) {}
     
    10373                        {
    10474                                // throw new IOException();
    105                                 return null;
    10675                        }
    10776
     
    11281                                int x = (int)partDef["pos x"];
    11382                                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));
    11584                        }
    11685
    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                }
    129144        }
    130145
  • trunk/MacFaceLibrary/MacFaceLibrary.csproj

    r13 r16  
    105105                />
    106106                <File
    107                     RelPath = "FacePattern.cs"
    108                     SubType = "Code"
    109                     BuildAction = "Compile"
    110                 />
    111                 <File
    112107                    RelPath = "HostStatistics.cs"
    113108                    SubType = "Code"
Note: See TracChangeset for help on using the changeset viewer.