Example #1
0
        private void SendMsg(byte[] msg)
        {
            if (m_mySocket == null)
            {
                return;
            }

            if (!m_isSocketReady)
            {
                return;
            }

            //lock (this)
            {
                if (m_mySocket.Client != null && m_mySocket.Client.Connected)
                {
                    try
                    {
                        m_mySocket.Client.Send(msg, 0, m_currentSendBufferWritePosition, SocketFlags.None);
                        m_currentSendBufferWritePosition = 0;
                    }
                    catch (Exception ex)
                    {
                        m_currentSendBufferWritePosition = 0;
                        DEBUG.Error("SendMsg Error: {0}", ex.Message.ToString());
                    }
                }
            }
        }
Example #2
0
        public string FilenameWithNumberSuffix(string filename, string extension, uint maxNumber = 100)
        {
            string currentFilename = filename + extension;

            if (!fileExists(currentFilename))
            {
                return(currentFilename);
            }

            // otherwise, add the suffixes and test them out until we find one that works
            StringBuilder tmpNum = new StringBuilder();

            tmpNum.Append(".");//<<1;
            for (uint i = 1; i < maxNumber; i++)
            {
                currentFilename = filename + tmpNum.ToString() + extension;
                if (fileExists(currentFilename))
                {
                    currentFilename = filename;
                    //tmpNum.seekp(0);
                    //tmpNum << "." << i;
                }
                else
                {
                    return(currentFilename);
                }
            }
            // if we can't find one, just give up and return whatever is the current filename
            if (Config.DEBUG_MEMORY)
            {
                DEBUG.WriteLine("ERROR  Warning: Couldn't find a suitable suffix for " + filename);
            }
            return(currentFilename);
        }
Example #3
0
        /// <summary>
        /// Remove the user interface panel.
        /// it will be remove from the m_UIPanels, and add to m_DelPanels.
        /// it will delete server frames later.
        /// </summary>
        /// <returns>
        /// success or not
        /// </returns>
        /// <param name='uiid'>
        /// Panel's ID
        /// </param>
        public bool RemoveUIPanel(ushort uiid)
        {
            DEBUG.Gui("Remove UI Panel: " + UIConstant.UIIdToString(uiid));

            //Debug.LogError("移除面板:" + uiid);

            if (UIPanels.ContainsKey(uiid))
            {
                if (IsActive(uiid))
                {
                    if ((GameObject)UIPanels[uiid] != null)
                    {
                        DoClosePanel(uiid);
                    }
                }

                if ((GameObject)UIPanels[uiid] != null)
                {
                    ((GameObject)UIPanels[uiid]).SetActive(false);
                    delPanels.Add(uiid, (UIPanels[uiid] as GameObject));
                }
                UIPanels.Remove(uiid);
                delDelayFrame = DEL_PANEL_FRAME;

                return(true);
            }

            return(false);
        }
Example #4
0
        public uint findChannelNumber(UInt64 addr)
        {
            // Single channel case is a trivial shortcut case
            if (Config.dram_config.NUM_CHANS == 1)
            {
                return(0);
            }

            if (!isPowerOfTwo(Config.dram_config.NUM_CHANS))
            {
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("ERROR  We can only support power of two # of channels.\n" +
                                    "I don't know what Intel was thinking, but trying to address map half a bit is a neat trick that we're not sure how to do");
                }
                Environment.Exit(1);
            }

            // only chan is used from this set
            int channelNumber = 0, rank = 0, bank = 0, row = 0, col = 0;

            addressMapping(addr, ref channelNumber, ref rank, ref bank, ref row, ref col);
            if (channelNumber >= Config.dram_config.NUM_CHANS)
            {
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("ERROR Got channel index " + channelNumber + " but only " + Config.dram_config.NUM_CHANS + " exist");
                }
                Environment.Exit(1);
            }
            //DEBUG("Channel idx = "<<channelNumber<<" totalbits="<<totalBits<<" channelbits="<<channelBits);

            return((uint)channelNumber);
        }
