Пример #1
0
        /// <summary>
        /// 重新嵌入一个页面
        /// </summary>
        /// <param name="content"></param>
        private void Insert_SO(string content)
        {
            string protocolFolder = string.Empty;

            if (currentProtocol == XDCProtocolType.NDC)
            {
                protocolFolder = "NDC";
            }
            else
            {
                protocolFolder = "DDC";
            }
            string filePath = XDCUnity.eCATPath + @"\XDC\" + protocolFolder + @"\Scripts\Screen\Host\000\" + content + ".txt";

            if (!File.Exists(filePath))
            {
                return;
            }
            string        txt    = XDCUnity.GetTxtFileText(filePath);
            List <object> result = XDCUnity.ScreenOperator.GetView(txt);

            if (result != null && result.Count > 0)
            {
                ExcuteScreenCmd(result);
            }
        }
Пример #2
0
 private void ShowDetailStateOrScreen(string FieldName, string FieldValue)
 {
     if (FieldName.Contains("Screen"))
     {
         string screenPath = XDCUnity.eCATPath + @"\XDC\" + folderName + @"\Scripts\Screen" + XDCUnity.CurrentResourceIndex + @"\Host\000\" + FieldValue + ".txt";
         if (File.Exists(screenPath))
         {
             string           screenText       = XDCUnity.GetTxtFileText(screenPath);
             Form_ScreenParse form_ScreenParse = new Form_ScreenParse(screenText, currentProtocolType, FieldValue + ".txt");
             form_ScreenParse.Show();
         }
         else
         {
             MessageBox.Show("Do note Exists Screen File:" + screenPath);
         }
     }
     else if (FieldName.Contains("State"))
     {
         string statePath = XDCUnity.eCATPath + @"\XDC\" + folderName + @"\Scripts\State" + XDCUnity.CurrentResourceIndex + @"\Host\" + FieldValue + ".txt";
         if (File.Exists(statePath))
         {
             string        stateText  = XDCUnity.GetTxtFileText(statePath);
             Form_MsgDebug form_Debug = new Form_MsgDebug(stateText, currentProtocolType, DataType.State, FieldValue + ".txt");
             form_Debug.Show();
         }
         else
         {
             MessageBox.Show("Do note Exists State File:" + statePath);
         }
     }
 }
Пример #3
0
        private void Rtb_Msg_DragDrop(object sender, DragEventArgs e)
        {
            Array fileName = (Array)e.Data.GetData(DataFormats.FileDrop);

            if (null != fileName)
            {
                rtb_Msg.Text = XDCUnity.GetTxtFileText(fileName.GetValue(0).ToString());
            }
            else
            {
                rtb_Msg.Text = e.Data.GetData(DataFormats.Text).ToString();
            }
            e.Effect = DragDropEffects.None;
            BeginPars();
        }
 private void Form_Left_SubFormEvent(object subControl, XDCProtocolType protocolType, DataType dataType)
 {
     {
         string text = XDCUnity.GetTxtFileText(subControl.ToString());
         //双击树节点,将数据传至主窗体并格式化显示
         if (dataType == DataType.Screen)
         {
             Form_ScreenParse form_ScreenParse = new Form_ScreenParse(text, protocolType, subControl.ToString());
             form_ScreenParse.Show();
         }
         else
         {
             form_MsgDebug.ParsFromSubForm(text, protocolType, dataType, subControl.ToString());
         }
     }
 }
Пример #5
0
        private void btn_Next_Click(object sender, EventArgs e)
        {
            Button currentButton = (Button)sender;

            if (string.IsNullOrEmpty(currentScreenPath))
            {
                return;
            }
            int    flit_1       = currentScreenPath.LastIndexOf('\\');
            int    flit_2       = currentScreenPath.LastIndexOf('.');
            int    newScreenNum = int.Parse(currentScreenPath.Substring(flit_1 + 1, flit_2 - flit_1 - 1));
            string newPath      = string.Empty;

            switch (currentButton.Name)
            {
            case "btn_Pre":
            {
                //newPath = currentScreenPath.Substring(0, flit_1 + 1) + string.Format("{0:D3}", newScreenNum - 1) + ".txt";
                newPath = GetNextScreenNum(currentScreenPath, flit_1, newScreenNum, true);
            }
            break;

            case "btn_Next":
            {
                // newPath = currentScreenPath.Substring(0, flit_1 + 1) + string.Format("{0:D3}", newScreenNum + 1) + ".txt";
                newPath = GetNextScreenNum(currentScreenPath, flit_1, newScreenNum, false);
            }
            break;

            default:
                break;
            }


            if (File.Exists(newPath))
            {
                rtb_Text.Text     = XDCUnity.GetTxtFileText(newPath);
                currentScreenPath = newPath;
                this.Text         = "ScreenParse - [" + newPath + "]";
            }
        }
