Exemple #1
0
        public static Objects.JSHashlinkResult Decode(ScriptEngine eng, object a)
        {
            if (a is String || a is ConcatenatedString)
            {
                String str = a.ToString();

                try
                {
                    IHashlinkRoom hashlink = Server.Hashlinks.Decrypt(a.ToString());

                    if (hashlink != null)
                    {
                        return(new Objects.JSHashlinkResult(eng.Object.InstancePrototype, hashlink));
                    }
                }
                catch { }
            }

            return(null);
        }
Exemple #2
0
        public static String EncodeHashlink(IHashlinkRoom room)
        {
            List <byte> list = new List <byte>();

            list.AddRange(new byte[20]);
            list.AddRange(Encoding.UTF8.GetBytes("CHATCHANNEL"));
            list.Add(0);
            list.AddRange(room.IP.GetAddressBytes());
            list.AddRange(BitConverter.GetBytes(room.Port));
            list.AddRange(room.IP.GetAddressBytes());
            list.AddRange(Encoding.UTF8.GetBytes(room.Name));
            list.Add(0);
            list.Add(0);

            byte[] buf = list.ToArray();
            buf = Zip.Compress(buf);
            buf = e67(buf, 28435);

            return(Convert.ToBase64String(buf));
        }
Exemple #3
0
 public JSHashlinkResult(ObjectInstance prototype, IHashlinkRoom obj)
     : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["HashlinkResult"]).InstancePrototype)
 {
     this.PopulateFunctions();
     this.parent = obj;
 }
 public String Encrypt(IHashlinkRoom room)
 {
     return(Hashlink.EncodeHashlink(room));
 }