예제 #1
0
 static void Main(string[] args)
 {
     if (args.Contains("/import"))
     {
         List <string> largs = new List <string>(args);
         largs.Remove("/import");
         s4pi.Helpers.RunHelper.Run(typeof(Import), largs.ToArray());
     }
     else if (args.Contains("/export"))
     {
         using (FileStream fs = new FileStream(args[1], FileMode.Open))
         {
             using (SaveFileDialog save = new SaveFileDialog()
             {
                 Filter = "DDS DXT5|*.dds", FileName = Path.GetFileName(args[1]), Title = "Export to DDS"
             })
             {
                 if (save.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     using (FileStream fs2 = new FileStream(save.FileName, FileMode.Create))
                     {
                         DSTResource dst = new DSTResource(1, fs);
                         dst.ToDDS().CopyTo(fs2);
                     }
                 }
             }
         }
     }
 }
예제 #2
0
 private void Import_Shown(object sender, EventArgs e)
 {
     if (this.filename != "")
     {
         using (FileStream fs = new FileStream(this.filename, FileMode.Open))
         {
             DSTResource dst = new DSTResource(1, fs);
             Stream s = dst.Stream;
             using (MemoryStream ms = new MemoryStream())
             {
                 s.CopyTo(ms);
                 this.Result = ms.ToArray();
                 Environment.ExitCode = 0;
             }
         }
     }
     
     this.Close();
 }