Ejemplo n.º 1
0
        public uint SearchList(uint ID)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.SEARCH,
                (byte)rsctrl.search.RequestMsgIds.MsgId_RequestListSearches,
                false
                );

            RequestListSearches request = new RequestListSearches();

            return(Send <RequestListSearches>(request, msgID));
        }
Ejemplo n.º 2
0
        public uint SystemRequestExternalAccess()
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.SYSTEM,
                (byte)rsctrl.system.RequestMsgIds.MsgId_RequestSystemExternalAccess,
                false
                );

            RequestSystemExternalAccess request = new RequestSystemExternalAccess();

            return(Send <RequestSystemExternalAccess>(request, msgID));
        }
Ejemplo n.º 3
0
        public uint SearchBasic(List <string> terms)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.SEARCH,
                (byte)rsctrl.search.RequestMsgIds.MsgId_RequestBasicSearch,
                false
                );

            RequestBasicSearch request = new RequestBasicSearch();

            request.terms.AddRange(terms);
            return(Send <RequestBasicSearch>(request, msgID));
        }
Ejemplo n.º 4
0
        public uint FilesGetTransferList(Direction dir)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.FILES,
                (byte)rsctrl.files.RequestMsgIds.MsgId_RequestTransferList,
                false
                );

            RequestTransferList request = new RequestTransferList();

            request.direction = dir;
            return(Send <RequestTransferList>(request, msgID));
        }
Ejemplo n.º 5
0
        public uint ChatRequestChatHistory(ChatId chatID)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.CHAT,
                (byte)rsctrl.chat.RequestMsgIds.MsgId_RequestChatHistory,
                false
                );

            RequestChatHistory request = new RequestChatHistory();

            request.id = chatID;
            return(Send <RequestChatHistory>(request, msgID));
        }
Ejemplo n.º 6
0
        public uint SearchClose(uint ID)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.SEARCH,
                (byte)rsctrl.search.RequestMsgIds.MsgId_RequestCloseSearch,
                false
                );

            RequestCloseSearch request = new RequestCloseSearch();

            request.search_id = ID;
            return(Send <RequestCloseSearch>(request, msgID));
        }
Ejemplo n.º 7
0
        public uint ChatSendMsg(ChatMessage msg)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.CHAT,
                (byte)rsctrl.chat.RequestMsgIds.MsgId_RequestSendMessage,
                false
                );

            RequestSendMessage request = new RequestSendMessage();

            request.msg = msg;
            return(Send <RequestSendMessage>(request, msgID));
        }
Ejemplo n.º 8
0
        public uint ChatRegisterEvent(RequestRegisterEvents.RegisterAction action)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.CHAT,
                (byte)rsctrl.chat.RequestMsgIds.MsgId_RequestRegisterEvents,
                false
                );

            RequestRegisterEvents request = new RequestRegisterEvents();

            request.action = action;
            return(Send <RequestRegisterEvents>(request, msgID));
        }
Ejemplo n.º 9
0
        public uint ChatGetLobbies(RequestChatLobbies.LobbySet type)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.CHAT,
                (byte)rsctrl.chat.RequestMsgIds.MsgId_RequestChatLobbies,
                false
                );

            RequestChatLobbies request = new RequestChatLobbies();

            request.lobby_set = type;
            return(Send <RequestChatLobbies>(request, msgID));
        }
Ejemplo n.º 10
0
        public uint StreamRequestListStream(StreamType type)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.STREAM,
                (byte)rsctrl.stream.RequestMsgIds.MsgId_RequestListStreams,
                false
                );

            RequestListStreams request = new RequestListStreams();

            request.request_type = type;
            return(Send <RequestListStreams>(request, msgID));
        }
Ejemplo n.º 11
0
        public uint FilesControllDownload(RequestControlDownload.Action action, File file)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.FILES,
                (byte)rsctrl.files.RequestMsgIds.MsgId_RequestControlDownload,
                false
                );

            RequestControlDownload request = new RequestControlDownload();

            request.action = action;
            request.file   = file;
            return(Send <RequestControlDownload>(request, msgID));
        }
