예제 #1
0
 public TVpObject Get(TAvatar avatar, TVpObject vpObject)
 {
     if (File.Exists(GetPath(avatar, vpObject)))
     {
         return(SerializableExtensions.Deserialize <TVpObject>(GetPath(avatar, vpObject)));
     }
     return(null);
 }
예제 #2
0
        private async Task Connect()
        {
            Cli.WriteLine(ConsoleMessageType.Information, "Connecting...");
            try
            {
                await Vp.Connect();

                Cli.WriteLine(ConsoleMessageType.Information, "Connected to universe.\n");
                if (File.Exists(AutoLogin.LoginconfigurationXmlPath))
                {
                    Cli.WriteLine(ConsoleMessageType.Information, "Autologin configuration enabled, attempting auto logon.");
                    var config = SerializableExtensions.Deserialize <InstanceConfiguration <World> >(AutoLogin.LoginconfigurationXmlPath);
                    try
                    {
                        await Vp.Login(config.UserName, config.Password, config.BotName);

                        await Vp.Enter(config.World.Name);

                        _world = config.World.Name;
                        Vp.UpdateAvatar();
                        ProceedAfterLogin(true);
                    }
                    catch (VpException ex)
                    {
                        if (ex.Reason == ReasonCode.NotInUniverse)
                        {
                            // strange native vpsdk bug, after reating a new native instance, upon first time
                            // the sdk does not seem to connect properly.
                            await Connect();
                        }
                        Cli.WriteLine(ConsoleMessageType.Information,
                                      "Autologin failed. Reason" + ex.Reason.ToString() + " " + ex.Message);
                        AutoReconnect();
                    }
                }
                else
                {
                    Cli.GetPromptTarget  = LoginPrompt;
                    Cli.ParseCommandLine = ProcessUserName;
                    Cli.ReadLine();
                }
            }
            catch (VpException ex)
            {
                AutoReconnect();
            }
        }
 public List <PluginDescription> LoadConfiguration(string path)
 {
     return(SerializableExtensions.Deserialize <List <PluginDescription> >(path));
 }