2018-07-18 12:24:37 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018. Ernesto Castellotti <erny.castell@gmail.com>
|
|
|
|
* This file is part of JTdlib.
|
|
|
|
*
|
|
|
|
* JTdlib is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License.
|
|
|
|
*
|
|
|
|
* JTdlib is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with JTdlib. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-08-18 23:13:36 +02:00
|
|
|
package it.tdlight.tdlight;
|
2018-07-18 12:24:37 +02:00
|
|
|
|
2020-08-18 23:13:36 +02:00
|
|
|
import it.tdlight.tdlight.utils.CantLoadLibrary;
|
|
|
|
import it.tdlight.tdlight.utils.LoadLibrary;
|
|
|
|
import it.tdlight.tdlight.utils.Os;
|
2018-07-18 12:24:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Init class to successfully initialize Tdlib
|
|
|
|
*/
|
|
|
|
public class Init {
|
2020-04-19 16:32:49 +02:00
|
|
|
|
|
|
|
private static boolean started = false;
|
|
|
|
|
2018-07-18 12:24:37 +02:00
|
|
|
/**
|
|
|
|
* Initialize Tdlib
|
2020-04-19 16:32:49 +02:00
|
|
|
*
|
2018-07-18 12:24:37 +02:00
|
|
|
* @throws CantLoadLibrary An exception that is thrown when the LoadLibrary class fails to load the library.
|
|
|
|
*/
|
2020-08-30 00:46:28 +02:00
|
|
|
public synchronized static void start() throws CantLoadLibrary {
|
2020-04-19 16:32:49 +02:00
|
|
|
if (!started) {
|
2020-08-20 13:59:38 +02:00
|
|
|
Os os = LoadLibrary.getOs();
|
2018-07-18 12:24:37 +02:00
|
|
|
|
2020-04-19 16:32:49 +02:00
|
|
|
if (os == Os.win) {
|
2020-10-09 03:25:27 +02:00
|
|
|
LoadLibrary.load("libstdc++-6");
|
|
|
|
LoadLibrary.load("libwinpthread-1");
|
2020-10-09 03:46:38 +02:00
|
|
|
LoadLibrary.load("libgcc_s_seh-1");
|
2020-10-08 19:43:30 +02:00
|
|
|
LoadLibrary.load("libcrypto-3-x64");
|
|
|
|
LoadLibrary.load("libssl-3-x64");
|
2020-04-19 16:32:49 +02:00
|
|
|
LoadLibrary.load("zlib1");
|
|
|
|
}
|
2018-07-18 12:24:37 +02:00
|
|
|
|
2020-04-19 16:32:49 +02:00
|
|
|
LoadLibrary.load("tdjni");
|
|
|
|
ConstructorDetector.init();
|
|
|
|
started = true;
|
|
|
|
}
|
2018-07-18 12:24:37 +02:00
|
|
|
}
|
|
|
|
}
|