Esempio n. 1
0
 private void Start()
 {
     _activeElements   = new List <GameObject>();
     _inactiveElements = new List <GameObject>();
     Dbg.Assert(_template != null);
     _template.SetActive(false);
 }
Esempio n. 2
0
        public ulong get_paddr(ulong paddr)
        {
            ulong pageId  = paddr / PageSize;
            ulong pageMod = paddr % PageSize;

            //page table hit
            if (Ptable.ContainsKey(pageId))
            {
                return(Ptable[pageId] * PageSize + pageMod);
            }

            //page table miss
            ulong frameId = pageId / Stride;

            frameId *= Stride;
            frameId += CurrFid;

            //update tables
            // TODO: there's a bug in this allocator b/c there can be duplicate frames
            Dbg.Assert(!Ftable.Contains(frameId));
            Ftable.Add(frameId);
            Ptable.Add(pageId, frameId);

            //update frame id
            CurrFid += 1;
            CurrFid  = CurrFid % Stride;

            //return physical address
            return(frameId * PageSize + pageMod);
        }
Esempio n. 3
0
    private static Material getMaterialRadial()
    {
        Material _mat = (Material)Resources.Load("AMRadialWipeMaterial");

        Dbg.Assert(_mat != null, "failed to load AMRadialWipeMaterial!!");

        // ## TO DO ##

        /*if(!_mat) {
         *      _mat = new Material
         *      (
         *              "Shader \"Animator/AMIrisShape\" {" +
         *              "Properties {" +
         *              "	_MainTex (\"Base (RGB)\", 2D) = \"white\" {}" +
         *              "	_Mask (\"Culling Mask\", 2D) = \"white\" {}" +
         *              "	_Cutoff (\"Alpha cutoff\", Range (0,1)) = 0.1 " +
         *              "   _Color (\"Main Color\", Color) = (1,1,1,1) }" +
         *              "SubShader {" +
         *              "	Tags {\"Queue\"=\"Background\"}" +
         *              "	Lighting Off" +
         *              "	ZWrite Off" +
         *              "	Blend SrcAlpha OneMinusSrcAlpha" +
         *              "	AlphaTest GEqual [_Cutoff]" +
         *              "	Pass {" +
         *              "		SetTexture [_Mask] { matrix [_Matrix] combine texture }" +
         *              "		SetTexture [_MainTex] { ConstantColor [_Color] matrix[_TexMatrix] combine texture * constant, previous }" +
         *              "	}" +
         *              "}}"
         *      );
         * }*/
        return(_mat);
    }
Esempio n. 4
0
 public override void LoadData(ref object id, int?HAcode = null)
 {
     try
     {
         using (DbManagerProxy manager = CreateDbManagerProxy())
         {
             IObjectSelectDetail accessor = ObjectAccessor.SelectDetailInterface(typeof(T));
             if (accessor != null)
             {
                 LifeTimeState  = LifeTimeState.DataLoading;
                 BusinessObject = accessor.SelectDetail(manager, id, HAcode) as T;
                 Dbg.Assert(BusinessObject != null, "unable to get BusinessObject");
                 // ReSharper disable PossibleNullReferenceException
                 id = BusinessObject.Key;
                 // ReSharper restore PossibleNullReferenceException
             }
         }
     }
     catch (Exception ex)
     {
         if (!bv.common.Configuration.BaseSettings.ScanFormsMode)
         {
             ErrorForm.ShowError(StandardError.DataRetrievingError, ex);
         }
     }
 }
