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


C# Cecil.Range类代码示例

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


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

示例1: TryGetCustomAttributeRange

		public bool TryGetCustomAttributeRange (ICustomAttributeProvider owner, out Range range)
		{
			return CustomAttributes.TryGetValue (owner.MetadataToken, out range);
		}
开发者ID:n017,项目名称:Confuser,代码行数:4,代码来源:MetadataSystem.cs

示例2: TryGetSecurityDeclarationRange

		public bool TryGetSecurityDeclarationRange (ISecurityDeclarationProvider owner, out Range range)
		{
			return SecurityDeclarations.TryGetValue (owner.MetadataToken, out range);
		}
开发者ID:n017,项目名称:Confuser,代码行数:4,代码来源:MetadataSystem.cs

示例3: TryGetEventsRange

		public bool TryGetEventsRange (TypeDefinition type, out Range range)
		{
			return Events.TryGetValue (type.token.RID, out range);
		}
开发者ID:n017,项目名称:Confuser,代码行数:4,代码来源:MetadataSystem.cs

示例4: TryGetGenericParameterRange

		public bool TryGetGenericParameterRange (IGenericParameterProvider owner, out Range range)
		{
			return GenericParameters.TryGetValue (owner.MetadataToken, out range);
		}
开发者ID:n017,项目名称:Confuser,代码行数:4,代码来源:MetadataSystem.cs

示例5: TryGetPropertiesRange

		public bool TryGetPropertiesRange (TypeDefinition type, out Range range)
		{
			return Properties.TryGetValue (type.token.RID, out range);
		}
开发者ID:n017,项目名称:Confuser,代码行数:4,代码来源:MetadataSystem.cs

示例6: AddEventsRange

		public void AddEventsRange (uint type_rid, Range range)
		{
			Events.Add (type_rid, range);
		}
开发者ID:n017,项目名称:Confuser,代码行数:4,代码来源:MetadataSystem.cs

示例7: TryGetSecurityDeclarationRanges

        internal bool TryGetSecurityDeclarationRanges(ISecurityDeclarationProvider owner, out Range[] ranges)
		{
			return SecurityDeclarations.TryGetValue (owner.MetadataToken, out ranges);
		}
开发者ID:MarkusSintonen,项目名称:MNetInjector,代码行数:4,代码来源:MetadataSystem.cs

示例8: AddPropertiesRange

		public void AddPropertiesRange (uint type_rid, Range range)
		{
			Properties.Add (type_rid, range);
		}
开发者ID:n017,项目名称:Confuser,代码行数:4,代码来源:MetadataSystem.cs

示例9: TryGetCustomAttributeRanges

        internal bool TryGetCustomAttributeRanges(ICustomAttributeProvider owner, out Range[] ranges)
		{
			return CustomAttributes.TryGetValue (owner.MetadataToken, out ranges);
		}
开发者ID:MarkusSintonen,项目名称:MNetInjector,代码行数:4,代码来源:MetadataSystem.cs

示例10: TryGetGenericParameterRanges

        internal bool TryGetGenericParameterRanges(IGenericParameterProvider owner, out Range[] ranges)
		{
			return GenericParameters.TryGetValue (owner.MetadataToken, out ranges);
		}
开发者ID:MarkusSintonen,项目名称:MNetInjector,代码行数:4,代码来源:MetadataSystem.cs

示例11: AddEventsRange

        internal void AddEventsRange(uint type_rid, Range range)
		{
			Events.Add (type_rid, range);
		}
开发者ID:MarkusSintonen,项目名称:MNetInjector,代码行数:4,代码来源:MetadataSystem.cs

