Ejemplo n.º 1
0
        private static void NotifyUserChange()
        {
            DictionaryEx dic2 = new DictionaryEx();

            dic2["id"] = 0;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnChangeUser, dic2);
        }
Ejemplo n.º 2
0
        public void Start(FSPParam param, uint playerId)
        {
            m_Param        = param;
            m_MinePlayerId = playerId;
            LOG_TAG        = "FSPManager[" + playerId + "]";

            if (!m_Param.useLocal)
            {
                m_ClientLockedFrame = m_Param.clientFrameRateMultiple - 1;

                m_Client = new FSPClient();
                m_Client.SetSessionId((ushort)param.sid);
                m_Client.SetFSPAuthInfo(param.authId);
                m_Client.Connect(param.host, param.port);
                m_Client.SetFSPListener(OnFSPListener);
                m_Client.VerifyAuth();
            }
            else
            {
                m_ClientLockedFrame = param.maxFrameId;
            }

            m_FrameCtrl = new FSPFrameController();
            m_FrameCtrl.Start(param);

            m_FrameBuffer = new DictionaryEx <int, FSPFrame>();

            m_IsRunning         = true;
            m_GameState         = FSPGameState.Create;
            m_CurrentFrameIndex = 0;
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="file"></param>
 public override int LoadProfile(string file)//这里发消息,桌面去加载
 {
     try
     {
         DictionaryEx dic = new DictionaryEx();
         foreach (ScriptEngine se in m_ScriptEngine)
         {
             se.DoFile(file);
         }
         System.Threading.Thread.Sleep(100);
         m_ItemTree = tmEnvironment.ParseProfile(this);
         if (m_ItemTree != null)
         {
             dic["items"] = m_ItemTree;
         }
         string Module = tmEnvironment.ParseModule(this);
         if (Module != null)
         {
             dic["Module"] = Module;
         }
         string Version = tmEnvironment.ParseVersion(this);
         if (Version != null)
         {
             dic["Version"] = Version;
         }
         NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnLoadProfile, dic);
         return(0);
     }
     catch (System.Exception e)
     {
         System.Windows.Forms.MessageBox.Show(e.Source + e.Message, "Load Profile Failed",
                                              System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
     }
     return(-1);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QuadTreeNode{TValue}"/> class.</summary>
        /// <param name="tree">
        /// The <see cref="QuadTree{TValue}"/> that contains the <see cref="QuadTreeNode{TValue}"/>.
        /// </param>
        /// <param name="signature">
        /// The signature of the <see cref="QuadTreeNode{TValue}"/>.</param>
        /// <param name="parent">
        /// The parent of the <see cref="QuadTreeNode{TValue}"/> in the tree structure.</param>
        /// <param name="bounds">
        /// The bounds of all keys in the <see cref="QuadTreeNode{TValue}"/>.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="tree"/> is a null reference.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="bounds"/> contains a <see cref="RectD.Width"/> or <see
        /// cref="RectD.Height"/> that is equal to or less than zero.</exception>

        internal QuadTreeNode(QuadTree <TValue> tree,
                              int signature, QuadTreeNode <TValue> parent, RectD bounds)
        {
            if (tree == null)
            {
                ThrowHelper.ThrowArgumentNullException("tree");
            }

            if (bounds.Width <= 0.0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(
                    "bounds.Width", bounds.Width, Strings.ArgumentNotPositive);
            }

            if (bounds.Height <= 0.0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(
                    "bounds.Height", bounds.Height, Strings.ArgumentNotPositive);
            }

            Tree      = tree;
            Signature = signature;
            Parent    = parent;
            Bounds    = bounds;
            Center    = new PointD(bounds.Left + bounds.Width / 2, bounds.Top + bounds.Height / 2);

            tree._nodes.Add(signature, this);
            _data = new DictionaryEx <PointD, TValue>(tree.Capacity);
        }
Ejemplo n.º 5
0
        int OnItemStart(object sender, object arg)
        {
            if (this.InvokeRequired)
            {
                return((int)Invoke(new delegateUiMessage(OnItemStart), new object[] { sender, arg }));
            }
            DictionaryEx dic   = arg as DictionaryEx;
            int          id    = (int)dic["id"];
            int          index = (int)dic["index"];

            ListViewItem.ListViewSubItemCollection sub = lvTestItem.Items[index].SubItems;
            lvTestItem.Items[index].SubItems[5 + id].Text = "Testing...";
#if true
            string message;
            message = index.ToString();
            message = message + ":[";
            message = message + lvTestItem.Items[index].SubItems[2].Text;
            message = message + "]";

            message = message + "start test!";
            testflow.push_testflowlog(message);

            message = "start time:";
            message = message + System.DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss:fff");
            testflow.push_testflowlog(message);
#endif
            StartItemTest = new TimeSpan(System.DateTime.Now.Ticks);

            return(0);
        }
Ejemplo n.º 6
0
        int slot   = 6; //这里决定一次测试的UUT数量lxl
        public void App_Load()
        {
            DictionaryEx dic = new DictionaryEx();

            m_dicContext["slot"]   = slot;
            m_dicContext["module"] = module;
            string[] f = ListTm();
            if (f.Length == 0)
            {
                MessageBox.Show("Couldn't find TM module file!", "Load TM", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            else if (f.Length == 1)
            {
                if (!LoadTmFile(f[0], dic))
                {
                    MessageBox.Show("Load failed", "Load TM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                }
            }
            else
            {
            }
            LoadTM(dic);
            //timerSplash.Enabled = false;
        }
Ejemplo n.º 7
0
        bool LoadTmFile(string filepath, DictionaryEx dic)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(filepath);
            try
            {
                XmlNodeList nodeList = doc.GetElementsByTagName("Module");
                if (0 == nodeList.Count)
                {
                    throw new Exception("no Module");
                }
                XmlElement module = nodeList.Item(0) as XmlElement;
                string     name   = module.GetAttribute("name");
                if (name == null)
                {
                    name = "Unkown Module";
                }
                dic["name"] = name;

                XmlElement element;
                //ui
                nodeList = module.GetElementsByTagName("ui");
                if (0 == nodeList.Count)
                {
                    throw new Exception("no specical user interface path");
                }
                element   = nodeList.Item(0) as XmlElement;
                dic["ui"] = element.InnerText;

                //engine
                nodeList = module.GetElementsByTagName("engine");
                if (nodeList == null)
                {
                    throw new Exception("no specical test engine path");
                }
                element = nodeList.Item(0) as XmlElement;
                string txt = element.InnerText;
                dic["engine"] = element.InnerText;

                //instruments
                nodeList = module.GetElementsByTagName("instruments");
                if (nodeList.Count != 0)
                {
                    element  = nodeList.Item(0) as XmlElement;
                    nodeList = element.GetElementsByTagName("instrument");
                    List <string> arr = new List <string>();
                    foreach (XmlNode node in nodeList)
                    {
                        arr.Add(node.InnerText);
                    }
                    dic["instruments"] = arr.ToArray();
                }
            }
            catch (System.Exception e)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 8
0
    /// <summary>
    /// 通过秒转换为中文时间格式
    /// </summary>
    public static String formatDuring(double mss)
    {
        int days    = (int)(mss / (60 * 60 * 24));
        int hours   = (int)((mss % (60 * 60 * 24)) / (60 * 60));
        int minutes = (int)((mss % (60 * 60)) / 60);
        int seconds = (int)(mss % 60);
        DictionaryEx <string, int> time = new DictionaryEx <string, int>();

        if (days != 0)
        {
            time.Add("days", days);
        }
        if (hours != 0)
        {
            time.Add("hours", hours);
        }
        if (minutes != 0)
        {
            time.Add("minutes", minutes);
        }
        if (seconds != 0)
        {
            time.Add("seconds", seconds);
        }
        string timeText = string.Empty;

        for (int i = 0; i < time.mList.Count; ++i)
        {
            timeText += string.Format(TextManager.GetUIString(time.mList[i].ToString()), time[time.mList[i]]);
        }
        time.Clear();
        return(timeText);
    }
Ejemplo n.º 9
0
        /// <summary>
        /// Clears the <see cref="QuadTreeNode{TValue}"/>.</summary>
        /// <remarks><para>
        /// <b>Clear</b> resets the <see cref="TopLeft"/>, <see cref="TopRight"/>, <see
        /// cref="BottomLeft"/>, and <see cref="BottomRight"/> properties to null references, and
        /// <see cref="Data"/> to an empty <see cref="DictionaryEx{PointD, TValue}"/>.
        /// </para><para>
        /// <b>Clear</b> does not clear any previously attached child nodes, or transfer their <see
        /// cref="Data"/>. Call this method only on the <see cref="QuadTree{TValue}.RootNode"/> of
        /// the containing <see cref="Tree"/> to destroy the entire tree structure.</para></remarks>

        internal void Clear()
        {
            Debug.Assert(this == Tree.RootNode);

            _topLeft = _topRight = _bottomLeft = _bottomRight = null;
            _data    = new DictionaryEx <PointD, TValue>(Tree.Capacity);
        }
Ejemplo n.º 10
0
        public void DbgLog(string msg, int id)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"]  = id;
            dic["msg"] = msg + "\r\n";
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kDegbugMessage, dic);
        }
Ejemplo n.º 11
0
        public int Load(object sender, object arg)
        {
            DictionaryEx dic = arg as DictionaryEx;

            m_TestEngine = dic["engine"] as Engine;
            NotificationCenter.DefaultCenter().AddObserver(tmMarcos.kOnUiLoadFinish, OnUiLoadFinish);
            return(0);
        }
Ejemplo n.º 12
0
 public void Init()
 {
     m_mapPTLType      = new DictionaryEx <uint, Type>();
     m_mapPID2Listener = new DictionaryEx <uint, PTLListenerHelper>();
     m_lstRspListener  = new List <PTLListenerHelper>();
     m_recvBufferTemp  = new NetBuffer(PTLStreamMaxLen);
     m_sendBufferTemp  = new NetBuffer(PTLStreamMaxLen);
 }
Ejemplo n.º 13
0
        private void NotifyUUTEnableChange(int id, bool bvalue)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"]    = id;
            dic["value"] = bvalue;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnUUTEnableChange, dic);
        }
Ejemplo n.º 14
0
 private IniFile(DictionaryEx <string, DictionaryEx <string, string> > data)
 {
     if (data == null)
     {
         throw new ArgumentOutOfRangeException("data");
     }
     cacheData = data;
 }
Ejemplo n.º 15
0
        public int ShowTestStart(int id)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"] = id;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnTestStart, dic);
            return(0);
        }
Ejemplo n.º 16
0
        public int ShowItemStart(int id, int index)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"]    = id;
            dic["index"] = index;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnTestItemStart, dic);
            return(0);
        }
