コード例 #1
0
        private bool Link()
        {
            foreach (var nodes in fmLinker.m_dicLinks)
            {
                foreach (var node in nodes.Value)
                {
                    fmData fromFmData = m_tableFmData.Find(node.m_eFromFmDataType, node.m_nFromIndex);
                    if (null == fromFmData)
                    {
                        return(false);
                    }
                    fmData toFmData = m_tableFmData.Find(node.m_eToFmDataType, node.m_nToIndex);
                    if (null == toFmData)
                    {
                        return(false);
                    }

                    DataLink fromDataLink = DataLinkManager.Find(node.m_strFromKey, node.m_nFromIndex);
                    if (null != fromDataLink)
                    {
                        fromDataLink.Add(toFmData);
                    }

                    DataLink toDataLink = DataLinkManager.Find(node.m_strToKey, node.m_nToIndex);
                    if (null != toDataLink)
                    {
                        toDataLink.Add(fromFmData);
                    }
                }
            }
            return(true);
        }
コード例 #2
0
        public bool Add(fmData data)
        {
            Type classType = data.GetType();

            eFmDataType eType = data.GetFmDataType();


            bool isHave = m_dicFmDatas.ContainsKey(eType);

            if (false == isHave)
            {
                m_dicFmDatas.Add(eType, new Dictionary <int, fmData>());
            }

            if (0 == data.Code)
            {
                return(false);
            }

            m_dicFmDatas[eType].Add(data.Code, data);

            string className = "class " + classType.Name;

            if (false == m_dicTypes.ContainsKey(className))
            {
                m_dicTypes.Add(className, eType);
            }

            return(true);
        }
コード例 #3
0
        public override void Add(fmData data)
        {
            fmData _data = GetFmData(data.Code);

            if (null == _data)
            {
                m_listDatas.Add(data);
            }
        }
コード例 #4
0
        public T Find <T>(int index) where T : fmData
        {
            fmData data = Find(typeof(T), index);

            if (null == data)
            {
                return(default(T));
            }

            return(data as T);
        }
コード例 #5
0
        public void EncodeDecode(eCoderType eCoder, BufferCoder coder)
        {
            if (eCoderType.Encode == eCoder)
            {
                {
                    int count = m_dicTypes.Count;
                    coder.EncodeDecode(eCoder, ref count);
                    foreach (var node in m_dicTypes)
                    {
                        string      dicKey   = node.Key.ToString();
                        eFmDataType dataType = node.Value;
                        coder.EncodeDecode(eCoder, ref dicKey);
                        coder.EncodeDecode(eCoder, ref dataType, sizeof(int));
                    }
                }
                {
                    // 1. Dictionary<eFmDataType, Dictionary<int, fmData>> dicTypeFmData
                    // 1-1 dicTypeFmData.Count;
                    int count = m_dicFmDatas.Count;
                    coder.EncodeDecode(eCoder, ref count);

                    // 1-2 dicKey
                    foreach (var node in m_dicFmDatas)
                    {
                        int dicKey = (int)node.Key;
                        coder.EncodeDecode(eCoder, ref dicKey);
                    }

                    // 2. Dictionary<int, fmData> dicFmData
                    foreach (var node in m_dicFmDatas)
                    {
                        // 2-1 dicFmData.Count
                        int cnt = node.Value.Count;
                        coder.EncodeDecode(eCoder, ref cnt);

                        // 2-2 dicKey
                        foreach (var item in node.Value)
                        {
                            item.Value.EncodeDecode(eCoder, coder);
                        }
                    }
                }
            }
            else
            {
                {
                    Dictionary <string, eFmDataType> dicTypes = new Dictionary <string, eFmDataType>();
                    dicTypes.Clear();

                    int count = 0;
                    coder.EncodeDecode(eCoder, ref count);
                    for (int i = 0; i < count; ++i)
                    {
                        string      dicKey   = string.Empty;
                        eFmDataType dataType = eFmDataType.None;
                        coder.EncodeDecode(eCoder, ref dicKey);
                        coder.EncodeDecode(eCoder, ref dataType, sizeof(int));
                        dicTypes.Add(dicKey, dataType);
                    }

                    m_dicTypes = dicTypes;
                }
                {
                    Dictionary <eFmDataType, Dictionary <int, fmData> > dicFmDatas = new Dictionary <eFmDataType, Dictionary <int, fmData> >();

                    int typeCount = 0;
                    coder.EncodeDecode(eCoder, ref typeCount);

                    for (int i = 0; i < typeCount; ++i)
                    {
                        eFmDataType eDataType = eFmDataType.None;
                        int         dicKey    = 0;
                        coder.EncodeDecode(eCoder, ref dicKey);
                        eDataType = (eFmDataType)dicKey;
                        dicFmDatas.Add(eDataType, new Dictionary <int, fmData>());
                    }

                    foreach (var node in dicFmDatas)
                    {
                        int listCount = 0;
                        coder.EncodeDecode(eCoder, ref listCount);

                        for (int i = 0; i < listCount; ++i)
                        {
                            fmData _fmData = CreateFmData(node.Key);

                            _fmData.EncodeDecode(eCoder, coder);

                            node.Value.Add(_fmData.Code, _fmData);
                        }
                    }

                    m_dicFmDatas = dicFmDatas;
                }
            }
        }
コード例 #6
0
 public override void Add(fmData data)
 {
     m_dicDatas.Add(data.Code, data);
 }
コード例 #7
0
 public DataLinkDic(string strKey, fmData fromData)
     : base(strKey)
 {
     m_fromfmData = fromData;
 }
コード例 #8
0
 public virtual void Add(fmData data)
 {
 }
コード例 #9
0
 public override void Add(fmData data)
 {
     m_linkfmData = data;
 }
コード例 #10
0
 public DataLinkOneZero(string strKey, fmData fromData)
     : base(strKey)
 {
     m_fromfmData = fromData;
 }