示例#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;
            }
        }
        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;
            }
        }
示例#3
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;
        }