Пример #1
0
        public void Start(FSPParam param, uint playerId)
        {
            m_Param        = param;
            m_MinePlayerId = playerId;
            Log_Tag        = "FSPManager[" + playerId + "]";

            if (m_Param.useLocal)
            {
                m_LockedFrameIndex = param.maxFrameId;
            }
            else
            {
                m_Client = new FSPClient();
                m_Client.Init(m_Param.sid);
                m_Client.SetFSPAuthInfo(param.authId);
                m_Client.SetFSPListener(OnFSPListener);

                m_Client.Connect(param.host, param.port);
                m_Client.VerifyAuth();

                m_LockedFrameIndex = m_Param.clientFrameRateMultiple - 1;
            }

            m_IsRunning = true;
            m_GameState = FSPGameState.Create;

            m_FrameBuffer       = new DictionarySafe <int, FSPFrame>();
            m_CurrentFrameIndex = 0;

            m_FrameCtrl = new FSPFrameController();
            m_FrameCtrl.Start(param);
        }
Пример #2
0
        private static void UpdateProfileSampleList()
        {
            List <NetSampleItem> list = NetDebuger.SampleList;
            int totalCnt = list.Count;

            if (m_profileNextIndex > totalCnt)
            {
                m_mapProfileSampleList = new DictionarySafe <string, List <NetSampleItem> >();
                m_mapProfileCurve      = new DictionarySafe <string, GUICurve>();
                m_profileNextIndex     = 0;
            }


            while (m_profileNextIndex < totalCnt)
            {
                NetSampleItem        item     = list[m_profileNextIndex];
                List <NetSampleItem> listTemp = m_mapProfileSampleList[item.name];

                if (listTemp == null)
                {
                    listTemp = new List <NetSampleItem>();
                    m_mapProfileSampleList.Add(item.name, listTemp);

                    GUICurve curve = new GUICurve();
                    curve.state = false;
                    m_mapProfileCurve.Add(item.name, curve);
                }
                listTemp.Add(item);

                m_profileNextIndex++;
            }
        }
Пример #3
0
        private static void CheckFileList()
        {
            m_listDbgFileName  = new List <string>();
            m_mapDbgFileToggle = new DictionarySafe <string, bool>();
            m_mapDbgFile       = new DictionarySafe <string, NetDebugFile>();
            m_mapCurve         = new DictionarySafe <string, GUICurve>();

            try
            {
                DirectoryInfo dirinfo = new DirectoryInfo(NetDebuger.DbgFileDir);

                if (dirinfo.Exists == false)
                {
                    return;
                }

                FileInfo[] files = dirinfo.GetFiles("*", SearchOption.TopDirectoryOnly);

                for (int i = 0; i < files.Length; i++)
                {
                    m_listDbgFileName.Add(files[i].Name);
                }
            }
            catch (IOException e)
            {
                Debuger.LogWarning(TAG, "CheckFileList() Error:" + e.Message);
            }
        }
        public ArrayStorage(string fullPath)
        {
            this.fullPath = fullPath;

            locker      = new ValueLock();
            cacheByte   = new DictionarySafe <long, byte[]>();
            cacheString = new DictionarySafe <long, string>();

            var inf = new FileInfo(fullPath);

            poolReaders = new Pool <FileStream>();
            poolWriters = new Pool <FileStream>();

            vars = new AsVars(fullPath + ".var");
            list = new ArrayStorageList(fullPath + ".asl");

            if (!inf.Exists)
            {
                if (!inf.Directory.Exists)
                {
                    inf.Directory.Create();
                }

                inf.Create().Close();

                // Выставляем первоначальный размер, что бы не дупустить запись по 0 адресу
                vars.Length = 10;
            }

            if (inf.IsReadOnly)
            {
                inf.IsReadOnly = false;
            }
        }
