public override void ShowDialog(object sender, EventArgs e) { if (d3d == null) { d3d = new Direct3D(); var pm = new SlimDX.Direct3D9.PresentParameters(); pm.Windowed = true; device = new Device(d3d, 0, DeviceType.Reference, IntPtr.Zero, CreateFlags.FpuPreserve, pm); } string[] files; string path; if (ConvDlg.Show(Name, GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { string dest = Path.Combine(path, Path.GetFileNameWithoutExtension(files[i]) + ".x"); Convert(new DevFileLocation(files[i]), new DevFileLocation(dest)); pd.Value = i; } pd.Close(); pd.Dispose(); } }
public override void ShowDialog(object sender, EventArgs e) { string[] files; string path; if (ConvDlg.Show("转换器", GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { componIndex = i; Convert(new DevFileLocation(files[i]), null); pd.Value = i; Application.DoEvents(); } pd.Close(); pd.Dispose(); string dest = Path.Combine(path, "index.png"); Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb); BitmapData data = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); uint *dst = (uint *)data.Scan0; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { result[i * width + j].Normalize(); uint val = 0; for (int k = 0; k < ConCount; k++) { val <<= 4; //if (result[i * width + j][k] > ConMax) //{ // throw new Exception(); //} val |= ((uint)result[i * width + j][k] & ConMax); } dst[i * width + j] = val; } } bmp.Save(dest, ImageFormat.Png); bmp.Dispose(); result = null; } }
public override void ShowDialog(object sender, EventArgs e) { string[] files; string path; if (ConvDlg.Show("", GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { string dest = Path.Combine(path, Path.GetFileNameWithoutExtension(files[i]) + ".tdmp"); Convert(new DevFileLocation(files[i]), new DevFileLocation(dest)); pd.Value = i; Application.DoEvents(); } pd.Close(); pd.Dispose(); } }
public override void ShowDialog(object sender, EventArgs e) { string[] files; string path; if (ConvDlg.Show("", GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); string dest = Path.Combine(path, "color.ini"); ini = new IniConfiguration(); iniSect = new IniSection("Textures"); ini.Add(iniSect.Name, iniSect); for (int i = 0; i < files.Length; i++) { Convert(new DevFileLocation(files[i]), null); pd.Value = i; Application.DoEvents(); } pd.Close(); pd.Dispose(); ini.Save(dest); } }