Create() public static méthode

public static Create ( RtException error ) : VisualStudioFriendlyErrorMessage
error Reinforced.Typings.Exceptions.RtException
Résultat VisualStudioFriendlyErrorMessage
        /// <summary>
        /// Usage: rtcli.exe Assembly.dll [Assembly2.dll Assembly3.dll ... etc] file.ts
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            Console.WriteLine("Reinforced.Typings CLI generator (c) 2015-2018 by Pavel B. Novikov");

            ExporterConsoleParameters parameters = null;

            if (args.Length == 0)
            {
                PrintHelp();
                return;
            }
            try
            {
                if (string.Compare(args[0], "profile",
#if NETCORE
                                   StringComparison.CurrentCultureIgnoreCase
#else
                                   StringComparison.InvariantCultureIgnoreCase
#endif
                                   ) == 0)
                {
                    if (!File.Exists(args[1]))
                    {
                        Console.WriteLine("Cannot find profile {0}, exiting", args[1]);
                        return;
                    }
                    parameters = ExtractParametersFromFile(args[1]);
                }
                else
                {
                    parameters = ExtractParametersFromArgs(args);
                }
                if (parameters == null)
                {
                    Console.WriteLine("No valid parameters found. Exiting.");
                    return;
                }

                _suppressedWarnings = ParseSuppressedWarnings(parameters.SuppressedWarnings);
                var settings = InstantiateExportContext(parameters);
                ResolveFluentMethod(settings, parameters);
                TsExporter exporter = new TsExporter(settings);
                exporter.Export();
                _assemblyManager.TurnOffAdditionalResolvation();
                foreach (var rtWarning in settings.Warnings)
                {
                    var msg = VisualStudioFriendlyErrorMessage.Create(rtWarning);
                    Console.WriteLine(msg.ToString());
                }
                ReleaseReferencesTempFile(parameters);
            }
Exemple #2
0
        /// <summary>
        /// Usage: rtcli.exe Assembly.dll [Assembly2.dll Assembly3.dll ... etc] file.ts
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            Console.WriteLine("Reinforced.Typings CLI generator (c) 2015 by Pavel B. Novikov");

            if (args.Length == 0)
            {
                PrintHelp();
                return;
            }
            try
            {
                _parameters = ExtractParametersFromArgs(args);
                if (_parameters == null)
                {
                    Console.WriteLine("No valid parameters found. Exiting.");
                    Environment.Exit(0);
                }
                _referencesFilePath = _parameters.ReferencesTmpFilePath;
                var settings = InstantiateExportContext();
                ResolveFluentMethod(settings);
                TsExporter exporter = new TsExporter(settings);
                exporter.Export();
                foreach (var rtWarning in settings.Warnings)
                {
                    var msg = VisualStudioFriendlyErrorMessage.Create(rtWarning);
                    Console.WriteLine(msg.ToString());
                }
            }
            catch (RtException rtException)
            {
                var error = VisualStudioFriendlyErrorMessage.Create(rtException);
                Console.WriteLine(error.ToString());
                Console.WriteLine(rtException.StackTrace);
                ReleaseReferencesTempFile();
                Environment.Exit(1);
            }
            catch (Exception ex)
            {
                BuildError(ex.Message);
                Console.WriteLine(ex.StackTrace);
                //ReleaseReferencesTempFile();
                Environment.Exit(1);
            }

            ReleaseReferencesTempFile();
            Console.WriteLine("Reinforced.Typings generation finished with total {0} assemblies loaded", _totalLoadedAssemblies);

            Console.WriteLine("Please build CompileTypeScript task to update javascript sources");
        }