示例#1
0
 public static bool MatchAndBind(TypeBind tb, int index, IPuzzlePiece ipp, Dictionary<string,object> tobind)
 {
     if(Match(tb,index,ipp)) {
         if(tb.bindingtable != null && tb.bindingtable.Count > 0x00) {
             if(!(ipp is IKeyValueTablePuzzlePiece<string,object>)) {
                 return false;
             }
             KeyValueTable<string,object> conv = ((IKeyValueTablePuzzlePiece<string,object>) ipp).Table;
             foreach(KeyValuePair<string,string> entry in tb.bindingtable) {
                 Console.WriteLine("Bind key {0} of {1}",entry.Key,ipp);
                 try {
                     tobind.Add(entry.Value,conv[entry.Key]);
                 }
                 catch {
                     return false;
                 }
             }
         }
         return true;
     }
     return false;
 }
示例#2
0
 public static bool Match(TypeBind tb, int index, IPuzzlePiece ipp)
 {
     return (ipp != null && tb.type.IsAssignableFrom(ipp.GetType()) && (tb.index == -0x01 || tb.index == index));
 }