Exemplo n.º 1
0
        public static void Init(ClientInitializer initializer)
        {
            var user = new User(initializer.Nick, initializer.NickColor);

            if (Interlocked.CompareExchange(ref model, new ClientModel(user), null) != null)
            {
                throw new InvalidOperationException("model already inited");
            }

            Api    = new ClientApi();
            Client = new AsyncClient(initializer.Nick);
            Peer   = new AsyncPeer();

            Plugins = new ClientPluginManager(initializer.PluginsPath);
            Plugins.LoadPlugins(initializer.ExcludedPlugins);
        }
Exemplo n.º 2
0
        public static void Init(ClientInitializer initializer)
        {
            if (Interlocked.CompareExchange(ref model, new ClientModel(), null) != null)
            {
                throw new InvalidOperationException("model already inited");
            }

            using (var client = Get())
                model.User = new User(initializer.Nick, initializer.NickColor);

            // API установится автоматически при подключении к серверу (согласно версии на сервере)
            Client  = new AsyncClient(initializer.Nick);
            Peer    = new AsyncPeer();
            Plugins = new ClientPluginManager(initializer.PluginsPath);
            Plugins.LoadPlugins(initializer.ExcludedPlugins);
        }
Exemplo n.º 3
0
        public static void Init(ClientInitializer initializer)
        {
            if (!initializer.Certificate.HasPrivateKey)
            {
                throw new ArgumentException("Initializer should have certificate with private key.");
            }

            var userId = new UserId(initializer.Nick, initializer.Certificate.Thumbprint);
            var user   = new ClientUser(userId, initializer.NickColor, initializer.Certificate);

            if (Interlocked.CompareExchange(ref _chat, new ClientChat(user), null) != null)
            {
                throw new InvalidOperationException("model already inited");
            }

            TrustedCertificates = new ClientCertificatesStorage(initializer.TrustedCertificatesPath, _notifier, _logger);

            Api    = new ClientApi();
            Client = new AsyncClient(userId, TrustedCertificates, initializer.Certificate, Api, _notifier, _logger);
            Peer   = new AsyncPeer(userId, initializer.Certificate, Api, _notifier, _logger);

            Plugins = new ClientPluginManager(initializer.PluginsPath);
            Plugins.LoadPlugins(initializer.ExcludedPlugins);
        }
Exemplo n.º 4
0
    public static void Init(ClientInitializer initializer)
    {
      var user = new User(initializer.Nick, initializer.NickColor);

      if (Interlocked.CompareExchange(ref model, new ClientModel(user), null) != null)
        throw new InvalidOperationException("model already inited");

      Api = new ClientApi();
      Client = new AsyncClient(initializer.Nick);
      Peer = new AsyncPeer();

      Plugins = new ClientPluginManager(initializer.PluginsPath);
      Plugins.LoadPlugins(initializer.ExcludedPlugins);
    }
Exemplo n.º 5
0
        public static void Init(ClientInitializer initializer)
        {
            var user = new User(initializer.Nick, initializer.NickColor);

              if (Interlocked.CompareExchange(ref model, new ClientModel(user), null) != null)
            throw new InvalidOperationException("model already inited");

              // API установится автоматически при подключении к серверу (согласно версии на сервере)
              Client = new AsyncClient(initializer.Nick);
              Peer = new AsyncPeer();
              Plugins = new ClientPluginManager(initializer.PluginsPath);
              Plugins.LoadPlugins(initializer.ExcludedPlugins);
        }