Exemple #1
0
 private static string EntryPrefix(LookupEntry entry)
 {
     switch(entry)
     {
         case LookupEntry.Amount: return "<TRNAMT>";
         case LookupEntry.Checknum: return "<CHECKNUM>";
         case LookupEntry.Date: return "<DTPOSTED>";
         case LookupEntry.Memo: return "<MEMO>";
         case LookupEntry.Payee: return "<NAME>";
         default: return $"<{entry}>";
     }
 }
Exemple #2
0
        public Option LookupOption(string s, object parent = null)
        {
            if (String.IsNullOrEmpty(s))
            {
                return(null);
            }

            LookupEntry entry = LookupEntries.FirstOrDefault(item => item.Comparer(s, item));

            if (entry != null)
            {
                entry.Option.Parent = parent;
                return(entry.Option);
            }
            return(null);
        }
Exemple #3
0
        private static bool ArgsComparer(string key, LookupEntry lookupEntry)
        {
            if (key.StartsWith(lookupEntry.AltName))
            {
                if (key.Length == lookupEntry.AltName.Length)
                {
                    return(true);
                }

                if (lookupEntry.Option.WantsArg && key.Length == lookupEntry.AltName.Length + 1 && key[lookupEntry.AltName.Length] == '_')
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #4
0
 public Entry(LookupEntry entry, string value)
     : this(EntryPrefix(entry), value)
 {
 }
Exemple #5
0
 public void AddEntry(LookupEntry entry, string value)
 {
     entries.Add(new Entry(entry, value));
 }
Exemple #6
0
 private static bool OptAltComparer(string key, LookupEntry lookupEntry)
 {
     return(IsEq(key, lookupEntry.Option.Name) || IsEq(key, lookupEntry.AltName));
 }