Ejemplo n.º 1
0
        public static void Bootstrap(TemplatesSource source, GenShell shell, Version wizardVersion)
        {
            try
            {
                AppHealth.Current.AddWriter(new ShellHealthWriter(shell));
                AppHealth.Current.Info.TrackAsync($"{StringRes.ConfigurationFileLoadedString}: {Configuration.LoadedConfigFile}").FireAndForget();

                string hostVersion = $"{wizardVersion.Major}.{wizardVersion.Minor}";

                var repository = new TemplatesRepository(source, wizardVersion);

                ToolBox = new GenToolBox(repository, shell);

                PurgeTempGenerations(Path.Combine(Path.GetTempPath(), Configuration.Current.TempGenerationFolderPath), Configuration.Current.DaysToKeepTempGenerations);

                CodeGen.Initialize(source.Id, hostVersion);

                IsInitialized = true;
            }
            catch (Exception ex)
            {
                IsInitialized = false;
                AppHealth.Current.Exception.TrackAsync(ex, StringRes.GenContextBootstrapError).FireAndForget();
                Trace.TraceError($"{StringRes.GenContextBootstrapError} Exception:\n\r{ex}");
                throw;
            }
        }
Ejemplo n.º 2
0
        public static void Bootstrap(TemplatesSource source, GenShell shell, Version wizardVersion, string platform, string language)
        {
            try
            {
                AppHealth.Current.AddWriter(new ShellHealthWriter(shell));
                AppHealth.Current.Info.TrackAsync($"{StringRes.ConfigurationFileLoadedString}: {Configuration.LoadedConfigFile}").FireAndForget();

                string hostVersion = $"{shell.GetVsVersionAndInstance()}-{wizardVersion.Major}.{wizardVersion.Minor}";

                if (source is RemoteTemplatesSource)
                {
                    CodeGen.Initialize($"{source.Id}.{source.Platform}.{source.Language}", hostVersion);
                }
                else
                {
                    CodeGen.Initialize($"{source.Id}", hostVersion);
                }

                var repository = new TemplatesRepository(source, wizardVersion, platform, language);

                ToolBox = new GenToolBox(repository, shell);

                PurgeTempGenerations(Configuration.Current.DaysToKeepTempGenerations);

                CurrentLanguage = language;
                CurrentPlatform = platform;
            }
            catch (Exception ex)
            {
                AppHealth.Current.Exception.TrackAsync(ex, StringRes.GenContextBootstrapError).FireAndForget();
                Trace.TraceError($"{StringRes.GenContextBootstrapError} Exception:\n\r{ex}");
                throw;
            }
        }
Ejemplo n.º 3
0
        private static async Task InitializeTemplatesAsync(TemplatesSource source)
        {
            GenContext.Bootstrap(source, new FakeGenShell(ProgrammingLanguages.VisualBasic), ProgrammingLanguages.VisualBasic);
            if (Templates == null)
            {
                await GenContext.ToolBox.Repo.SynchronizeAsync(true);

                Templates = GenContext.ToolBox.Repo.GetAll();
            }
        }
        private static void InitializeTemplates(TemplatesSource source)
        {
            GenContext.Bootstrap(source, new FakeGenShell(Platforms.Uwp, ProgrammingLanguages.VisualBasic), Platforms.Uwp, ProgrammingLanguages.VisualBasic);

            if (!syncExecuted == true)
            {
                GenContext.ToolBox.Repo.SynchronizeAsync(true).Wait();
                syncExecuted = true;
            }
        }
        private static async Task InitializeTemplatesAsync(TemplatesSource source)
        {
            GenContext.Bootstrap(source, new FakeGenShell(ProgrammingLanguages.CSharp), ProgrammingLanguages.CSharp);

            if (!syncExecuted)
            {
                await GenContext.ToolBox.Repo.SynchronizeAsync(true);

                syncExecuted = true;
            }
        }
        private static void InitializeTemplates(TemplatesSource source)
        {
            if (syncExecuted.ContainsKey(source.Id) && syncExecuted[source.Id] == true)
            {
                return;
            }

            GenContext.Bootstrap(source, new FakeGenShell(Platforms.Uwp, ProgrammingLanguages.CSharp), Platforms.Uwp, ProgrammingLanguages.CSharp);

            GenContext.ToolBox.Repo.SynchronizeAsync(true).Wait();
            syncExecuted.Add(source.Id, true);
        }
        private static void InitializeTemplates(TemplatesSource source, string language)
        {
            Configuration.Current.CdnUrl = "https://wtsrepository.blob.core.windows.net/pro/";

            GenContext.Bootstrap(source, new FakeGenShell(Platforms.Uwp, language), new Version("2.0"), language);
            if (!syncExecuted)
            {
                GenContext.ToolBox.Repo.SynchronizeAsync(true, true).Wait();

                syncExecuted = true;
            }
        }
