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