Beispiel #1
0
        private string ProcessSnippetFunction(CodeSnippetDeclaration d)
        {
            // This item is obfuscated and can not be translated.
            if (!Regex.IsMatch(d.get_Function().Trim(), @"ClassName\s*\(\s*\)", RegexOptions.IgnoreCase))
            {
                Match match = Regex.Match(d.get_Function().Trim(), @"SimpleTypeName\s*\((.*)\)", RegexOptions.IgnoreCase);
                if (match.Success)
                {
                    string str2 = match.Groups[1].Value.Trim();
                    if (str2.StartsWith("global::"))
                    {
                        str2 = str2.Substring("global::".Length);
                    }
                    return(str2);
                }
                if (d.get_Function().Trim() == "DateTime.Now.Year")
                {
                    return(DateTime.Now.Year.ToString());
                }
                if (d.get_Function().Trim() == "DateTime.Now.Month")
                {
                    return(DateTime.Now.Month.ToString());
                }
                if (d.get_Function().Trim() == "DateTime.Now.Day")
                {
                    return(DateTime.Now.Day.ToString());
                }
                return(null);
            }
            SemanticParserService.WaitForParse(SemanticParserServiceRequest.GetParseHashKey(base.get_Document(), base.get_Document()), 0x7d0);
            IAstNode node = base.get_Document().get_SemanticParseData() as IAstNode;

            if (node != null)
            {
                for (IAstNode node2 = node.FindNodeRecursive(base.get_Caret().get_Offset()); node2 == null; node2 = node2.get_ParentNode())
                {
Label_0065:
                    if (0 == 0)
                    {
                        if (node2 != null)
                        {
                            return(((ClassDeclaration)node2).get_FullName().Split(new char[] { '.', '+' }).Last <string>());
                        }
                        goto Label_00B6;
                    }
                }
                goto Label_0065;
            }
Label_00B6:
            return(null);
        }