示例#1
0
        private string processSetupSession2Request(string input_data_val)
        {
            this.debugIt(true, "processSetupSession3Request", "input_data_val = " + input_data_val);
            SetupSession2RequestFormat format_data;

            using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(input_data_val)))
            {
                DataContractJsonSerializer deseralizer = new DataContractJsonSerializer(typeof(SetupSession2RequestFormat));
                format_data = (SetupSession2RequestFormat)deseralizer.ReadObject(ms);// //反序列化ReadObject
                this.debugIt(true, "processSetupSession3Request", "link_id = " + format_data.link_id);
                this.debugIt(true, "processSetupSession3Request", "session_id = " + format_data.session_id);
                this.debugIt(true, "processSetupSession3Request", "theme_id = " + format_data.theme_id_str);
                this.debugIt(true, "processSetupSession3Request", "accept = " + format_data.accept);
                this.debugIt(true, "processSetupSession3Request", "theme_data = " + format_data.theme_data);
            }

            LinkClass link = this.LinkMgrObject().GetLinkById(format_data.link_id);

            if (link == null)
            {
                return(errorProcessSetupSession2(format_data.link_id, "null link"));
            }
            SessionClass session = link.SessionMgrObject().GetSessionBySessionId(format_data.session_id);

            if (session == null)
            {
                return(errorProcessSetupSession2(format_data.link_id, "null session"));
            }
            session.SetBrowserThemeIdStr(format_data.theme_id_str);
            GroupClass group = session.GroupObject();

            if (group == null)
            {
                return(errorProcessSetupSession2(format_data.link_id, "null group"));
            }
            this.mallocRoom(group, format_data.theme_data);

            string response_data = this.dFabricResponseObject.GenerateSetupSession2Response(link.LinkIdStr(), session.SessionIdStr(), session.BrowserThemeIdStr());

            return(response_data);
        }
示例#2
0
        private string processSetupSessionRequest(string input_data_val)
        {
            this.debugIt(true, "processSetupSessionRequest", "input_data_val = " + input_data_val);
            SetupSessionRequestFormat format_data;

            using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(input_data_val)))
            {
                DataContractJsonSerializer deseralizer = new DataContractJsonSerializer(typeof(SetupSessionRequestFormat));
                format_data = (SetupSessionRequestFormat)deseralizer.ReadObject(ms);// //反序列化ReadObject
                this.debugIt(true, "processSetupSessionRequest", "link_id = " + format_data.link_id);
                this.debugIt(true, "processSetupSessionRequest", "his_name = " + format_data.his_name);
                this.debugIt(true, "processSetupSessionRequest", "theme_data = " + format_data.theme_data);
            }

            string theme_id_str = format_data.theme_data.Substring(0, Protocols.FabricFrontEndProtocolClass.BROWSER_THEME_ID_SIZE);
            string theme_data   = format_data.theme_data.Substring(Protocols.FabricFrontEndProtocolClass.BROWSER_THEME_ID_SIZE);

            LinkClass    link    = this.LinkMgrObject().GetLinkByIdStr(format_data.link_id);
            SessionClass session = link.MallocSession();

            session.SetBrowserThemeIdStr(theme_id_str);
            GroupClass group = this.GroupMgrObject().MallocGroup(theme_data);

            if (group == null)
            {
                return(this.errorProcessSetupSession(format_data.link_id, "null group"));
            }
            group.InsertSession(session);
            session.BindGroup(group);

            if (format_data.his_name == link.MyName())
            {
                this.mallocRoom(group, theme_data);
            }
            else
            {
                LinkClass his_link = this.LinkMgrObject().GetLinkByMyName(format_data.his_name);
                if (his_link == null)
                {
                    return(this.errorProcessSetupSession(format_data.link_id, "his_link does not exist"));
                }
                SessionClass his_session = his_link.MallocSession();
                if (his_session == null)
                {
                    return(this.errorProcessSetupSession(format_data.link_id, "null his_session"));
                }

                group.InsertSession(his_session);
                his_session.BindGroup(group);

                his_link.SetPendingSessionSetup(his_link.LinkIdStr() + his_session.SessionIdStr(), theme_data);
            }
            //char* data_ptr;
            //char* downlink_data = data_ptr = (char*)phwangMalloc(LINK_MGR_DATA_BUFFER_SIZE + 4, "DFS1");
            //*data_ptr++ = WEB_FABRIC_PROTOCOL_RESPOND_IS_SETUP_SESSION;
            //memcpy(data_ptr, ajax_id, WEB_FABRIC_PROTOCOL_AJAX_ID_SIZE);
            //data_ptr += WEB_FABRIC_PROTOCOL_AJAX_ID_SIZE;
            //strcpy(data_ptr, session->sessionIdIndex());
            //this->transmitFunction(tp_transfer_object_val, downlink_data);

            string response_data = this.dFabricResponseObject.GenerateSetupSessionResponse(link.LinkIdStr(), session.SessionIdStr());

            return(response_data);
        }