View Single Post
  #13  
Old 12-09-2009, 05:24 AM
remko remko is offline
Member
 
Join Date: Dec 2009
Posts: 8
Default

I think the problem lies here:
Code:
unit  Namespace_01;
interface
type
strict private Class_01 = class sealed
    // Methods
    function Class_01.Method_00(num1: Integer): string;
    var
        buffer: Byte[];
    begin
        lock (typeof(Class_01))
        beginif (Class_01.Field_00 = nil) then
            begin
                executingAssembly := Assembly.GetExecutingAssembly;
                Class_01.Field_00 := executingAssembly.GetManifestResourceStream(executingAssembly.ManifestModule.ModuleVersionId.ToString('B'));
                publicKeyToken := executingAssembly.GetName.GetPublicKeyToken;
                if (publicKeyToken <> nil) then
                begin
                    index := 0;
                    repeat
                        Class_01.Field_01 := (Class_01.Field_01 xor ((publicKeyToken[index] shl 8) + publicKeyToken[(index + 1)]));
                        inc(index, 2)
                    until (index >= (publicKeyToken.Length - 1))
                end;
                num2 := (((MethodBase.GetCurrentMethod.MetadataToken and $ffffff) - 1) mod $ffff);
                Class_01.Field_01 := (Class_01.Field_01 xor num2)
            end;
            Class_01.Field_00.Position := (num1 - Class_01.Field_01);
            num3 := Class_01.Field_00.ReadByte;
            count := 0;
            if ((num3 and $80) = 0) then
                count := num3;
            if ((num3 and $40) = 0) then
                count := (((num3 and $3f) shl 8) + Class_01.Field_00.ReadByte)
            else
                count := (((((num3 and $1f) shl $18) + (Class_01.Field_00.ReadByte shl $10)) + (Class_01.Field_00.ReadByte shl 8)) + Class_01.Field_00.ReadByte);
            buffer := New(array[count] of Byte);
            Class_01.Field_00.Read(buffer, 0, count)
        end;
        if (buffer.Length = 0) then
            begin
                Result := string.Empty;
                exit
            end;
        bytes := Convert.FromBase64String(Encoding.UTF8.GetString(buffer, 0, buffer.Length));
        begin
            Result := string.Intern(Encoding.UTF8.GetString(bytes, 0, bytes.Length));
            exit
        end
    end;


    // Fields
    strict private class var Field_00: Stream;
    strict private class var Field_01: Integer = 0;

end;
and it called in the code like this:
Code:
    function LandBase.ToString: string;
    begin
        Result := string.Format(Class_01.Method_00($7588), self.Naam)
    end;
It seems to return a string from an encrypted resource and this fails because the public key has changed??
Reply With Quote