private bool DoSave() { if (string.IsNullOrEmpty(mFilePath)) { var res = SaveFileDlg.ShowDialog(); if (res != DialogResult.OK) { return(false); } mFilePath = SaveFileDlg.FileName; } var rtCfg = new RuntimeConfig { PanelIcon = BrowseIcon.FileName, PanelText = PanelText.Text, RibbonText = RibbonText.Text, TabText = TabText.Text, CommandConfigs = mConfigs }; rtCfg.SaveToFile(mFilePath); mDirty = false; UpdateUserInterface(); return(true); }
protected void DownAtt(string tableName) { #region 载附件 try { BusinessObject bo = new BusinessObject(); string sql = "select AttName,AttExt,Attachment from " + tableName + " where " + m_strPKM + " = " + m_dvM[0][m_strPKM]; bo.BusiDataSQL = new string[] { sql }; bo.GetBusiData(); if (bo.BusiData.Tables[0].Rows[0]["Attachment"].ToString() != "") { SaveFileDlg.FileName = this.m_dvM[0]["AttName"].ToString(); SaveFileDlg.DefaultExt = this.m_dvM[0]["AttExt"].ToString(); if (SaveFileDlg.ShowDialog() == DialogResult.OK) { byte[] buffByte = (byte[])bo.BusiData.Tables[0].Rows[0]["Attachment"]; FileInfo fi = new FileInfo(SaveFileDlg.FileName); FileStream fs = fi.OpenWrite(); fs.Write(buffByte, 0, buffByte.Length); fs.Close(); fi.CopyTo(SaveFileDlg.FileName); fi.Delete(); } } else { MsgBox.ShowInfoMsg("没有附件!"); } } catch { } #endregion }
private void BtnSave_Click(object sender, EventArgs e) { if (SaveFileDlg.ShowDialog() == DialogResult.OK) { string fileName = SaveFileDlg.FileName; File.WriteAllText(fileName, TxtBox.Text); } }
private void BtnCreateDB_Click(object sender, EventArgs e) { SaveFileDlg.Filter = "FichierAccess|*.mdb|Tous fichiers|*.*"; SaveFileDlg.ShowDialog(); string Creationpath = SaveFileDlg.FileName; CreateDB(Creationpath); MessageBox.Show("The database has been created !", "Successful creation", MessageBoxButtons.OK, MessageBoxIcon.Information); getPath = Creationpath; OpenDB f1 = new OpenDB(); f1.ShowDialog(); }
void OnTagInstanceExtractAs(BlamLib.Blam.CacheIndex.Item tag_instance) { SaveFileDlg.Filter = tag_instance.GroupTag.Filter; if (SaveFileDlg.ShowDialog(this) == DialogResult.OK) { string path = SaveFileDlg.FileName; var tiei = new TagInstanceExtractionInfo(); tiei.InitializeStateForTagInstance(tag_instance, System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), @"\"), System.IO.Path.GetFileNameWithoutExtension(path)); tiei.InitializeExtractionForTagInstance(); bgwTagExtract.RunWorkerAsync(tiei); } SaveFileDlg.Filter = ""; }
private void SaveDocument(bool newLocation) { UpdateDocument(); if (Program.Document != null) { newLocation |= String.IsNullOrEmpty(Program.Document.FilePath); } if (newLocation) { if (SaveFileDlg.ShowDialog(this) == DialogResult.OK) { Program.Document.SaveAs(SaveFileDlg.FileName); } } else { Program.Document.Save(); } Text = "Midi Mapper - [" + Program.Document.FilePath + "]"; }
//保存 private void MenuItemSave_Click(object sender, EventArgs e) { if (_openmp3 == "") { MessageBox.Show(this, "未打开mp3文件,请重新打开!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); MenuItemOpen_Click(sender, e); return; } if (_maker == "" || _fileName == "") { MessageBox.Show(this, "无文件信息,请修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); MenuItemFileInfo_Click(sender, e); return; } if (_openSong == "") { if (SaveFileDlg.ShowDialog() == DialogResult.OK) { _openSong = SaveFileDlg.FileName; } else { return; } } string savePath = Path.GetTempPath() + "RTMP\\"; if (Directory.Exists(Path.GetTempPath() + "RTMP")) { Directory.Delete(Path.GetTempPath() + "RTMP", true); } Directory.CreateDirectory(savePath); File.Copy(_openmp3, savePath + "song.mp3"); FileStream fileStream = new FileStream(savePath + "song.map", FileMode.Create); BinaryWriter binaryWriter = new BinaryWriter(fileStream); //文件信息 binaryWriter.Write(_fileName); //曲名 binaryWriter.Write(_maker); //制作者 //binaryWriter.Write(1);//模式,已删除 binaryWriter.Write(_difficulty); //难度 binaryWriter.Write(_description); //描述 binaryWriter.Write(listBoxSave.Items.Count); //数目 //音符信息 for (int i = 0; i < listBoxSave.Items.Count; i++) { mykey = (MyKey)listBoxSave.Items[i]; binaryWriter.Write(mykey.myKeyShow); binaryWriter.Write(mykey.timeMin); binaryWriter.Write(mykey.timeSec); binaryWriter.Write(mykey.timeMs); binaryWriter.Write(mykey.keyCount); binaryWriter.Write(mykey.A); binaryWriter.Write(mykey.S); binaryWriter.Write(mykey.D); binaryWriter.Write(mykey.F); binaryWriter.Write(mykey.Space); binaryWriter.Write(mykey.J); binaryWriter.Write(mykey.K); binaryWriter.Write(mykey.L); binaryWriter.Write(mykey.Sem); } binaryWriter.Close(); fileStream.Close(); CreateZipFile(savePath, savePath + _fileName + ".rtm"); System.IO.File.Copy(savePath + _fileName + ".rtm", _openSong, true); }