示例#1
0
        public bool WriteOffset(string address, string value)
        {
            bool           result = false;
            IPCValueOffset offset = null;

            try
            {
                if (!currentValues.ContainsKey(address))
                {
                    offset = new IPCValueOffset(address, AppSettings.groupStringWrite, OffsetAction.Write);
                    offset.Write(value, AppSettings.groupStringWrite);
                    offset.Dispose();
                    offset = null;
                    result = true;
                }
                else
                {
                    (currentValues[address] as IPCValueOffset).Write(value, AppSettings.groupStringWrite);
                }
            }
            catch
            {
                Log.Logger.Error($"IPCManager: Exception while writing Offset <{address}> (size:{offset?.Size}/float:{offset?.IsFloat}/string:{offset?.IsString}/signed:{offset?.IsSigned}) to FSUIPC");
                if (offset != null)
                {
                    offset.Dispose();
                    offset = null;
                }
            }

            return(result);
        }
示例#2
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}");
        }
示例#3
0
        public IPCValue RegisterAddress(string address, string group, bool persistent = false)
        {
            IPCValue value = null;

            try
            {
                if (!IPCTools.IsReadAddress(address))
                {
                    Log.Logger.Error($"RegisterValue: Not an Read-Address! [{address}]");
                    return(value);
                }

                if (currentValues.ContainsKey(address))
                {
                    value = currentValues[address];
                    currentRegistrations[address]++;
                    Log.Logger.Debug($"RegisterValue: Added Registration for Address {address}, Registrations: {currentRegistrations[address]}");
                }
                else
                {
                    if (IPCTools.rxOffset.IsMatch(address))
                    {
                        value = new IPCValueOffset(address, group);
                    }
                    else
                    {
                        value = new IPCValueLvar(address);
                    }

                    currentValues.Add(address, value);
                    currentRegistrations.Add(address, 1);
                    if (persistent)
                    {
                        persistentValues.Add(address);
                    }

                    Log.Logger.Debug($"RegisterValue: Added Address {address}, Persistent: {persistent}");
                }
            }
            catch
            {
                Log.Logger.Error($"RegisterValue: Exception while registering Address {address}");
            }

            if (value == null)
            {
                Log.Logger.Error($"RegisterValue: Null Reference for Address {address}");
            }

            return(value);
        }
示例#4
0
        public IPCManager(string group)
        {
            inMenuValue = RegisterAddress(inMenuAddr, group, true) as IPCValueOffset;

            isPausedValue = RegisterAddress(isPausedAddr, group, true) as IPCValueOffset;
        }