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


C# DumpState类代码示例

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


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

示例1: DumpMem

        public static void DumpMem(object b, DumpState D)
        {
#if XBOX || SILVERLIGHT
			// todo: implement this - mjf
			Debug.Assert(false);
#else
            //Console.WriteLine(b.GetType().ToString() + ":::" + b.ToString());
            //uint size = (uint)Marshal.SizeOf(b);
            //D.status = D.writer(D.L, new CharPtr(b.ToString()), size, D.data);
            
            ///*
            int size = Marshal.SizeOf(b);
            IntPtr ptr = Marshal.AllocHGlobal(size);
            Marshal.StructureToPtr(b, ptr, false);
            byte[] bytes = new byte[size];
            Marshal.Copy(ptr, bytes, 0, size);
            char[] ch = new char[bytes.Length];
            for (int i = 0; i < bytes.Length; i++)
                ch[i] = (char)bytes[i];
            CharPtr str = ch;
            DumpBlock(str, (uint)str.chars.Length, D);
            Marshal.Release(ptr);
            // */
#endif
        }
开发者ID:chenzuo,项目名称:SharpLua,代码行数:25,代码来源:ldump.cs

示例2: DumpMem

 public static void DumpMem(object b, int n, DumpState D)
 {
     Array array = b as Array;
     Debug.Assert(array.Length == n);
     for (int i = 0; i < n; i++)
         DumpMem(array.GetValue(i), D);
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:7,代码来源:ldump.cs

示例3: Write

 public override void Write(object o, HtmlWriter tag, DumpState state, RefDictionary refDict)
 {
     var val =  o.ToString();
     tag.Tag("kbd", t =>
     {
         t.NewLineAfterSTag = false;
         t.WriteString(val);
     });
 }
开发者ID:cmc19,项目名称:DumpUtil,代码行数:9,代码来源:EnumDumpType.cs

示例4: DumpBlock

 private static void DumpBlock(CharPtr b, uint size, DumpState D)
 {
     if (D.status==0)
      {
       LuaUnlock(D.L);
       D.status=D.writer(D.L,b,size,D.data);
       LuaLock(D.L);
      }
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:9,代码来源:ldump.cs

示例5: LuaUDump

 public static int LuaUDump(LuaState L, Proto f, lua_Writer w, object data, int strip)
 {
     DumpState D = new DumpState();
      D.L=L;
      D.writer=w;
      D.data=data;
      D.strip=strip;
      D.status=0;
      DumpHeader(D);
      DumpFunction(f,null,D);
      return D.status;
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:12,代码来源:ldump.cs

示例6: DumpVector

 static void DumpVector(object b, int n, DumpState D)
 {
     DumpInt(n,D);
      DumpMem(b, n, D);
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:5,代码来源:ldump.cs

示例7: DumpString

 private static void DumpString(TString s, DumpState D)
 {
     if (s==null || GetStr(s)==null)
      {
       uint size=0;
       DumpVar(size,D);
      }
      else
      {
       uint size=s.tsv.len+1;		/* include trailing '\0' */
       DumpVar(size,D);
       DumpBlock(GetStr(s),size,D);
      }
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:14,代码来源:ldump.cs

示例8: DumpNumber

 private static void DumpNumber(LuaNumberType x, DumpState D)
 {
     DumpVar(x,D);
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:ldump.cs

示例9: DumpInt

 private static void DumpInt(int x, DumpState D)
 {
     DumpVar(x,D);
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:ldump.cs

示例10: DumpHeader

 private static void DumpHeader(DumpState D)
 {
     CharPtr h = new char[LUAC_HEADERSIZE];
      luaU_header(h);
      DumpBlock(h,LUAC_HEADERSIZE,D);
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:6,代码来源:ldump.cs

示例11: DumpFunction

 private static void DumpFunction(Proto f, TString p, DumpState D)
 {
     DumpString( ((f.source==p) || (D.strip!=0)) ? null : f.source, D);
      DumpInt(f.linedefined,D);
      DumpInt(f.lastlinedefined,D);
      DumpChar(f.nups,D);
      DumpChar(f.numparams,D);
      DumpChar(f.is_vararg,D);
      DumpChar(f.maxstacksize,D);
      DumpCode(f,D);
      DumpConstants(f,D);
      DumpDebug(f,D);
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:13,代码来源:ldump.cs

示例12: DumpMem

        public static void DumpMem(object b, DumpState D)
        {
            #if XBOX
            // todo: implement this - mjf
            Debug.Assert(false);
            #endif

            #if SILVERLIGHT
            // No support for Marshal.SizeOf in Silverlight, so we
            // have to manually set the size. Size values are from
            // Lua's 5.1 spec.

            // No support for Marshal.StructureToPtr in Silverlight,
            // let's use BitConverter instead!

            int size = 0;
            byte[] bytes;
            Type t = b.GetType();
            if (t.Equals(typeof(UInt32)))
            {
                size = 4;
                bytes = BitConverter.GetBytes((uint)b);
            }
            else if (t.Equals(typeof(Int32)))
            {
                size = 4;
                bytes = BitConverter.GetBytes((int)b);
            }
            else if (t.Equals(typeof(Char)))
            {
                size = 1;
                bytes = new byte[1] { BitConverter.GetBytes((char)b)[0] };
            }
            else if (t.Equals(typeof(Byte)))
            {
                size = 1;
                bytes = new byte[1] { (byte)b };
                //bytes = BitConverter.GetBytes((byte)b);
            }
            else if (t.Equals(typeof(Double)))
            {
                size = 8;
                bytes = BitConverter.GetBytes((double)b);
            }
            else
            {
                throw new NotImplementedException("Invalid type: " + t.FullName);
            }

            #else
            int size = Marshal.SizeOf(b);
            IntPtr ptr = Marshal.AllocHGlobal(size);
            Marshal.StructureToPtr(b, ptr, false);
            byte[] bytes = new byte[size];
            Marshal.Copy(ptr, bytes, 0, size);
            #endif
            char[] ch = new char[bytes.Length];
            for (int i = 0; i < bytes.Length; i++)
                ch[i] = (char)bytes[i];
            CharPtr str = ch;
            DumpBlock(str, (uint)str.chars.Length, D);

            #if !SILVERLIGHT
            Marshal.Release(ptr);
            #endif
        }
开发者ID:WondermSwift,项目名称:KopiLua,代码行数:66,代码来源:ldump.cs

示例13: DumpVar

 public static void DumpVar(object x, DumpState D)
 {
     DumpMem(x, D);
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:4,代码来源:ldump.cs

示例14: WriteUOL

 private static void WriteUOL(WZUOLProperty node, DumpState ds, BinaryWriter bw) {
     ds.AddNode(node);
     bw.Write(ds.AddString(node.Name));
     ds.AddUOL(node, bw.BaseStream.Position);
     bw.Write(0L);
     bw.Write(0L);
 }
开发者ID:mspencer92,项目名称:ms-wz2nx,代码行数:7,代码来源:Program.cs

示例15: DumpCode

 private static void DumpCode(Proto f, DumpState D)
 {
     DumpInt(f.sizecode, D);
     for (int i = 0; i < f.sizecode; i++)
         DumpInt((int)f.code[i], D);
 }
开发者ID:chenzuo,项目名称:SharpLua,代码行数:6,代码来源:ldump.cs


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