Ejemplo n.º 1
0
        private void LoadSettings()
        {
            settings = SettingsManager.GetSettings();

            ListViewProjectTypes.Items.Clear();
            ListViewKeywords.Items.Clear();

            if (settings != null)
            {
                ListViewProjectTypes.Columns.Add("Project Type");
                ListViewProjectTypes.Columns.Add("Name");
                ListViewProjectTypes.Columns.Add("Final Name");
                ListViewProjectTypes.Columns.Add("Directory");
                ListViewProjectTypes.Columns.Add("Solution GUID");
                ListViewProjectTypes.Columns.Add("GUID Two");

                ListViewKeywords.Columns.Add("Keyword");

                TextboxCreateDirectory.Text = settings.DefaultDirectory;

                foreach (var projectType in settings.ProjectTypes)
                {
                    foreach (var project in projectType.Projects)
                    {
                        var item = new ListViewItem(projectType.DisplayName);
                        item.SubItems.Add(project.Name);
                        item.SubItems.Add(project.FinalName);
                        item.SubItems.Add(project.Directory);
                        item.SubItems.Add(project.GUID);
                        item.SubItems.Add(project.GUIDTwo);

                        ListViewProjectTypes.Items.Add(item);
                    }
                }

                foreach (var keyword in settings.Keywords)
                {
                    var item = new ListViewItem(keyword.KeywordDisplay);

                    ListViewKeywords.Items.Add(item);
                }
            }
        }
Ejemplo n.º 2
0
        private static void CreateSettings()
        {
            var coreGUID = Guid.NewGuid().ToString();
            var netGUID  = Guid.NewGuid().ToString();

            var settings = new Models.Settings()
            {
                DefaultDirectory = "F:\\Tests\\Core",
                ProjectTypes     = new List <ProjectType>()
                {
                    new ProjectType()
                    {
                        DisplayName = "Full .NET",
                        Projects    = new List <Project>()
                        {
                            new Project()
                            {
                                Directory = "Templates.ClassLibraryNet\\Templates.ClassLibraryNet.csproj",
                                FinalName = "Templates.ClassLibrary",
                                Name      = "ClassLibraryNet",
                                GUID      = netGUID,
                                GUIDTwo   = Guid.NewGuid().ToString()
                            },
                            new Project()
                            {
                                Directory = "Templates.MVC6Net\\Templates.MVC6Net.csproj",
                                FinalName = "Templates",
                                Name      = "MVC6Net",
                                GUID      = netGUID,
                                GUIDTwo   = Guid.NewGuid().ToString()
                            },
                            new Project()
                            {
                                Directory = "Templates.TestNet\\Templates.TestNet.csproj",
                                FinalName = "Templates.Test",
                                Name      = "TestNet",
                                GUID      = netGUID,
                                GUIDTwo   = Guid.NewGuid().ToString()
                            },
                            new Project()
                            {
                                Directory = "Templates.WebAPI2\\Templates.WebAPI2.csproj",
                                FinalName = "Templates.WebAPI",
                                Name      = "WebAPI2",
                                GUID      = netGUID,
                                GUIDTwo   = Guid.NewGuid().ToString()
                            }
                        }
                    },
                    new ProjectType()
                    {
                        DisplayName = "Core",
                        Projects    = new List <Project>()
                        {
                            new Project()
                            {
                                Directory = "Templates.ClassLibraryCore\\Templates.ClassLibraryCore.csproj",
                                FinalName = "Templates.ClassLibrary",
                                Name      = "ClassLibraryCore",
                                GUID      = coreGUID,
                                GUIDTwo   = Guid.NewGuid().ToString()
                            },
                            new Project()
                            {
                                Directory = "Templates.MVC6Core\\Templates.MVC6Core.csproj",
                                FinalName = "Templates",
                                Name      = "MVC6Core",
                                GUID      = coreGUID,
                                GUIDTwo   = Guid.NewGuid().ToString()
                            },
                            new Project()
                            {
                                Directory = "Templates.TestCore\\Templates.TestCore.csproj",
                                FinalName = "Templates.Test",
                                Name      = "TestCore",
                                GUID      = coreGUID,
                                GUIDTwo   = Guid.NewGuid().ToString()
                            },
                            new Project()
                            {
                                Directory = "Templates.WebAPICore2\\Templates.WebAPICore2.csproj",
                                FinalName = "Templates.WebAPI",
                                Name      = "WebAPICore2",
                                GUID      = coreGUID,
                                GUIDTwo   = Guid.NewGuid().ToString()
                            }
                        }
                    }
                }
            };

            if (File.Exists("Settings.json"))
            {
                File.Delete("Settings.json");
            }

            File.WriteAllText("Settings.json", JsonConvert.SerializeObject(settings));
        }