Ejemplo n.º 12
0
        public uint ChatJoinLeaveLobby(RequestJoinOrLeaveLobby.LobbyAction action, string lobbyID)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.CHAT,
                (byte)rsctrl.chat.RequestMsgIds.MsgId_RequestJoinOrLeaveLobby,
                false
                );

            RequestJoinOrLeaveLobby request = new RequestJoinOrLeaveLobby();

            request.action   = action;
            request.lobby_id = lobbyID;
            return(Send <RequestJoinOrLeaveLobby>(request, msgID));
        }
Ejemplo n.º 13
0
        public uint FilesRequestShareDirList(string friendsSSLID, string path)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.FILES,
                (byte)rsctrl.files.RequestMsgIds.MsgId_RequestShareDirList,
                false
                );

            RequestShareDirList request = new RequestShareDirList();

            request.path   = path;
            request.ssl_id = friendsSSLID;
            return(Send <RequestShareDirList>(request, msgID));
        }
Ejemplo n.º 14
0
        public uint PeersGetFriendList(RequestPeers.SetOption option)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.PEERS,
                (byte)rsctrl.peers.RequestMsgIds.MsgId_RequestPeers,
                false
                );

            RequestPeers request = new RequestPeers();

            request.info = RequestPeers.InfoOption.ALLINFO;
            request.set  = option;
            return(Send <RequestPeers>(request, msgID));
        }
Ejemplo n.º 15
0
        public uint SearchResult(List <uint> IDs, uint limit = 150)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.SEARCH,
                (byte)rsctrl.search.RequestMsgIds.MsgId_RequestSearchResults,
                false
                );

            RequestSearchResults request = new RequestSearchResults();

            request.search_ids.AddRange(IDs);
            //request.result_limit = limit;
            return(Send <RequestSearchResults>(request, msgID));
        }
Ejemplo n.º 16
0
        public uint PeersAddPeer(string pgpID, string sshID = "")
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.PEERS,
                (byte)rsctrl.peers.RequestMsgIds.MsgId_RequestAddPeer,
                false
                );

            RequestAddPeer request = new RequestAddPeer();

            request.ssl_id = sshID;
            request.pgp_id = pgpID;
            request.cmd    = RequestAddPeer.AddCmd.ADD;
            return(Send <RequestAddPeer>(request, msgID));
        }
Ejemplo n.º 17
0
        public uint PeersModifyPeer(Person peer, RequestModifyPeer.ModCmd cmd)
        {
            throw new Exception("THIS IS INCOMPLETE... DON'T USE. - drBob");
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.PEERS,
                (byte)rsctrl.peers.RequestMsgIds.MsgId_RequestModifyPeer,
                false
                );

            RequestModifyPeer request = new RequestModifyPeer();

            request.peers.Add(peer);
            request.cmd = cmd;
            return(Send <RequestModifyPeer>(request, msgID));
        }
Ejemplo n.º 18
0
        public uint PeersExaminePeer(string cert, string pgpID, RequestExaminePeer.ExamineCmd cmd)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.PEERS,
                (byte)rsctrl.peers.RequestMsgIds.MsgId_RequestExaminePeer,
                false
                );

            RequestExaminePeer request = new RequestExaminePeer();

            request.cert   = cert;
            request.pgp_id = pgpID;
            request.cmd    = cmd;
            return(Send <RequestExaminePeer>(request, msgID));
        }
Ejemplo n.º 19
0
        public uint StreamRequestControlStream(RequestControlStream.StreamAction action, float rateKBs, ulong seekByte, uint streamID)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.STREAM,
                (byte)rsctrl.stream.RequestMsgIds.MsgId_RequestControlStream,
                false
                );

            RequestControlStream request = new RequestControlStream();

            request.action    = action;
            request.rate_kbs  = rateKBs;
            request.seek_byte = seekByte;
            request.stream_id = streamID;
            return(Send <RequestControlStream>(request, msgID));
        }