Esempio n. 5
0
            /// <summary>
            /// given a real vert, return the virtual vert
            /// </summary>
            public VVert GetVV(int rvIdx)
            {
                Dbg.Assert(m_VVertCont.ContainsKey(rvIdx), "VMesh.GetVV: real vert idx: {0}", rvIdx);
                VVert vvert = m_VVertCont[rvIdx];

                return(vvert);
            }
    eAttackResult CalcAttackResult(Attacking damager)
    {
        if (currentAttackDirection == eAttackDirection.NoAttack)
        {
            // Not attacking at all, so no chance for defence.
            return(eAttackResult.Hit);
        }
        else if (currentAttackDirection == damager.currentAttackDirection)
        {
            // Matching attack directions, we have a chance for defence or
            // being vulnerable.
            switch (currentAttackWindow)
            {
            case eAttackWindow.Starting:
                return(eAttackResult.Parry);

            case eAttackWindow.Swinging:
            case eAttackWindow.Landing:
                return(eAttackResult.Block);

            case eAttackWindow.Landed:
            case eAttackWindow.Done:
                return(eAttackResult.Hit);
            }

            Dbg.Assert(false, "Unhandled enum case: " + currentAttackWindow);
            return(eAttackResult.Hit);
        }
        else
        {
            return(eAttackResult.Hit);
        }
    }
    eAttackWindow CalcAttackWindow()
    {
        Dbg.Assert(percentUntilSwinging < percentUntilLanding, "Must swing before we can land");

        float progress = CalcAttackProgressPercent();

        if (progress < 0 || progress >= 1f)
        {
            // Invalid progress values must mean we're done.
            return(eAttackWindow.Done);
        }
        else if (currentAttackWindow == eAttackWindow.Landed)
        {
            // Stay in Landed until time runs out.
            return(eAttackWindow.Landed);
        }
        else if (progress > percentUntilLanding)
        {
            return(eAttackWindow.Landing);
        }
        else if (progress > percentUntilSwinging)
        {
            return(eAttackWindow.Swinging);
        }
        else
        {
            return(eAttackWindow.Starting);
        }
    }
Esempio n. 8
0
        public override void issued_write_cmd(Cmd cmd)
        {
            Dbg.Assert(cmd.is_write());
            uint cid = cmd.Addr.cid;

            ServeCnt[cid]++;
        }
            private Vector3[] m_CachedVertPos; //used in dragging handle, cache the starting position of verts

            #endregion "data"

            #region "public method"
            // public method

            public void Init(EditableMesh m, MeshSelection sel, Pivotor p)
            {
                m_Mesh      = m;
                m_Selection = sel;
                m_Pivot     = p;
                Dbg.Assert(m_Pivot != null, "SoftSelection.Init: pivotor is null");

                m_Range = 1f;

                m_Cont = new _Data[m.mesh.vertexCount];
                for (int i = 0; i < m_Cont.Length; ++i)
                {
                    m_Cont[i] = new _Data();
                }

                m_EffectVertIdxLst = new VLst();

                m_Mode        = Mode.Off;
                m_PrepareMode = PrepareMode.Always;

                // atten curve
                var res = (SoftSelectionRes)AssetDatabase.LoadAssetAtPath(SOFTSEL_ATTEN_CURVE_PATH, typeof(SoftSelectionRes));

                if (res == null)
                {
                    res = ScriptableObject.CreateInstance <SoftSelectionRes>();
                    AssetDatabase.CreateAsset(res, SOFTSEL_ATTEN_CURVE_PATH);
                    res = (SoftSelectionRes)AssetDatabase.LoadAssetAtPath(SOFTSEL_ATTEN_CURVE_PATH, typeof(SoftSelectionRes));
                    Dbg.Assert(res != null, "SoftSelection.Init: failed to create curve asset for SoftSelection");
                }
                m_Atten = res.attenCurve;

                MeshManipulator.evtHandleDraggingStateChanged += this._OnHandleDraggingStateChanged;
            }
Esempio n. 10
0
        private static Cmd salp1_cmd_issue(ReqType r, MemAddr a, Cmd cmd, NodeMachine bank, NodeMachine subarray)
        {
            Dbg.Assert(bank.OpenChildrenId.Count <= 1);

            // closed bank
            if (bank.OpenChildrenId.Count == 0)
            {
                cmd.Type = CmdType.ACT;
                return(cmd);
            }

            // subarray-miss
            if (bank.OpenChildrenId[0] != a.said)
            {
                cmd.Type      = CmdType.PRE_SA;
                cmd.Addr.said = (uint)bank.OpenChildrenId[0]; // close the opened sibling
                return(cmd);
            }

            // row-miss
            if (subarray.OpenChildrenId[0] != a.rowid)
            {
                cmd.Type = CmdType.PRE_SA;
                return(cmd);
            }

            // row-hit
            cmd.Type = r == ReqType.READ ? CmdType.RD : CmdType.WR;
            return(cmd);
        }