Ejemplo n.º 8
0
        private static async Task InitializeTemplatesAsync(TemplatesSource source, string language)
        {
            Configuration.Current.CdnUrl = "https://wtsrepository.blob.core.windows.net/pro/";

            GenContext.Bootstrap(source, new FakeGenShell(language), new Version("1.7"), language);
            if (!syncExecuted)
            {
                await GenContext.ToolBox.Repo.SynchronizeAsync(true);

                syncExecuted = true;
            }
        }
Ejemplo n.º 9
0
        private static async Task InitializeTemplatesAsync(TemplatesSource source)
        {
            GenContext.Bootstrap(source, new FakeGenShell(ProgrammingLanguages.CSharp), ProgrammingLanguages.CSharp);

            if (syncExecuted.ContainsKey(source.Id) && syncExecuted[ShortFrameworkName(source.Id)] == true)
            {
                return;
            }

            await GenContext.ToolBox.Repo.SynchronizeAsync(true);

            syncExecuted.Add(source.Id, true);
        }
Ejemplo n.º 10
0
 private static async Task InitializeTemplatesForLanguageAsync(TemplatesSource source)
 {
     GenContext.Bootstrap(source, new FakeGenShell(ProgrammingLanguages.CSharp), ProgrammingLanguages.CSharp);
     if (Templates == null)
     {
         await GenContext.ToolBox.Repo.SynchronizeAsync();
     }
     else
     {
         await GenContext.ToolBox.Repo.RefreshAsync();
     }
     Templates = GenContext.ToolBox.Repo.GetAll();
 }
Ejemplo n.º 11
0
        public static void Bootstrap(TemplatesSource source, GenShell shell, Version wizardVersion)
        {
            AppHealth.Current.AddWriter(new ShellHealthWriter());
            AppHealth.Current.Info.TrackAsync($"Configuration file loaded: {Configuration.LoadedConfigFile}").FireAndForget();

            string hostVersion = $"{wizardVersion.Major}.{wizardVersion.Minor}";

            CodeGen.Initialize(source.Id, hostVersion);
            TemplatesRepository repository = new TemplatesRepository(source, wizardVersion);

            ToolBox = new GenToolBox(repository, shell);

            IsInitialized = true;
        }
        private static void InitializeTemplates(TemplatesSource source, string language)
        {
            Configuration.Current.CdnUrl = "https://wtsrepository.blob.core.windows.net/pro/";

            source.LoadConfigAsync(default(CancellationToken)).Wait();
            var version = new Version(source.Config.Latest.Version.Major, source.Config.Latest.Version.Minor);

            GenContext.Bootstrap(source, new FakeGenShell(Platforms.Uwp, language), version, language);
            if (!syncExecuted)
            {
                GenContext.ToolBox.Repo.SynchronizeAsync(true, true).Wait();

                syncExecuted = true;
            }
        }
Ejemplo n.º 13
0
        private static async Task InitializeTemplatesForLanguageAsync(TemplatesSource source, string language)
        {
            GenContext.Bootstrap(source, new FakeGenShell(language), language);

            if (!syncExecuted)
            {
                await GenContext.ToolBox.Repo.SynchronizeAsync();

                syncExecuted = true;
            }
            else
            {
                await GenContext.ToolBox.Repo.RefreshAsync();
            }
        }
Ejemplo n.º 14
0
 public async Task ChangeTemplatesSourceAsync(TemplatesSource source)
 {
     GenContext.Bootstrap(source, new FakeGenShell(ProgrammingLanguages.CSharp), ProgrammingLanguages.CSharp);
     await GenContext.ToolBox.Repo.SynchronizeAsync(true);
 }
Ejemplo n.º 15
0
 public static void Bootstrap(TemplatesSource source, GenShell shell, string platform, string language)
 {
     Bootstrap(source, shell, GetWizardVersionFromAssembly(), platform, language);
 }
Ejemplo n.º 16
0
 public static void Bootstrap(TemplatesSource source, GenShell shell)
 {
     Bootstrap(source, shell, GetWizardVersionFromAssembly());
 }
 public void ChangeTemplatesSource(TemplatesSource source, string language, string platform)
 {
     GenContext.Bootstrap(source, new FakeGenShell(platform, language), language);
     GenContext.ToolBox.Repo.SynchronizeAsync(true, true).Wait();
 }
        private static void InitializeTemplates(TemplatesSource source, string language)
        {
            Configuration.Current.CdnUrl = "https://wtsrepository.blob.core.windows.net/pro/";

            source.LoadConfigAsync(default).Wait();
Ejemplo n.º 19
0
 public async Task ChangeTemplatesSourceAsync(TemplatesSource source, string language)
 {
     GenContext.Bootstrap(source, new FakeGenShell(language), language);
     await GenContext.ToolBox.Repo.SynchronizeAsync(true);
 }