Ejemplo n.º 1
0
        ///
        /// <summary>
        /// Imports IP addresses from file
        /// </summary>
        /// <param name="filePath">File path of IP txt file</param>
        /// <param name="usedTarget">Target that contains the settings that will be used by the imported addresses</param>
        /// <returns></returns>
        public List <TargetSettings> importIPFile(string filePath, string usedTarget)
        {
            TargetSettings tsToUse   = new TargetSettings();
            List <string>  lstAllIPs = new List <string>();

            foreach (TargetSettings ts in _lstTargets)
            {
                if (ts.TargetServer == usedTarget)
                {
                    tsToUse = ts;                                     //Settings that will be used
                }
                lstAllIPs.Add(ts.TargetServer);
            }
            ImportIPs             impIPs = new ImportIPs(tsToUse, filePath, lstAllIPs); //Reads file and creates a list of new targets
            List <TargetSettings> newIPs = impIPs.getTargets();                         //Retreives new target list

            try
            {
                foreach (TargetSettings ts in newIPs)
                {
                    addTarget(ts);
                }
                return(newIPs); //Only want the new targets
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        ///
        /// <summary>
        /// Imports IP addresses from file
        /// </summary>
        /// <param name="filePath">File path of IP txt file</param>
        /// <param name="usedTarget">Target that contains the settings that will be used by the imported addresses</param>
        /// <returns></returns>
        public List<TargetSettings> importIPFile(string filePath, string usedTarget)
        {
            TargetSettings tsToUse = new TargetSettings();
              List<string> lstAllIPs = new List<string>();

              foreach(TargetSettings ts in _lstTargets)
              {
            if(ts.TargetServer == usedTarget)
            {
              tsToUse = ts;                                               //Settings that will be used
            }
            lstAllIPs.Add(ts.TargetServer);
              }
              ImportIPs impIPs = new ImportIPs(tsToUse, filePath, lstAllIPs); //Reads file and creates a list of new targets
              List<TargetSettings> newIPs = impIPs.getTargets();             //Retreives new target list

              try
              {
            foreach(TargetSettings ts in newIPs)
            {
              addTarget(ts);
            }
            return newIPs;    //Only want the new targets
              }
              catch
              {
            return null;
              }
        }