예제 #1
0
        public void Init()
        {
            if (currentActions != null && ipcManager != null && imgManager != null && manifestProfiles != null)
            {
                loadedFSProfile = ipcManager.RegisterAddress("9540:64:s", AppSettings.groupStringRead, true) as IPCValueOffset;
                loadedAircraft  = ipcManager.RegisterAddress("3500:24:s", AppSettings.groupStringRead, true) as IPCValueOffset;
                Log.Logger.Information($"ActionController successfully initialized. Poll-Time {AppSettings.pollInterval}ms / Wait-Ticks {waitTicks} / Redraw Always {redrawAlways}");
            }

            dynamic manifest = JObject.Parse(File.ReadAllText(@"manifest.json"));

            if (manifest?.Profiles != null)
            {
                foreach (var profile in manifest.Profiles)
                {
                    string name = profile?.Name;
                    if (!string.IsNullOrEmpty(name) && profile?.DeviceType != null)
                    {
                        manifestProfiles.Add(new StreamDeckProfile(name, (int)profile.DeviceType, ""));
                    }
                }
            }
            Log.Logger.Information($"Loaded {manifestProfiles.Count} StreamDeck Profiles from Manifest.");

            AppSettings.SetLocale();
            Log.Logger.Information($"Locale is set to \"{AppSettings.locale}\" - FontStyles: {AppSettings.fontDefault} / {AppSettings.fontBold} / {AppSettings.fontItalic}");
        }
예제 #2
0
        public bool RegisterValue(string id, string address)
        {
            IPCValue value = ipcManager.RegisterAddress(address, AppSettings.groupStringRead);

            if (value != null)
            {
                if (!managedValues.ContainsKey(id))
                {
                    managedValues.Add(id, new ValuePair(address, value));
                    return(true);
                }
                else
                {
                    Log.Logger.Error($"RegisterValue: Variable {id} already exists!");
                }
            }
            else
            {
                Log.Logger.Error($"RegisterValue: Could not Register Address {address} for Variable {id}!");
            }

            return(false);
        }