Beispiel #1
0
        /// <summary>
        /// 复制(潜拷贝)
        /// </summary>
        protected override void toShadowCopy(BaseData data)
        {
            if (!(data is UIObjectData))
            {
                return;
            }

            UIObjectData mData = (UIObjectData)data;

            this.name     = mData.name;
            this.type     = mData.type;
            this.style    = mData.style;
            this.children = mData.children;
            this.intArgs  = mData.intArgs;
            this.strArgs  = mData.strArgs;
        }
Beispiel #2
0
        /// <summary>
        /// 转文本输出
        /// </summary>
        protected override void toWriteDataString(DataWriter writer)
        {
            writer.writeTabs();
            writer.sb.Append("name");
            writer.sb.Append(':');
            writer.sb.Append(this.name);

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("type");
            writer.sb.Append(':');
            writer.sb.Append(this.type);

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("style");
            writer.sb.Append(':');
            writer.sb.Append(this.style);

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("children");
            writer.sb.Append(':');
            writer.sb.Append("List<UIObjectData>");
            if (this.children != null)
            {
                SList <UIObjectData> childrenT = this.children;
                int childrenLen = childrenT.size();
                writer.sb.Append('(');
                writer.sb.Append(childrenLen);
                writer.sb.Append(')');
                writer.writeEnter();
                writer.writeLeftBrace();
                for (int childrenI = 0; childrenI < childrenLen; ++childrenI)
                {
                    UIObjectData childrenV = childrenT.get(childrenI);
                    writer.writeTabs();
                    writer.sb.Append(childrenI);
                    writer.sb.Append(':');
                    if (childrenV != null)
                    {
                        childrenV.writeDataString(writer);
                    }
                    else
                    {
                        writer.sb.Append("UIObjectData=null");
                    }

                    writer.writeEnter();
                }
                writer.writeRightBrace();
            }
            else
            {
                writer.sb.Append("=null");
            }

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("intArgs");
            writer.sb.Append(':');
            writer.sb.Append("Array<int>");
            if (this.intArgs != null)
            {
                int[] intArgsT   = this.intArgs;
                int   intArgsLen = intArgsT.Length;
                writer.sb.Append('(');
                writer.sb.Append(intArgsLen);
                writer.sb.Append(')');
                writer.writeEnter();
                writer.writeLeftBrace();
                for (int intArgsI = 0; intArgsI < intArgsLen; ++intArgsI)
                {
                    int intArgsV = intArgsT[intArgsI];
                    writer.writeTabs();
                    writer.sb.Append(intArgsI);
                    writer.sb.Append(':');
                    writer.sb.Append(intArgsV);

                    writer.writeEnter();
                }
                writer.writeRightBrace();
            }
            else
            {
                writer.sb.Append("=null");
            }

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("strArgs");
            writer.sb.Append(':');
            writer.sb.Append("Array<string>");
            if (this.strArgs != null)
            {
                string[] strArgsT   = this.strArgs;
                int      strArgsLen = strArgsT.Length;
                writer.sb.Append('(');
                writer.sb.Append(strArgsLen);
                writer.sb.Append(')');
                writer.writeEnter();
                writer.writeLeftBrace();
                for (int strArgsI = 0; strArgsI < strArgsLen; ++strArgsI)
                {
                    string strArgsV = strArgsT[strArgsI];
                    writer.writeTabs();
                    writer.sb.Append(strArgsI);
                    writer.sb.Append(':');
                    writer.sb.Append(strArgsV);

                    writer.writeEnter();
                }
                writer.writeRightBrace();
            }
            else
            {
                writer.sb.Append("=null");
            }

            writer.writeEnter();
        }
