Exemplo n.º 1
0
        private static void Java()
        {
            string[] files = { "javaFiles.json", "javaEntites.json", "javaTree.json", "javaProject.json" };

            IParser csParser = new GitHubParser("LyndonChin", "AndroidRubberIndicator", _username, _password);

            IEnumerable <IFile> javaFiles;
            EntityCollection    javaEnitities;
            Node <Entity>       javaRoot;

            if (!File.Exists(files[0]))
            {
                javaFiles = csParser.Read();
                SaveClass(javaFiles, files[0]);
            }
            else
            {
                javaFiles = ReadClass <IEnumerable <GitHubFile> >(files[0]);
            }

            if (!File.Exists(files[1]))
            {
                javaEnitities = Project.MakeEntities(javaFiles);
                SaveClass(javaEnitities, files[1]);
            }
            else
            {
                javaEnitities = ReadClass <EntityCollection>(files[1]);
            }

            if (!File.Exists(files[2]))
            {
                javaRoot = Project.MakeTree(javaEnitities);
                SaveClass(javaRoot, files[2]);
            }
            else
            {
                javaRoot = ReadClass <Node <Entity> >(files[2]);
            }

            Project project = new Project(javaEnitities, javaRoot, ProjectType.CSharp);

            SaveClass(project, files[3]);
        }
Exemplo n.º 2
0
        private static void Cs()
        {
            string[] files = { "csFiles.json", "csEntites.json", "csTree.json", "csProject.json" };

            IParser csParser = new GitHubParser("JamesNK", "Newtonsoft.Json", _username, _password);

            IEnumerable <IFile> csFiles;
            EntityCollection    csEnitities;
            Node <Entity>       csRoot;

            if (!File.Exists(files[0]))
            {
                csFiles = csParser.Read();
                SaveClass(csFiles, files[0]);
            }
            else
            {
                csFiles = ReadClass <IEnumerable <GitHubFile> >(files[0]);
            }

            if (true)
            {
                csEnitities = Project.MakeEntities(csFiles);
                SaveClass(csEnitities, files[1]);
            }
            else
            {
                csEnitities = ReadClass <EntityCollection>(files[1]);
            }

            if (!File.Exists(files[2]))
            {
                csRoot = Project.MakeTree(csEnitities);
                SaveClass(csRoot, files[2]);
            }
            else
            {
                csRoot = ReadClass <Node <Entity> >(files[2]);
            }

            Project project = new Project(csEnitities, csRoot, ProjectType.CSharp);

            SaveClass(project, files[3]);
        }
Exemplo n.º 3
0
        public void ReadTest()
        {
            GitHubParser        gitHubParser = new GitHubParser(_owner, _project, _username, _password);
            IEnumerable <IFile> files        = gitHubParser.Read();

            Assert.NotNull(files);

            if (files == null)
            {
                return;
            }

            Assert.Greater(files.Count(), 0);

            foreach (var item in files)
            {
                Assert.IsNotNullOrEmpty(item.Path);
            }
        }
Exemplo n.º 4
0
        public MainClass() : base("Cod2d")
        {
            SetDefaultSize(1920, 1080);
            SetPosition(WindowPosition.Center);
            DeleteEvent += delegate
            {
                Application.Quit();
            };

            DrawingArea darea = new DrawingArea();

            darea.ExposeEvent += OnExpose;

            Add(darea);

            if (project == null)
            {
                string[] files = { "csFiles.json", "csEntites.json", "csTree.json", "csProject.json", "csBuilding.json" };

                IParser csParser = new GitHubParser(_owner, _project, _username, _password);

                IEnumerable <IFile> csFiles;
                EntityCollection    csEnitities;
                Node <Entity>       csRoot;
                Node <Building>     csBuilding;

                if (!File.Exists(files[0]))
                {
                    csFiles = csParser.Read();
                    SaveClass(csFiles, files[0]);
                }
                else
                {
                    csFiles = ReadClass <IEnumerable <GitHubFile> >(files[0]);
                }

                if (!File.Exists(files[1]))
                {
                    csEnitities = Project.MakeEntities(csFiles);
                    SaveClass(csEnitities, files[1]);
                }
                else
                {
                    csEnitities = ReadClass <EntityCollection>(files[1]);
                }

                if (!File.Exists(files[2]))
                {
                    csRoot = Project.MakeTree(csEnitities);
                    SaveClass(csRoot, files[2]);
                }
                else
                {
                    csRoot = ReadClass <Node <Entity> >(files[2]);
                }

                if (!File.Exists(files[4]))
                {
                    csBuilding = LayoutGenerator.GenerateSize(csRoot);
                    SaveClass(csBuilding, files[4]);
                }
                else
                {
                    csBuilding = ReadClass <Node <Building> >(files[4]);
                }

                Vivacity.Library.Model.Tree tree = new Vivacity.Library.Model.Tree
                {
                    Root = csBuilding
                };

                tree.Normalize(1920, 1080);

                project = new Project(csEnitities, csRoot, ProjectType.CSharp);
                SaveClass(project, files[3]);
            }
        }