예제 #1
0
파일: Entry.cs 프로젝트: Phazyck/CsvToYnab
 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}>";
     }
 }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
파일: Entry.cs 프로젝트: Phazyck/CsvToYnab
 public Entry(LookupEntry entry, string value)
     : this(EntryPrefix(entry), value)
 {
 }
예제 #5
0
 public void AddEntry(LookupEntry entry, string value)
 {
     entries.Add(new Entry(entry, value));
 }
예제 #6
0
 private static bool OptAltComparer(string key, LookupEntry lookupEntry)
 {
     return(IsEq(key, lookupEntry.Option.Name) || IsEq(key, lookupEntry.AltName));
 }