Exemplo n.º 1
0
        public static string ToTypeScript(this IEnumerable<TypeDefinition> value, string filterRegex = null)
        {
            var typeCollection = new TypeCollection(new WinMDTypeWriterTypeSelector());
            var errors = new StringBuilderTypeNotFoundErrorHandler();
            var config = new WinmdConfig();

            new TypeWriterCollector(errors, typeCollection.TypeSelector)
                .Collect(value, typeCollection, config);
            var result = typeCollection.Render(filterRegex);
            var errorResult = errors.ToString();
            if (string.IsNullOrEmpty(errorResult))
            {
                return result;
            }
            return errorResult + Environment.NewLine + Environment.NewLine + result;
        }
Exemplo n.º 2
0
        public void AllWinmdFilesInWinMetadata()
        {
            var allFiles = System.IO.Directory.GetFiles(@"C:\Windows\System32\WinMetadata\", "*.winmd");
            var sw       = new System.IO.StringWriter();
            var error    = new StringBuilderTypeNotFoundErrorHandler();
            var config   = new WinmdConfig
            {
                AssemblyPaths            = allFiles,
                IncludeSpecialTypes      = false,
                TypeNotFoundErrorHandler = error,
            };

            ToTypeScriptD.Render.AllAssemblies(config, sw);
            var result = error.ToString() + Environment.NewLine + Environment.NewLine + sw.ToString();

            result.Verify();
        }
Exemplo n.º 3
0
        public static string ToTypeScript(this IEnumerable <TypeDefinition> value, string filterRegex = null)
        {
            var typeCollection = new TypeCollection(new WinMDTypeWriterTypeSelector());
            var errors         = new StringBuilderTypeNotFoundErrorHandler();
            var config         = new WinmdConfig();

            new TypeWriterCollector(errors, typeCollection.TypeSelector)
            .Collect(value, typeCollection, config);
            var result      = typeCollection.Render(filterRegex);
            var errorResult = errors.ToString();

            if (string.IsNullOrEmpty(errorResult))
            {
                return(result);
            }
            return(errorResult + Environment.NewLine + Environment.NewLine + result);
        }
Exemplo n.º 4
0
 public void AllWinmdFilesInWinMetadata()
 {
     var allFiles = System.IO.Directory.GetFiles(@"C:\Windows\System32\WinMetadata\", "*.winmd");
     var sw = new System.IO.StringWriter();
     var error = new StringBuilderTypeNotFoundErrorHandler();
     var config = new WinmdConfig
     {
         AssemblyPaths = allFiles,
         IncludeSpecialTypes = false,
         TypeNotFoundErrorHandler = error,
     };
     ToTypeScriptD.Render.AllAssemblies(config, sw);
     var result = error.ToString() + Environment.NewLine + Environment.NewLine + sw.ToString();
     result.Verify();
 }