public Item ItemCreate(string sPreset, string sFile, UserReplacement[] aUserReplacements) // aUserReplacements может быть null, nAssetsID может быть 0 { Item cRetVal = null; try { if (0 < Client.nID) { string sInfo = "Template, " + sFile; if (null != (cRetVal = GarbageCollector.ItemGet(sInfo)) && cRetVal.eStatus != Item.Status.Stopped && cRetVal.eStatus != Item.Status.Error) { return(cRetVal); } cRetVal = new Template(sFile, (null == aUserReplacements ? null : aUserReplacements.ToDictionary(row => row.sKey, row => row.sValue))); cRetVal.sPreset = sPreset; cRetVal.sInfo = sInfo; GarbageCollector.ItemAdd(cRetVal); (new Logger()).WriteDebug3("create: " + sInfo + " hash:[" + cRetVal.GetHashCode() + "]"); } else { (new Logger()).WriteError("create: не инициирован механизм регистрации клиента"); } } catch (Exception ex) { (new Logger()).WriteError(ex); } return(cRetVal); }