Example #5
0
        public void actual_update()
        {
            if (currentClockCycle == 0)
            {
                InitOutputFiles(traceFilename);
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("DEBUG :  DRAMSim2 Clock Frequency =" + clockDomainCrosser.clock1 + "Hz, CPU Clock Frequency=" + clockDomainCrosser.clock2 + "Hz");
                }
            }

            if (currentClockCycle % Config.dram_config.EPOCH_LENGTH == 0)
            {
                for (int i = 0; i < Config.dram_config.NUM_CHANS; i++)
                {
                    channels[i].printStats(false);
                }
            }

            for (int i = 0; i < Config.dram_config.NUM_CHANS; i++)
            {
                channels[i].update();
            }


            currentClockCycle++;
        }
Example #6
0
        /// <summary>
        /// 获取mcgstest
        /// </summary>
        /// <returns></returns>
        public List <XML_MCGSTest> GetAllMCGSTest()
        {
            List <XML_MCGSTest> _listMcgsTest = new List <XML_MCGSTest>();

            try
            {
                XmlNodeList nodeList = Utility.XmlHelper.GetXmlNodeListByXpath(Path, "/ClientConfig/MCGS/Test");

                foreach (XmlNode item in nodeList)
                {
                    XmlElement   xel  = (XmlElement)item;
                    XML_MCGSTest mcgs = new XML_MCGSTest();
                    mcgs.UniqueId        = int.Parse(xel.GetAttribute("UniqueId"));
                    mcgs.StationUniqueId = int.Parse(xel.GetAttribute("StationUniqueId"));
                    mcgs.TestId          = int.Parse(xel.GetAttribute("TestId"));
                    mcgs.ColumnName      = xel.GetAttribute("ColumnName");
                    mcgs.TestName        = xel.GetAttribute("TestName");

                    _listMcgsTest.Add(mcgs);
                }
            }
            catch (Exception ex)
            {
                LogMg.AddError(ex);
                DEBUG.ThrowException(ex);
            }
            return(_listMcgsTest);
        }
Example #7
0
        public MultiChannelMemorySystem(string systemIniFilename_, uint megsOfMemory_)
        {
            megsOfMemory = megsOfMemory_;

            systemIniFilename = systemIniFilename_;


            //  clockDomainCrosser = (new ClockDomain::Callback<MultiChannelMemorySystem, void>(this, &MultiChannelMemorySystem::actual_update));
            clockDomainCrosser = new ClockDomainCrosser(new ClockUpdateCB(this.actual_update));

            currentClockCycle = 0;

            if (!isPowerOfTwo(megsOfMemory))
            {
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("ERROR:  Please specify a power of 2 memory size");
                }
                Environment.Exit(1);
            }
            if (Config.DEBUG_MEMORY)
            {
                DEBUG.WriteLine("DEBUG: == Loading system model file '" + systemIniFilename + "' == ");
            }
            channels = new List <MemorySystem>();
            for (uint i = 0; i < Config.dram_config.NUM_CHANS; i++)
            {
                MemorySystem channel = new MemorySystem(i, megsOfMemory / Config.dram_config.NUM_CHANS, ref dramsim_log);
                channels.Add(channel);
            }
        }
Example #8
0
        /// <summary>
        /// 返回所有农村项目检测点
        /// </summary>
        /// <returns></returns>
        public List <XML_CountryTest> GetAllCountryTest()
        {
            List <XML_CountryTest> _listCountryTest = new List <XML_CountryTest>();

            try
            {
                XmlNodeList nodeList = Utility.XmlHelper.GetXmlNodeListByXpath(Path, "/ClientConfig/CountryTest/Test");

                foreach (XmlNode item in nodeList)
                {
                    XmlElement      xel         = (XmlElement)item;
                    XML_CountryTest countryTest = new XML_CountryTest();

                    countryTest.UniqueId        = int.Parse(xel.GetAttribute("UniqueId"));
                    countryTest.StationUniqueId = int.Parse(xel.GetAttribute("StationUniqueId"));
                    countryTest.NodeId          = xel.GetAttribute("NodeId");
                    countryTest.TestId          = int.Parse(xel.GetAttribute("TestId"));
                    countryTest.Multiple        = double.Parse(xel.GetAttribute("Multiple"));
                    countryTest.Remark          = xel.GetAttribute("备注");

                    _listCountryTest.Add(countryTest);
                }
            }
            catch (Exception ex)
            {
                LogMg.AddError(ex);
                DEBUG.ThrowException(ex);
            }
            return(_listCountryTest);
        }
