Init() private method

private Init ( ) : void
return void
Esempio n. 1
0
    public void ConnectTo(Block toBlock, float travelTime)
    {
        GameObject connectionObj = GameObject.Instantiate(ConnectionPrefab);

        connectionObj.transform.parent = transform;

        Connection c = connectionObj.GetComponent <Connection>();

        c.Init(this, toBlock, travelTime);
        Connections.Add(c);
    }
Esempio n. 2
0
    private void CreateConnection()
    {
        if (connections == null)
        {
            connections = new List <Connection>();
        }

        Connection connection = CreateInstance <Connection>();

        connection.Init(selectedInPoint, selectedOutPoint, OnClickRemoveConnection);
        connections.Add(connection);
    }
Esempio n. 3
0
        public override bool Open(NetworkClientConfig config)
        {
            if (!NetworkCore.CreateUdpClient(config.LocalEndPoint, out var socket))
            {
                return(false);
            }

            UdpClient  = socket;
            Connection = Kernel.Get <BaseNetworkConnection>();
            Connection.Init(UdpClient);

            return(true);
        }
Esempio n. 4
0
        public override bool Open(NetworkClientConfig config)
        {
            if (!NetworkHelper.UdpClient(config.LocalEndPoint, out var socket))
            {
                return(false);
            }

            Config     = config;
            UdpClient  = socket;
            Connection = Kernel.Get <BaseNetworkConnection>();
            Connection.Init(UdpClient, Config.ConnectionConfig);

            TokenManager.Init(UdpClient);
            TokenCache.Init(UdpClient, TokenManager);
            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// Constructs Job Storage by database connection string and options
        /// </summary>
        /// <param name="connectionString">LiteDB connection string</param>
        /// <param name="storageOptions">Storage options</param>
        public LiteDbStorage(string connectionString, LiteDbStorageOptions storageOptions)
        {
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                throw new ArgumentNullException(nameof(connectionString));
            }

            _connectionString = connectionString;
            _storageOptions   = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions));

            Connection = HangfireDbContext.Instance(connectionString, storageOptions.Prefix);
            Connection.Init(_storageOptions);
            var defaultQueueProvider = new LiteDbJobQueueProvider(_storageOptions);

            QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
        }
        /// <summary>
        /// Constructs Job Storage by database connection string and options
        /// </summary>
        /// <param name="databasePath">SQLite connection string</param>
        /// <param name="storageOptions">Storage options</param>
        public SQLiteStorage(string databasePath, SQLiteStorageOptions storageOptions)
        {
            if (string.IsNullOrWhiteSpace(databasePath))
            {
                throw new ArgumentNullException(nameof(databasePath));
            }

            _connectionString = databasePath;
            _storageOptions   = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions));

            Connection = HangfireDbContext.Instance(databasePath, storageOptions.Prefix);
            Connection.Init(_storageOptions);

            var defaultQueueProvider = new SQLiteJobQueueProvider(_storageOptions);

            QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
        }
Esempio n. 7
0
    /*
     * CreateConnection() forms a new Connection between the currently
     * selected in/out ConnectionPoints.
     */
    public static Connection CreateConnection(bool clickable, bool markHistory = true)
    {
        if (markHistory)
        {
            HistoryManager.RecordEditor();
        }

        Connection newConnection = ScriptableObject.CreateInstance <Connection>();

        newConnection.Init(selectedInPoint, selectedOutPoint, RemoveConnection, clickable);
        mainEditor.connections.Add(newConnection);

        // add the connection references
        selectedOutPoint.connections.Add(newConnection);
        selectedInPoint.connections.Add(newConnection);

        return(newConnection);
    }
Esempio n. 8
0
        public RecurrentLayer(int p_dim, ACTIVATION p_activationFunction, TYPE p_type) : base(p_type, RECURRENT)
        {
            NeuralGroup core    = new NeuralGroup("core", p_dim, p_activationFunction);
            NeuralGroup context = new NeuralGroup("context", p_dim, ACTIVATION.IDENTITY);

            _groups.Add("core", core);
            _groups.Add("context", context);

            Connection c = Connect(context, core, true);

            c.Init(Connection.INIT.LECUN_UNIFORM, 0.05f);

            Connection r = Connect(core, context, false);

            r.Weights = Matrix.Identity(p_dim, p_dim);

            _inputGroup = _outputGroup = core;
        }
