private void ExecuteTransfer(string param, out string retValue)
        {
            retValue = "Res=ArgumentException";

            if (!string.IsNullOrEmpty(param))
            {
                string[] paths = param.Split(' ');
                if (paths.Length == 2)
                {
                    string[] array = paths[1].Split('@');
                    int      index = 0;

                    if (array[0].StartsWith("machine"))
                    {
                        try
                        {
                            index = Int32.Parse(array[0].Substring("machine".Length));

                            FileTransferClient client = new FileTransferClient(NetUtil.GetStationIp(index - 1));
                            if (FileTransferClient.TRANSFER_ERROR_NONE == client.Upload(paths[0], array[1]))
                            {
                                retValue = "Res=Pass";
                            }
                            else
                            {
                                retValue = "Res=Fail";
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// 测试完成后,调用此接口,用来记录测试结果
        /// </summary>
        /// <param name="sn"></param>
        public static void Record(string sn)
        {
            InitResultList();

            foreach (FlowItem flowItem in FlowControl.Instance.FlowItemList)
            {
                if (flowItem.IsFinished() && !flowItem.Item.Property.Disable && !flowItem.Item.Property.Hide)
                {
                    ResultInfo info = new ResultInfo();
                    info.Key   = flowItem.Name;
                    info.Value = RestoreCmdResult(flowItem.SpecValueList);
                    resultList_.Add(info);
                }
            }

            if (resultList_.Count > 0)
            {
                string filename = @"d:\DataFragment\" + sn + "_" + NetUtil.GetStationIndex();
                using (StreamWriter sw = new StreamWriter(filename))
                {
                    using (JsonWriter writer = new JsonTextWriter(sw))
                    {
                        JsonSerializer serializer = new JsonSerializer();
                        serializer.Serialize(writer, resultList_);
                    }
                }

                ThreadPool.QueueUserWorkItem(delegate
                {
                    FileTransferClient client = new FileTransferClient(NetUtil.GetStationIp(AppInfo.STATION_SERVER));
                    client.Upload(filename, filename);
                });
            }
        }
示例#3
0
        private void OnWatchedFileChange(object state)
        {
            Console.WriteLine("OnWatchedFileChange");

            string             srcfilename  = @"C:\TRT_Camera_Tester_Picture\test result\result.txt";
            string             destfilename = @"d:\DataFragment\result_" + NetUtil.GetStationIndex() + ".txt";
            FileTransferClient client       = new FileTransferClient(NetUtil.GetStationIp(AppInfo.STATION_SERVER));

            client.Upload(srcfilename, destfilename);
        }