Example #9
0
        /// <summary>
        /// 获取所有检测节点
        /// </summary>
        /// <returns></returns>
        public List <XML_CountryNode> GetAllCountryNode()
        {
            List <XML_CountryNode> _listCountryTest = new List <XML_CountryNode>();

            try
            {
                XmlNodeList nodeList = Utility.XmlHelper.GetXmlNodeListByXpath(Path, "/ClientConfig/CountryTest/Nodes/Node");
                foreach (XmlNode item in nodeList)
                {
                    XmlElement      xel  = (XmlElement)item;
                    XML_CountryNode node = new XML_CountryNode();

                    node.NodeId = xel.GetAttribute("NodeId");
                    node.Remark = xel.GetAttribute("备注");

                    _listCountryTest.Add(node);
                }
            }
            catch (Exception ex)
            {
                LogMg.AddError(ex);
                DEBUG.ThrowException(ex);
            }
            return(_listCountryTest);
        }
Example #10
0
        //ConnectionRequestListener
        public void onConnectDone(ConnectEvent eventObj)
        {
            Debug.Log("onConnectDone >> " + eventObj.getResult());
            DEBUG.Log("ConnectDone >> " + eventObj.getResult());
            //DEBUG.Log ("onConnectDone "+eventObj.getResult());
//			GameObject camera = GameObject.FindGameObjectWithTag ("LoginPanel");

            if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
            {
                loginScript.onConnectedSuccessfully();
                m_apppwarp.isConnected = true;
            }
            else if (eventObj.getResult() == WarpResponseResultCode.SUCCESS_RECOVERED)
            {
                Debug.Log("onConnectDone >>  Recovered Done" + eventObj.getResult());
            }
            else if (eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE)
            {
                Debug.Log("onConnectDone >> Connection Recoverable" + eventObj.getResult());
                StartCoroutine(ReconnectToServer());
            }
            else if (eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERR)
            {
                loginScript.onConnectedFail("" + eventObj.getResult());
                m_apppwarp.isConnected = false;
            }
        }
Example #11
0
        public bool DecryptHeader(string password, bool checkonly = false)
        {
            ReadHeader();

            if (_header == null)
            {
                throw new InvalidOperationException("Header not decrypted");
            }
            DEBUG.Print(GetType(), "unlock");
            string d = Crypto.Decrypt(this._header, EnhancePassword(password));

            if (d == null)
            {
                return(false);
            }
            if (_headerRegex.IsMatch(d))
            {
                if (!checkonly)
                {
                    this._decryptedheader = d;
                }
                return(true);
            }
            return(false);
        }
Example #12
0
        public void powerUp()
        {
            if (!isPowerDown)
            {
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("== Error - Trying to power up rank " + id + " while it is not already powered down");
                }
                Environment.Exit(1);
            }

            isPowerDown = false;

            for (int i = 0; i < Config.dram_config.NUM_BANKS; i++)
            {
                if (bankStates[i].nextPowerUp > currentClockCycle)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("== Error - Trying to power up rank " + id + " before we're allowed to");
                    }
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine(bankStates[i].nextPowerUp + "    " + currentClockCycle);
                    }
                    Environment.Exit(1);
                }
                bankStates[i].nextActivate     = currentClockCycle + Config.dram_config.tXP;
                bankStates[i].currentBankState = CurrentBankState.Idle;
            }
        }
Example #13
0
 public override void Update()
 {
     DEBUG.reset();
     gun.CoolDown();
     readInput();
     base.Update();
 }
