Exemplo n.º 1
0
        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.");
            }
        }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
        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}");
            }
        }
Exemplo n.º 4
0
 static void UseExtendedStorage(IStandardStorage storage, ulong[] ids)
 {
     Console.WriteLine("Using an extended Storage...");
     UseStorage(storage, ids);
 }