GetResourceTokenResourceValues() public method

public GetResourceTokenResourceValues ( string tokenValue ) : string>>.List
tokenValue string
return string>>.List
コード例 #1
0
        public bool ValidateWebPartOnPages(ProvisioningTemplate template, TokenParser parser)
        {
            var web = cc.Web;
            var file = template.Files.First();
            var folderName = parser.ParseString(file.Folder);
            var url = folderName + "/" + template.Connector.GetFilenamePart(file.Src);
            var resourceValues = parser.GetResourceTokenResourceValues(file.WebParts.First().Title);
            var ok = ValidatePartOnPage(parser, resourceValues, web, url);
            if (!ok) return false;

            var page = template.Pages.First();
            url = parser.ParseString(page.Url);
            resourceValues = parser.GetResourceTokenResourceValues(file.WebParts.First().Title);
            ok = ValidatePartOnPage(parser, resourceValues, web, url);
            return ok;
        }
コード例 #2
0
        private bool ValidateResourceEntries(TokenParser sParser, TokenParser tParser, string sTokenValue, string tTokenValue)
        {
            int sCount = 0;
            int tCount = 0;
            bool isValid = false;

            var sResValues = sParser.GetResourceTokenResourceValues(sTokenValue);
            var tResValues = tParser.GetResourceTokenResourceValues(tTokenValue);

            foreach (var sResVal in sResValues)
            {
                sCount++;
                var tResItem = tResValues.Where(t => t.Item1.ToLower().Equals(sResVal.Item1.ToLower())).FirstOrDefault();
                if (tResItem != null && tResItem.Item2.ToLower() == sResVal.Item2.ToLower())
                {
                    tCount++;
                    break;
                }
            }

            if (sCount == tCount) { isValid = true; }
            return isValid;
        }
コード例 #3
0
        public bool ValidateListView(ProvisioningTemplate template, TokenParser parser)
        {
            var web = cc.Web;
            cc.Load(web.Lists);
            cc.ExecuteQueryRetry();
            var allOk = true;
            foreach (var listDef in template.Lists)
            {
                var list = web.GetListByUrl(listDef.Url);
                foreach (var viewDef in listDef.Views)
                {
                    XElement currentXml = XElement.Parse(viewDef.SchemaXml);
                    var viewUrl = currentXml.Attribute("Url").Value;
                    var dispName = currentXml.Attribute("DisplayName").Value;
                    if (dispName.ContainsResourceToken())
                    {
                        var resourceValues = parser.GetResourceTokenResourceValues(dispName);
                        foreach (var resourceValue in resourceValues)
                        {
                            list.Context.PendingRequest.RequestExecutor.WebRequest.Headers["Accept-Language"] = resourceValue.Item1;
                            list.Context.Load(list.Views);
                            list.Context.ExecuteQueryRetry();
                            var view = list.Views.Single(v => v.ServerRelativeUrl.EndsWith(viewUrl));
                            if (!view.Title.Equals(resourceValue.Item2)) {
                                allOk = false;
                            }
                        }
                    }
                }

            }
            return allOk;
        }