public static IEnumerable <Type> Add(Type type, Assembly a = null) { var implements = GetImplements(type, a); if (_iList.ContainsKey(type)) { var l = _iList[type]; lock (obj4Lock) l.AddRange(implements.Where(t => !l.Contains(t))); return(l); } else { var l = implements.ToList(); _iList.TryAdd(type, l); return(l); } }
public static string AsString(decimal nParam, string cVal, bool lDec) { cVal = string.IsNullOrEmpty(cVal) || !numItems.ContainsKey(cVal) ? DefaultItem : cVal.ToUpper(); string[] numItem = numItems[cVal]; aWord[5][0] = numItem[0]; aWord[5][1] = numItem[1]; aWord[5][2] = numItem[2]; string buf1 = ((UInt64)nParam).ToString("##0").PadLeft(15, '0'); buf1 = buf1.Substring(buf1.Length - 15); for (; buf1.Substring(0, 3) == "000" && buf1.Length > 3;) { buf1 = buf1.Substring(3); } int iCount = buf1.Length / 3; int k = 0; StringBuilder result = new StringBuilder(); byte[] buf2; for (int i = 1; i <= iCount; i++) { buf2 = toByteArray(buf1.Substring(k, 3)); if ((i == iCount - 1) | (i == iCount & numItem[6] == "W")) { aNum[2][0] = "одна"; aNum[2][1] = "две"; } else { aNum[2][0] = "один"; aNum[2][1] = "два"; } for (int j = 0; j < 3; j++) { if (!(buf2[j] == 1 & j == 1)) { result.Append(two(buf2, j, j)); } else if (buf2[j + 1] == 0) { result.Append(two(buf2, j, j)); break; } else { result.Append(two(buf2, 3, j)); break; } } int n = 0; if (buf2[1] == 1) { n = 2; } else if (buf2[2] == 1) { n = 0; } else if (buf2[2] >= 2 & buf2[2] <= 4) { n = 1; } else { n = 2; } if (buf1.Substring(k, 3) != "000") { result.Append(aWord[5 - iCount + i][n] + " "); } else if (iCount == 1) { result.Append("ноль " + aWord[5][n] + " "); } else if (5 - iCount + i == 5) { result.Append(aWord[5][n] + " "); } k += 3; } if (lDec == true) { buf1 = nParam.ToString("0.00"); buf1 = buf1.Substring(buf1.Length - 2); result.Append(buf1 + " "); buf2 = toByteArray(buf1); if (buf2[0] == 1) { result.Append(numItem[5] + " "); } else if (buf2[1] == 1) { result.Append(numItem[3] + " "); } else if (buf2[1] >= 2 & buf2[1] <= 4) { result.Append(numItem[4] + " "); } else { result.Append(numItem[5] + " "); } } buf1 = result.ToString(); return(buf1.Substring(0, 1).ToUpper() + buf1.Substring(1)); }