Пример #5
0
        public void Create(uint userId, string userName, ISession session, string roomName)
        {
            m_mapSession = new DictionarySafe <uint, ISession>();

            m_data       = new RoomData();
            m_data.id    = NewRoomID();
            m_data.name  = roomName;
            m_data.owner = userId;
            AddPlayer(userId, userName, session);
        }
Пример #6
0
        private static string ValidPermissionInWhiteList(string permission, string openId)
        {
            if (MapWhiteList == null)
            {
                MapWhiteList = new DictionarySafe <string, string[]>();
                MapWhiteList.Add(Permission_Admin, WhiteList_Admin);
                MapWhiteList.Add(Permission_Log, WhiteList_Log);

                //TODO 新的白名单在这里增加
            }

            if (string.IsNullOrEmpty(permission))
            {
                bool valided = (Array.IndexOf(WhiteList_Admin, openId) >= 0);
                if (valided)
                {
                    return(Permission_Admin);
                }

                permission = "";

                foreach (KeyValuePair <string, string[]> pair in MapWhiteList)
                {
                    valided = (Array.IndexOf(pair.Value, openId) >= 0);
                    if (valided)
                    {
                        if (permission == "")
                        {
                            permission = pair.Key;
                        }
                        else
                        {
                            permission = permission + "|" + pair.Key;
                        }
                    }
                }
            }
            else
            {
                bool valided = false;
                if (MapWhiteList.ContainsKey(permission))
                {
                    valided = (Array.IndexOf(MapWhiteList[permission], openId) >= 0);
                }

                if (!valided)
                {
                    permission = "";
                }
            }

            return(permission);
        }
        //
        protected Table(DataBase dataBase, TableVersion current, string key)
        {
            Key            = key;
            CurrentVersion = current;

            DataBase      = dataBase;
            ht            = new DictionarySafe <int, T>();
            File          = new PageFile(dataBase.DirectoryPath + Key + ".pgf", CurrentVersion.RecordSize, current.Mode);
            CashSizeLow   = 10000;
            CashSizeHight = 20000;
            Indexes       = new List <object>();

            dataBase.Tables.Add(this);
            InitVersion(current);
        }
Пример #8
0
        private static void OnDbgGUI_RealtimeProfiler()
        {
            if (m_mapProfileCurve == null)
            {
                m_mapProfileCurve = new DictionarySafe <string, GUICurve>();
            }

            if (m_mapProfileSampleList == null)
            {
                m_mapProfileSampleList = new DictionarySafe <string, List <NetSampleItem> >();
            }

            try
            {
                UpdateProfileSampleList();
            }
            catch (Exception e)
            {
                Debuger.LogError(TAG, "OnDbgGUI_RealtimeProfiler() UpdateProfileSampleList: " + e.Message);
            }



            GUILayout.Label("每屏数据采样个数:" + m_NumPerPage);
            m_NumPerPage = (int)GUILayout.HorizontalSlider(m_NumPerPage, 10, 1800);

            foreach (KeyValuePair <string, List <NetSampleItem> > pair in m_mapProfileSampleList)
            {
                string   name   = pair.Key;
                GUICurve curve  = m_mapProfileCurve[name];
                bool     toggle = (bool)curve.state;
                toggle      = GUILayout.Toggle(toggle, name);
                curve.state = toggle;

                if (toggle)
                {
                    OnGUI_ReportProfiler(curve, pair.Value);
                }
            }
        }
 public void Init()
 {
     m_listListener    = new List <object>();
     m_mapMethodHelper = new DictionarySafe <string, RPCMethodHelper>();
 }
Пример #10
0
 public NetDebugFile()
 {
     m_content           = new NetDebugFileData();
     m_mapAllSampleList  = new DictionarySafe <string, List <NetSampleItem> >();
     m_listAllSampleName = new List <string>();
 }
Пример #11
0
        public DictionarySafe<byte, BreakpointAdlers> GetExtBreakpointsList()
        {
            if (_breakpointsExt != null)
                return _breakpointsExt;

            _breakpointsExt = new DictionarySafe<byte, BreakpointAdlers>();

            return _breakpointsExt;
        }
