Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ENBModel
- {
- public string Name { get; set; }
- public BitmapImage Image { get; set; }
- }
- foreach (var file in files)
- {
- using (var zip = ZipFile.Read(file))
- {
- var enb = new ENBModel();
- using (var dataStream = new MemoryStream())
- {
- var dataZip = zip["PSSData.json"];
- dataZip.Extract(dataStream);
- var data = Encoding.Default.GetString(dataStream.ToArray());
- var json = JsonConvert.DeserializeObject<FileDataModel>(data);
- enb.Name = json.Name;
- }
- var imageSource = new BitmapImage();
- using (MemoryStream imageSteam = new MemoryStream())
- {
- var imgZip = zip["Image.png"];
- imgZip.Extract(imageSteam);
- imageSource.BeginInit();
- imageSource.StreamSource = imageSteam;
- imageSource.CacheOption = BitmapCacheOption.OnLoad;
- imageSource.EndInit();
- enb.Image = imageSource;
- }
- Presets.Add(enb);
- }
- }
- <ListBox ItemsSource="{Binding Presets}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel/>
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- </ListBox>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement