Beispiel #1
0
        public void CloseSession()
        {
            int count = 0;
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.OmitXmlDeclaration = false;
            settings.IndentChars        = "    ";
            settings.Indent             = true;

            XmlWriter writer = XmlWriter.Create(_outfs, settings);


            XmlSerializerNamespaces n = new XmlSerializerNamespaces();

            n.Add("", "");

            _xmlData.EventValues = Convert.ToBase64String(_periodData);

            Vix2Channel tempChannel;

            foreach (string channelName in _sessionData.ChannelNames)
            {
                tempChannel = new Vix2Channel()
                {
                    name    = channelName,
                    id      = count,
                    output  = count,
                    enabled = true,
                    color   = -1
                };
                count++;
                _xmlData.Channels.Add(tempChannel);
            }

            if (_sessionData.AudioFileName.Length > 0)
            {
                _xmlData.Audio          = new Vix2Audio();
                _xmlData.Audio.filename = Path.GetFileName(_sessionData.AudioFileName);
                _xmlData.Audio.duration = _sessionData.PeriodMS.ToString();
                _xmlData.Audio.Value    = _xmlData.Audio.filename;
            }


            XmlSerializer serializer = new XmlSerializer(typeof(Vix2XMLData));

            serializer.Serialize(writer, _xmlData, n);


            try
            {
                _outfs.Close();
                _outfs = null;
            }
            catch (Exception e)
            {
                _outfs = null;
                throw e;
            }
        }
Beispiel #2
0
        public void CloseSession()
        {
            int count = 0;
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.OmitXmlDeclaration = false;
            settings.IndentChars = "    ";
            settings.Indent = true;

            XmlWriter writer =  XmlWriter.Create(_outfs, settings);

            XmlSerializerNamespaces n = new XmlSerializerNamespaces();
            n.Add("", "");

            _xmlData.EventValues = Convert.ToBase64String(_periodData);

            Vix2Channel tempChannel;

            foreach (string channelName in _sessionData.ChannelNames)
            {
                tempChannel = new Vix2Channel()
                {
                    name = channelName,
                    id = count,
                    output = count,
                    enabled = true,
                    color = -1
                };
                count++;
                _xmlData.Channels.Add(tempChannel);
            }

            if (_sessionData.AudioFileName.Length > 0)
            {
                _xmlData.Audio = new Vix2Audio();
                _xmlData.Audio.filename = Path.GetFileName(_sessionData.AudioFileName);
                _xmlData.Audio.duration = _sessionData.PeriodMS.ToString();
                _xmlData.Audio.Value = _xmlData.Audio.filename;
            }

            XmlSerializer serializer = new XmlSerializer(typeof(Vix2XMLData));
            serializer.Serialize(writer, _xmlData, n);

            try
            {
                _outfs.Close();
                _outfs = null;

            }
            catch (Exception e)
            {
                _outfs = null;
                throw e;
            }
        }