示例12: Transform

            MethodData Transform(MethodBody body, int idx, byte[] codes, Range range)
            {
                MethodData ret = new MethodData();
                ret.Index = idx;
                ret.EHs = Mono.Empty<MethodData.MethodEH>.Array;
                if ((codes[range.Start] & 0x3) == 0x2)
                {
                    ret.ILCodes = new byte[codes[range.Start] >> 2];
                    Buffer.BlockCopy(codes, (int)range.Start + 1, ret.ILCodes, 0, ret.ILCodes.Length);
                    ret.LocalVars = 0;
                    ret.MaxStack = (uint)8;
                    ret.Options = (uint)Confuser.Random.Next(0, 2) << 8;
                }
                else
                {
                    ushort flags = BitConverter.ToUInt16(codes, (int)range.Start);
                    ret.ILCodes = new byte[BitConverter.ToInt32(codes, (int)range.Start + 4)];
                    Buffer.BlockCopy(codes, (int)range.Start + 12, ret.ILCodes, 0, ret.ILCodes.Length);
                    ret.LocalVars = BitConverter.ToUInt32(codes, (int)range.Start + 8);
                    ret.MaxStack = BitConverter.ToUInt16(codes, (int)range.Start + 2);
                    ret.Options = (flags & 0x10) != 0 ? 0x10 : 0U;
                    ret.Options |= (uint)Confuser.Random.Next(0, 2) << 8;

                    if ((flags & 0x8) != 0)
                    {
                        int ptr = (int)range.Start + 12 + ret.ILCodes.Length;
                        var ehs = new List<MethodData.MethodEH>();
                        byte f;
                        do
                        {
                            ptr = (ptr + 3) & ~3;
                            f = codes[ptr];
                            uint count;
                            bool isSmall = (f & 0x40) == 0;
                            if (isSmall)
                                count = codes[ptr + 1] / 12u;
                            else
                                count = (BitConverter.ToUInt32(codes, ptr) >> 8) / 24;
                            ptr += 4;

                            for (int i = 0; i < count; i++)
                            {
                                var clause = new MethodData.MethodEH();
                                clause.Flags = (ExceptionHandlerType)(codes[ptr] & 0x7);
                                ptr += isSmall ? 2 : 4;

                                clause.TryOffset = isSmall ? BitConverter.ToUInt16(codes, ptr) : BitConverter.ToUInt32(codes, ptr);
                                ptr += isSmall ? 2 : 4;
                                clause.TryLength = isSmall ? codes[ptr] : BitConverter.ToUInt32(codes, ptr);
                                ptr += isSmall ? 1 : 4;

                                clause.HandlerOffset = isSmall ? BitConverter.ToUInt16(codes, ptr) : BitConverter.ToUInt32(codes, ptr);
                                ptr += isSmall ? 2 : 4;
                                clause.HandlerLength = isSmall ? codes[ptr] : BitConverter.ToUInt32(codes, ptr);
                                ptr += isSmall ? 1 : 4;

                                clause.ClassTokenOrFilterOffset = BitConverter.ToUInt32(codes, ptr);
                                ptr += 4;

                                if ((clause.ClassTokenOrFilterOffset & 0xff000000) == 0x1b000000)
                                    ret.Options |= 0x80;

                                ehs.Add(clause);
                            }
                        }
                        while ((f & 0x80) != 0);
                        ret.EHs = ehs.ToArray();
                    }
                }

                return ret;
            }
开发者ID:n017,项目名称:Confuser,代码行数:72,代码来源:AntiTamperConfusion.JIT.cs

