static void AddFileToArchive(BigArchive archive, string filepath, bool update = false) { BigArchiveEntry entry = null; if (!update) { Console.WriteLine("adding: {0}", filepath); entry = archive.CreateEntry(filepath); } else { try { entry = archive.Entries.First(x => x.FullName == filepath); Console.WriteLine("updating: {0}", filepath); } catch (InvalidOperationException e) { entry = archive.CreateEntry(filepath); Console.WriteLine("adding: {0}", filepath); } } using (var entryStream = entry.Open()) { using (var fileStream = File.OpenRead(filepath)) { fileStream.CopyTo(entryStream); } } }
private void SetAudio() { ui_content.Children.Clear(); BigArchiveEntry entry = ui_listview.SelectedItem as BigArchiveEntry; m_audio = new SoundPlayer(entry.Open()); m_audio.Play(); }
private void ExportFile(BigArchiveEntry entry, string filePath) { using (var entryStream = entry.Open()) { using (var fileStream = File.OpenWrite(filePath)) { entryStream.CopyTo(fileStream); } } }
private void SetText() { ui_content.Children.Clear(); BigArchiveEntry entry = ui_listview.SelectedItem as BigArchiveEntry; StreamReader sr = new StreamReader(entry.Open()); ScrollViewer sv = new ScrollViewer(); TextBox tb = new TextBox(); tb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; tb.Text = sr.ReadToEnd(); ui_content.Children.Add(tb); }
private void ExportFile(BigArchiveEntry entry, DialogResult result) { if (!result.Success) { return; } using (var entryStream = entry.Open()) { using (var fileStream = File.OpenWrite(result.FileName)) { entryStream.CopyTo(fileStream); } } }
private void SetImage() { ui_content.Children.Clear(); BigArchiveEntry entry = ui_listview.SelectedItem as BigArchiveEntry; Image img = new Image(); try { img.Source = BitmapFrame.Create(entry.Open(), BitmapCreateOptions.None, BitmapCacheOption.OnLoad); } catch { } ui_content.Children.Add(img); }