Ejemplo n.º 17
0
        public int ShowTestFinish(int id, int status)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"]    = id;
            dic["state"] = status;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnTestFinish, dic);
            return(0);
        }
Ejemplo n.º 18
0
        int OnUiLoadFinish(Notification nf)
        {
            DictionaryEx      dic   = nf.context as DictionaryEx;
            ToolStripMenuItem instr = dic["instr"] as ToolStripMenuItem;

            instr.DropDownItems.Add("DUT Config", null, new EventHandler(OnConfig));
            //   Init();
            return(0);
        }
Ejemplo n.º 19
0
        public int OnUUTEnableChange(Notification nf)
        {
            DictionaryEx dic    = nf.context as DictionaryEx;
            int          id     = (int)dic["id"];
            bool         bvalue = (bool)dic["value"];

            //m_object.UpdateFixtureUpCopy(id,bvalue);
            return(0);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 设置sn
        /// </summary>
        /// <param name="id"></param>
        /// <param name="str"></param>
        /// <returns></returns>
        public int UiSetSN(int id, string str)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"] = id;
            dic[tmMarcos.kContextMLBSN] = str;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnGetSN, dic);
            return(0);
        }
Ejemplo n.º 21
0
        static int MeasureTupleVsKeyValuePairInDictionaryLookup()
        {
            const int iterations = 1000000;

            int ran = 0;

            var tupleMap  = new DictionaryEx <Tuple <int, int, int, DateTime>, int>(200);
            var structMap = new DictionaryEx <StructTuple <int, int, int, DateTime>, int>(200);

            for (int i = 200 - 1; i >= 0; i--)
            {
                tupleMap.Add(new Tuple <int, int, int, DateTime>(400 - i, i + 1, i - 1, new DateTime(1990 + i % 10, 5, 2)), 0);
                structMap.Add(new StructTuple <int, int, int, DateTime>(400 - i, i + 1, i - 1, new DateTime(1990 + i % 10, 5, 2)), 0);
            }

            //CodeTimer.Time(true, "Tuple lookup",
            //    iterations,
            //    () =>
            //    {
            //        int value;
            //        if (tupleMap.TryGetValue(new Tuple<int, int, int, DateTime>(390, 11, 9, new DateTime(1990, 5, 2)), out value))
            //            ran += 1;
            //    });

            CodeTimer.Time(true, "Struct lookup outer add or update",
                           iterations,
                           () =>
            {
                var key = new StructTuple <int, int, int, DateTime>(390, 11, 9, new DateTime(1990, 5, 2));
                int a   = 1;
                int value;
                if (structMap.TryGetValue(key, out value))
                {
                    structMap[key] = value + a;
                }
                else
                {
                    structMap.Add(key, a);
                }
                ran += 1;
            });

            CodeTimer.Time(true, "Struct lookup AddOrUpdate",
                           iterations,
                           () =>
            {
                int a = 1;
                structMap.AddOrUpdate(
                    new StructTuple <int, int, int, DateTime>(390, 11, 9, new DateTime(1990, 5, 2)),
                    a,
                    (k, cv, nv) => cv + nv);
                ran += 1;
            });

            return(ran);
        }
