Example #1
0
        /// <summary>
        /// Saves the sample.
        /// </summary>
        /// <param name="sampleName">Name of the sample.</param>
        /// <param name="sample">The sample.</param>
        /// <returns></returns>
        public FileInfo saveSample(string sampleName, webSiteSimpleSample sample)
        {
            sampleName = Path.GetFileNameWithoutExtension(sampleName);
            sampleName = sampleName.ensureEndsWith(".xml");
            string path = folder[ACFolders.samples].pathFor(sampleName);
            webSiteSimpleSample simpleSample = sample;

            objectSerialization.saveObjectToXML(simpleSample, path);
            return(new FileInfo(path));
        }
Example #2
0
        /// <summary>
        /// Loads the sample.
        /// </summary>
        /// <param name="sampleName">Name of the sample.</param>
        /// <returns></returns>
        public webSiteSimpleSample loadSample(string sampleName, bool random = false)
        {
            sampleName = sampleName.ensureEndsWith(".xml");
            string path = folder[ACFolders.samples].pathFor(sampleName);
            webSiteSimpleSample output = objectSerialization.loadObjectFromXML(path, typeof(webSiteSimpleSample)) as webSiteSimpleSample;

            if (random)
            {
                output.Randomize();
            }
            return(output);
        }
Example #3
0
        /// <summary>
        /// Adds any new domains from the source
        /// </summary>
        /// <param name="source">The source.</param>
        /// <returns></returns>
        public int Add(webSiteSimpleSample source, int start = 0, int take = -1)
        {
            int c = 0;
            int i = 0;

            if (take == -1)
            {
                take = source.Count - start;
            }

            foreach (string domain in source.domains)
            {
                if ((i >= start) && (i < (start + take)))
                {
                    domainAnalysis da = new domainAnalysis(domain);
                    if (Add(da.urlProper))
                    {
                        c++;
                    }
                }
                i++;
            }
            return(c);
        }