コード例 #1
0
        public static IO.Branch.Indexing.BranchUniversalObject ToNativeBUO(BranchUniversalObject buo)
        {
            IO.Branch.Indexing.BranchUniversalObject resBuo = new IO.Branch.Indexing.BranchUniversalObject();

            foreach (string keyword in buo.keywords)
            {
                resBuo.AddKeyWord(keyword);
            }

            foreach (string key in buo.metadata.Keys)
            {
                resBuo.AddContentMetadata(key, buo.metadata[key]);
            }

            resBuo.SetCanonicalIdentifier(buo.canonicalIdentifier);
            resBuo.SetCanonicalUrl(buo.canonicalUrl);
            resBuo.SetTitle(buo.title);
            resBuo.SetContentDescription(buo.contentDescription);
            resBuo.SetContentImageUrl(buo.imageUrl);
            resBuo.SetContentType(buo.type);

            if (buo.contentIndexMode == 0)
            {
                resBuo.SetContentIndexingMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Public);
            }
            else
            {
                resBuo.SetContentIndexingMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Private);
            }

            Java.Util.Date date = new Java.Util.Date(buo.expirationDate.HasValue ? (buo.expirationDate.Value.Ticks / 10000) : 0);
            resBuo.SetContentExpiration(date);

            return(resBuo);
        }
コード例 #2
0
        public static IO.Branch.Indexing.BranchUniversalObject ToNativeBUO(BranchUniversalObject buo)
        {
            IO.Branch.Indexing.BranchUniversalObject resBuo = new IO.Branch.Indexing.BranchUniversalObject();

            resBuo.SetCanonicalIdentifier(buo.canonicalIdentifier);
            resBuo.SetCanonicalUrl(buo.canonicalUrl);
            resBuo.SetTitle(buo.title);
            resBuo.SetContentDescription(buo.contentDescription);
            resBuo.SetContentImageUrl(buo.imageUrl);

            if (buo.contentIndexMode == 0)
            {
                resBuo.SetContentIndexingMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Public);
            }
            else
            {
                resBuo.SetContentIndexingMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Private);
            }

            if (buo.localIndexMode == 0)
            {
                resBuo.SetLocalIndexMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Public);
            }
            else
            {
                resBuo.SetLocalIndexMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Private);
            }

            Java.Util.Date date = new Java.Util.Date(buo.expirationDate.HasValue ? (buo.expirationDate.Value.Ticks / 10000) : 0);
            resBuo.SetContentExpiration(date);

            foreach (string keyword in buo.keywords)
            {
                resBuo.AddKeyWord(keyword);
            }

            JSONObject dict = new JSONObject(buo.metadata.ToJsonString());

            if (dict != null)
            {
                IO.Branch.Referral.Util.ContentMetadata cmd =
                    IO.Branch.Referral.Util.ContentMetadata.CreateFromJson(new IO.Branch.Referral.BranchUtil.JsonReader(dict));

                if (cmd != null)
                {
                    resBuo.SetContentMetadata(cmd);
                }
            }

            return(resBuo);
        }