Ejemplo n.º 22
0
        public int Load(object sender, object arg)
        {
            DictionaryEx dic = arg as DictionaryEx;

            m_TestEngine = dic["engine"] as Engine;

            InitialGlobal();

            return(0);
        }
Ejemplo n.º 23
0
        private void btnCalibRight_Click(object sender, EventArgs e)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"]      = 0;
            dic["profile"] = tmEnvironment.AppDir() + @"profile\Glass_Alsar_Calibration_Right2.lua";
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kLoadRightPulsarProfile, dic);
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
Ejemplo n.º 24
0
        void DoTest_LUA(tmTreeNode itemTree, object obj)
        {
            DictionaryEx dic    = obj as DictionaryEx;
            TestEngine   engine = dic["engine"] as TestEngine;
            int          id     = (int)dic["id"];

            ScriptEngine se = engine.GetScriptEngine(id) as ScriptEngine;

            se.DoString("return main()");   //goto main...
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Splits the <see cref="QuadTreeNode{TValue}"/> into child nodes.</summary>
        /// <remarks>
        /// <b>Split</b> transfers all <see cref="Data"/> of the current instance to newly created
        /// children. Children that would receive no <see cref="Data"/> are not created.</remarks>

        internal void Split()
        {
            foreach (var pair in _data)
            {
                QuadTreeNode <TValue> child = FindOrCreateChild(pair.Key);
                child._data.Add(pair);
            }

            _data = null;
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 高亮测试过程中的灯
        /// </summary>
        /// <param name="nside">-1就是全关掉,左(0)还是右(1)</param>
        /// <param name="nindex"></param>
        /// <returns></returns>
        public int UiHighlightLamp(int id, int nside, int nindex)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"]        = id;
            dic["lampside"]  = nside;
            dic["lamplight"] = nindex;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnCtrlLamp, dic);
            return(0);
        }