Пример #6
0
        private void Pnl_Screen_DragDrop(object sender, DragEventArgs e)
        {
            Array fileName = (Array)e.Data.GetData(DataFormats.FileDrop);

            if (null != fileName)
            {
                rtb_Text.Text = XDCUnity.GetTxtFileText(fileName.GetValue(0).ToString());
            }
            else
            {
                rtb_Text.Text = e.Data.GetData(DataFormats.Text).ToString();
            }
            e.Effect = DragDropEffects.None;


            DrawXDCScreen();
            if (!string.IsNullOrEmpty(rtb_Text.Text.Trim()))
            {
                BegionScreenParse();
            }
        }
Пример #7
0
        private static void GetFilesList(ref TreeNode currentNode, string dirctoryPath)
        {
            DirectoryInfo folder = new DirectoryInfo(XDCUnity.eCATPath + dirctoryPath);

            if (!folder.Exists)
            {
                return;
            }
            foreach (FileInfo fileItem in folder.GetFiles("*.txt"))
            {
                if (!string.IsNullOrEmpty(onlyNode) &&
                    !fileItem.Name.StartsWith(onlyNode))
                {
                    continue;
                }
                TreeNode tn = new TreeNode();
                if (currentNode.Name.EndsWith("ndc_state", StringComparison.OrdinalIgnoreCase))
                {
                    #region 读取状态内的信息 20160330----NDC
                    string stateContent = XDCUnity.GetTxtFileText(fileItem.FullName);
                    string stateFlag    = stateContent.StartsWith("@") ? stateContent.Substring(0, 2) : stateContent.Substring(0, 1);
                    if (stateFlag.Equals("d"))
                    {
                    }
                    if (!stateScan_NDC.ContainsKey(stateFlag))
                    {
                        stateScan_NDC.Add(stateFlag, new List <string> {
                            fileItem.Name.Substring(0, fileItem.Name.Length - 4)
                        });
                    }
                    else
                    {
                        if (!stateScan_NDC[stateFlag].Contains(fileItem.Name.Substring(0, fileItem.Name.Length - 4)))
                        {
                            stateScan_NDC[stateFlag].Add(fileItem.Name.Substring(0, fileItem.Name.Length - 4));
                        }
                    }
                    tn.Text = fileItem.Name.Substring(0, fileItem.Name.Length - 4) + "_" + stateFlag;
                    #endregion
                }
                else if (currentNode.Name.EndsWith("ddc_state", StringComparison.OrdinalIgnoreCase))
                {
                    #region 读取状态内的信息 20160330----DDC
                    string stateContent = XDCUnity.GetTxtFileText(fileItem.FullName);
                    string stateFlag    = stateContent.Contains(" ") ? stateContent.Substring(0, 2) : stateContent.Substring(0, 1);
                    if (stateFlag.Equals("d"))
                    {
                    }
                    if (!stateScan_DDC.ContainsKey(stateFlag))
                    {
                        stateScan_DDC.Add(stateFlag, new List <string> {
                            fileItem.Name.Substring(0, fileItem.Name.Length - 4)
                        });
                    }
                    else
                    {
                        if (!stateScan_DDC[stateFlag].Contains(fileItem.Name.Substring(0, fileItem.Name.Length - 4)))
                        {
                            stateScan_DDC[stateFlag].Add(fileItem.Name.Substring(0, fileItem.Name.Length - 4));
                        }
                    }
                    tn.Text = fileItem.Name.Substring(0, fileItem.Name.Length - 4) + "_" + stateFlag;
                    #endregion
                }
                else
                {
                    tn.Text = fileItem.Name.Substring(0, fileItem.Name.Length - 4);
                }
                tn.Name = currentNode.Name + "_" + fileItem.Name;
                tn.Tag  = fileItem.FullName;
                currentNode.Nodes.Add(tn);
            }
        }