static void GetPrintRecord(IStandardStorage storage, ulong id) { IStandardStorageRecord record = storage.GetRecordById(id); if (record != null) { Console.WriteLine($"Obtained a Record (ID={id}): [{record.Data}]."); } else { Console.WriteLine($"Record with ID={id} does not exist."); } }
static void UseStorage(IStandardStorage storage, ulong[] ids) { if (storage == null) { throw new Exception("Storage is not set"); } storage.Connect(); foreach (var id in ids) { GetPrintRecord(storage, id); } storage.Disconnect(); Console.WriteLine(); }
static void Main(string[] args) { ulong[] ids = { 1, 2, 3, 4 }; try { UseStandardStorage(ids); string pathToPlugin = "../../../plugin/storage.dll"; object pluggedObject = EnablePlugin(pathToPlugin); IStandardStorage extendedStorage = pluggedObject as IStandardStorage; UseExtendedStorage(extendedStorage, ids); } catch (Exception ex) { Console.WriteLine($"{ex.GetType()} Exception: {ex.Message}"); } }
static void UseExtendedStorage(IStandardStorage storage, ulong[] ids) { Console.WriteLine("Using an extended Storage..."); UseStorage(storage, ids); }