Ejemplo n.º 27
0
        int OnUiLoadFinish(Notification nf)
        {
            DictionaryEx      dic   = nf.context as DictionaryEx;
            ToolStripMenuItem instr = dic["instr"] as ToolStripMenuItem;

            instr.DropDownItems.Add("C28 Ctrl", null, new EventHandler(OnConfig));
            //这个时候配置已经读取了
            m_object.Init();
            ConnectCom();
            return(0);
        }
Ejemplo n.º 28
0
        int OnUiLoadFinish(Notification nf)
        {
            DictionaryEx      dic   = nf.context as DictionaryEx;
            ToolStripMenuItem instr = dic["instr"] as ToolStripMenuItem;

            instr.DropDownItems.Add("34972A Debug", null, new EventHandler(OnConfig));
            //这个时候配置已经读取了
            m_object.OpenRM();
            m_object.OpenSession(m_object.Device, m_object.resourceManager);
            return(0);
        }
Ejemplo n.º 29
0
        public int ShowItemFinish(int id, int index, string display, int status, string remark)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"]     = id;
            dic["index"]  = index;
            dic["value"]  = display;
            dic["state"]  = status;
            dic["remark"] = remark;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnTestItemFinish, dic);
            return(0);
        }
Ejemplo n.º 30
0
        public int ShowItemExInfo(int id, string display, int status, string exinfo)
        {
            DictionaryEx dic = new DictionaryEx();

            dic["id"]     = id;
            dic["value"]  = display;
            dic["state"]  = status;
            dic["exinfo"] = exinfo;
            NotificationCenter.DefaultCenter().PostNotification(tmMarcos.kOnTestItemFinishEx, dic);

            return(0);
        }
