public static void Procedure(RustScript script, string method) { if (script == null) { throw new ArgumentNullException(nameof(script)); } if (string.IsNullOrWhiteSpace(method)) { throw new ArgumentNullException(nameof(method)); } Action invoker; lock (_procedureCache) { var target = new InvokeTarget(script, method); if (!_procedureCache.TryGetValue(target, out invoker)) { invoker = InvokeBuilder.GetInvoker <Action>(script, method); _procedureCache.Add(target, invoker); } } invoker?.Invoke(); }
public uint Store(byte[] data, Type type, uint entityID, uint numID = 0u) { using (TimeWarning.New("FileStorage.Store")) { uint cRC = GetCRC(data, type); if (db != null) { db.Execute("INSERT OR REPLACE INTO data ( crc, data, entid, filetype, part ) VALUES ( ?, ?, ?, ?, ? )", (int)cRC, data, (int)entityID, (int)type, (int)numID); } _cache.Remove(cRC); _cache.Add(cRC, new CacheData { data = data, entityID = entityID, numID = numID }); return(cRC); } }