コード例 #1
0
        private static List <string> GetComputerNamesFromString(string computerNameInfo)
        {
            computerNameInfo = computerNameInfo.Trim( );
            if (string.IsNullOrEmpty(computerNameInfo))
            {
                return(new List <string>( ));
            }
            var computerNames = MagicValues.DeleniateComputerList(computerNameInfo);
            var result        = new List <string>( );

            foreach (var computerName in computerNames)
            {
                if (IsFile(computerName))
                {
                    result.AddRange(GetComputerNamesFromFile(computerName));
                }
                else
                {
                    result.Add(computerName);
                }
            }

            return(result.Where(name => !string.IsNullOrEmpty(name.Trim( ))).OrderBy(name => name).Distinct( ).ToList( ));
        }
コード例 #2
0
 private static IEnumerable <string> GetComputerNamesFromFile(string fileName)
 {
     fileName = MagicValues.StripSurroundingDblQuotes(fileName);
     Helpers.Assert(IsFile(fileName), "File does not exist");
     return(MagicValues.DeleniateComputerList(File.ReadAllText(fileName)));
 }