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


C# Asset.GetContent方法代码示例

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


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

示例1: AutoLinkLocales

        public static void AutoLinkLocales(Asset aContentSource, Asset aContentDest, string szSitePath)
        {
            if (!Asset.Load(szSitePath + "/Relationships Config/" + aContentSource.Id.ToString() + "-" + aContentDest.Id.ToString()).IsLoaded)
            {
                Asset aRelationship = Asset.CreateNewAsset(aContentSource.Id.ToString() + "-" + aContentDest.Id.ToString(), Asset.Load(szSitePath + "/Relationships Config/"), Asset.Load("/System/Translation Model Framework/_Models/Relationship/Relationship"), new Dictionary<string, string>());

                Dictionary<string, string> dtTmpContent = new Dictionary<string, string>();
                dtTmpContent.Add("source_id", aContentSource.Id.ToString());
                dtTmpContent.Add("destination_id", aContentDest.Id.ToString());
                dtTmpContent.Add("source_last_modified_date", aContentSource.ModifiedDate.ToString());
                dtTmpContent.Add("filter_string", "|" + aContentSource.Id.ToString() + "|" + aContentDest.Id.ToString() + "|");

                foreach (KeyValuePair<string, string> kvpData in aContentSource.GetContent())
                {
                    if (!string.Equals(kvpData.Key.Substring(0, 1), "_", StringComparison.OrdinalIgnoreCase))
                        dtTmpContent.Add("sourceOld_" + kvpData.Key, kvpData.Value);
                }

                aRelationship.SaveContent(dtTmpContent);
            }
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:21,代码来源:IhSiteBuilderHelper.cs

示例2: FixRelativeLinks

        public static void FixRelativeLinks(Asset aContentDest, Asset aSourceLanguageContent, Asset aDestLanguageContent, string szSitePath)
        {
            //Out.DebugWriteLine("FixRelativeLinks starts");
            string szCurrId = aContentDest.Id.ToString();

            foreach (KeyValuePair<string, string> kvpData in aContentDest.GetContent())
            {
                if (kvpData.Key.StartsWith("upload#"))
                {
                    Asset aLinkedItem = Asset.Load(kvpData.Value);
                    string szSourcePath = aLinkedItem.AssetPath.ToString();
                    string szDestinationPath = szSourcePath.Replace(aSourceLanguageContent["folder_root"], aDestLanguageContent["folder_root"]);

                    int nFixLinkFlag = 0;
                    if (Asset.Load(szDestinationPath).IsLoaded && !string.Equals(szSourcePath, szDestinationPath))
                    {
                        nFixLinkFlag = 1;
                    }
                    else
                    {
                        string szDestinationId = "";
                        foreach (Asset aConfig in GetRelList(aLinkedItem.Id, "source", szSitePath))
                        {
                            if (Asset.Load(aConfig["destination_id"]).AssetPath.ToString().ToLower().Contains(aDestLanguageContent["folder_root"].ToLower()))
                            {
                                szDestinationId = aConfig["destination_id"];
                                break;
                            }
                        }

                        if (!string.IsNullOrWhiteSpace(szDestinationId))
                        {
                            szDestinationPath = szDestinationId;
                            nFixLinkFlag = 1;

                        }
                        else
                            nFixLinkFlag = 0;
                    }

                    if (int.Equals(nFixLinkFlag, 1))
                    {
                        Asset aCurrId = Asset.Load(szCurrId);
                        aCurrId.DeleteContentField(kvpData.Key);

                        Asset aItemDest = Asset.Load(szDestinationPath);
                        //TODO: FixRelativeLinks (_cmsIdPath)
                        aCurrId.SaveContentField(kvpData.Key, "/cpt_internal/" + aItemDest.Id.ToString());
                    }
                }
            }
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:52,代码来源:IhSiteBuilderHelper.cs

示例3: GetAssetContent

        private string GetAssetContent(Asset asset)
        {
            StringBuilder sbOutput = new StringBuilder();
            foreach (KeyValuePair<string, string> kvpField in asset.GetContent())
            {
                string szKey = ReplaceTextValues(kvpField.Key);
                string szValue = ReplaceTextValues(ReplaceCptInternalPath(kvpField.Value));

                sbOutput.AppendLine(string.Format("<content_field key=\"{0}\"><![CDATA[{1}]]></content_field>", szKey, szValue));
            }
            return sbOutput.ToString();
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:12,代码来源:IhSiteBuilderExport.cs


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