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


C# Snippet.PrintNull方法代码示例

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


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

示例1: StoreHit

        public bool StoreHit(Snippet snippet)
        {
            //check input validity:
            if (snippet == null)
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, string.Format("Input error: snippet={0}", snippet.PrintNull()));
                return false;
            }

            //send the request and parse the response:
            S2CResObj<object> resp = SendReqObj("SnippetHit/" + snippet.ID, string.Empty, true, false);

            //build the result:
            return ParseBoolResponse(resp);
        }
开发者ID:modulexcite,项目名称:snip2codeNET,代码行数:15,代码来源:SnippetsWS.cs

示例2: StoreCopyAction

        public bool StoreCopyAction(Snippet snippet, bool embedded)
        {
            //check input validity:
            if (snippet == null)
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, string.Format("Input error: snippet={0}", snippet.PrintNull()));
                return false;
            }

            //send the request and parse the response:
            S2CResObj<object> resp = SendReqObj("Explore/WhoCopy?snippetId=" + snippet.ID + "&embedded=" + embedded, 
                                string.Empty, true, false);

            //build the result:
            return ParseBoolResponse(resp);
        }
开发者ID:modulexcite,项目名称:snip2codeNET,代码行数:16,代码来源:SnippetsWS.cs

示例3: SaveSnippet

        /////////////////////////////////////////////////////////////////////////////////////////////////////


        #region Create/Add/Modify Methods
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        ///// <summary>
        ///// Create a Snippet having Owner and Creator = CurrentUser
        ///// </summary>
        //public long SaveSnippet(Snippet snippet)
        //{
        //    //Check that the client has been already logged in, and if this is not the case, automatically login:
        //    if (!CheckLogin())
        //    {
        //        SetLastError(log, "Cannot login into the system");
        //        return -1;
        //    }

        //    snippet.TargetGroupID = CurrentUser.PersonalGroupID;
        //    return CreateSnippet(snippet, CurrentUser);
        //}


        public long SaveSnippet(Snippet snippet)
        {
            if ((snippet == null) || (snippet.AreFieldsValid() != SnippetWrongField.OK))
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, 
                    string.Format("Input error: snippet={0}, creator={1}", snippet.PrintNull(), CurrentUser.PrintNull()));
                return -1;
            }

            //Check that the client has been already logged in, and if this is not the case, automatically login:
            if (!CheckLogin())
            {
                SetLastError(log, ErrorCodes.NOT_LOGGED_IN, "Cannot login into the system");
                return -1;
            }

            //send the request and parse the response:
            string contentToSend = "content=" + HttpUtility.UrlEncode(snippet.Serialize(m_serialFormat));
            S2CResObj<object> resp = SendReqObj(CREATE_SNIPPET_URL, contentToSend, true);

            //build the result:
            long result = ParseLongResponse(resp);
            if (result == -1)
            {
                //check if the Status is TARGET_GROUP_INVALID:
                if ((resp != null) && (resp.Status == ErrorCodes.TARGET_GROUP_DELETED))
                    return -2;
            }
            return result;
        }
开发者ID:modulexcite,项目名称:snip2codeNET,代码行数:52,代码来源:SnippetsWS.cs


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