Exemplo n.º 1
0
        public bool StartNewConnection(string userName, string password, string address, int port)
        {
            // Reset the connection if it is already open
            ResetConnection();
            hubConfig = null;

            // We can't connect if these have not been set
            if (String.IsNullOrEmpty(userName) || String.IsNullOrEmpty(password) || String.IsNullOrEmpty(address) || port == 0)
                return false;

            // Get an auth token if we dont have one
            var harmonyAuthToken = GetUserAuthToken(userName, password);
            if (harmonyAuthToken == null)
                return false;

            OpenConnection(address, port);

            // Start pinging the harmony to keep the connection alive
            if (_pingThread == null)
            {
                _pingThread = new Thread(new ThreadStart(PingHarmony));
                _pingThread.Name = "Ping_Harmony";
                _pingThread.Start();
            }

            // Get the config info
            GetConfig();

            return true;
        }
Exemplo n.º 2
0
 protected void Application_Start()
 {
   AreaRegistration.RegisterAllAreas();
   WebApiConfig.Register(GlobalConfiguration.Configuration);
   FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
   HubConfig.RegisterHubs(RouteTable.Routes);
   RouteConfig.RegisterRoutes(RouteTable.Routes);
   BundleConfig.RegisterBundles(BundleTable.Bundles);
   AuthConfig.RegisterAuth();
   ApplicationComponents.Register();      
 }
Exemplo n.º 3
0
        public static void ReloadConfig(CommandArgs args)
        {
            TSPlayer tSPlayer = args.Player;

            HubConfig.config = HubConfig.Read(HubConfig.configPath);
            if (!File.Exists(HubConfig.configPath))
            {
                HubConfig.config.Write(HubConfig.configPath);
            }

            ClassConfig.config = ClassConfig.Read(ClassConfig.configPath);
            if (!File.Exists(ClassConfig.configPath))
            {
                ClassConfig.config.Write(ClassConfig.configPath);
            }

            tSPlayer.SendSuccessMessage("The config was successfully reloaded.");
        }
Exemplo n.º 4
0
    private void AutoAddHubTypes(IServiceCollection services)
    {
        var hubTypes = new List <Type>();

        services.OnRegistred(context =>
        {
            if (IsHubClass(context) && !IsDisabledForAutoMap(context))
            {
                hubTypes.Add(context.ImplementationType);
            }
        });

        services.Configure <AbpSignalROptions>(options =>
        {
            foreach (var hubType in hubTypes)
            {
                options.Hubs.Add(HubConfig.Create(hubType));
            }
        });
    }
Exemplo n.º 5
0
        public override void Initialize()
        {
            AddCommands();

            AddHooks();

            SetSSCDefaults();

            // Config
            HubConfig.config = HubConfig.Read(HubConfig.configPath);
            if (!File.Exists(HubConfig.configPath))
            {
                HubConfig.config.Write(HubConfig.configPath);
            }

            ClassConfig.config = ClassConfig.Read(ClassConfig.configPath);
            if (!File.Exists(ClassConfig.configPath))
            {
                ClassConfig.config.Write(ClassConfig.configPath);
            }
        }
 public BlazorHubConnectionManager(HttpClient httpClient, NotificationManager notificationManager, HubConfig hubConfig)
 {
     _httpClient          = httpClient;
     _notificationManager = notificationManager;
     _baseUrl             = hubConfig.Url;
 }
Exemplo n.º 7
0
 public LKHub(HubConfig config)
 {
     Config = config;
 }
Exemplo n.º 8
0
        public void GetConfig()
        {
            var iqCmd = $"<iq type='get' from='1' to='guest' id='j64Harmony_4'><oa xmlns='connect.logitech.com' mime='vnd.logitech.harmony/vnd.logitech.harmony.engine?config'/></iq>";
            var response = SendReceiveSocketData(iqCmd, 2);

            // Turn the config into a strongly typed document
            string config = response.DocumentElement.FirstChild?.NextSibling?.InnerText;
            if (config == null)
            {
                config = File.ReadAllText("myHubConfig.json");
                if (config == null)
                    throw new Exception("Could not get config from the harmony hub.  Consider power cycling the hub.");
            }

            hubConfig = JsonConvert.DeserializeObject<HubConfig>(config);

            // Save the config to a file for debugging purposes
            File.WriteAllText("myHubConfig.json", JsonConvert.SerializeObject(hubConfig, Formatting.Indented));
        }