Project Boolean [C# - R63A - OS - Free]

Page 3 of 6 FirstFirst 123456 LastLast
Results 31 to 45 of 79
  1. #31
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by maritnmine View Post
    The lock at the console writing would kill your performance. Avoid using locks :)

    - Martin
    You know, not using Lock(); Just a password..

    And im not gonna sell anything. It's Free

    SVN: https://github.com/devBoolean/Project-Boolean

  2. #32
    Retired maritnmine is offline
    MemberRank
    May 2007 Join Date
    North KoreaLocation
    1,103Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by Squard View Post
    You know, not using Lock(); Just a password..

    And im not gonna sell anything. It's Free

    SVN: https://github.com/devBoolean/Project-Boolean
    Wtf? Password? Just do Console.WriteLine(string message);

    - Martin

  3. #33
    Novice MrWorldwide is offline
    MemberRank
    Dec 2011 Join Date
    4Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by maritnmine View Post
    Wtf? Password? Just do Console.WriteLine(string message);

    - Martin
    Hey man, in case of a collection, it's better to clone it or to use lock/timedlock?

  4. #34
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by maritnmine View Post
    Wtf? Password? Just do Console.WriteLine(string message);

    - Martin
    You dunno what im goign to make, let me explain.

    You start your console ui.
    If you wanna typ a command into the debugging line. You need to typ first a password before executing a command. I will make like 50 commands ingame and for the console ui.

    Code:
    while(Console.ReadLine().Length > 0) 
    { 
    if(AuthenticatedPassword) 
    { 
    ExcecuteCommand(Line); 
    } 
    else 
    { 
    CheckPassword(Line); 
    } 
    }

  5. #35
    swagggggg Livar is offline
    MemberRank
    Oct 2008 Join Date
    United KingdomLocation
    2,272Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by Squard View Post
    You dunno what im goign to make, let me explain.

    You start your console ui.
    If you wanna typ a command into the debugging line. You need to typ first a password before executing a command. I will make like 50 commands ingame and for the console ui.

    Code:
    while(Console.ReadLine().Length > 0) 
    { 
    if(AuthenticatedPassword) 
    { 
    ExcecuteCommand(Line); 
    } 
    else 
    { 
    CheckPassword(Line); 
    } 
    }
    Great idea!

  6. #36
    Retired maritnmine is offline
    MemberRank
    May 2007 Join Date
    North KoreaLocation
    1,103Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by MrWorldwide View Post
    Hey man, in case of a collection, it's better to clone it or to use lock/timedlock?
    Hellno! Avoiding that is how Bfly is able to hold that many users :)

    Quote Originally Posted by Squard View Post
    You dunno what im goign to make, let me explain.

    You start your console ui.
    If you wanna typ a command into the debugging line. You need to typ first a password before executing a command. I will make like 50 commands ingame and for the console ui.

    Code:
    while(Console.ReadLine().Length > 0) 
    { if(AuthenticatedPassword) { ExcecuteCommand(Line); } else { CheckPassword(Line); } }
    *Faceplant* Just do:
    while (true)
    {
    string inputCommand = Console.ReadLine();
    handleCommand(inputCommand);
    }
    Edit: In case of auth, just add an if statement for that in the handle command function :D

  7. #37
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by maritnmine View Post
    Hellno! Avoiding that is how Bfly is able to hold that many users :)



    *Faceplant* Just do:
    while (true)
    {
    string inputCommand = Console.ReadLine();
    handleCommand(inputCommand);
    }
    Edit: In case of auth, just add an if statement for that in the handle command function :D
    I will see how i am gonna create that ;)

    Authenticating coded: http://www.iaza.com/work/120109C/iaza14498197582200.jpg

    I've updated github: https://github.com/devBoolean/Project-Boolean

    You can see the new Packets i've done.

  8. #38
    Account Upgraded | Title Enabled! George2000 is offline
    MemberRank
    Jul 2011 Join Date
    The NetherlandsLocation
    1,150Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by Squard View Post
    I will see how i am gonna create that ;)

    Authenticating coded: http://www.iaza.com/work/120109C/iaza14498197582200.jpg

    I've updated github: https://github.com/devBoolean/Project-Boolean

    You can see the new Packets i've done.
    I thought you was coding new crypto, that are just old swfs @ http://www.iaza.com/work/120109C/iaza14498197582200.jpg

  9. #39
    Lurking since '06 1ntel is offline
    MemberRank
    Jul 2006 Join Date
    401Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by MrWorldwide View Post
    Hey man, in case of a collection, it's better to clone it or to use lock/timedlock?
    You don't want to clone. You can safely use locks in classes which are initialized PER USER and PER ROOM. However, never use locks on anything that is shared amongst every user, you will notice performance to decrease as more users become online, instead use a ReaderWriterLockSlim available in .NET 4 and set the reading to a read lock and writing to a write, this means when anything global is updated it will halt the users briefly from reading whilst it updates, and because updates happen every so many days it won't kill performance at all, ever.

    You could just search around and find my collection classes I made almost a year ago, copy them into your project like martinmine has done with his Butterfly Emulator (in which he cannot deny because I have his source code, and before he says, it isn't an old source it's the new one with his Wired and shit) and use it.

    I think the only thing martin has ever said that's made some sense is not to use locking when writing to the console although he still explained that badly. It will only mess with the performance where you are writing to the console, and only if you have logging on where it puts out everything that is going on, but locks are deffo not needed for the console.

    ------------------------------

    Anyway Wichard this project will fail, your socket code is completely wrong, just how it has been on every single Habbo project made in C#. It won't scale.

    You need to allocate the buffer space on startup for every client your expecting. You could try and implement SuperSocket, an extensible socket application framework (SuperSocket) it will make it easier for you or write your own, heres what you need:
    SocketAsyncEventArgs Class

  10. #40
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by matty13 View Post
    You don't want to clone. You can safely use locks in classes which are initialized PER USER and PER ROOM. However, never use locks on anything that is shared amongst every user, you will notice performance to decrease as more users become online, instead use a ReaderWriterLockSlim available in .NET 4 and set the reading to a read lock and writing to a write, this means when anything global is updated it will halt the users briefly from reading whilst it updates, and because updates happen every so many days it won't kill performance at all, ever.

    You could just search around and find my collection classes I made almost a year ago, copy them into your project like martinmine has done with his Butterfly Emulator (in which he cannot deny because I have his source code, and before he says, it isn't an old source it's the new one with his Wired and shit) and use it.

    I think the only thing martin has ever said that's made some sense is not to use locking when writing to the console although he still explained that badly. It will only mess with the performance where you are writing to the console, and only if you have logging on where it puts out everything that is going on, but locks are deffo not needed for the console.

    ------------------------------

    Anyway Wichard this project will fail, your socket code is completely wrong, just how it has been on every single Habbo project made in C#. It won't scale.

    You need to allocate the buffer space on startup for every client your expecting. You could try and implement SuperSocket, an extensible socket application framework (SuperSocket) it will make it easier for you or write your own, heres what you need:
    SocketAsyncEventArgs Class
    I did what you asked for :D

    Added some SuperSockets :D (Look github)

    Like this:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    using System.Net.Sockets;
    using System.Net;
    using System.Threading;
    
    using Boolean.Network.Transmission.SuperSocket;
    using Boolean.Network.Transmission;
    using Boolean.Enumerables;
    
    namespace Boolean
    {
        static class SessionHandler
        {
            public const int RECV_BUFFER_SIZE = 8192;
            public const int OPS_TO_PRE_ALLOC = 2;
    
            private static SocketAsyncEventArgsPool SocketPool;
            private static Socket BaseSocket;
            private static Semaphore SocketSemaphore;
            private static Dictionary<int, Session> Sessions;
    
            private static int ConnectedAmount;
            private static int Counter;
    
            public static Session GetSession(Socket Socket)
            {
                foreach (var kvp in Sessions)
                {
                    if (kvp.Value.Socket == Socket)
                    {
                        return kvp.Value;
                    }
                }
    
                return null;
            }
    
            public static SerializeResult Serialize()
            {
                try
                {
                    var MaxConnections = int.Parse(Settings.GetValue("TCP.Listener.Max"));
    
                    Counter = 0;
                    Sessions = new Dictionary<int, Session>();
                    SocketPool = new SocketAsyncEventArgsPool(MaxConnections);
                    ConnectedAmount = new int();
                    SocketSemaphore = new Semaphore(MaxConnections, MaxConnections);
    
                    for (int i = 0; i < MaxConnections; i++)
                    {
                        var Async = new SocketAsyncEventArgs();
                        Async.Completed += new EventHandler<SocketAsyncEventArgs>(Async_Completed);
                        Async.UserToken = new AsyncUserToken();
                        Async.SetBuffer((Async.UserToken as AsyncUserToken).Buffer, 0, (Async.UserToken as AsyncUserToken).Buffer.Length);
    
                        SocketPool.Push(Async);
                    }
    
                    var IPEndPoint = new IPEndPoint(IPAddress.Parse(Settings.GetValue("TCP.Listener.IP")), int.Parse(Settings.GetValue("TCP.Listener.Port")));
    
                    BaseSocket = new Socket(IPEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                    BaseSocket.Bind(IPEndPoint);
                    BaseSocket.Listen(int.Parse(Settings.GetValue("TCP.Listener.Backlog")));
    
                    WaitForAsync(null);
                }
                catch { return SerializeResult.Broken; }
    
                return SerializeResult.Finished;
            }
    
            static void WaitForAsync(SocketAsyncEventArgs Args)
            {
                if (Args == null)
                {
                    Args = new SocketAsyncEventArgs();
                    Args.Completed += new EventHandler<SocketAsyncEventArgs>(AcceptAsync_Completed);
                }
                else
                {
                    Args.AcceptSocket = null;
                }
    
                SocketSemaphore.WaitOne();
    
                if (!BaseSocket.AcceptAsync(Args))
                {
                    HandleAsync(Args);
                }
            }
    
            static void HandleAsync(SocketAsyncEventArgs Args)
            {
                try
                {
                    Interlocked.Increment(ref ConnectedAmount);
    
                    var SingleSocketAsync = SocketPool.Pop();
                    var Token = (AsyncUserToken)SingleSocketAsync.UserToken;
    
                    Token.Socket = Args.AcceptSocket;
    
                    var Session = new Session(Interlocked.Increment(ref Counter), Token.Socket, Args);
    
                    Sessions.Add(Session.Id, Session);
    
                    if (!Args.AcceptSocket.ReceiveAsync(SingleSocketAsync))
                    {
                        HandleReceive(SingleSocketAsync);
                    }
                }
                catch { }
                finally { WaitForAsync(Args); }
            }
    
            static void HandleReceive(SocketAsyncEventArgs Args)
            {
                try
                {
                    var Token = Args.UserToken as AsyncUserToken;
    
                    if (Args.BytesTransferred > 0 && Args.SocketError == SocketError.Success)
                    {
                        var Received = new byte[Args.BytesTransferred];
    
                        Array.Copy(Token.Buffer, Received, Args.BytesTransferred);
    
                        MessageHandler.HandleBytes(GetSession(Token.Socket), ref Received);
    
                        if (!Token.Socket.ReceiveAsync(Args))
                        {
                            HandleReceive(Args);
                        }
                    }
                    else
                    {
                        CloseClientSocket(Args);
                    }
                }
                catch { CloseClientSocket(Args); }
            }
    
            public static void HandleSend(SocketAsyncEventArgs Args)
            {
                if (Args.SocketError != SocketError.Success)
                {
                    CloseClientSocket(Args);
                }
            }
    
            public static void CloseClientSocket(SocketAsyncEventArgs Args)
            {
                var Token = Args.UserToken as AsyncUserToken;
    
                if (Token.Redused) return;
    
                Token.Redused = true;
    
                try
                {
                    Sessions.Remove(GetSession(Token.Socket).Id);
                }
                catch { }
    
                try
                {
                    Token.Socket.Shutdown(SocketShutdown.Both);
                }
                catch (Exception) { }
    
                Token.Socket.Close();
    
                Interlocked.Decrement(ref ConnectedAmount);
    
                SocketSemaphore.Release();
    
                SocketPool.Push(Args);
            }
    
            static void AcceptAsync_Completed(object sender, SocketAsyncEventArgs Args)
            {
                HandleAsync(Args);
            }
    
            static void Async_Completed(object sender, SocketAsyncEventArgs Args)
            {
                if (Args.LastOperation == SocketAsyncOperation.Receive)
                {
                    HandleReceive(Args);
                }
                else if (Args.LastOperation == SocketAsyncOperation.Send)
                {
                    HandleSend(Args);
                }
            }
        }
    }

  11. #41
    Retired maritnmine is offline
    MemberRank
    May 2007 Join Date
    North KoreaLocation
    1,103Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by matty13 View Post
    You don't want to clone. You can safely use locks in classes which are initialized PER USER and PER ROOM. However, never use locks on anything that is shared amongst every user, you will notice performance to decrease as more users become online, instead use a ReaderWriterLockSlim available in .NET 4 and set the reading to a read lock and writing to a write, this means when anything global is updated it will halt the users briefly from reading whilst it updates, and because updates happen every so many days it won't kill performance at all, ever.

    You could just search around and find my collection classes I made almost a year ago, copy them into your project like martinmine has done with his Butterfly Emulator (in which he cannot deny because I have his source code, and before he says, it isn't an old source it's the new one with his Wired and shit) and use it.

    I think the only thing martin has ever said that's made some sense is not to use locking when writing to the console although he still explained that badly. It will only mess with the performance where you are writing to the console, and only if you have logging on where it puts out everything that is going on, but locks are deffo not needed for the console.

    ------------------------------

    Anyway Wichard this project will fail, your socket code is completely wrong, just how it has been on every single Habbo project made in C#. It won't scale.

    You need to allocate the buffer space on startup for every client your expecting. You could try and implement SuperSocket, an extensible socket application framework (SuperSocket) it will make it easier for you or write your own, heres what you need:
    SocketAsyncEventArgs Class
    *SIGH, we meet again* I am not using any cloning in my server, nor any direct locks on the collections :) So yes, I do deny. I am not using any "slim lock" crap any more. We have gone away from that system many months ago ^^ And if you deny, feel free to do. Because Im not using any cloning or direct lock crap on any collection. And for fucks sake stop coming with those wild theories. That source you got is ~1.5 years old with n00bs that have put code for wired on it.

    - Martin

  12. #42
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    New SVN: https://github.com/devBoolean/Boolean

    If you need something to include in my emulator. Please say it.

  13. #43
    Account Upgraded | Title Enabled! George2000 is offline
    MemberRank
    Jul 2011 Join Date
    The NetherlandsLocation
    1,150Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by Squard View Post
    New SVN: https://github.com/devBoolean/Boolean

    If you need something to include in my emulator. Please say it.
    Newest swfs, this is another old-packet development..

  14. #44
    The one and only! Hejula is offline
    MemberRank
    Nov 2008 Join Date
    4,128Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by Squard View Post
    You're not funny.
    I want new SWF's too - without new SWF's this will be no better than any other emulator?

  15. #45
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: Project Boolean [C# - R63A - OS - Free]

    Quote Originally Posted by Hejula View Post
    I want new SWF's too - without new SWF's this will be no better than any other emulator?
    You dunno ever took a look at source?

    https://github.com/devBoolean/Boolean



Page 3 of 6 FirstFirst 123456 LastLast

Advertisement