Ignore:
Timestamp:
Nov 15, 2004, 2:12:03 AM (19 years ago)
Author:
altba\tomoyo
Message:

MacFaceFloat?

  • %USERPROFILE%\Application Data\MacFace\ に設定を保存するようにした。
  • 設定ダイアログを作成した。

MacFaceLibrary?

  • パターンをクラスとして扱えるようにした(FacePattern?)。
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MacFaceLibrary/FaceDef.cs

    r12 r13  
    1616        public class FaceDef
    1717        {
    18                 public const string FaceDefName = "faceDef.plist";
    19                 public const int PatternCols = 11;
    20                 public const int PatternRows = 3;
    21 
    22                 protected string path;
    23                 protected string title;
    24                 protected string auther;
    25                 protected string version;
    26                 protected string webSite;
    27 
    28                 protected PartList parts = 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();
    2929                //protected int[][,] patterns;
    30                 //protected PartList makers = new PartList();
     30                internal PartList _makers = new PartList();
     31                internal FacePattern _patterns;
    3132
    3233
    3334                // ctor
    34                 private FaceDef() {}
    35 
     35                public FaceDef() {}
    3636
    3737                // properties
     38                public FacePattern FacePattern
     39                {
     40                        get { return _patterns; }
     41                }
     42                public PartList Markers
     43                {
     44                        get { return _makers; }
     45                }
    3846                public PartList Parts
    3947                {
    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                }
    4375
    4476                // methods
     
    4779                        FaceDef faceDef = new FaceDef();
    4880
    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
    5199
    52100                        // Part ‚ð“ǂݍž‚ށB
     
    64112                                int x = (int)partDef["pos x"];
    65113                                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));
    67115                        }
    68116
    69117                        // TODO: pattern ‚ð“ǂݍž‚ށB
     118                        faceDef._patterns = new FacePattern(faceDef.Parts, def["pattern"] as ArrayList);
    70119
    71120                        return faceDef;
    72121                }
    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: ƒtƒH[ƒ}ƒbƒg‚ª•s³‚¾‚Á‚½‚Æ‚«‚É“Š‚°‚éException‚ð‘‚¢‚āA•s³‚¾‚Á‚½‚Æ‚«‚É“Š‚°‚é‚悤‚É‚·‚éB
    74134        }
    75135}
Note: See TracChangeset for help on using the changeset viewer.