当前位置: 首页>>代码示例>>C#>>正文


C# Tracer.Attach方法代码示例

本文整理汇总了C#中Tracer.Attach方法的典型用法代码示例。如果您正苦于以下问题:C# Tracer.Attach方法的具体用法?C# Tracer.Attach怎么用?C# Tracer.Attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tracer的用法示例。


在下文中一共展示了Tracer.Attach方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetQueryResults

        public List<BugReport> GetQueryResults()
        {
            SetSource (SplatterCore.Instance.Sources[SourceId]);
            Console.WriteLine ("Making query");
            List<BugReport> results = new List<BugReport> ();

            Tracer trace = new Tracer();
            trace.Attach(bugProxy);

            GetBugsResponse result = bugProxy.SearchBugs (queryParameters);
            Console.WriteLine ("Query finished with {0} results", result.bugs.Length);
            foreach (BugReport bug in result.bugs) {
                results.Add (bug);
            }

            return results;
        }
开发者ID:skyronic,项目名称:splatter,代码行数:17,代码来源:QueryService.cs

示例2: TryLogin

        public bool TryLogin(string login, string password)
        {
            Console.WriteLine ("Logging in");
            LoginParams loginParams = new LoginParams();
            loginParams.login = login;
            loginParams.password = password;
            loginParams.remember = true;
            try
            {
                Tracer trace = new Tracer();
                trace.Attach(userProxy);
                XmlRpcStruct loginResult = userProxy.Login(loginParams);
                trace.Detach(userProxy);
                if((int)loginResult["id"] == 0)
                {
                    Console.WriteLine ("User/pass invalid");
                    return false;
                }

            }
            catch(XmlRpcFaultException ex)
            {
                if(ex.FaultCode == 300)
                {
                    Console.WriteLine ("Username invalid");
                    return false;
                }
                Console.WriteLine ("Some strange error");
                return false;
            }
            catch(Exception ex)
            {
                Console.WriteLine ("Unknown error" + ex.Message);
                return false;
            }

            // If the code reaches here, the login is valid
            Console.WriteLine ("Login succeeded");

            // yum :)
            LoginCookies = userProxy.ResponseCookies;

            CookieDict = new Dictionary<string, string[]>();
            CookieList = new List<string[]>();

            foreach(Cookie c in LoginCookies)
            {
                //CookieDict[c.Name] = new string[] {c.Value, c.Path, c.Domain};
                CookieList.Add(new string[] {c.Name, c.Value, c.Path, c.Domain});
            }

            LoggedIn = true;

            return true;
        }
开发者ID:skyronic,项目名称:splatter,代码行数:55,代码来源:UserService.cs

示例3: PostComment

        public bool PostComment(int bugId, string text)
        {
            Console.WriteLine ("Posting comment");
            // Set the source if it hasn't been set alreayd
            Generator.SetSource (SplatterCore.Instance.Sources[this.SourceID]);

            Tracer trace = new Tracer();
            trace.Attach(Generator.bugProxy);
            PostCommentParams postCommentParams = new PostCommentParams();
            postCommentParams.id = bugId;
            postCommentParams.comment = text;

            // Make the request;
            XmlRpcStruct result;
            try{
            result = Generator.bugProxy.PostComment(postCommentParams);
            }
            catch{
                return false;
            }

            // This is probably stupid. Let's reconstruct the entire comment :);
            Comment target = new Comment();
            target.bug_id = bugId;
            target.id = (int)result["id"];
            target.text = text;

            // Retrieve the author
            this.Source = SplatterCore.Instance.Sources[SourceID];
            target.author = Source.UserName;

            target.time = DateTime.Now;
            //target.is_private = false;

            // Add the comment to the bug
            BugReport bug = BugFromBugId(bugId);

            bug.Comments.Add(target);

            return true;
        }
开发者ID:skyronic,项目名称:splatter,代码行数:41,代码来源:QueryService.cs


注:本文中的Tracer.Attach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。