public void Export(Signal signal, System.IO.FileInfo file) { //FileStream fs = file.Open(FileMode.OpenOrCreate); //fs.Close(); using (StreamWriter sw = file.CreateText()) { for (int i = 0; i < signal.T.Length; ++i) sw.WriteLine(signal.X[i].ToString(CultureInfo.InvariantCulture)); } }
private void SaveXmlFile(System.IO.FileInfo fileInfo) { try { System.IO.StreamWriter streamWriter = fileInfo.CreateText(); XmlSerializer xmlSerializer = new XmlSerializer(typeof(Definition)); xmlSerializer.Serialize(streamWriter, this.definition); streamWriter.Flush(); streamWriter.Close(); UpdateCurrentFile(fileInfo); } catch (Exception ex) { MessageBox.Show(ex.Message, "Save", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void SaveSqlFile(System.IO.FileInfo fileInfo) { try { SqlGenerator sqlGenerator = new SqlGenerator(); System.IO.StreamWriter streamWriter = fileInfo.CreateText(); foreach (EntitiesGenerator.Definitions.DataTable table in this.definition.Tables) { string sqlText = sqlGenerator.GenerateForMSSQL(table); streamWriter.Write(sqlText); streamWriter.WriteLine(SQLSEPARATINGCHARACTER); } streamWriter.Flush(); streamWriter.Close(); UpdateCurrentFile(fileInfo); } catch (Exception ex) { MessageBox.Show(ex.Message, "Save", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void writeToFile(System.IO.FileInfo file, List<IJobDetail> jobDetails) { using (StreamWriter writer = file.CreateText()) { XNamespace ns = "http://quartznet.sourceforge.net/JobSchedulingData"; XDocument doc = new XDocument(new XDeclaration("1.0", "UTF-8", "yes") , new XElement(ns + "quartz" , new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance") , new XAttribute("version", "1.0") , new XAttribute("overwrite-existing-jobs", "true") ) ); foreach (IJobDetail detail in jobDetails) { doc.Root.Add( new XElement(ns + "job" , new XElement(ns + "job-detail" , new XElement(ns + "name", detail.Key.Name) , new XElement(ns + "group", detail.Key.Group) , new XElement(ns + "description", detail.Description) , new XElement(ns + "job-type", detail.JobType.FullName + "," + detail.JobType.Assembly.FullName) //TODO: Apparently volatile is no longer available. Check. //, new XElement(ns + "volatile", detail.Volatile) , new XElement(ns + "durable", detail.Durable) , new XElement(ns + "recover", detail.RequestsRecovery) , getJobDataMap(ns, detail.JobDataMap) ) , getTriggers(ns, detail) ) ); } writer.Write(doc); writer.Flush(); writer.Close(); } }
/// <summary> /// Debugging routine to dump the code to a given file. Can be called directly from within /// the debugger. /// </summary> /// <param name="output"></param> internal void DumpToFile(System.IO.FileInfo output) { using (var writer = output.CreateText()) { foreach (var l in CodeBody.CodeItUp()) { writer.WriteLine(l); } writer.Close(); } }