Esempio n. 1
0
        public static void Main(string[] args)
        {
            string studioDir = FindStudioDirectory();

            string targetDir = Path.Combine(studioDir, TypingsDirectory);

            Console.WriteLine("Using directory: " + Path.GetFullPath(targetDir));
            Directory.CreateDirectory(targetDir);

            var scripter = new CustomScripter()
                           .UsingFormatter(new TsFormatter
            {
                EnumsAsString = true
            });

            scripter
            .WithTypeMapping(TsPrimitive.String, typeof(Char))
            .WithTypeMapping(TsPrimitive.String, typeof(Guid))
            .WithTypeMapping(TsPrimitive.String, typeof(TimeSpan))
            .WithTypeMapping(TsPrimitive.Number, typeof(Size))
            .WithTypeMapping(TsPrimitive.Number, typeof(UInt32))
            .WithTypeMapping(TsPrimitive.Number, typeof(UInt64))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(HashSet <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(List <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IEnumerable <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(Queue <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(ConcurrentQueue <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IReadOnlyList <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IReadOnlyCollection <>))
            .WithTypeMapping(new TsInterface(new TsName("dictionary<Raven.Client.Documents.Queries.Timings.QueryTimings>")),
                             typeof(IDictionary <string, QueryTimings>))
            .WithTypeMapping(new TsInterface(new TsName("dictionary<Raven.Server.NotificationCenter.Notifications.Details.HugeDocumentInfo>")),
                             typeof(ConcurrentDictionary <string, HugeDocumentInfo>))
            .WithTypeMapping(TsPrimitive.Any, typeof(TreePage))
            .WithTypeMapping(TsPrimitive.String, typeof(DateTime))
            .WithTypeMapping(TsPrimitive.String, typeof(LazyStringValue))
            .WithTypeMapping(TsPrimitive.Any, typeof(DynamicJsonValue))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(BlittableJsonReaderArray))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(DynamicJsonArray))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(IEnumerable))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(IList))
            .WithTypeMapping(TsPrimitive.Any, typeof(TaskCompletionSource <object>))
            .WithTypeMapping(TsPrimitive.Any, typeof(BlittableJsonReaderObject));

            scripter = ConfigureTypes(scripter);
            Directory.Delete(targetDir, true);
            Directory.CreateDirectory(targetDir);
            scripter
            .SaveToDirectory(targetDir);

            var endpoints = new EndpointsExporter();

            endpoints.Create(targetDir);

            var configuration = new ConfigurationExporter();

            configuration.Create(targetDir);
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            Directory.CreateDirectory(TargetDirectory);

            var scripter = new CustomScripter()
                           .UsingFormatter(new TsFormatter
            {
                EnumsAsString = true
            });

            scripter
            .WithTypeMapping(TsPrimitive.String, typeof(Guid))
            .WithTypeMapping(TsPrimitive.String, typeof(TimeSpan))
            .WithTypeMapping(TsPrimitive.Number, typeof(UInt32))
            .WithTypeMapping(TsPrimitive.Number, typeof(UInt64))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(HashSet <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(List <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IEnumerable <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(Queue <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(ConcurrentQueue <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IReadOnlyList <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IReadOnlyCollection <>))
            .WithTypeMapping(new TsInterface(new TsName("dictionary<Raven.Client.Documents.Queries.Timings.QueryTimings>")),
                             typeof(IDictionary <string, QueryTimings>))
            .WithTypeMapping(new TsInterface(new TsName("dictionary<Raven.Server.NotificationCenter.Notifications.Details.HugeDocumentInfo>")),
                             typeof(ConcurrentDictionary <string, HugeDocumentInfo>))
            .WithTypeMapping(TsPrimitive.Any, typeof(TreePage))
            .WithTypeMapping(TsPrimitive.String, typeof(DateTime))
            .WithTypeMapping(TsPrimitive.String, typeof(LazyStringValue))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(BlittableJsonReaderArray))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(DynamicJsonArray))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(IEnumerable))
            .WithTypeMapping(TsPrimitive.Any, typeof(TaskCompletionSource <object>))
            .WithTypeMapping(TsPrimitive.Any, typeof(BlittableJsonReaderObject));

            scripter = ConfigureTypes(scripter);
            Directory.Delete(TargetDirectory, true);
            Directory.CreateDirectory(TargetDirectory);
            scripter
            .SaveToDirectory(TargetDirectory);
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            Directory.CreateDirectory(TargetDirectory);

            var scripter = new CustomScripter()
                           .UsingFormatter(new TsFormatter
            {
                EnumsAsString = true
            });

            scripter
            .WithTypeMapping(TsPrimitive.String, typeof(Guid))
            .WithTypeMapping(TsPrimitive.String, typeof(TimeSpan))
            .WithTypeMapping(TsPrimitive.Number, typeof(UInt32))
            .WithTypeMapping(TsPrimitive.Number, typeof(UInt64))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(HashSet <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(List <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IEnumerable <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(Queue <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IReadOnlyList <>))
            .WithTypeMapping(new TsInterface(new TsName("Array")), typeof(IReadOnlyCollection <>))
            .WithTypeMapping(TsPrimitive.Any, typeof(TreePage))
            .WithTypeMapping(TsPrimitive.String, typeof(DateTime))
            .WithTypeMapping(TsPrimitive.String, typeof(LazyStringValue))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(BlittableJsonReaderArray))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(DynamicJsonArray))
            .WithTypeMapping(new TsArray(TsPrimitive.Any, 1), typeof(IEnumerable))
            .WithTypeMapping(TsPrimitive.Any, typeof(TaskCompletionSource <object>))
            .WithTypeMapping(TsPrimitive.Any, typeof(BlittableJsonReaderObject));

            scripter = ConfigureTypes(scripter);
            Directory.Delete(TargetDirectory, true);
            Directory.CreateDirectory(TargetDirectory);
            scripter
            .SaveToDirectory(TargetDirectory);
        }