static void create()
        {
            Console.WriteLine("Creating...");
            var baseDir = new FSODirectory(sourcePath, FSOType.RootDirectory)
            {
                Info = info
            };
            var subObjs = baseDir.trawlRecursively(new NominalRTM(prompt, sourcePath), false);

            baseDir.update();
            var objs = new List <FSOBase>();

            objs.Add(baseDir);
            objs.AddRange(subObjs);
            side1 = new Integrator(integratorTypes, 1, objs.Count);
            for (int i = 0; i < objs.Count; i++)
            {
                side1.set_block(0, i, objs[i].createElements());
            }
            if (serializeIntegration)
            {
                var sav = new BinaryLoaderSaver();
                side1.save(sav);
                File.WriteAllBytes(integrationFile, sav.data);
            }
            else
            {
                var sav = new XMLLoaderSaver();
                side1.save(sav);
                File.WriteAllText(integrationFile, sav.data);
            }
        }
Esempio n. 2
0
        public virtual FSOBase[] trawlRecursively(IRecursiveTrawlerManager rtm, Boolean doUpdates)
        {
            if (info)
            {
                Console.WriteLine("Recursively Trawling: " + path);
            }
            var toret = new List <FSOBase>();

            subFSO.Clear();
            var localObjs = new List <FSOBase>();
            var files     = new List <String>(Directory.EnumerateFiles(path));

            for (int i = 0; i < files.Count; i++)
            {
                var c = new FSOFile(files[i])
                {
                    Info = this.info
                };
                if (rtm.shouldTrawl(c))
                {
                    if (doUpdates)
                    {
                        c.update();
                    }
                    toret.Add(c);
                    localObjs.Add(c);
                }
            }
            var dirs = new List <String>(Directory.EnumerateDirectories(path));

            for (int i = 0; i < dirs.Count; i++)
            {
                var c = new FSODirectory(dirs[i])
                {
                    Info = this.info
                };
                if (rtm.shouldTrawl(c))
                {
                    toret.Add(c);
                    localObjs.Add(c);
                    toret.AddRange(c.trawlRecursively(rtm, doUpdates));
                    if (doUpdates)
                    {
                        c.update();
                    }
                }
            }
            subFSO.AddRange(localObjs);
            return(toret.ToArray());
        }
Esempio n. 3
0
        public virtual FSOBase[] trawl(Boolean includeDirectories, Boolean doUpdates)
        {
            if (info)
            {
                Console.WriteLine("Trawling: " + path);
            }
            var toret = new List <FSOBase>();

            subFSO.Clear();
            var files = new List <String>(Directory.EnumerateFiles(path));

            for (int i = 0; i < files.Count; i++)
            {
                var c = new FSOFile(files[i])
                {
                    Info = this.info
                };
                if (doUpdates)
                {
                    c.update();
                }
                toret.Add(c);
            }
            if (includeDirectories)
            {
                var dirs = new List <String>(Directory.EnumerateDirectories(path));
                for (int i = 0; i < dirs.Count; i++)
                {
                    var c = new FSODirectory(dirs[i])
                    {
                        Info = this.info
                    };
                    if (doUpdates)
                    {
                        c.update();
                    }
                    toret.Add(c);
                }
            }
            subFSO.AddRange(toret);
            return(toret.ToArray());
        }