Esempio n. 1
0
        public static void SaveToBinaryFile(BinaryWrapper bin, string path)
        {
            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);

            formatter.Serialize(stream, bin);
            stream.Close();
        }
Esempio n. 2
0
        public static BinaryWrapper ReadFromBinaryFile(string path)
        {
            IFormatter    formatter = new BinaryFormatter();
            Stream        stream    = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            BinaryWrapper bin       = (BinaryWrapper)formatter.Deserialize(stream);

            stream.Close();

            return(bin);
        }
Esempio n. 3
0
        public void LoadSignal(object sender, RoutedEventArgs e)
        {
            string path = Serializer.FilePath(true);

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            BinaryWrapper binaryWrapper = Serializer.ReadFromBinaryFile(path);

            Signal = binaryWrapper.DiscreteSignal;
            ReplotChartAndHistogram();
        }
Esempio n. 4
0
        public void SaveSignal(object sender, RoutedEventArgs e)
        {
            string path = Serializer.FilePath(false);

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            BinaryWrapper binaryWrapper = new BinaryWrapper
            {
                SelectedSignal = SelectedSignal,
                SignalParams   = Params,
                DiscreteSignal = Signal
            };

            Serializer.SaveToBinaryFile(binaryWrapper, path);
        }