コード例 #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))
                     {
                         RLEResource r = new RLEResource(1, fs);
                         r.ToDDS().CopyTo(fs2);
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: dwalternatio/Sims4Tools
 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" })
            {
                if (save.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    using (FileStream fs2 = new FileStream(save.FileName, FileMode.Create))
                    {
                        RLEResource r = new RLEResource(1, fs);
                        r.ToDDS().CopyTo(fs2);
                    }
                }
            }
        }
    }
 }
コード例 #3
0
ファイル: DDSPanel.cs プロジェクト: mrhodes/Sims4Tools
        /// <summary>
        /// Load a RLE image from a <see cref="System.IO.Stream"/>;
        /// if <paramref name="supportHSV"/> is passed and true (default is false), the image will
        /// support HSV shift operations.
        /// </summary>
        /// <param name="stream">The <see cref="System.IO.Stream"/> containing the RLE image to display,<br/>
        /// - or -<br/>
        /// <c>null</c> to clear the image and free resources.</param>
        /// <param name="supportHSV">Optional; when true, HSV operations will be supported on the image.</param>
        public void RLELoad(Stream stream, bool supportHSV = false)
        {
            if (stream != null && stream.Length > 0)
            {
                try
                {
                    this.Enabled = false;
                    Application.UseWaitCursor = true;
                    Application.DoEvents();

                    RLEResource rle = new RLEResource(1, stream);
                    ddsFile.Load(rle.ToDDS(), supportHSV);

                    loaded = true;
                }
                finally { this.Enabled = true; Application.UseWaitCursor = false; Application.DoEvents(); }
                this.supportHSV = supportHSV;
                ckb_CheckedChanged(null, null);
            }
            else
            {
                Clear();
            }
        }
コード例 #4
0
ファイル: DDSPanel.cs プロジェクト: falerin/Sims4Tools
        /// <summary>
        /// Load a RLE image from a <see cref="System.IO.Stream"/>;
        /// if <paramref name="supportHSV"/> is passed and true (default is false), the image will
        /// support HSV shift operations.
        /// </summary>
        /// <param name="stream">The <see cref="System.IO.Stream"/> containing the RLE image to display,<br/>
        /// - or -<br/>
        /// <c>null</c> to clear the image and free resources.</param>
        /// <param name="supportHSV">Optional; when true, HSV operations will be supported on the image.</param>
        public void RLELoad(Stream stream, bool supportHSV = false)
        {
            if (stream != null && stream.Length > 0)
            {
                try
                {
                    this.Enabled = false;
                    Application.UseWaitCursor = true;
                    Application.DoEvents();

                    RLEResource rle = new RLEResource(1, stream);
                    ddsFile.Load(rle.ToDDS(), supportHSV);

                    loaded = true;
                }
                finally { this.Enabled = true; Application.UseWaitCursor = false; Application.DoEvents(); }
                this.supportHSV = supportHSV;
                ckb_CheckedChanged(null, null);
            }
            else
                Clear();
        }