Пример #1
0
        public IEnumerable <UserWords> GetChat(string room_name)
        {
            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            //return ChatManager.Get(room);
            return(ChatPond.Get(canonical_room_name));
        }
Пример #2
0
        public void UpdatePosition2(string user_id, double x, double y, string room_name)
        {
            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            UserCenter.UpdatePosition(canonical_room_name, user_id, x, y);
            HotRoomCenter.Update(canonical_room_name, user_id);
        }
Пример #3
0
        public object GetFigurePage(string room_name, int page_id)
        {
            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            IEnumerable <FigureInfo> list = FigureCenter.GetFigurePage(canonical_room_name, ref page_id);

            return(new { page_id = page_id, list = list });
        }
Пример #4
0
        public int /*0=suc, 1=fail, 2=full, 3=suc almost full, 4=too fast*/ DrawPaths(PathModel[] models, string room_name)
        {
            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            if (Limiter.IsOverRate(Context.ConnectionId))
            {
                return(4);
            }

            // Order inversion may happen when current paths are still under processing and next paths rush in in a new thread.
            // This causes later path gets smaller gsid.

            int ret = 0;
            //Trace.TraceInformation("DrawPaths. models.Length={0}.", models.Length);

            string batch_uri  = null;
            int    batch_gsid = 0;

            for (int i = 0; i < models.Length; i++)
            {
                PathModel model = models[i];

                if (model.Type == (int)PathType.PT_BATCH)
                {
                    if (model.DxDyCombined == batch_uri)
                    {
                        model.Gsid = batch_gsid;
                    }
                    else
                    {
                        model.Gsid = GsidManager.Get(canonical_room_name);                                      // Negative and 0 GSIDs are also valid.
                        batch_gsid = model.Gsid;
                        batch_uri  = model.DxDyCombined;

                        // make all flag paths have same gsid. Otherwise path orders are affected by flag path's GSID. Batch path's order should depend on subid only.
                    }
                }
                else
                {
                    model.Gsid = GsidManager.Get(canonical_room_name);                                  // Negative and 0 GSIDs are also valid.
                }
                int r = DrawAPath5(model, canonical_room_name);
                if (r != 0)
                {
                    ret = r;
                }
            }
            return(ret);
        }
Пример #5
0
        public void UpdateStatus2(string user_id, string name, string status, string room_name)
        {
            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            if (name != null && status != null)
            {
                if (name.Length <= 20 && status.Length <= 100)
                {
                    //ChatManager.Add(name, status);
                    ChatPond.AddChat(canonical_room_name, name, status);

                    UserCenter.UpdateStatus(canonical_room_name, user_id, name, status);
                }
            }
        }
Пример #6
0
        public bool CreateFigure(string room_name, string figure_name, string uri, string user_id)
        {
            if (figure_name.Length > 100 || figure_name.Length < 1)
            {
                return(false);
            }
            if (!Util.WithinCharSetUserName(figure_name))
            {
                return(false);
            }

            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            bool ret = FigureStore.CreateFigure(canonical_room_name, figure_name, uri, user_id);

            if (ret)
            {
                Clients.Group(canonical_room_name).onNewFigure();
            }
            return(ret);
        }
Пример #7
0
        public IDictionary <string, UserStatus> GetAllStatus(string room_name)
        {
            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            return(UserCenter.GetAllStatus(canonical_room_name));
        }
Пример #8
0
        public void AddEarlyPath(PathModel model, string room_name)
        {
            string canonical_room_name = RoomNameGuard.CheckName(room_name);

            PathCenter.AddEarlyPath(model, canonical_room_name);
        }