Esempio n. 9
0
        public void WrongIpInitThrowsException()
        {
            var socketOptions = new SocketOptions();

            socketOptions.SetConnectTimeoutMillis(1000);
            var config = new Configuration(
                new Cassandra.Policies(),
                new ProtocolOptions(),
                new PoolingOptions(),
                socketOptions,
                new ClientOptions(),
                NoneAuthProvider.Instance,
                null,
                new QueryOptions(),
                new DefaultAddressTranslator());

            try
            {
                using (var connection = new Connection(1, new IPEndPoint(new IPAddress(new byte[] { 1, 1, 1, 1 }), 9042), config))
                {
                    connection.Init();
                    Assert.Fail("It must throw an exception");
                }
            }
            catch (SocketException ex)
            {
                //It should have timed out
                Assert.AreEqual(SocketError.TimedOut, ex.SocketErrorCode);
            }
            try
            {
                using (var connection = new Connection(1, new IPEndPoint(new IPAddress(new byte[] { 255, 255, 255, 255 }), 9042), config))
                {
                    connection.Init();
                    Assert.Fail("It must throw an exception");
                }
            }
            catch (SocketException)
            {
                //Socket exception is just fine.
            }
        }
        private void BtnValide_Click(object sender, EventArgs e)
        {
            // Initialisation de la connexion
            Connection.Init();

            // Verification des identifiants saisis
            if (Connection.MdpConnection(txtLogin.Text, txtMdp.Text))
            {
                this.OpenGestion();
            }
            else
            if (Connection.ErrorConfiguration == true)
            {
                MessageBox.Show("Impossible de se connecter à la base de données !", "Connexion impossible", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("Vos identifiant sont erronés.", "Connexion impossible", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 11
0
    }                              // Invoke ctor

    static Const()
    {
        Connection.Init("AppName");

        using (Connection conn = new Connection())
        {
            Sender sender = Sender.Seek(conn, InstanceSelf, UcnType.Self);
            Court  court  = new Court();

            court.court = sender.court;  // TODO? make alias
            court.Get(conn, null);
            CourtCode = court.court;
            CourtName = court.name;
            CourtType = court.courtType;

            Alias.Init(conn);

            // the modern (c - '0') is quite long
            int TextIndex         = Convert.ToInt32(ElectricType.Text.ToString()),
                ImageIndex        = Convert.ToInt32(ElectricType.Image.ToString()),
                FilterIndex       = Convert.ToInt32(ElectricType.Filter.ToString());
            ConfigData configData = new ConfigData();

            configData.config        = ConfigNameGlobal;
            configData.section       = "external";
            ElectricDirs[TextIndex]  = configData.GetValue(conn, "TEXT_PATH");
            ElectricDirs[ImageIndex] = configData.GetValue(conn, "IMAGE_PATH");
            configData.value         = "DOC";
            ElectricExts[TextIndex]  = configData.GetExtension(conn, "TEXT_TYPE");
            configData.value         = "TIF";
            ElectricExts[ImageIndex] = configData.GetExtension(conn, "IMAGE_TYPE");

            configData.section        = "filter";
            ElectricDirs[FilterIndex] = configData.GetValue(conn, "PATH");
            ElectricExts[FilterIndex] = "HTM";
        }
    }
Esempio n. 12
0
 private static void Init(string ip, int port)
 {
     Connection.Init(ip, port, PORT_RANGE_POSSIBILITY);
 }
Esempio n. 13
0
 void InitConnection()
 {
     connection = Connection.GetInstance();
     connection.Init();
     connection.onConnect += OnConnectSuccess;
 }
Esempio n. 14
0
        static void Main()
        {
            const int threadCount = 10;
            var       vlakna      = new Thread[threadCount];

            Connection.Init("Server=Revizie.ukf.sk,1433;Database=Skolenie;User Id=Skolenie;Password=12345;");
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");

            var doc = new XmlDocument();

            doc.Load("input.xml");
            var produkty = new List <Product>();

            var sw = new Stopwatch();

            sw.Start();

            foreach (XmlNode n in doc.SelectNodes("//product"))
            {
                var p = new Product(n);
                if (p.IsValid)
                {
                    produkty.Add(p);
                }
            }

            string nazvy = produkty.Select((x) => x.Nazov).Take(3).Aggregate((seed, akt) => seed + "..." + akt);

            Console.WriteLine(nazvy);

            double priemer = produkty.Sum((x) => x.Cena);

            produkty.Select((x) => x.Cena).Where((x) => x > 30).Skip(10).Take(10);

            //produkty.Where((x) => x.Cena > 30);

            //int varka = produkty.Count / threadCount;
            //for (int i = 0; i < vlakna.Length; i++)
            //{
            //    vlakna[i] = new Thread(Download);
            //    var param = new DownloadParam()
            //        {
            //            Pocet = varka,
            //            Produkty = produkty,
            //            StartIndex = i * varka
            //        };
            //    vlakna[i].Start(param);
            //}
            //for (int i = 0; i < vlakna.Length; i++)
            //{
            //    vlakna[i].Join();
            //}

            sw.Stop();
            Console.WriteLine("Elapsed time:{1}m {0}s", sw.Elapsed.Seconds, sw.Elapsed.Minutes);
            Console.WriteLine("Done");
            Console.ReadLine();

            var list = new List <int>()
            {
                1, 2, 3, 4, 5
            };

            AplikujFunkciu(list, (x, y) => x + y);

            //LINQ

            foreach (var l in list)
            {
                Console.WriteLine(l);
            }

            var slovo = "abcd";

            slovo.Osekni(4);
        }
 private void ChargerLesActions()
 {
     Connection.Init();
     lesActions = Connection.GetLesActions();
 }