Example #14
0
File: PIM.cs Project: hoangt/PIMSim
        public PIM(ref InsPartition ins_p_)
        {
            if (Config.DEBUG_PIM)
            {
                DEBUG.WriteLine("PIM Module Initialed.");
            }
            ins_p = ins_p_;

            unit = new List <ComputationalUnit>();
            if (PIMConfigs.unit_type == PIM_Unit_Type.Processors)
            {
                if (Config.DEBUG_PIM)
                {
                    DEBUG.WriteLine("PIM Unit Type : Processors.");
                }
                for (int i = 0; i < PIMConfigs.N; i++)
                {
                    var p = new PIMProc(ref ins_p, i);
                    unit.Add(p);
                }
            }
            else
            {
                if (Config.DEBUG_PIM)
                {
                    DEBUG.WriteLine("PIM Unit Type : Pipeline.");
                }
                //pipeline mode
                // When PIMSim runs into pipeline mode, input should always be a Function.

                for (int i = 0; i < PIMConfigs.CU_Name.Count; i++)
                {
                    if (PIMConfigs.CU_Name[i] == "Customied")
                    {
                        //add your code here
                    }
                    else
                    {
                        if (PIMConfigs.CU_Name[i] == "Adder")
                        {
                            unit.Add(new Adder(i, ref ins_p) as ComputationalUnit);
                            return;
                        }
                        else
                        {
                            if (PIMConfigs.CU_Name[i] == "Adder_Conventional")
                            {
                                unit.Add(new Adder_Conventional(i, ref ins_p) as ComputationalUnit);
                                return;
                            }
                            else
                            {
                                DEBUG.Error("No PIM Unit templates.");
                                Environment.Exit(2);
                            }
                        }
                    }
                }
            }
        }
Example #15
0
 //Bite Special Attack -TRex
 public void Bite(Animator _dinoAnimator)
 {
     if (timerBite >= coolDownBite)
     {
         if (animator)
         {
             animator.enabled = true;
         }
         bite = true;
         EnableInput(false);
         if (animator)
         {
             animator.SetTrigger("Bite");
         }
         animator.SetInteger("Dinotype", (int)controller.thisTank);
         _dinoAnimator.SetTrigger("SpecialAttack");
         if (loadoutPanel.specialButtonAnimator)
         {
             loadoutPanel.specialButtonAnimator.SetBool("IsReady", false);
         }
         loadoutPanel.SetSpecialGreyOutBadge(controller.currentDino);
         specialHasFired = true;
         DEBUG.Log("Bite special attack has been carried out witht the all the animator triggers set");
     }
 }
Example #16
0
        // <summary>
        /// 连接报名服务器
        /// </summary>
        public void Connect()
        {
            tryCount++;
            //设置回调函数
            NetClient.SetCallBack(OnNetMessage, OnDisConnect, OnConnectResult);
            if (NetworkMgr.Instance.ProxyEnable == 1)
            {
                if (proxyIndex == 0)
                {
                    proxyIndex = 1 + Random.Range(0, NetworkMgr.Instance.ProxyInfoList.Count);
                }
                Debug.LogWarning("开始连接服务器" + "开始通过代理[" + NetworkMgr.Instance.ProxyInfoList[proxyIndex - 1].ip + ":"
                                 + NetworkMgr.Instance.ProxyInfoList[proxyIndex - 1].port + "]连接游戏报名服务器["
                                 + ServerIP + ":" + ServerPort + "]");

                DEBUG.Networking(DEBUG.TRACER_LOG + "开始通过代理[" + NetworkMgr.Instance.ProxyInfoList[proxyIndex - 1].ip + ":"
                                 + NetworkMgr.Instance.ProxyInfoList[proxyIndex - 1].port + "]连接游戏报名服务器["
                                 + ServerIP + ":" + ServerPort + "]");

                //把代理网址转为IP地址
                IPHostEntry ipHost = Dns.GetHostEntry(NetworkMgr.Instance.ProxyInfoList[proxyIndex - 1].ip);
                IPAddress[] ipAddr = ipHost.AddressList;
                NetClient.ConnectServer(NetComm.NetProxy.ProxyType.PROXY_HTTP,
                                        ipAddr[0].ToString(), NetworkMgr.Instance.ProxyInfoList[proxyIndex - 1].port,
                                        ServerIP, ServerPort, "", "");
            }
            else
            {
                proxyIndex = 0;

                Debug.LogError("[LobbyNetMgr] " + "开始连接游戏报名服务器[" + ServerIP + ":" + ServerPort + "]");

                NetClient.ConnectServer(ServerIP, ServerPort);
            }
        }
Example #17
0
        public void PrintStatus()
        {
            DEBUG.WriteLine();
            DEBUG.WriteLine();
            DEBUG.WriteLine("++++++++++++++++++++++     Statistics    ++++++++++++++++++++");
            DEBUG.WriteLine();
            DEBUG.WriteLine();
            foreach (var item in proc)
            {
                item.PrintStatus();
            }
            Mctrl.PrintStatus();
            if (Config.use_pim)
            {
                PIMMctrl.PrintStatus();
            }


            ins_p.PrintStatus();

            foreach (var item in pim.unit)
            {
                item.PrintStatus();
            }
        }
