예제 #1
0
        static void Main(String[] args)
        {
            CList <CTest> l = new CList <CTest>();

            l.Add(new CTest());
            l.Add(new CTest());
            l.Add(new CTest());
            l.Remove(2);
            l.Remove(1);

            var i = l.Add(new CTest());
            var v = i.Index;



            l.AddAt(1, new CTest());
            l.AddAt(2, new CTest());
            l.AddAt(0, new CTest());
            l.Remove(1);
            var i0 = l.Get(0);


            var i1 = l.Get(1);

            if (i1)
            {
                Console.WriteLine("i1");
            }

            var i2 = l.Get(2);
            var i3 = l.Get(3);

            Console.WriteLine("end");
        }
예제 #2
0
            public bool Connect(TPeerCnt PeerNum_)
            {
                try
                {
                    CNamePort AuthNamePort;
                    var       DataFile = _DataPath + "Allocator_" + PeerNum_.ToString() + ".dat";
                    var       itServer = _Servers.AddAt((Int32)PeerNum_, new _SServer(DataFile));
                    if (itServer.Data.NamePort.Data)
                    {
                        AuthNamePort = itServer.Data.NamePort.Data;
                    }
                    else
                    {
                        AuthNamePort = _AllocatorNamePort;
                    }

                    if (_Net.Connect(AuthNamePort, PeerNum_) == null)
                    {
                        _Servers.Remove((Int32)PeerNum_);
                        return(false);
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
예제 #3
0
파일: Client.cs 프로젝트: thinking2535/Rso
            public CKey Connect(TPeerCnt PeerNum_, string DataPath_, CNamePort MasterNamePort_)
            {
                var FullPath = Path.GetFullPath(DataPath_);

                var FileName = FullPath + "Data_" + PeerNum_.ToString() + ".bin";

                _Servers.AddAt((Int32)PeerNum_, new _SServer(_PeerCounter, MasterNamePort_, FileName));
                if (!_Connect(PeerNum_))
                {
                    return(new CKey());
                }

                return(new CKey(PeerNum_, _PeerCounter++));
            }
예제 #4
0
            public CKey Connect(CNamePort NamePort_, TPeerCnt PeerNum_)
            {
                try
                {
                    var itPeerConnecting = _PeersAndConnectings.AddAt((Int32)PeerNum_, _NewKey(PeerNum_));
                    try
                    {
                        _Connectings.AddAt((Int32)PeerNum_, NamePort_);
                    }
                    catch
                    {
                        _PeersAndConnectings.Remove(itPeerConnecting);
                        throw;
                    }

                    return(itPeerConnecting.Data);
                }
                catch
                {
                    return(null);
                }
            }
예제 #5
0
파일: Client.cs 프로젝트: thinking2535/Rso
 public void Create(TPeerCnt PeerNum_, string DataPath_, CNamePort AuthNamePort_, string ID_, string Nick_, TUID SubUID_, CStream Stream_)
 {
     _Clients.AddAt((Int32)PeerNum_, new _SClient(PeerNum_, DataPath_, AuthNamePort_, ID_, Nick_, SubUID_, Stream_));
     _ConnectToUpper(PeerNum_, _ENode.Auth);
 }
예제 #6
0
 public bool AddRecvProto(Int32 ProtoNum_, TRecvFunc RecvFunc_)
 {
     return(_BinderRecv.AddAt(ProtoNum_, RecvFunc_));
 }
예제 #7
0
 public bool Add(Int32 PeerNum_, Socket Socket_)
 {
     return(_Connects.AddAt(PeerNum_, new _CConnect(Socket_, Environment.TickCount)));
 }