ActionScript - Pasar de AS3 a C#

 
Vista:
sin imagen de perfil

Pasar de AS3 a C#

Publicado por ZylarD (1 intervención) el 29/03/2014 13:55:48
Hola muy buenas gente. ¿Me podrían ayudar en pasar una serie de instrucciones de AS3 a C#?

-AS3-


internal function encrypt(arg1:flash.utils.ByteArray):flash.utils.ByteArray
{
var loc2:*=0;
var loc3:*=0;
var loc1:*=new flash.utils.ByteArray();
arg1.position = 0;
while (arg1.bytesAvailable > 0)
{
loc2 = arg1.readByte();
loc3 = loc2 ^ this._gf6154 ^ this._ac707;
loc1.writeByte(loc3);
this._gf6154 = _xi7447(this._gf6154);
this._ac707 = loc2;
}
loc1.position = 0;
return loc1;
}

internal function decrypt(arg1:flash.utils.ByteArray):flash.utils.ByteArray
{
var loc2:*=0;
var loc3:*=0;
var loc1:*=new flash.utils.ByteArray();
arg1.position = 0;
while (arg1.bytesAvailable > 0)
{
loc2 = arg1.readByte();
loc3 = loc2 ^ this._vp15885 ^ this._ad2402;
loc1.writeByte(loc3);
this._vp15885 = _xi7447(this._vp15885);
this._ad2402 = loc3;
}
loc1.position = 0;
return loc1;
}

-Y me gustaría pasarlo a C#-


¿Me podríais ayudar? Hay algún programa o alguna Web que te ayude a pasarlo a C#?

Por ahora solo he conseguido esto:


public static void Decrypt(byte[] arg1);

Saludos.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alejandro

Conversión de funciones de encriptación y desencriptación a C#

Publicado por Alejandro (369 intervenciones) el 28/06/2023 18:16:31
¡Claro! Estoy aquí para ayudarte a convertir el código de ActionScript 3 a C#. No conozco una herramienta específica que pueda realizar la conversión automáticamente, pero puedo ayudarte a traducir el código manualmente.

Aquí tienes el código convertido a C#:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
internal byte[] Encrypt(byte[] arg1)
{
    int loc2 = 0;
    int loc3 = 0;
    byte[] loc1 = new byte[arg1.Length];
    int position = 0;
    while (position < arg1.Length)
    {
        loc2 = arg1[position];
        loc3 = loc2 ^ this._gf6154 ^ this._ac707;
        loc1[position] = (byte)loc3;
        this._gf6154 = _xi7447(this._gf6154);
        this._ac707 = loc2;
        position++;
    }
    return loc1;
}
 
internal byte[] Decrypt(byte[] arg1)
{
    int loc2 = 0;
    int loc3 = 0;
    byte[] loc1 = new byte[arg1.Length];
    int position = 0;
    while (position < arg1.Length)
    {
        loc2 = arg1[position];
        loc3 = loc2 ^ this._vp15885 ^ this._ad2402;
        loc1[position] = (byte)loc3;
        this._vp15885 = _xi7447(this._vp15885);
        this._ad2402 = loc3;
        position++;
    }
    return loc1;
}

Ten en cuenta que he asumido que `_gf6154`, `_ac707`, `_vp15885` y `_ad2402` son variables miembro de la clase que contienen los valores necesarios para realizar las operaciones de encriptación y desencriptación.

Espero que esto te ayude a tener una base para continuar con tu trabajo en C#. ¡Buena suerte con tu proyecto!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar