Exemple #1
0
        //public void ConnectToServer()
        //{
        //    try
        //    {
        //        _clientSocket.Connect(_ipe);
        //        Console.WriteLine("Connected to {0} @ Port:{1}.", IP.ToString(), Port.ToString());
        //    }
        //    catch (SocketException e)
        //    {
        //        Console.WriteLine("Failed to Connect Server -{0}", e.ToString());
        //        return;
        //    }
        //}

        public void SndData(WitsConfig witsConfig)
        {
            string str = dataSimu.Simu(witsConfig);    //每次取las文件中下一行的数据

            byte[] sndByte = System.Text.Encoding.Default.GetBytes(str);
            ClientSocket.Send(sndByte);
        }
Exemple #2
0
 // private Thread _thread;
 public MainWindow()
 {
     InitializeComponent();
     comm        = new Communication("127.0.0.1", 6699);
     _witsConfig = new WitsConfig();
     Wits_DataGrid.ItemsSource = _witsConfig.WitsChart7;
 }
Exemple #3
0
        //一个完整的传输信息,包含所有的某个时刻或者某个深度对应的数据组合。
        public string Simu(WitsConfig witsConfig)
        {
            GetDatasFromLasFile();


            int dataNum = witsConfig.WitsChart7.Count();

            _logData   = new LogData();
            Strbuilder = new StringBuilder();
            Strbuilder.Append("&&\r\n");

            for (int i = 0; i < dataNum; i++)
            {
                _logData.ChartNo   = witsConfig.WitsChart7[i].RecordID;
                _logData.ChannelNo = witsConfig.WitsChart7[i].ItemID;
                _logData.DataValue = dataset[i].Samples[index].Value;//(random.NextDouble() * 100).ToString("0.00");//此处需要修改为las文件中的数据
                Strbuilder.Append(_logData.DataEntry());
            }

            if (index >= dataset[0].Samples.Count - 1)
            {
                index = 0;
            }
            else
            {
                index++;
            }
            //while (--dataNum>=0)
            //{
            //    _logData.ChartNo = "0"+random.Next(7,8).ToString();
            //    _logData.ChannelNo = random.Next(1,25).ToString();
            //    _logData.DataValue = (random.NextDouble()*100).ToString("0.00");
            //    Strbuilder.Append(_logData.DataEntry());
            //}

            Strbuilder.Append("!!\r\n");

            Console.WriteLine(Strbuilder.ToString());
            return(Strbuilder.ToString());

            //
        }