|
@ -1,4 +1,5 @@ |
|
|
using System.Collections.ObjectModel; |
|
|
using System; |
|
|
|
|
|
using System.Collections.ObjectModel; |
|
|
using System.IO; |
|
|
using System.IO; |
|
|
using System.Runtime.Serialization.Formatters.Binary; |
|
|
using System.Runtime.Serialization.Formatters.Binary; |
|
|
|
|
|
|
|
@ -41,11 +42,16 @@ namespace Signal_Generator.Properties { |
|
|
public static ObservableCollection<IAnalogSignal> LoadSignals() |
|
|
public static ObservableCollection<IAnalogSignal> LoadSignals() |
|
|
{ |
|
|
{ |
|
|
BinaryFormatter formatter = new BinaryFormatter(); |
|
|
BinaryFormatter formatter = new BinaryFormatter(); |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
using (FileStream fs = new FileStream("settings.dat", FileMode.Open)) |
|
|
using (FileStream fs = new FileStream("settings.dat", FileMode.Open)) |
|
|
{ |
|
|
{ |
|
|
if (!fs.CanRead) return null; |
|
|
|
|
|
return (ObservableCollection<IAnalogSignal>)formatter.Deserialize(fs); |
|
|
return (ObservableCollection<IAnalogSignal>)formatter.Deserialize(fs); |
|
|
} |
|
|
} |
|
|
|
|
|
} catch |
|
|
|
|
|
{ |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|