static void Main(string[] args) { SecondLife client; if (args.Length == 0 || (args.Length < 3 && args[0] != "--printmap")) { Console.WriteLine("Usage: sldump [--printmap] [--decrypt] [inputfile] [outputfile] [--protocol] [firstname] " + "[lastname] [password]"); return; } if (args[0] == "--decrypt") { try { ProtocolManager.DecodeMapFile(args[1], args[2]); } catch (Exception e) { Console.WriteLine(e.ToString()); } return; } client = new SecondLife(); if (args[0] == "--printmap") { ProtocolManager protocol; try { protocol = new ProtocolManager("message_template.msg", client); } catch (Exception e) { // Error initializing the client, probably missing file(s) Console.WriteLine(e.ToString()); return; } protocol.PrintMap(); return; } // Setup the packet callback and disconnect event handler client.Network.RegisterCallback(PacketType.Default, new PacketCallback(DefaultHandler)); client.Network.OnDisconnected += new DisconnectCallback(DisconnectHandler); Dictionary <string, object> loginParams = NetworkManager.DefaultLoginValues(args[0], args[1], args[2], "0", "last", "Win", "0", "sldump", "*****@*****.**"); // An example of how to pass additional options to the login server //loginParams["id0"] = "65e142a8d3c1ee6632259f111cb168c9"; //loginParams["viewer_digest"] = "0e63550f-0991-a092-3158-b4206e728ffa"; if (!client.Network.Login(loginParams /*, "http://127.0.0.1:8080/"*/)) { // Login failed Console.WriteLine("Error logging in: " + client.Network.LoginError); return; } // Login was successful Console.WriteLine("Message of the day: " + client.Network.LoginValues["message"]); while (true) { client.Tick(); } }
static void Main(string[] args) { SecondLife client; if (args.Length == 0 || (args.Length < 4 && args[0] != "--printmap")) { Console.WriteLine("Usage: sldump [--printmap] [--decrypt] [inputfile] [outputfile] " + "[--protocol] [firstname] [lastname] [password] [seconds (0 for infinite)]"); return; } if (args[0] == "--decrypt") { try { ProtocolManager.DecodeMapFile(args[1], args[2]); } catch (Exception e) { Console.WriteLine(e.ToString()); } return; } client = new SecondLife(); // Turn off some unnecessary things client.Settings.DEBUG = false; client.Settings.MULTIPLE_SIMS = false; // Throttle packets that we don't want all the way down client.Throttle.Land = 0; client.Throttle.Wind = 0; client.Throttle.Cloud = 0; if (args[0] == "--printmap") { ProtocolManager protocol; try { protocol = new ProtocolManager("message_template.msg", client); } catch (Exception e) { // Error initializing the client, probably missing file(s) Console.WriteLine(e.ToString()); return; } protocol.PrintMap(); return; } // Setup the packet callback and disconnect event handler client.Network.RegisterCallback(PacketType.Default, new NetworkManager.PacketCallback(DefaultHandler)); client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(DisconnectHandler); client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin); client.Network.BeginLogin(client.Network.DefaultLoginParams(args[0], args[1], args[2], "sldump", "*****@*****.**")); LoginEvent.WaitOne(); if (!LoginSuccess) { Console.WriteLine("Login failed: {0}", client.Network.LoginMessage); return; } Console.WriteLine("Message of the day: " + client.Network.LoginMessage); int start = Environment.TickCount; int milliseconds = Int32.Parse(args[3]) * 1000; bool forever = (milliseconds > 0) ? false : true; while (true) { System.Threading.Thread.Sleep(100); if (!forever && Environment.TickCount - start > milliseconds) { break; } } client.Network.Logout(); }