Esempio n. 1
0
        public static void ImportTestSettings(
            ISettingsCmdletBaseDataObject cmdlet,
            string path,
            string[] variableNames)
        {
            XElement wholeXML =
                XElement.Load(path);

            // default result
            Func <IEnumerable <string>, XElement, bool> query = (variableNamesCollection, variableElement) => true;

//            cmdlet.WriteVerbose(cmdlet, "checking the VariableName list");
            if (null != variableNames && variableNames.Any())
            {
//                cmdlet.WriteVerbose(cmdlet, "the VariableName list is not empty");
                query = (variableNamesCollection, variableElement) => variableNamesCollection.Contains(variableElement.Attribute((XName)"name").Value);
            }

//            cmdlet.WriteVerbose(cmdlet, "getting the variables collection");
            var variablesCollection =
                from variableElement in wholeXML.Elements()
                where query(((IEnumerable <string>)variableNames), variableElement)
                select variableElement;

//            cmdlet.WriteVerbose(cmdlet, "collection created");

            if (null == variablesCollection || !variablesCollection.Any())
            {
//                cmdlet.WriteVerbose(cmdlet, "there are no variables to import");
                return;
            }

            // 20140721
            // TmxHelper.ImportVariables(cmdlet, variablesCollection);
            // 20160116
            // ImportExportHelper.ImportVariables(cmdlet, variablesCollection);
        }
Esempio n. 2
0
        public static void ImportTestSettings(
            ISettingsCmdletBaseDataObject cmdlet,
            string path,
            string[] variableNames)
        {
            XElement wholeXML =
                XElement.Load(path);
            
            // default result
            Func<IEnumerable<string>, XElement, bool> query = (variableNamesCollection, variableElement) => true;
            
//            cmdlet.WriteVerbose(cmdlet, "checking the VariableName list");
            if (null != variableNames && variableNames.Any()) {
//                cmdlet.WriteVerbose(cmdlet, "the VariableName list is not empty");
                query = (variableNamesCollection, variableElement) => variableNamesCollection.Contains(variableElement.Attribute((XName)"name").Value);
            }
            
//            cmdlet.WriteVerbose(cmdlet, "getting the variables collection");
            var variablesCollection = 
                from variableElement in wholeXML.Elements()
                where query(((IEnumerable<string>)variableNames), variableElement)
                    select variableElement;
            
//            cmdlet.WriteVerbose(cmdlet, "collection created");
            
            if (null == variablesCollection || !variablesCollection.Any()) {
//                cmdlet.WriteVerbose(cmdlet, "there are no variables to import");
                return;
            }
            
            // 20140721
            // TmxHelper.ImportVariables(cmdlet, variablesCollection);
            // 20160116
            // ImportExportHelper.ImportVariables(cmdlet, variablesCollection);
        }