Esempio n. 11
0
 protected static DbManagerProxy CreateDbManagerProxy()
 {
     Dbg.Assert(DbManagerFactory.Factory != null, "DbManagerFactory.Factory not initialized");
     // ReSharper disable PossibleNullReferenceException
     return(DbManagerFactory.Factory.Create(ModelUserContext.Instance));
     // ReSharper restore PossibleNullReferenceException
 }
Esempio n. 12
0
        // Only close all the specified subarrays in all banks within a rank
        private bool close_sa_children_id(uint said)
        {
            // close children of the leaf node
            if (Children == null)
            {
                Dbg.Assert(OpenChildrenId.Count <= 1);
                if (id == said)
                {
                    OpenChildrenId.Clear();
                    return(true);
                }
                return(false);
            }

            // recursively close my children
            foreach (var i in OpenChildrenId)
            {
                if (Children[i].close_sa_children_id(said))
                {
                    OpenChildrenId.Remove(i);
                }
            }

            // No more open child
            if (OpenChildrenId.Count == 0)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 13
0
        void UpdateStatusButtons(ClientStatus_t status)
        {
            Dbg.Assert(!InvokeRequired);


            m_tsbBanishClient.Checked = m_tsbDisableClient.Checked = m_tsbEnableClient.Checked = false;

            m_tsbReset.Enabled            = m_tsbBanishClient.Enabled = m_tsbDisableClient.Enabled =
                m_tsbEnableClient.Enabled = status != ClientStatus_t.Unknown;

            if (status != ClientStatus_t.Unknown)
            {
                switch (status)
                {
                case ClientStatus_t.Enabled:
                    m_tsbEnableClient.Checked = true;
                    break;

                case ClientStatus_t.Disabled:
                    m_tsbDisableClient.Checked = true;
                    break;

                case ClientStatus_t.Banned:
                    m_tsbBanishClient.Checked = true;
                    break;
                }
            }
        }
Esempio n. 14
0
    void Start()
    {
        Dbg.Assert(count == 0, "You cannot edit Count.");

        // The counter must have an output.
        counterDisplay = GetComponentsInChildren <Text>()[0];
    }
Esempio n. 15
0
            static EditorRes()
            {
                texDetail = AssetDatabase.LoadAssetAtPath(TEX_DETAIL, typeof(Texture2D)) as Texture2D;
                Dbg.Assert(texDetail != null, "EditorRes.sctor: failed to load texDetail at: {0}", TEX_DETAIL);

                texDelete = AssetDatabase.LoadAssetAtPath(TEX_DELETE, typeof(Texture2D)) as Texture2D;
                Dbg.Assert(texDelete != null, "EditorRes.sctor: failed to load texDelete at: {0}", TEX_DELETE);

                tex100Per = AssetDatabase.LoadAssetAtPath(TEX_APPLY, typeof(Texture2D)) as Texture2D;
                Dbg.Assert(texDelete != null, "EditorRes.sctor: failed to load tex100Per at: {0}", TEX_APPLY);

                skinMorphProc = AssetDatabase.LoadAssetAtPath(SKIN_PATH, typeof(GUISkin)) as GUISkin;
                Dbg.Assert(skinMorphProc != null, "EditorRes.sctor: failed to load skinMorphProc at: {0}", SKIN_PATH);

                styleBtnMorphProc = skinMorphProc.button;

                texSample = AssetDatabase.LoadAssetAtPath(TEX_SAMPLE, typeof(Texture2D)) as Texture2D;
                Dbg.Assert(texSample != null, "EditorRes.sctor: failed to load texSample at: {0}", TEX_SAMPLE);

                texAdd = AssetDatabase.LoadAssetAtPath(TEX_ADD, typeof(Texture2D)) as Texture2D;
                Dbg.Assert(texAdd != null, "EditorRes.sctor: failed to load texAdd at: {0}", TEX_ADD);

                texApplyToMesh = AssetDatabase.LoadAssetAtPath(TEX_APPLYMESH, typeof(Texture2D)) as Texture2D;
                Dbg.Assert(texApplyToMesh != null, "EditorRes.sctor: failed to load texApplyToMesh at: {0}", TEX_APPLYMESH);
            }
Esempio n. 16
0
        // ----------------------------------------------------------------------
        protected virtual void Awake()
        // ----------------------------------------------------------------------
        {
            if (_mModel == MoveModel.NavMesh)
            {
                _mover = new SM_PawnMoveNavMesh();
            }
            else
            {
                _mover = new SM_PawnMoveVelocity();
            }

            _mover.Initialize(this, _speed, _turnSpeed);

            _nma = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>();
            Dbg.Assert(_nma != null, "Pawn requires nav mesh agent, but probably shouldn't"); // TO DO remove dependency

            _charControl = GetComponent <CharacterController>();
            Dbg.Assert(_charControl != null, "Pawn requires CharacterController");

            _animationMgr = GetComponentInChildren <SM_PawnAnimMgr>(true);
            Dbg.Assert(_animationMgr != null, "Pawn requires SM_PawnAnimMgr");



            _animationMgr.SetPawn(this);
        }
Esempio n. 17
0
 /// <summary>
 /// Links designer with entire control
 /// All DesignElement flags are applied to entire control
 /// </summary>
 public ControlDesigner(Control ctl, string caption = null)
 {
     Dbg.Assert(ctl != null, "Control designer can't be  initialized without parent control");
     ProcessedControl = ctl;
     DesignType       = DesignElement.All;
     InitBehavior(Point.Empty, Size.Empty, caption);
 }
Esempio n. 18
0
        void ProcessDialog(uint clientID, IEnumerable <Message> msgs)
        {
            ActiveClientsQueue.IClientData clData = m_onlineClients.Get(clientID);

            if (clData == null)
            {
                return;
            }


            uint lastClMsgID = clData.LastClientMessageID;

            var seq = from msg in msgs
                      where msg.ID > lastClMsgID
                      select msg;


            if (seq.Any())
            {
                uint lastSrvMsgID = clData.LastSrvMessageID;
                var  respList     = new List <Message>(seq.Count());

                var clStatus = m_ndxerClientsStatus.Get(clientID) as ClientStatus;
                clStatus.LastSeen          = DateTime.Now;
                clData.TimeToLive          = ActiveClientsQueue.InitTimeToLive;
                clData.LastClientMessageID = seq.Max(m => m.ID);

                foreach (Message msg in seq)
                {
                    Dbg.Log($"Processing dialog msg {msg.ID}: {msg.MessageCode}...");

                    if (m_msgProcessors.ContainsKey(msg.MessageCode))
                    {
                        Message resp = m_msgProcessors[msg.MessageCode](msg, clientID);

                        if (resp != null)
                        {
                            respList.Add(resp);
                        }
                    }
                }


                if (respList.Count > 0)
                {
                    DialogEngin.AppendSrvDialog(AppPaths.GetSrvDialogFilePath(clientID), respList);
                    AddUpload(Names.GetSrvDialogFile(clientID));
                }



                Dbg.Assert(clData.LastClientMessageID >= lastClMsgID);
                clStatus.SentMsgCount += clData.LastClientMessageID - lastClMsgID;

                Dbg.Assert(clData.LastSrvMessageID >= lastSrvMsgID);
                clStatus.ReceivedMsgCount += clData.LastSrvMessageID - lastSrvMsgID;

                m_ndxerClientsStatus.Source.Replace(m_ndxerClientsStatus.IndexOf(clientID), clStatus);
            }
        }
Esempio n. 19
0
        public IEnumerator <StackIndexChild> GetEnumerator()
        {
            _log("GetEnumerator()");
            var L = Parent.L;

            luanet.checkstack(L, 3, "StackIndexChild.GetEnumerator");
            var results = new List <StackIndexChild>();

            this.push();
            Dbg.Assert(_keys.All(k => k.IsSupported));
            if (lua.type(L, -1) == LUA.T.TABLE)
            {
                StackAssert.Start(L);
                lua.pushnil(L);
                while (lua.next(L, -2))
                {
                    var keys = new LuaValue[_keys.Length + 1];
                    Array.Copy(_keys, keys, _keys.Length);
                    keys[keys.Length - 1] = LuaValue.read(L, -2, true);
                    results.Add(new StackIndexChild(this.Parent, keys));
                    lua.pop(L, 1);
                }
                StackAssert.End();
            }
            lua.pop(L, 1);
            return(results.GetEnumerator());
        }
Esempio n. 20
0
        private void _PreCalc(float t, out int currPt)
        {
            int  pcnt  = m_points.Count;
            bool cycle = (m_points[0] == m_points[pcnt - 1]);

            _PrepControlPts(cycle);

            if (m_dirty)
            {
                _Recalc();
            }

            // calc currPt
            currPt = -1;
            float T = t * m_BigT;

            for (int i = m_pointTpos.Count - 2; i >= 0; --i)
            {
                if (T >= m_pointTpos[i])
                {
                    currPt = i;
                    break;
                }
            }

            Dbg.Assert(currPt >= 0, "CatmullRomCentripetal._PreCalc: failed to calc currPt");
        }
Esempio n. 21
0
        private void Reset_Click(object sender, EventArgs e)
        {
            const string msg = "Vous êtes sur le point d’envoyer une demande de réinitialisation " +
                               "au client sélectionné, celle-ci forcera ce dernier à s’enregistrer une nouvelle " +
                               "fois sous un autre ID. Voulez-vous poursuivre ?";

            if (MessageBox.Show(msg, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
            {
                return;
            }

            TreeNode selNode = m_tvClients.SelectedNode;

            Dbg.Assert(selNode != null && selNode.Parent != null);

            var client = selNode.Tag as HubClient;

            AppContext.LogManager.LogUserActivity($"Action utilisateur :  Réinitialisation du client {ClientsManager.ClientStrID(client.ID)}");


            AppContext.LogManager.LogSysActivity("Envoi d'une notification de réinitialisation au client " +
                                                 $"{ClientsManager.ClientStrID(client.ID)}", true);

            AppContext.ClientsManager.SetClientStatus(client, ClientStatus_t.Reseted);
        }
Esempio n. 22
0
        public void push()
        {
            _keys[_keys.Length - 1].VerifySupport();
            var L = Parent.L;

            luanet.checkstack(L, 2, "StackIndexChild.push"); StackAssert.Start(L);
            Dbg.Assert(_keys.All(k => k.IsSupported));
            var keys = _keys;

            lua.CFunction tryBlock = L2 =>
            {
                for (int i = 0; i < keys.Length; ++i)
                {
                    keys[i].push(L2);
                    lua.gettable(L2, -2);
                    lua.remove(L2, -2);
                }
                return(1);
            };
            // parent should be pushed first. it might be pointing to the index we're about to fill
            this.Parent.push();
            lua.pushcfunction(L, tryBlock);
            lua.insert(L, -2);
            var ex = luanet.pcall(L, 1, 1);

            if (ex != null)
            {
                StackAssert.End();
                Trace.TraceError("push failed: " + ex.Message);
                throw ex;
            }
            GC.KeepAlive(tryBlock);                          StackAssert.End(1);
        }
Esempio n. 23
0
        void ProcessClientStatus(ClientStatus_t status)
        {
            Dbg.Assert(!InvokeRequired);

            var client = m_tvClients.SelectedNode.Tag as HubClient;
            ManagementMode_t prfMgmnt = AppContext.ClientsManager.GetProfileManagementMode(client.ProfileID);
            var prf = m_ndxerProfiles.Get(client.ProfileID) as UserProfile;

            if (prfMgmnt == ManagementMode_t.Auto)
            {
                if (MessageBox.Show(this,
                                    $"La gestion du profil {prf.Name} sera changée en mode 'manuel'. Poursuivre ?",
                                    Text, MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    return;
                }
            }

            AppContext.LogManager.LogUserActivity($"Action utilisateur:  Changement du statut du client {ClientsManager.ClientStrID(client.ID)} en {ClientStatuses.GetStatusName(status)}");

            AppContext.ClientsManager.SetProfileManagementMode(client.ProfileID, ManagementMode_t.Manual);

            //maj le status
            AppContext.ClientsManager.SetClientStatus(client, status);
        }
Esempio n. 24
0
        void RebuildActionList(MT_Combatant who)
        {
            if (Dbg.Assert(who != null))
            {
                return;
            }
            if (Dbg.Assert(who.Base != null))
            {
                return;
            }
            if (Dbg.Assert(who.Base.Actions != null))
            {
                return;
            }

            for (int i = 0; i < who.Base.Actions.Count; i++)
            {
                GameObject obj = AddElement();
                if (Dbg.Assert(obj != null))
                {
                    return;
                }

                UI_ActionListPanelEntry entry = obj.GetComponent <UI_ActionListPanelEntry>();
                if (Dbg.Assert(entry != null))
                {
                    return;
                }

                entry.Set(who, who.Base.Actions[i], i);
                UN.SetActive(obj, true);
            }
        }
        void Refresh()
        {
            if (Dbg.Assert(_target != null))
            {
                return;
            }


            if (_target.IsHilighted || _target.IsSelected)
            {
                Material mat = null;
                if (_target.IsHilighted && _target.IsSelected)
                {
                    mat = _selectedAndHilightedMat;
                }
                else if (_target.IsHilighted)
                {
                    mat = _highlightedMat;
                }
                else if (_target.IsSelected)
                {
                    mat = _selectedMat;
                }

                if (_projector.material != mat)
                {
                    _projector.material = mat;
                }
            }

            UN.SetActive(gameObject, _target.IsHilighted || _target.IsSelected);
        }
Esempio n. 26
0
    /// <summary>
    /// 1. if newTr doesn't have CutsceneController attached, then do nothing
    /// 2. set the m_evtGoRoot for the new clipRoot
    /// </summary>
    private void _OnRootTransformChange(Transform oldTr, Transform newTr)
    {
        //Dbg.Log("RootGO changed: {0}", newTr == null ? "null" : newTr.name);

        m_evtGoRoot = null; //reset first, will be set to non-null value if needed
        m_ClipRoot  = newTr;

        if (newTr != null)
        {
            //1.
            m_CC = newTr.GetComponent <CutsceneController>();
            if (m_CC != null)
            {
                //2.
                GameObject eventGO = Misc.ForceGetGO(EventGOS, m_ClipRoot.gameObject);
                Dbg.Assert(eventGO != null, "CCEditor._OnRootTransformChange: failed to force_get eventGO: {0}", EventGOS);
                m_evtGoRoot = eventGO.transform;
            }
            else
            {
            }
        }

        Repaint();
    }
Esempio n. 27
0
        private static Cmd base_cmd_issue(ReqType r, MemAddr a, Cmd cmd, NodeMachine bank, NodeMachine subarray)
        {
            Dbg.Assert(bank.OpenChildrenId.Count <= 1);

            // closed bank
            if (bank.OpenChildrenId.Count == 0)
            {
                cmd.Type = CmdType.ACT;
                return(cmd);
            }

            // subarray-miss
            if (bank.OpenChildrenId[0] != a.said)
            {
                cmd.Type = CmdType.PRE_BANK;
                return(cmd);
            }

            // row-miss
            if (subarray.OpenChildrenId[0] != a.rowid)
            {
                cmd.Type = CmdType.PRE_BANK;
                return(cmd);
            }

            // row-hit
            cmd.Type = r == ReqType.READ ? CmdType.RD : CmdType.WR;
            return(cmd);
        }
Esempio n. 28
0
 // Use this for initialization
 protected override void Start()
 {
     Dbg.Assert(_baseStats != null);
     Dbg.Assert(_nameText != null);
     Dbg.Assert(_classSpecies != null);
     Events.AddGlobalListener <SM_SelectionChangedEvent>(OnSelectionSet);
 }
Esempio n. 29
0
        void ProcessTimer(object unused)
        {
            m_timer.Change(Timeout.Infinite, Timeout.Infinite);

            var    netEngin = new NetEngin(Program.NetworkSettings);
            string tmpFile  = Path.GetTempFileName();

            netEngin.Download(tmpFile, Urls.ConnectionRespURL, true);

            var seq = from msg in DialogEngin.ReadConnectionsResp(tmpFile)
                      where msg.ReqID >= m_lastMsgID
                      select msg;

            if (!seq.Any())
            {
                m_timer.Change(Timeout.Infinite, Timeout.Infinite);
            }
            else
            {
                Message resp = (from msg in seq
                                where msg.ReqID == m_lastMsgID
                                select msg).SingleOrDefault();

                if (resp == null)
                {
                    PostReqAsync();
                }
                else
                {
                    switch (resp.MessageCode)
                    {
                    case Message_t.Ok:
                        //reset dlg file
                        try
                        {
                            string dlgFile = SettingsManager.GetClientDialogFilePath(m_clientID);
                            DialogEngin.WriteHubDialog(dlgFile, m_clientID, Enumerable.Empty <Message>());
                            netEngin.Upload(SettingsManager.GetClientDialogURL(m_clientID), dlgFile, true);
                            m_callback(Result_t.Ok);
                        }
                        catch (Exception ex)
                        {
                            Dbg.Log(ex.Message);
                            PostReqAsync();
                        }
                        break;

                    case Message_t.InvalidID:
                    case Message_t.Rejected:
                        m_callback(Result_t.Rejected);
                        break;

                    default:
                        Dbg.Assert(false);
                        break;
                    }
                }
            }
        }
Esempio n. 30
0
        private static Cmd salp2_cmd_issue(ReqType r, MemAddr a, Cmd cmd, NodeMachine bank, NodeMachine subarray)
        {
            Dbg.Assert(bank.OpenChildrenId.Count <= 2);

            // closed bank
            if (bank.OpenChildrenId.Count == 0)
            {
                cmd.Type = CmdType.ACT;
                return(cmd);
            }
            // open bank (one subarray)
            if (bank.OpenChildrenId.Count == 1)
            {
                // subarray-miss
                if (bank.OpenChildrenId[0] != a.said)
                {
                    cmd.Type = CmdType.ACT;
                    return(cmd);
                }

                // row-miss
                if (subarray.OpenChildrenId[0] != a.rowid)
                {
                    cmd.Type = CmdType.PRE_SA;
                    return(cmd);
                }

                // row-hit
                cmd.Type = r == ReqType.READ ? CmdType.RD : CmdType.WR;
                return(cmd);
            }
            // open bank (two subarrays)
            // all subarray-miss
            if (!bank.OpenChildrenId.Contains(a.said))
            {
                cmd.Type      = CmdType.PRE_SA;
                cmd.Addr.said = (uint)bank.OpenChildrenId[1]; // close least-recently-opened subarray
                return(cmd);
            }

            // not the most-recently-opened subarray
            if (bank.OpenChildrenId[0] != a.said)
            {
                cmd.Type      = CmdType.PRE_SA;
                cmd.Addr.said = (uint)bank.OpenChildrenId[1]; // close least-recently-opened subarray
                return(cmd);
            }

            // row-miss
            if (subarray.OpenChildrenId[0] != a.rowid)
            {
                cmd.Type = CmdType.PRE_SA;
                return(cmd);
            }

            // row-hit
            cmd.Type = r == ReqType.READ ? CmdType.RD : CmdType.WR;
            return(cmd);
        }