public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer) { if (arrayEncoding) { AmqpBitConverter.WriteInt(buffer, (int)value); } else { IntEncoding.Encode((int)value, buffer); } }
public override int GetObjectEncodeSize(object value, bool arrayEncoding) { if (arrayEncoding) { return(FixedWidth.Int); } else { return(IntEncoding.GetEncodeSize((int)value)); } }
/// <summary> /// Decodes a 32-bit signed integer from the buffer and advances the buffer's position. /// </summary> /// <param name="buffer">The buffer to read.</param> /// <returns>A 32-bit signed integer.</returns> public static int?DecodeInt(ByteBuffer buffer) { return(IntEncoding.Decode(buffer, 0)); }
/// <summary> /// Encodes a 32-bit signed integer and appends the bytes to the buffer. /// </summary> /// <param name="data">The 32-bit signed integer.</param> /// <param name="buffer">The destination buffer.</param> public static void EncodeInt(int?data, ByteBuffer buffer) { IntEncoding.Encode(data, buffer); }
/// <summary> /// Gets the encode size of a 32-bit signed integer. /// </summary> /// <param name="value">The 32-bit signed integer.</param> /// <returns>Encode size in bytes of the 32-bit signed integer.</returns> public static int GetIntEncodeSize(int?value) { return(IntEncoding.GetEncodeSize(value)); }
static void Main(string[] args) { Console.WriteLine("Drag & drop your file : "); string path = Console.ReadLine(); Console.WriteLine("Preparing obfuscation..."); if (!File.Exists("config.txt")) { Console.WriteLine("Config file not found, continuing without it."); goto obfuscation; } Parser p = new Parser() { ConfigFile = "config.txt" }; ForceWinForms = bool.Parse(p.Read("ForceWinFormsCompatibility").ReadResponse().ReplaceSpaces()); DontRename = bool.Parse(p.Read("DontRename").ReadResponse().ReplaceSpaces()); obfuscation: Module = ModuleDefMD.Load(path); FileExtension = Path.GetExtension(path); Console.WriteLine("Renaming..."); Renamer.Execute(); Console.WriteLine("Adding junk methods..."); JunkMethods.Execute(); Console.WriteLine("Adding proxy calls..."); ProxyAdder.Execute(); Console.WriteLine("Encoding ints..."); IntEncoding.Execute(); Console.WriteLine("Encrypting strings..."); StringEncryption.Execute(); Console.WriteLine("Injecting Anti-Tamper..."); AntiTamper.Execute(); Console.WriteLine("Watermarking..."); Watermark.AddAttribute(); Console.WriteLine("Saving file..."); FilePath = @"C:\Users\" + Environment.UserName + @"\Desktop\" + Path.GetFileNameWithoutExtension(path) + "_protected" + FileExtension; ModuleWriterOptions opts = new ModuleWriterOptions(Module) { Logger = DummyLogger.NoThrowInstance }; Module.Write(FilePath, opts); if (AntiTamper.HasBeenTampered) { AntiTamper.InjectMd5(FilePath); } Console.WriteLine("Done! Press any key to exit..."); Console.ReadKey(); }
public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode) { return(IntEncoding.Decode(buffer, formatCode)); }