private void new_btn_Click(object sender, System.EventArgs e) { if (saveFileDialog1.InitialDirectory == null && saveFileDialog1.FileName != null && saveFileDialog1.FileName.ToLower().Contains(@"data\fx")) { saveFileDialog1.InitialDirectory = Path.GetDirectoryName(openFileDialog1.FileName); } else if (saveFileDialog1.InitialDirectory == null && openFileDialog1.FileName != null && openFileDialog1.FileName.ToLower().Contains(@"data\fx")) { saveFileDialog1.InitialDirectory = Path.GetDirectoryName(openFileDialog1.FileName); } if (!saveFileDialog1.InitialDirectory.ToLower().Contains(@"data\fx") && fxFile != null) { saveFileDialog1.InitialDirectory = Path.GetDirectoryName(fxFile); } if (eventsBhvrFilesMComboBx.Text != null) { string currentFileName = eventsBhvrFilesMComboBx.Text; saveFileDialog1.FileName = currentFileName; } DialogResult dr = saveFileDialog1.ShowDialog(); if (dr == DialogResult.OK) { if (dr == DialogResult.OK) { if (ownerName.Equals("Behavior")) { BehaviorWin bWin = (BehaviorWin)this.ownerDockablePanel; bWin.setBhvrPanels(new Behavior("null.bhvr")); common.COH_IO.writeDistFile(bWin.getData(), saveFileDialog1.FileName); bWin.loadStandAloneBhvrFile(saveFileDialog1.FileName); } else { ParticalsWin pWin = (ParticalsWin)this.ownerDockablePanel; pWin.setPartPanels(new Partical("null.part", false)); common.COH_IO.writeDistFile(pWin.getData(), saveFileDialog1.FileName); pWin.loadStandAlonePartFile(saveFileDialog1.FileName); } enableElements(true); } } }
private void saveFile(string file_name) { if (ownerName.Equals("Behavior")) { BehaviorWin bWin = (BehaviorWin)this.ownerDockablePanel; ArrayList data = bWin.getData(); common.COH_IO.writeDistFile(data, file_name); //updateBhvr(file_name, data); } else { ParticalsWin pWin = (ParticalsWin)this.ownerDockablePanel; ArrayList data = pWin.getData(); common.COH_IO.writeDistFile(data, file_name); //updatePart(file_name, data); } }