示例#1
0
        public static void AddDefaultExtractSettingsToAsset(Asset asset, string siteRootParentAssetId)
        {
            // Get starting path for all other paths
              var parentAssetId = int.Parse(siteRootParentAssetId);
              var parentAsset = Asset.LoadDirect(parentAssetId);
              var basePath = parentAsset.AssetPath.ToString();

              // Get paths needed by the site builder tool
              var pro_library_folder = Asset.LoadDirect(basePath + "/Project/Library").GetLink(LinkType.Internal);

              if (string.IsNullOrEmpty(pro_library_folder))
              pro_library_folder = Asset.LoadDirect(basePath + "/Project/Client Library").GetLink(LinkType.Internal);

              var pro_model_folder = Asset.LoadDirect(basePath + "/Project/Models").GetLink(LinkType.Internal);
              var pro_nav_wrap_location = Asset.LoadDirect(basePath + "/Project/Templates/MasterPage").GetLink(LinkType.Internal);
              var pro_project_folder = Asset.LoadDirect(basePath + "/Project").GetLink(LinkType.Internal);
              var pro_site_root_folder = Asset.LoadDirect(basePath + "/Site Root").GetLink(LinkType.Internal);
              var pro_template_folder = Asset.LoadDirect(basePath + "/Project/Templates").GetLink(LinkType.Internal);

              var fields = new Dictionary<string, string>();
              fields.Add("export_site_option", "yes");
              fields.Add("extract_type", "project");
              fields.Add("include_binaries", "true");
              fields.Add("include_contents", "true");
              fields.Add("include_wrappers", "true");
              fields.Add("pro_library_folder", pro_library_folder);
              fields.Add("pro_model_folder", pro_model_folder);
              fields.Add("pro_nav_wrap_location", pro_nav_wrap_location);
              fields.Add("pro_project_folder", pro_project_folder);
              fields.Add("pro_site_root_folder", pro_site_root_folder);
              fields.Add("pro_template_folder", pro_template_folder);

              asset.SaveContent(fields);
        }