예제 #1
0
        public static void AddKeyboardInputTask(ref string strBase64, bool bCapsLock, bool bNumLock, bool bScrollLock)
        {
            if (string.IsNullOrEmpty(strBase64))
            {
                AppInsights.LogException("AddKeyboardInputTask", "strBase64 is null");
                return;
            }

            var keyboardTaskDescription = GenerateCSCode.GetDecodedKeyboardInput(strBase64, bCapsLock, bNumLock, bScrollLock);

            StringBuilder sb = new StringBuilder();

            foreach (var strLine in keyboardTaskDescription)
            {
                sb.Append(GenerateXPath.XmlEncode(strLine));
            }

            RecordedUiTask lastRecordedUi = null;

            lock (RecordedUiTask.s_lockRecordedUi)
            {
                if (RecordedUiTask.s_listRecordedUi.Count > 0)
                {
                    lastRecordedUi = RecordedUiTask.s_listRecordedUi.Last();
                }
            }

            if (lastRecordedUi != null && lastRecordedUi.UiTaskName == EnumUiTaskName.KeyboardInput)
            {
                lastRecordedUi.AppendKeyboardInput(strBase64);
            }
            else
            {
                var keyboarTask = new RecordedUiTask(EnumUiTaskName.KeyboardInput, strBase64, bCapsLock, bScrollLock, bNumLock);
                MainWindow.AddRecordedUi(keyboarTask);
            }

            strBase64 = null;
        }
예제 #2
0
        static List <string> GetRootToLeafNodes(string strLeafToRoot)
        {
            if (string.IsNullOrEmpty(strLeafToRoot))
            {
                AppInsights.LogException("GetRootToLeafNodes", "strLeafToRoot is null");
                return(null);
            }

            List <string> listRet = new List <string>();
            string        patNode = "/[^\n]+\n";

            System.Text.RegularExpressions.Regex regNode = new System.Text.RegularExpressions.Regex(patNode, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            if (regNode != null && string.IsNullOrEmpty(strLeafToRoot) == false)
            {
                System.Text.RegularExpressions.Match matchNode = regNode.Match(strLeafToRoot);
                while (matchNode.Success)
                {
                    listRet.Insert(0, matchNode.Value.Substring(0, matchNode.Value.Length - 1));
                    matchNode = matchNode.NextMatch();
                }
            }

            return(listRet);
        }