public void PrependRegistryItemToList(BlueprintRegistryItem item)
 {
     if (item == null)
     {
         return;
     }
     RemoveRegistryItem(item.Id);
     AppSettings.BlueprintList.Insert(0, item);
 }
        public void RemoveRegistryItem(Guid blueprintId)
        {
            BlueprintRegistryItem item = GetRegistryItem(blueprintId);

            if (item == null)
            {
                return;
            }
            AppSettings.BlueprintList.Remove(item);
        }
Ejemplo n.º 3
0
        public Task <BlueprintStorage> LoadBlueprint(Guid blueprintId)
        {
            BlueprintRegistryItem item = RegistryItemListManager.GetRegistryItem(blueprintId);

            if (item == null)
            {
                return(Task.FromResult(null as BlueprintStorage));
            }
            string           json    = FileSystem.ReadAllText(item.FilePath);
            BlueprintStorage storage = ConvertFromJSON(json, item);

            return(Task.FromResult(storage));
        }
Ejemplo n.º 4
0
        private BlueprintStorage ConvertFromJSON(string fileJson, BlueprintRegistryItem item)
        {
            if (string.IsNullOrWhiteSpace(fileJson))
            {
                return(null);
            }
            BlueprintStorage storage = JsonConvert.DeserializeObject <BlueprintStorage>(fileJson);

            storage.StorageType           = Constants.StorageType.Local;
            storage.BlueprintRegistryItem = item;
            string json = CryptoService.Decrypt(storage.Data, item.Key);

            storage.Blueprint = JsonConvert.DeserializeObject <Blueprint>(json);
            return(storage);
        }