Ejemplo n.º 20
0
        public uint ChatCreateLobby(string name, string topic, LobbyPrivacyLevel privacy)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.CHAT,
                (byte)rsctrl.chat.RequestMsgIds.MsgId_RequestCreateLobby,
                false
                );

            RequestCreateLobby request = new RequestCreateLobby();

            //request.invited_friends = ... // what strings?
            request.lobby_name    = name;
            request.lobby_topic   = topic;
            request.privacy_level = privacy;
            return(Send <RequestCreateLobby>(request, msgID));
        }
Ejemplo n.º 21
0
        public uint StreamRequestStartFileStream(File file, ulong startByte, ulong endByte, float rateKBs)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.STREAM,
                (byte)rsctrl.stream.RequestMsgIds.MsgId_RequestStartFileStream,
                false
                );

            RequestStartFileStream request = new RequestStartFileStream();

            request.end_byte   = endByte;
            request.file       = file;
            request.rate_kbs   = rateKBs;
            request.start_byte = startByte;
            return(Send <RequestStartFileStream>(request, msgID));
        }
Ejemplo n.º 22
0
        public uint ChatSetLobbyNickname(string name, List <string> lobbyIDs = null)
        {
            uint msgID = RSProtoBuf.ConstructMsgId(
                (byte)ExtensionId.CORE,
                (ushort)PackageId.CHAT,
                (byte)rsctrl.chat.RequestMsgIds.MsgId_RequestSetLobbyNickname,
                false
                );

            RequestSetLobbyNickname request = new RequestSetLobbyNickname();

            if (lobbyIDs != null)
            {
                request.lobby_ids.AddRange(lobbyIDs);
            }
            request.nickname = name;
            return(Send <RequestSetLobbyNickname>(request, msgID));
        }
Ejemplo n.º 23
0
        private void ProcessNewMsgLoop()
        {
            RSProtoBuffSSHMsg msg;

            while (_run)
            {
                if (_receiveQueue.Count > 0 && _connected)
                {
                    lock (_receiveQueue)
                        msg = _receiveQueue.Dequeue();
                    if (RSProtoBuf.IsRpcMsgIdResponse(msg.MsgID))
                    {
                        _receivedMsg(msg);
                    }
                }
                Thread.Sleep(125);
            }
        }
Ejemplo n.º 24
0
        public bool Connect(string host, ushort port, string user, string pw)
        {
            if (!_connected && !_disconnecting)
            {
                _sendQueue.Clear();
                _receiveQueue.Clear();
                _rsConnector = new RSSSHConnector(this, host, port, user, pw);
                if (_rsConnector.Connect())
                {
                    _rsProtoBuf = new RSProtoBuf(_rsConnector.Stream, _sendQueue, _receiveQueue, this);
                    _connected  = true;
                    _run        = true;

                    _t          = new Thread(new ThreadStart(ProcessNewMsgLoop));
                    _t.Name     = "Process new msg loop";
                    _t.Priority = ThreadPriority.Normal;
                    _t.Start();

                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 25
0
        private void ShutDownThread()
        {
            byte counter = 0;

            _rsProtoBuf.FinishQueue();
            // wait 10 seconds to send all remaining items
            while (_rsProtoBuf.ThreadRunning && counter < 10 * 2)
            {
                System.Diagnostics.Debug.WriteLineIf(DEBUG, "waiting to send remaining items - " + counter);
                Thread.Sleep(500);
                counter++;
            }
            _rsProtoBuf.StopThread();
            Thread.Sleep(100);
            if (!_useProperDisconnect)
            {
                _rsProtoBuf.BreakConnection();
            }
            _rsProtoBuf = null;
            _rsConnector.Disconnect();
            _rsConnector   = null;
            _connected     = false;
            _disconnecting = false;
        }