コード例 #1
0
        private void go(string[] args)
        {
            try
            {
                var path = args[0];

                FileInfo info = new FileInfo(path);
                if (!info.Exists)
                {
                    Console.WriteLine("Source file does not exist");
                    return;
                }

                totalMaximumBytes += new FileInfo(path).Length;

                var connectionInfo = new SDCardFileConnectionInfo();
                connectionInfo.FilePath = path;

                var connection = new Connection(connectionInfo);

                var directory = args[1];
                var logger    = new SessionLogger(SessionSettings.CreateForFileAndPath(directory, info), connection);

                logger.Start();

                connection.Message += new MessageEvent(ConnectionMessage);
                connection.Connect();

                logger.Stop();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #2
0
            internal void Save(XmlElement parent)
            {
                XmlElement node = Helper.CreateElement(parent, "ConnectionInformation");

                Helper.AppendAttributeAndValue(node, "ConnectionType", ConnectionType.ToString());

                if (ConnectionInfo is UdpConnectionInfo)
                {
                    UdpConnectionInfo info = ConnectionInfo as UdpConnectionInfo;

                    Helper.AppendAttributeAndValue(node, "SendIPAddress", info.SendIPAddress.ToString());
                    Helper.AppendAttributeAndValue(node, "SendPort", info.SendPort.ToString());

                    Helper.AppendAttributeAndValue(node, "AdapterIPAddress", info.AdapterIPAddress.ToString());
                    Helper.AppendAttributeAndValue(node, "ReceivePort", info.ReceivePort);

                    Helper.AppendAttributeAndValue(node, "AdapterName", info.AdapterName);
                }
                else if (ConnectionInfo is SerialConnectionInfo)
                {
                    SerialConnectionInfo info = ConnectionInfo as SerialConnectionInfo;

                    Helper.AppendAttributeAndValue(node, "PortName", info.PortName);
                    Helper.AppendAttributeAndValue(node, "BaudRate", info.BaudRate);
                    Helper.AppendAttributeAndValue(node, "RtsCtsEnabled", info.RtsCtsEnabled);
                }
                else if (ConnectionInfo is SDCardFileConnectionInfo)
                {
                    SDCardFileConnectionInfo info = ConnectionInfo as SDCardFileConnectionInfo;

                    Helper.AppendAttributeAndValue(node, "FilePath", info.FilePath);
                }

                parent.AppendChild(node);
            }
 public FileReadConnectionImplementation(Connection connection, SDCardFileConnectionInfo info, OscCommunicationStatistics statistics)
 {
     this.connection          = connection;
     sdCardFileConnectionInfo = info;
     this.statistics          = statistics;
 }