Ejemplo n.º 31
0
        public MirrorObjectModel(object instance)
        {
            if (instance == null)
                throw new ArgumentNullException(nameof(instance));

            _instance = instance;
            var dict = new DictionaryEx<string, IProperty>();
            _properties = dict;

            Load();

            dict.OnPairChanged += Properties_OnPairChanged;
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Called by Phoenix.Init();
 /// </summary>
 internal static void Init()
 {
     instanceList = new DictionaryEx<int, Instance>().CreateSynchronized();
     defaultInstance = new Instance();
     Phoenix.Logging.JournalHandler.JournalEntryAdded += new JournalEntryAddedEventHandler(JournalHandler_JournalEntryAdded);
 }
Ejemplo n.º 33
0
 protected Mapping()
 {
     Properties = new DictionaryEx<string, object>();
     PredicateMode = PredicateMode.Any;
 }
Ejemplo n.º 34
0
 protected AnalyserBase()
 {
     Properties = new DictionaryEx<string, object>();
     Enabled = true;
     ConfigureDefault();
 }
Ejemplo n.º 35
0
        static int MeasureTupleVsKeyValuePairInDictionaryLookup()
        {
            const int iterations = 1000000;

            int ran = 0;

            var tupleMap = new DictionaryEx<Tuple<int, int, int, DateTime>, int>(200);
            var structMap = new DictionaryEx<StructTuple<int, int, int, DateTime>, int>(200);
            for (int i = 200 - 1; i >= 0; i--)
            {
                tupleMap.Add(new Tuple<int, int, int, DateTime>(400 - i, i + 1, i - 1, new DateTime(1990 + i % 10, 5, 2)), 0);
                structMap.Add(new StructTuple<int, int, int, DateTime>(400 - i, i + 1, i - 1, new DateTime(1990 + i % 10, 5, 2)), 0);
            }

            //CodeTimer.Time(true, "Tuple lookup",
            //    iterations,
            //    () =>
            //    {
            //        int value;
            //        if (tupleMap.TryGetValue(new Tuple<int, int, int, DateTime>(390, 11, 9, new DateTime(1990, 5, 2)), out value))
            //            ran += 1;
            //    });

            CodeTimer.Time(true, "Struct lookup outer add or update",
                iterations,
                () =>
                {
                    var key = new StructTuple<int, int, int, DateTime>(390, 11, 9, new DateTime(1990, 5, 2));
                    int a = 1;
                    int value;
                    if (structMap.TryGetValue(key, out value))
                        structMap[key] = value + a;
                    else
                        structMap.Add(key, a);
                    ran += 1;
                });

            CodeTimer.Time(true, "Struct lookup AddOrUpdate",
                iterations,
                () =>
                {
                    int a = 1;
                    structMap.AddOrUpdate(
                        new StructTuple<int, int, int, DateTime>(390, 11, 9, new DateTime(1990, 5, 2)),
                        a,
                        (k, cv, nv) => cv + nv);
                    ran += 1;
                });

            return ran;
        }