Пример #12
0
        public void AddExtBreakpoint(List<string> newBreakpointDesc)
        {
            if (_breakpointsExt == null)
                _breakpointsExt = new DictionarySafe<byte, BreakpointAdlers>();

            BreakpointInfo breakpointInfo = new BreakpointInfo();

            //1.LEFT condition
            bool leftIsMemoryReference = false;

            string left = newBreakpointDesc[1];
            if (DebuggerManager.isMemoryReference(left))
            {
                breakpointInfo.leftCondition = left.ToUpper();

                // it can be memory reference by registry value, e.g.: (PC), (DE), ...
                if (DebuggerManager.isRegistryMemoryReference(left))
                    breakpointInfo.leftValue = DebuggerManager.getRegistryValueByName(m_spectrum.CPU.regs, DebuggerManager.getRegistryFromReference(left));
                else
                    breakpointInfo.leftValue = DebuggerManager.getReferencedMemoryPointer(left);

                leftIsMemoryReference = true;
            }
            else
            {
                //must be a registry
                if (!DebuggerManager.isRegistry(left))
                    throw new Exception("incorrect breakpoint(left condition)");

                breakpointInfo.leftCondition = left.ToUpper();
            }

            //2.CONDITION type
            breakpointInfo.conditionTypeSign = newBreakpointDesc[2]; // ==, !=, <, >, ...

            //3.RIGHT condition
            byte rightType = 0xFF; // 0 - memory reference, 1 - registry value, 2 - common value

            string right = newBreakpointDesc[3];
            if (DebuggerManager.isMemoryReference(right))
            {
                breakpointInfo.rightCondition = right.ToUpper(); // because of breakpoint panel
                breakpointInfo.rightValue = m_spectrum.ReadMemory(DebuggerManager.getReferencedMemoryPointer(right));

                rightType = 0;
            }
            else
            {
                if (DebuggerManager.isRegistry(right))
                {
                    breakpointInfo.rightCondition = right;

                    rightType = 1;
                }
                else
                {
                    //it has to be a common value, e.g.: #4000, %111010101, ...
                    breakpointInfo.rightCondition = right.ToUpper(); // because of breakpoint panel
                    breakpointInfo.rightValue = DebuggerManager.convertNumberWithPrefix(right); // last chance

                    rightType = 2;
                }
            }

            if (rightType == 0xFF)
                throw new Exception("incorrect right condition");

            //4. finish
            if (leftIsMemoryReference)
            {
                if (DebuggerManager.isRegistryMemoryReference(breakpointInfo.leftCondition)) // left condition is e.g.: (PC), (HL), (DE), ...
                {
                    if (rightType == 2) // right is number
                        breakpointInfo.accessType = BreakPointConditionType.registryMemoryReferenceVsValue;
                }
            }
            else
            {
                if (rightType == 2)
                    breakpointInfo.accessType = BreakPointConditionType.registryVsValue;
            }

            breakpointInfo.isOn = true; // activate the breakpoint

            //save breakpoint command line string
            breakpointInfo.breakpointString = String.Empty;
            for (byte counter = 0; counter < newBreakpointDesc.Count; counter++)
            {
                breakpointInfo.breakpointString += newBreakpointDesc[counter];
                if (counter + 1 < newBreakpointDesc.Count)
                    breakpointInfo.breakpointString += " ";
            }

            // ADD breakpoint into list
            // Here will be the breakpoint key assigned by searching keys starting with key 0
            // Maximum 255 breakpoints is allowed
            if (_breakpointsExt.Count < 255)
            {
                var bp = new BreakpointAdlers(breakpointInfo);
                _breakpointsExt.Add((byte)_breakpointsExt.Count, bp);
                m_spectrum.AddBreakpoint(bp);
            }
            else
                throw new Exception("Maximum breakpoints count(255) exceeded...");
        }