private void exportw2rigjsonToolStripMenuItem_Click(object sender, EventArgs e) { if (modFileList.SelectedNode != null) { Console.WriteLine(ActiveMod.FileDirectory + "\\" + modFileList.SelectedNode.FullPath); } string w2rigFilePath = ActiveMod.FileDirectory + "\\" + modFileList.SelectedNode.FullPath; using (var sf = new SaveFileDialog()) { sf.Filter = "W3 json | *.json"; sf.FileName = Path.GetFileName(ActiveMod.FileDirectory + "\\" + modFileList.SelectedNode.FullPath + ".json"); if (sf.ShowDialog() == DialogResult.OK) { CommonData cdata = new CommonData(); Rig exportRig = new Rig(cdata); byte[] data; data = File.ReadAllBytes(w2rigFilePath); using (MemoryStream ms = new MemoryStream(data)) using (BinaryReader br = new BinaryReader(ms)) { CR2WFile rigFile = new CR2WFile(br); exportRig.LoadData(rigFile); exportRig.SaveRig(sf.FileName); } MessageBox.Show(this, "Sucessfully wrote file!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void btSave_Click(object sender, EventArgs e) { if (!File.Exists(txw3fac.Text)) { DialogResult = DialogResult.None; txw3fac.Focus(); MessageBox.Show("Invalid path", "failed to save."); return; } if (!File.Exists(txw2anims.Text)) { DialogResult = DialogResult.None; txw2anims.Focus(); MessageBox.Show("Invalid path", "failed to save."); return; } using (var sf = new SaveFileDialog()) { sf.Filter = "W3 json | *.json"; sf.FileName = Path.GetFileName(txw2anims.Text) + ".json"; if (sf.ShowDialog() == DialogResult.OK) { CommonData cdata = new CommonData(); Rig exportRig = new Rig(cdata); byte[] data; data = File.ReadAllBytes(txw3fac.Text); using (MemoryStream ms = new MemoryStream(data)) using (BinaryReader br = new BinaryReader(ms)) { CR2WFile rigFile = new CR2WFile(); rigFile.Read(br); exportRig.LoadData(rigFile); } //exportFac.Apply(exportRig); //exportFac.LoadData(sf.FileName); MessageBox.Show(this, "Sucessfully wrote file!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }