Example #1
0
        public void UpdateTable()
        {
            Room4Server.LoadAllPVPReplays();

            var replayKeys = Room4Server.AllReplayTitles;

            if (replayKeys == null || replayKeys.Length == 0)
            {
                return;
            }

            for (int i = 0; i < replayKeys.Length; i++)
            {
                var r = Room4Server.GetReplay(replayKeys[i]);

                var da = new DataAnalysis();

                DeserializeReplay(da, r);

                dac.Retrieve(da.ID, (data) =>
                {
                    var isNew = data == null;

                    if (isNew)
                    {
                        dac.AddNew(da);
                        dac.Close();
                    }
                });
            }
        }
Example #2
0
        // 调取自己最近录像
        void OnGetMyReplayList(Session s, IReadableBuffer data, IWriteableBuffer buff)
        {
            var maxNum  = data.ReadInt();
            var usrInfo = s.Usr.Info;

            var lst = new List <string>();
            var arr = usrInfo.MyReplays.ToArray();

            for (var i = 0; lst.Count < maxNum && i < arr.Length; i++)
            {
                var r = arr[arr.Length - i - 1];
                if (Room4Server.AllReplayTitles.FirstIndexOf(r) >= 0)
                {
                    lst.Add(r);
                }
                else
                {
                    usrInfo.MyReplays.Remove(r);
                }
            }

            buff.Write(lst.Count);
            foreach (var rid in lst)
            {
                var r = Room4Server.GetReplay(rid);
                r.SerializeHeader(buff);
            }
        }
Example #3
0
        // 调取最近录像列表
        void OnGetReplayList(Session s, IReadableBuffer data, IWriteableBuffer buff)
        {
            var maxNum = data.ReadInt();
            var arr    = Room4Server.AllReplayTitles;
            var lst    = new List <string>();

            for (var i = 0; lst.Count < maxNum && i < arr.Length; i++)
            {
                var n = arr.Length - 1 - i;
                var t = arr[n];
                var r = Room4Server.GetReplay(t);

                if (t.IndexOf(".crash.") < 0 && r.Length < 0 /* 两分钟 */)
                {
                    continue;
                }

                lst.Add(t);
            }

            buff.Write(lst.Count);
            foreach (var rid in lst)
            {
                var r = Room4Server.GetReplay(rid);
                r.SerializeHeader(buff);
            }
        }
Example #4
0
        // 调取录像
        void OnGetReplay(Session s, IReadableBuffer data, IWriteableBuffer buff)
        {
            var replayName = data.ReadString();
            var r          = Room4Server.GetReplay(replayName);

            buff.Write(r != null);
            if (r != null)
            {
                r.Serialize(buff);
            }
        }