public comBlowingSchemaEvent[] LoadBlowingSchema(string schemaName) { StoredScheme result = new StoredScheme(); try { using (FileStream fs = new FileInfo( string.Format("{0}dat\\{1}.heatScript", System.AppDomain.CurrentDomain.BaseDirectory, schemaName)).OpenRead()) { BinaryFormatter formatter = new BinaryFormatter(); formatter.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; formatter.Binder = new PreMergeToMergedDeserializationBinder(); result = (StoredScheme)formatter.Deserialize(fs); fs.Close(); } } catch { }; return result.BlowingSchemas; }
public void SaveBlowingSchema(string schemaName, comBlowingSchemaEvent[] schemas) { StoredScheme str = new StoredScheme(); str.BlowingSchemas = schemas; if (!Directory.Exists(System.AppDomain.CurrentDomain.BaseDirectory + "\\dat")) Directory.CreateDirectory(System.AppDomain.CurrentDomain.BaseDirectory + "\\dat"); using (FileStream fs = new FileInfo( string.Format("{0}\\dat\\{1}.heatScript", System.AppDomain.CurrentDomain.BaseDirectory, schemaName)).Create()) { new BinaryFormatter().Serialize(fs, str); fs.Close(); } }