コード例 #1
0
        /// <summary>
        /// Simple user question selector. returns a object of the result.
        /// </summary>
        /// <param name="question"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private Object Ask(string question, AskType type)
        {
            string answear = Ask(question);

            switch (type)
            {
            case AskType.YesNo:
                if (answear == "y")
                {
                    return(true);
                }
                if (answear == "n")
                {
                    return(false);
                }
                break;

            case AskType.Sauce:
                return(Enum.Parse(typeof(Sauce), answear, true));

            case AskType.Bread:
                return(Enum.Parse(typeof(Bread), answear, true));

            default:
                return(answear);
            }
            return(answear);
        }
コード例 #2
0
 public XmppPersonModel(Jid jid, string nick, XmppProtocolManager protocolManager)
     : base(jid, nick, protocolManager.NetworkID, protocolManager.Protocol, protocolManager)
 {
     Trace.Call(jid, nick, protocolManager);
     Jid          = jid.Bare;
     Resources    = new Dictionary <string, XmppResourceModel>();
     Ask          = AskType.NONE;
     Subscription = SubscriptionType.none;
     Temporary    = true;
     if (!String.IsNullOrEmpty(jid.Resource))
     {
         GetOrCreateResource(jid);
     }
 }
コード例 #3
0
    public bool DownloadAsync(string file, System.Object obj, DownloadHandler handler, AskType askType, ResourceType resType)
    {
        //已经加载
        AssetBundle asset = GetFromMemory(file);

        if (asset != null)
        {
            if (handler != null)
            {
                handler(obj, asset);
            }
            return(true);
        }
        Resource res = GetInDownloadList(file);

        if (res != null)
        {
            OwnerInfo info;
            info.obj     = obj;
            info.handler = handler;
            res.objects.Add(info);
            //LogManager.Log("Add Handler to res :" + res.FilePath);
            return(true);
        }

        res = new Resource();
        OwnerInfo inf;

        inf.obj     = obj;
        inf.handler = handler;
        res.objects.Add(inf);
        res.FilePath = file;
        res.type     = askType;
        res.ResType  = resType;

        //这里和ProcessDownload数据同步是否有问题?
        requestList.Add(res);

        return(true);
    }
コード例 #4
0
 // 由于资源被打包后无法直接判断出是否加密,暂时由使用者来判断 [3/27/2012 Ivan]
 public bool DownloadAsync(string file, System.Object obj, DownloadHandler handler, AskType askType)
 {
     return(DownloadAsync(file, obj, handler, askType, ResourceType.RT_Normal));
 }
コード例 #5
0
ファイル: Doner.cs プロジェクト: sebhero/DonerMaker
        /// <summary>
        /// Simple user question selector. returns a object of the result.
        /// </summary>
        /// <param name="question"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private Object Ask(string question, AskType type)
        {
            string answear = Ask(question);
            switch (type)
            {
                case AskType.YesNo:
                    if (answear == "y")
                        return true;
                    if (answear == "n")
                        return false;
                    break;

                case AskType.Sauce:
                    return Enum.Parse(typeof (Sauce), answear, true);
                case AskType.Bread:
                    return Enum.Parse(typeof (Bread), answear, true);
                default:
                    return answear;
            }
            return answear;
        }