mirror of
https://github.com/ErnyTech/TLScheme2Json
synced 2024-06-02 19:36:08 +02:00
Generates the schema instead of downloading the pre-generated
This commit is contained in:
parent
ec1e334f4c
commit
257010deee
|
@ -1,18 +1,16 @@
|
||||||
module dscheme;
|
module dscheme;
|
||||||
|
|
||||||
import tlscheme2json;
|
import tlscheme2json;
|
||||||
enum DEFAULT_SCHEME_URL = "https://raw.githubusercontent.com/ErnyTech/TLScheme2Json/master/TLScheme.json";
|
|
||||||
|
|
||||||
class DScheme {
|
class DScheme {
|
||||||
private static TLClass[] tlClasses;
|
private static TLClass[] tlClasses;
|
||||||
|
|
||||||
static this() {
|
static this() {
|
||||||
import std.stdio : writeln;
|
|
||||||
import std.net.curl : get;
|
|
||||||
import asdf : deserialize;
|
import asdf : deserialize;
|
||||||
|
|
||||||
writeln("Obtaining TLScheme Json from " , DEFAULT_SCHEME_URL);
|
auto parser = new TLScheme2Json();
|
||||||
auto jsonScheme = get(DEFAULT_SCHEME_URL).dup;
|
parser.parse;
|
||||||
|
auto jsonScheme = parser.toJson;
|
||||||
auto tljson = deserialize!TLJson(jsonScheme);
|
auto tljson = deserialize!TLJson(jsonScheme);
|
||||||
this.tlClasses = tljson.tl_classes;
|
this.tlClasses = tljson.tl_classes;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user