예제 #1
0
파일: Program.cs 프로젝트: tecno14/OpenSAGE
        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);
                }
            }
        }
예제 #2
0
        private void SetAudio()
        {
            ui_content.Children.Clear();
            BigArchiveEntry entry = ui_listview.SelectedItem as BigArchiveEntry;

            m_audio = new SoundPlayer(entry.Open());
            m_audio.Play();
        }
예제 #3
0
 private void ExportFile(BigArchiveEntry entry, string filePath)
 {
     using (var entryStream = entry.Open())
     {
         using (var fileStream = File.OpenWrite(filePath))
         {
             entryStream.CopyTo(fileStream);
         }
     }
 }
예제 #4
0
        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);
        }
예제 #5
0
        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);
                }
            }
        }
예제 #6
0
        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);
        }