Example #18
0
    // Used for swapping weapon icons
    public void SwapSelectedWeapon()
    {
        foreach (Transform item in selectedPanel.transform)
        {
            Destroy(item.gameObject);
        }
        GameObject badge = (GameObject)Instantiate(loadoutbadgePrefab); // under badge a prefab will be instantiated

        badge.transform.SetParent(selectedPanel.transform, false);      // set the parent of the badge
        badge.transform.localScale = new Vector3(1, 1, 1);              // set the position of the badge icon
        badge.GetComponent <Animator>().enabled = false;
        Sprite       tempSprte      = APP.PlayerTankManager.m_loadout[tankGunController.selectedWeaponIndex].GetComponent <WeaponIcon>().icon;
        LoadoutBadge badgeScriptRef = badge.GetComponent <LoadoutBadge>();

        badgeScriptRef.iconImage.sprite    = tempSprte;                                                                              // get the temporary sprite from the badge reference
        badgeScriptRef.weaponName          = APP.PlayerTankManager.m_loadout[tankGunController.selectedWeaponIndex].gameObject.name; // get the weapon name from the selected weapon of the tankGunController
        badgeScriptRef.selectImage.enabled = true;
        if (APP.PlayerTankManager.m_loadout[tankGunController.selectedWeaponIndex].GetComponent <WeaponIcon>().isInfinate)
        {
            badgeScriptRef.qtyText.text = "";
        }
        else
        {
            badgeScriptRef.qtyText.text = APP.PlayerTankManager.GetWeaponQuantity(APP.PlayerTankManager.m_loadout[tankGunController.selectedWeaponIndex].gameObject.name).ToString();
        }
        DEBUG.Log("Weapon has been swapped");
    }
Example #19
0
File: LRU.cs Project: hoangt/PIMSim
        /// <summary>
        /// l1Cache replace implement
        /// </summary>
        /// <param name="assoc">cache assoc</param>
        /// <param name="index">cache index</param>
        /// <param name="cache_">cache</param>
        /// <param name="ret_assoc">counted replace assoc index</param>
        /// <returns></returns>
        public override bool Calculate_Rep(int assoc, int index, CacheEntity[,] cache_, ref int ret_assoc)
        {
            int    min_index = -1;
            UInt64 timestamp = UInt64.MaxValue;

            for (int i = 0; i < assoc; i++)
            {
                if (cache_[i, index].block_addr == NULL)
                {
                    ret_assoc = i;

                    return(false);
                }
                if (cache_[i, index].timestamp < timestamp)
                {
                    min_index = i;
                    timestamp = cache_[i, index].timestamp;
                }
            }
            if (min_index != -1)
            {
                ret_assoc = min_index;
                return(true);
            }
            //found no suitable replacement
            DEBUG.WriteLine("ERROR : No suitable replacement found.");
            return(false);
        }
Example #20
0
        /// <summary>
        /// 获取UI面板的ID
        /// </summary>
        public virtual ushort GetID()
        {
            DEBUG.Gui("Get ID: UIConstant.UIID_WRONG_ID. Overwrite the GetID() function in subclass!");

            return(0x0000);
            //return UIConstant.UIID_WRONG_ID;
        }
Example #21
0
        /// <summary>
        /// Search for a cacheline in cache.
        /// </summary>
        /// <param name="block_addr_">target block address</param>
        /// <param name="reqt_">related request type</param>
        /// <returns></returns>
        public bool search_block(UInt64 block_addr_, RequestType reqt_)
        {
            cycle++;

            UInt64 index = block_addr_ % (uint)max_set;

            for (int i = 0; i < assoc; i++)
            {
                if (cache[i, index].block_addr == block_addr_)
                {
                    //cache hit
                    hits++;
                    cache[i, index].timestamp = cycle;
                    if (reqt_ == RequestType.WRITE)
                    {
                        cache[i, index].dirty = true;
                    }
                    if (Config.DEBUG_CACHE)
                    {
                        DEBUG.WriteLine("-- L1Cache : Hit : [" + reqt_ + "] [0x" + block_addr_.ToString("X") + "]");
                    }
                    return(true);
                }
            }

            //found none in cache
            miss++;
            if (Config.DEBUG_CACHE)
            {
                DEBUG.WriteLine("-- L1Cache : Miss : [" + reqt_ + "] [0x" + block_addr_.ToString("X") + "]");
            }
            return(false);
        }