示例13: Phase3

            public void Phase3(MetadataProcessor.MetadataAccessor accessor)
            {
                MethodTable tbl = accessor.TableHeap.GetTable<MethodTable>(Table.Method);

                accessor.Codes.Position = 0;
                codes = accessor.Codes.ReadBytes(accessor.Codes.Length);
                accessor.Codes.Reset(null);
                accessor.Codes.Position = 0;

                uint bas = accessor.Codebase;
                List<object> o = new List<object>();
                for (int i = 0; i < tbl.Length; i++)
                {
                    if (tbl[i].Col1 == 0) continue;
                    if (excludes.Contains(i) || (tbl[i].Col2 & MethodImplAttributes.CodeTypeMask) != MethodImplAttributes.IL)
                    {
                        if ((tbl[i].Col2 & MethodImplAttributes.CodeTypeMask) != MethodImplAttributes.IL)
                            accessor.Codes.WriteBytes(((accessor.Codes.Position + 15) & ~15) - accessor.Codes.Position);
                        tbl[i].Col1 = (uint)accessor.Codes.Position + bas;

                        Range range = accessor.BodyRanges[new MetadataToken(TokenType.Method, i + 1)];
                        byte[] buff = new byte[range.Length];
                        Buffer.BlockCopy(codes, (int)(range.Start - bas), buff, 0, buff.Length);
                        accessor.Codes.WriteBytes(buff);
                        accessor.Codes.WriteBytes(((accessor.Codes.Position + 3) & ~3) - accessor.Codes.Position);
                    }
                    else
                    {
                        tbl[i].Col2 |= MethodImplAttributes.NoInlining;

                        Range range = accessor.BodyRanges[new MetadataToken(TokenType.Method, i + 1)];
                        range = new Range(range.Start - bas, range.Length);
                        ExtractRefs(bodies[i], i, o);
                        var dat = Transform(bodies[i], i, codes, range);
                        o.Add(dat);
                    }
                }

                int[] randArray = new int[o.Count];
                for (int i = 0; i < o.Count; i++) randArray[i] = Confuser.Random.Next();
                object[] objs = o.ToArray();
                Array.Sort(randArray, objs);

                var mtdDats = new Dictionary<int, MethodData>();
                foreach (var i in objs)
                {
                    if (i is MethodData)
                    {
                        MethodData mtdDat = i as MethodData;
                        mtdDats[mtdDat.Index] = mtdDat;
                        mtdDat.BufferOffset = finalDat.Position;
                        finalDat.WriteBytes(mtdDat.Serialize(fieldLayout));

                        Confuser.Database.AddEntry("AntiTamper", (0x06000001 + mtdDat.Index).ToString("X"), mtdDat.BufferOffset);
                    }
                    else
                    {
                        StringData strDat = i as StringData;
                        strDat.BufferOffset = finalDat.Position;
                        finalDat.WriteBytes(strDat.Serialize(key5));

                        Confuser.Database.AddEntry("AntiTamper", strDat.String, strDat.BufferOffset);
                    }
                }

                foreach (var i in objs)
                {
                    if (i is StringData)
                    {
                        StringData dat = i as StringData;
                        uint token = 0x70800000;
                        token |= (uint)dat.BufferOffset;
                        Buffer.BlockCopy(BitConverter.GetBytes(token), 0, mtdDats[dat.Index].ILCodes, dat.Offset, 4);
                    }
                }

                byte[] randBuff = new byte[4];
                foreach (var i in mtdDats)
                {
                    uint ptr = (uint)i.Value.BufferOffset;

                    Confuser.Random.NextBytes(randBuff);
                    uint key = BitConverter.ToUInt32(randBuff, 0);
                    tbl[i.Key].Col1 = (uint)accessor.Codes.Position + bas;
                    byte[] buff = i.Value.Serialize(fieldLayout);
                    Crypt(buff, key * (uint)key4, key);
                    finalDat.Position = i.Value.BufferOffset;
                    finalDat.WriteBytes(buff);

                    accessor.Codes.WriteByte(0x46); //flags
                    accessor.Codes.WriteByte(0x21); //ldc.i8
                    accessor.Codes.WriteUInt64(((ulong)key << 32) | (ptr ^ key));
                    accessor.Codes.WriteByte(0x20); //ldc.i4
                    accessor.Codes.WriteUInt32(~(uint)buff.Length ^ key);
                    accessor.Codes.WriteByte(0x26);

                    accessor.BlobHeap.Position = (int)tbl[i.Key].Col5;
                    accessor.BlobHeap.ReadCompressedUInt32();
                    byte flags = accessor.BlobHeap.ReadByte();
                    if ((flags & 0x10) != 0) accessor.BlobHeap.ReadCompressedUInt32();
//.........这里部分代码省略.........
开发者ID:n017,项目名称:Confuser,代码行数:101,代码来源:AntiTamperConfusion.JIT.cs


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