Beispiel #3
0
        /// <summary>
        /// 是否数据一致
        /// </summary>
        protected override bool toDataEquals(BaseData data)
        {
            UIObjectData mData = (UIObjectData)data;

            if (this.name != mData.name)
            {
                return(false);
            }

            if (this.type != mData.type)
            {
                return(false);
            }

            if (this.style != mData.style)
            {
                return(false);
            }

            if (mData.children != null)
            {
                if (this.children == null)
                {
                    return(false);
                }
                if (this.children.size() != mData.children.size())
                {
                    return(false);
                }
                SList <UIObjectData> childrenT = this.children;
                SList <UIObjectData> childrenR = mData.children;
                int childrenLen = childrenT.size();
                for (int childrenI = 0; childrenI < childrenLen; ++childrenI)
                {
                    UIObjectData childrenU = childrenT.get(childrenI);
                    UIObjectData childrenV = childrenR.get(childrenI);
                    if (childrenV != null)
                    {
                        if (childrenU == null)
                        {
                            return(false);
                        }
                        if (!childrenU.dataEquals(childrenV))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (childrenU != null)
                        {
                            return(false);
                        }
                    }
                }
            }
            else
            {
                if (this.children != null)
                {
                    return(false);
                }
            }

            if (mData.intArgs != null)
            {
                if (this.intArgs == null)
                {
                    return(false);
                }
                if (this.intArgs.Length != mData.intArgs.Length)
                {
                    return(false);
                }
                int[] intArgsT   = this.intArgs;
                int[] intArgsR   = mData.intArgs;
                int   intArgsLen = intArgsT.Length;
                for (int intArgsI = 0; intArgsI < intArgsLen; ++intArgsI)
                {
                    int intArgsU = intArgsT[intArgsI];
                    int intArgsV = intArgsR[intArgsI];
                    if (intArgsU != intArgsV)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (this.intArgs != null)
                {
                    return(false);
                }
            }

            if (mData.strArgs != null)
            {
                if (this.strArgs == null)
                {
                    return(false);
                }
                if (this.strArgs.Length != mData.strArgs.Length)
                {
                    return(false);
                }
                string[] strArgsT   = this.strArgs;
                string[] strArgsR   = mData.strArgs;
                int      strArgsLen = strArgsT.Length;
                for (int strArgsI = 0; strArgsI < strArgsLen; ++strArgsI)
                {
                    string strArgsU = strArgsT[strArgsI];
                    string strArgsV = strArgsR[strArgsI];
                    if (strArgsU != strArgsV)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (this.strArgs != null)
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #4
0
        /// <summary>
        /// 复制(深拷贝)
        /// </summary>
        protected override void toCopy(BaseData data)
        {
            if (!(data is UIObjectData))
            {
                return;
            }

            UIObjectData mData = (UIObjectData)data;

            this.name = mData.name;

            this.type = mData.type;

            this.style = mData.style;

            if (mData.children != null)
            {
                if (this.children != null)
                {
                    this.children.clear();
                    this.children.ensureCapacity(mData.children.size());
                }
                else
                {
                    this.children = new SList <UIObjectData>();
                }

                SList <UIObjectData> childrenT = this.children;
                if (!mData.children.isEmpty())
                {
                    UIObjectData[] childrenVValues = mData.children.getValues();
                    for (int childrenVI = 0, childrenVLen = mData.children.length(); childrenVI < childrenVLen; ++childrenVI)
                    {
                        UIObjectData childrenV = childrenVValues[childrenVI];
                        UIObjectData childrenU;
                        if (childrenV != null)
                        {
                            childrenU = (UIObjectData)BytesControl.createData(UIObjectData.dataID);
                            childrenU.copy(childrenV);
                        }
                        else
                        {
                            childrenU = null;
                        }

                        childrenT.add(childrenU);
                    }
                }
            }
            else
            {
                this.children = null;
            }

            if (mData.intArgs != null)
            {
                int[] intArgsR   = mData.intArgs;
                int   intArgsLen = intArgsR.Length;
                if (this.intArgs == null || this.intArgs.Length != intArgsLen)
                {
                    this.intArgs = new int[intArgsLen];
                }
                BytesControl.arrayCopy(mData.intArgs, this.intArgs, intArgsLen);
            }
            else
            {
                this.intArgs = null;
            }

            if (mData.strArgs != null)
            {
                string[] strArgsR   = mData.strArgs;
                int      strArgsLen = strArgsR.Length;
                if (this.strArgs == null || this.strArgs.Length != strArgsLen)
                {
                    this.strArgs = new string[strArgsLen];
                }
                string[] strArgsT = this.strArgs;
                for (int strArgsI = 0; strArgsI < strArgsLen; ++strArgsI)
                {
                    string strArgsV = strArgsR[strArgsI];
                    string strArgsU;
                    strArgsU = strArgsV;

                    strArgsT[strArgsI] = strArgsU;
                }
            }
            else
            {
                this.strArgs = null;
            }
        }
Beispiel #5
0
        /// <summary>
        /// 写入字节流(简版)
        /// </summary>
        protected override void toWriteBytesSimple(BytesWriteStream stream)
        {
            stream.writeUTF(this.name);

            stream.writeInt(this.type);

            stream.writeUTF(this.style);

            if (this.children != null)
            {
                stream.writeBoolean(true);
                stream.writeLen(this.children.size());
                if (!this.children.isEmpty())
                {
                    UIObjectData[] childrenVValues = this.children.getValues();
                    for (int childrenVI = 0, childrenVLen = this.children.length(); childrenVI < childrenVLen; ++childrenVI)
                    {
                        UIObjectData childrenV = childrenVValues[childrenVI];
                        if (childrenV != null)
                        {
                            stream.writeBoolean(true);
                            childrenV.writeBytesSimple(stream);
                        }
                        else
                        {
                            stream.writeBoolean(false);
                        }
                    }
                }
            }
            else
            {
                stream.writeBoolean(false);
            }

            if (this.intArgs != null)
            {
                stream.writeBoolean(true);
                int[] intArgsT = this.intArgs;
                stream.writeLen(intArgsT.Length);
                for (int intArgsVI = 0, intArgsVLen = intArgsT.Length; intArgsVI < intArgsVLen; ++intArgsVI)
                {
                    int intArgsV = intArgsT[intArgsVI];
                    stream.writeInt(intArgsV);
                }
            }
            else
            {
                stream.writeBoolean(false);
            }

            if (this.strArgs != null)
            {
                stream.writeBoolean(true);
                string[] strArgsT = this.strArgs;
                stream.writeLen(strArgsT.Length);
                for (int strArgsVI = 0, strArgsVLen = strArgsT.Length; strArgsVI < strArgsVLen; ++strArgsVI)
                {
                    string strArgsV = strArgsT[strArgsVI];
                    stream.writeUTF(strArgsV);
                }
            }
            else
            {
                stream.writeBoolean(false);
            }
        }