Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int EncipherConstant = 135;
- private int EncipherMorph;
- private int DecipherConstant = 135;
- private int DecipherMorph;
- public byte[] Encrypt(byte[] Data)
- {
- int Length = Data.Length;
- int ActualByte;
- int Morph;
- byte[] Buffer = new byte[Length];
- int Index = 0;
- while (Length-- > 0)
- {
- ActualByte = Data[Index];
- Morph = (ActualByte ^ this.EncipherConstant) ^ this.EncipherMorph;
- Buffer[Index] = (byte)Morph;
- Index++;
- this.EncipherConstant = Rand(this.EncipherConstant);
- this.EncipherMorph = ActualByte;
- }
- return Buffer;
- }
- public byte[] Decrypt(byte[] Data)
- {
- int Length = Data.Length;
- int ActualByte;
- int Morph;
- byte[] Buffer = new byte[Length];
- int Index = 0;
- while (Length-- > 0)
- {
- ActualByte = Data[Index];
- Morph = (ActualByte ^ this.DecipherConstant) ^ this.DecipherMorph;
- Buffer[Index] = (byte)Morph;
- Index++;
- this.DecipherConstant = Rand(this.DecipherConstant);
- this.DecipherMorph = Morph;
- }
- return Buffer;
- }
- string Name = Parameters[1];
- string Password = Parameters[2];
- if (Name.Contains("/"))
- {
- string[] separator = Regex.Split(Name, "/");
- Name = Tools.decodebase64(separator[0]);
- Password = separator[1];
- }
- else
- {
- Password = Tools.getMD5(Password);
- }
- User User = Users.GetUserFromName(Name);//Chequeamos usuario
- if (User != null)//existe si o no
- {
- if (SessionAdministrator.AllSessions.ContainsKey(User.DNI))
- {
- Session ConnectedSession = SessionAdministrator.GetSession(User.DNI);
- ConnectedSession.DestructSession("Connected -> offline -> enter");
- }
- if (Password.ToLower() == User.MD5Password.ToLower())//contraseña correcta o no
- {
- Session.User = User;
- Login:
- if (CheckBan(Session) == false)
- {
- CheckVip(Session);
- Tools.REnameWord(ref Session.User.Name);
- ServerMessage SMessage = new ServerMessage(new byte[] { 120, 121 });
- SMessage.AppendParameter((uint)1);
- SMessage.AppendParameter(User.Name);
- SMessage.AppendParameter(User.AvatarNumber);
- SMessage.AppendParameter(User.AvatarColour);
- SMessage.AppendParameter(User.Email);
- SMessage.AppendParameter(18);
- SMessage.AppendParameter((uint)2);
- SMessage.AppendParameter("Spain");
- SMessage.AppendParameter((uint)0);
- SMessage.AppendParameter(User.DNI);
- SMessage.AppendParameter(User.Mod);
- SMessage.AppendParameter(User.Gold);
- SMessage.AppendParameter(User.Silver);
- SMessage.AppendParameter(200);
- SMessage.AppendParameter(5);
- SMessage.AppendParameter(24465); //invitaciones enviadas
- SMessage.AppendParameter(-1); //regalo
- SMessage.AppendParameter(0 + "³²" + 0 + "³²0³²ES³²0³²0³²" + User.Vip + "³²³²" + 2 + "³²" + 0 + "³²" + 0 + "³²0³²1³0³²0³²0");
- Session.Send(SMessage);
- Session.HasLoged = true;
- Console.WriteLine();
- Console.ForegroundColor = ConsoleColor.Green;
- Console.Write("Connected Account: ");
- Console.ForegroundColor = ConsoleColor.White;
- Console.Write(User.Name);
- Console.ForegroundColor = ConsoleColor.Gray;
- // Tools.WriteLine("Se ha conectado: " + User.Name, ConsoleColor.Green);
- Console.WriteLine();
- Check_Months_Registered(Session);
- UpDateLastOnline(Session);
- Tools.ConnectedUsers += 1;
- Tools.RefreshTitle();
- SessionAdministrator.AllSessions.Add(User.DNI, Session);
- // new Thread(Session.GetActivity).Start();
- }
- else
- {
- int bantype = int.Parse(Session.User.Ban.Split(new char[] { '_' })[0]);
- if (bantype == 1)
- {
- string reason = Session.User.Ban.Split(new char[] { '_' })[1];
- string expire = Session.User.Ban.Split(new char[] { '_' })[2];
- DateTime BaneoTimeFlush = Convert.ToDateTime(expire);
- if (DateTime.Now >= BaneoTimeFlush)
- {
- DataClient client = DataManager.GetClient();
- client.SetParameter("id", Session.User.DNI);
- client.ExecuteNonQuery("update usuarios set baneo = '' where id = @id");
- Session.User.Ban = "";
- goto Login;
- }
- else
- {
- Session.Send(new ServerMessage(new byte[] { 185 }, new object[] { (BaneoTimeFlush - DateTime.Now).TotalSeconds.ToString().Split(new char[] { ',' })[0], reason }));
- return;
- }
- }
- else
- {
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement