当前位置: 首页>>代码示例>>C#>>正文


C# DumpState.AddCanvas方法代码示例

本文整理汇总了C#中DumpState.AddCanvas方法的典型用法代码示例。如果您正苦于以下问题:C# DumpState.AddCanvas方法的具体用法?C# DumpState.AddCanvas怎么用?C# DumpState.AddCanvas使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DumpState的用法示例。


在下文中一共展示了DumpState.AddCanvas方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteNode

        private static void WriteNode(WZObject node, DumpState ds, BinaryWriter bw, uint nextChildID) {
            ds.AddNode(node);
            bw.Write(ds.AddString(node.Name));
            bw.Write(nextChildID);
            bw.Write((ushort) node.ChildCount);
            ushort type;

            if (node is WZDirectory || node is WZImage || node is WZSubProperty || node is WZConvexProperty ||
                node is WZNullProperty)
                type = 0; // no data; children only (8)
            else if (node is WZInt32Property || node is WZUInt16Property || node is WZInt64Property)
                type = 1; // int32 (4)
            else if (node is WZSingleProperty || node is WZDoubleProperty)
                type = 2; // Double (0)
            else if (node is WZStringProperty)
                type = 3; // String (4)
            else if (node is WZPointProperty)
                type = 4; // (0)
            else if (node is WZCanvasProperty)
                type = 5; // (4)
            else if (node is WZAudioProperty)
                type = 6; // (4)
            else
                throw new InvalidOperationException("Unhandled WZ node type [1]");

            bw.Write(type);

            if (node is WZInt32Property)
                bw.Write((long) ((WZInt32Property) node).Value);
            else if (node is WZUInt16Property)
                bw.Write((long) ((WZUInt16Property) node).Value);
            else if (node is WZInt64Property)
                bw.Write(((WZInt64Property) node).Value);
            else if (node is WZSingleProperty)
                bw.Write((double) ((WZSingleProperty) node).Value);
            else if (node is WZDoubleProperty)
                bw.Write(((WZDoubleProperty) node).Value);
            else if (node is WZStringProperty)
                bw.Write(ds.AddString(((WZStringProperty) node).Value));
            else if (node is WZPointProperty) {
                Point pNode = ((WZPointProperty) node).Value;
                bw.Write(pNode.X);
                bw.Write(pNode.Y);
            } else if (node is WZCanvasProperty) {
                WZCanvasProperty wzcp = (WZCanvasProperty) node;
                bw.Write(ds.AddCanvas(wzcp));
                if (dumpImg) {
                    bw.Write((ushort) wzcp.Value.Width);
                    bw.Write((ushort) wzcp.Value.Height);
                    wzcp.Dispose();
                } else
                    bw.Write(0);
            } else if (node is WZAudioProperty) {
                WZAudioProperty wzmp = (WZAudioProperty) node;
                bw.Write(ds.AddMP3(wzmp));
                if (dumpSnd) {
                    bw.Write((uint) wzmp.Value.Length);
                    wzmp.Dispose();
                } else
                    bw.Write(0);
            }
            switch (type) {
                case 0:
                    bw.Write(0L);
                    break;
                case 3:
                    bw.Write(0);
                    break;
            }
        }
开发者ID:mspencer92,项目名称:ms-wz2nx,代码行数:70,代码来源:Program.cs


注:本文中的DumpState.AddCanvas方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。