Example #22
0
 public bool isEmpty(uint rank)
 {
     if (Config.dram_config.queuingStructure == QueuingStructure.PerRank)
     {
         return(queues[(int)rank][0].Count() <= 0);
     }
     else if (Config.dram_config.queuingStructure == QueuingStructure.PerRankPerBank)
     {
         for (int i = 0; i < Config.dram_config.NUM_BANKS; i++)
         {
             if (!(queues[(int)rank][(int)i].Count() <= 0))
             {
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         if (Config.DEBUG_MEMORY)
         {
             DEBUG.WriteLine("DEBUG: Invalid Queueing Stucture");
         }
         Environment.Exit(1);
         return(false);
     }
 }
Example #23
0
        private void DeviceControlCallBack(Socket socket, string json)
        {
            C_To_S_Data <CSDataStandard.Transfer.DeviceControl> receiveObj = Utility.JsonHelper.JsonDeserialize <C_To_S_Data <CSDataStandard.Transfer.DeviceControl> >(json);

            //获取所有Org
            Clazz.Config.XML_Org org = SysConfig.orgConfig.GetOrgByOrgId(receiveObj.OrgId);
            if (org == null)  //判断Org是否存在
            {
                string msg = "OrgId:" + receiveObj.OrgId + "不存在";
                LogMg.AddError(msg);
                lb_msg.Items.Add(msg);
            }
            else
            {
                try
                {
                    SWSDataContext  db          = new SWSDataContext(ServerSocketHelper.GetConnection(org.DBName));
                    string          stationName = "未知的客户端";
                    country_station station     = db.country_station.SingleOrDefault(c => c.id == receiveObj.StationId);
                    if (station != null)
                    {
                        stationName = station.name;
                    }

                    saveData(db, receiveObj, stationName);

                    sendData(db, socket, stationName, receiveObj.StationId);
                }
                catch (Exception ex)
                {
                    LogMg.AddError(ex);
                    DEBUG.MsgBox(ex.ToString());
                }
            }
        }
Example #24
0
    public int SendCliMsg(object obj, ushort type, bool bEncrypt)
    {
        int iRet = -2;

        if ((null != m_client) && (null != obj))
        {
            try
            {
                iRet = m_client.send((byte[])obj, bEncrypt);
                //byte[] item = NetClient.ConvertToByte(obj);
                //int offset = 0;
                //NetComm.MsgHeadDef header = XConvert.ToObject<NetComm.MsgHeadDef>(item, ref offset);
                //header.cVersion = 3;
                //header.cMsgType = type;
                //byte[] headItem = NetClient.ConvertToByte(header);
                //Array.Copy(headItem, item, headItem.Length);
                ////DEBUG.NetworkClient(type, item);
                //iRet = m_client.send(item, bEncrypt);
            }
            catch (Exception e)
            {
                DEBUG.Networking(DEBUG.TRACER_LOG + "GameClient.SendCliMsg, exp: " + e.Message, LogType.Exception);
            }
        }

        return(iRet);
    }
Example #25
0
    // connect to server
    public bool Connect(string strHost, int Port)
    {
        //m_strServer = strHost;
        //m_iPort = Port;

        bool br = false;

        try
        {
            if (Application.webSecurityEnabled)
            {
                int start_index = UnityEngine.Random.Range(0, CROSSDOMAIN_PORTLIST.Length);
                int i           = 0;
                for (; i < CROSSDOMAIN_PORTLIST.Length; i++)
                {
                    if (Security.PrefetchSocketPolicy(strHost, CROSSDOMAIN_PORTLIST[(start_index + i) % CROSSDOMAIN_PORTLIST.Length]))
                    {
                        break;
                    }
                }
                if (i == CROSSDOMAIN_PORTLIST.Length)
                {
                    DEBUG.Networking(DEBUG.TRACER_LOG + "cross_domain failed, ip=" + strHost, LogType.Error);
                    return(br);
                }
            }
            // Debug.LogWarning("connect000============" + strHost);
            br = m_client.connect(strHost, Port);
        }
        catch
        {
        }

        return(br);
    }
Example #26
0
        /// <summary>
        /// Add to MSHR
        /// </summary>
        /// <param name="req_">Processor Request</param>
        /// <returns>False when MSHR is full; else true.</returns>
        public bool add_to_mshr(ProcRequest req_)
        {
            if (MSHR.Exists(x => x.actual_addr == req_.actual_addr && x.block_addr == req_.block_addr))
            {
                for (int i = 0; i < MSHR.Count; i++)
                {
                    if (MSHR[i].actual_addr == req_.actual_addr && MSHR[i].block_addr == req_.block_addr)
                    {
                        if (Config.DEBUG_PROC)
                        {
                            DEBUG.WriteLine("-- MSHR : Merge Reqs : [" + req_.type + "] [0x" + req_.actual_addr.ToString("X") + "]");
                        }
                        return(true);
                    }
                }
            }

            if (MSHR.Count > Config.mshr_size)
            {
                if (Config.DEBUG_PROC)
                {
                    DEBUG.WriteLine("-- MSHR : Failed to add Req to MSHR.");
                }
                mshr_stalled++;
                return(false);
            }
            mshr_loaded++;
            MSHR.Add(req_);
            if (Config.DEBUG_PROC)
            {
                DEBUG.WriteLine("-- MSHR : New Entry : [" + req_.type + "] [0x" + req_.actual_addr.ToString("X") + "]");
            }
            return(true);
        }
Example #27
0
 // Swipe Special Attack - Stego
 public void Swipe(Animator _dinoAnimator)
 {
     if (timerSwipe >= coolDownSwipe)            // if swipe is greater or equal to my swipe cool down
     {
         if (animator)
         {
             animator.enabled = true;
         }
         swipe = true;
         EnableInput(false);
         _dinoAnimator.SetTrigger("SpecialAttack");
         animator.SetInteger("Dinotype", (int)controller.thisTank);
         if (animator)
         {
             animator.SetTrigger("Swipe");
         }
         if (loadoutPanel.specialButtonAnimator)
         {
             loadoutPanel.specialButtonAnimator.SetBool("IsReady", false);
         }
         loadoutPanel.SetSpecialGreyOutBadge(controller.currentDino);
         specialHasFired = true;
         DEBUG.Log("Swipe special attack has been carried out witht the all the animator triggers set");
     }
 }
        /// <summary>
        /// 获取所有Test
        /// </summary>
        /// <returns></returns>
        public List <Clazz.Config.XML_Test> GetAllTests()
        {
            List <Clazz.Config.XML_Test> ListTest = new List <Clazz.Config.XML_Test>();

            try
            {
                XmlNodeList nodeList = Utility.XmlHelper.GetXmlNodeListByXpath(PATH, "/Config/Tests/Test");
                foreach (XmlNode item in nodeList)
                {
                    XmlElement            xel  = (XmlElement)item;
                    Clazz.Config.XML_Test test = new Clazz.Config.XML_Test();
                    test.StationUnique  = int.Parse(xel.GetAttribute("StationUnique"));
                    test.StationId      = int.Parse(xel.GetAttribute("StationId"));
                    test.RegisterNo     = ushort.Parse(xel.GetAttribute("RegisterNo"));
                    test.TestId         = int.Parse(xel.GetAttribute("TestId"));
                    test.Multiple       = double.Parse(xel.GetAttribute("Multiple"));
                    test.FunctionCode   = Convert.ToInt32(xel.GetAttribute("FunctionCode"));
                    test.ReceiveTimeout = Convert.ToInt32(xel.GetAttribute("ReceiveTimeout"));
                    test.DataType       = xel.GetAttribute("DataType");
                    test.Address        = byte.Parse(xel.GetAttribute("Address"));
                    test.DecodeOrder    = xel.GetAttribute("DecodeOrder");
                    test.Min            = double.Parse(xel.GetAttribute("Min"));
                    test.Max            = double.Parse(xel.GetAttribute("Max"));
                    test.AddNumber      = double.Parse(xel.GetAttribute("AddNumber"));
                    ListTest.Add(test);
                }
            }
            catch (Exception ex)
            {
                LogMg.AddError(ex);
                DEBUG.ThrowException(ex);
            }
            return(ListTest);
        }
        /// <summary>
        /// 返回所有的Station
        /// </summary>
        /// <returns></returns>
        private List <Clazz.Config.XML_Station> GetAllStation()
        {
            List <Clazz.Config.XML_Station> ListStation = new List <Clazz.Config.XML_Station>();

            try
            {
                XmlNodeList nodeList = Utility.XmlHelper.GetXmlNodeListByXpath(PATH, "/Config/Stations/Station");
                foreach (XmlNode item in nodeList)
                {
                    XmlElement xel = (XmlElement)item;
                    Clazz.Config.XML_Station station = new Clazz.Config.XML_Station();
                    station.Unique    = int.Parse(xel.GetAttribute("Unique"));    //主键
                    station.StationId = int.Parse(xel.GetAttribute("StationId")); //站点Id
                    station.Name      = xel.GetAttribute("Name");                 //站点名称
                    station.OrgId     = xel.GetAttribute("OrgId");
                    station.Tel       = xel.GetAttribute("Tel");                  //手机号码
                    station.Protocol  = xel.GetAttribute("Protocol");             //手机号码
                    ListStation.Add(station);
                }
            }
            catch (Exception ex)
            {
                LogMg.AddError(ex);
                DEBUG.ThrowException(ex);
            }
            return(ListStation);
        }
Example #30
0
 // The function that is called to display the chooserMenu which basically activates the menu where the player can select a tank and powerups, before the game starts
 public void ChooserMenu()
 {
     if (levelManagerRef.isArcadeMode) // checking if arcade mode has been selected by the LevelManagerRef
     {
         if (APP.PlayerTankManager._ArcadeMode == arcadeMode.defend || APP.PlayerTankManager._ArcadeMode == arcadeMode.SearchAndDestroy)
         {
             Time.timeScale = 1;
             loadingOverlay.SetActive(true);
             SceneManager.LoadScene("ChooseDino");
             defendModeSettings.GetChildObject(ArcadeController.instance.playerArmorCollider, "playerBackArmorCollider").gameObject.name  = "RearArmorCollider";
             defendModeSettings.GetChildObject(ArcadeController.instance.playerArmorCollider, "playerFrontArmorCollider").gameObject.name = "FrontArmorCollider";
             ArcadeController.instance.gameObject.SetActive(false);
         }
         else
         {
             Time.timeScale = 1;
             loadingOverlay.SetActive(true);
             SceneManager.LoadScene("ChooseDino");
         }
         DEBUG.Log("Arcade mode has been selected");
     }
     else
     {
         loadingOverlay.SetActive(true);
         Time.timeScale = 1;
         if (PhotonNetwork.connectionStateDetailed == ClientState.Joined)
         {
             Debug.Log("Show Dino selection here");
         }
         else
         {
             SceneManager.LoadScene("ChooseDino");
         }
     }
 }
        /// <summary>
        /// 返回选择的行的序号。
        /// 如果有多个选择,返回最小号(最上)的行序号。
        /// 如果允许打钩选择,返回最上的打钩行序号。
        /// </summary>
        /// <returns>-1=没有选中的行</returns>
        public int GetSelectLineNo ()
        {
            DEBUG d = new DEBUG ();

            int nSel = -1;

            if ( AllowMultiSelect )
            {
                int [] nSels = GetSelectCheckBoxLine ();

                //如果有多个打钩,选第一个打钩的行。
                if ( nSels != null && nSels.Length > 0 )
                {
                    nSel = nSels [0];
                }
                else  //没有选择任何打钩, 则查看有无光标选择行。
                {
                    //光标有选择行
                    if ( SelectedRows.Count > 0 )
                    {
                        nSel = SelectedRows [0].Index;
                    }
                }
            }
            else  //不允许打钩
            {
                //光标有选择行
                if ( SelectedRows.Count > 0 )
                {
                    nSel = SelectedRows [0].Index;
                }
            }

            return nSel;
        }
Example #32
0
 public static void SetDebugLevel(string host, DEBUG level)
 {
     int status = FLISetDebugLevel(host, level);
     if (0 != status)
         throw new Win32Exception(-status);
 }
Example #33
0
 private static extern int FLISetDebugLevel(string host, DEBUG level);