Пример #1
0
        private bool ChangeConfigurationValue(ParseContext context, XObject x, string currentValue, out string newValue)
        {
            var valueModified = ChangeConfigurationStringValue(context, currentValue, out newValue);

            // first check for type converter
            var attributeDefinition = GetAttribute(x);

            if (attributeDefinition != null)
            {
                if (attributeDefinition.TypeName == "PathType")
                {
                    newValue = ProcsDE.GetFileName(x, newValue);

                    valueModified |= true;
                }
                else if (attributeDefinition.TypeName == "PathArray")
                {
                    newValue = Procs.JoinPaths(Procs.SplitPaths(newValue).Select(c => ProcsDE.GetFileName(x, c)));

                    valueModified |= true;
                }
                else if (attributeDefinition.TypeName == "CertificateType")
                {
                    if (String.IsNullOrEmpty(newValue) || !newValue.StartsWith("store://"))
                    {
                        newValue       = ProcsDE.GetFileName(x, newValue);
                        valueModified |= true;
                    }
                }
            }

            return(valueModified);
        }         // func ChangeConfigurationValue
Пример #2
0
        public void XmlSplitPaths()
        {
            var t = Procs.SplitPaths("a b c").ToArray();

            Assert.AreEqual("a", t[0]);
            Assert.AreEqual("b", t[1]);
            Assert.AreEqual("c", t[2]);

            t = Procs.SplitPaths("a \"b\" \"c\\\"").ToArray();
            Assert.AreEqual("a", t[0]);
            Assert.AreEqual("b", t[1]);
            Assert.AreEqual("c\\", t[2]);
        }