Exemplo n.º 1
0
        /// <summary>
        ///     Initialises class. No connections are made at init of class, so call `Initialise()` to begin sending and
        ///     recieiving.
        /// </summary>
        public Client(string address, int port)
        {
            if (!Directory.Exists(ClientConfiguration.DefaultResourceDirectory))
            {
                Directory.CreateDirectory(ClientConfiguration.DefaultResourceDirectory);
            }

            ClientConfiguration.CheckCreateConfig(ClientConfiguration.DefaultFilePath);
            ClientConfiguration = JsonConvert.DeserializeObject <ClientConfiguration>(File.ReadAllText(ClientConfiguration.DefaultFilePath));

            wrapper      = new PluginWrapper();
            MainDatabase = new Database(ClientConfiguration.DatabaseFilePath);

            Connection conn = new Connection(address, port);

            Server = new Server(conn);
        }