예제 #1
0
        public SkyrimSettings(SkyrimComponent component, LiveSplitState state)
        {
            InitializeComponent();

            _component        = component;
            _state            = state;
            _uiThread         = SynchronizationContext.Current;
            PRESETS_FILE_PATH = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + PRESETS_FILE_NAME;

            // defaults
            AutoStart         = DEFAULT_AUTOSTART;
            AutoReset         = DEFAULT_AUTORESET;
            AutoUpdatePresets = DEFAULT_AUTOUPDATEPRESETS;

            CustomAutosplits = new AutoSplitList(DEFAULT_PRESET_NAME);
            AutoSplitList    = new AutoSplitList();
            Presets          = new BindingList <AutoSplitList>()
            {
                CustomAutosplits
            };

            var addr = new SkyrimData();

            _hiddenAddresses = new HashSet <string>()
            {
                addr.IsQuickSaving.Name,
                addr.Location.Name,
                addr.WorldID.Name,
                addr.CellX.Name,
                addr.CellY.Name
            };
            _autoSplitEnv = new AutoSplitEnv()
            {
                Addresses           = addr.Where(w => !_hiddenAddresses.Contains(w.Name)),
                Events              = GameEvent.GetValues(typeof(SkyrimEvent)),
                Presets             = Presets.Except(new AutoSplitList[] { CustomAutosplits }),
                DefaultVariableType = typeof(AutoSplitData.Variables.LoadScreen)
            };

            if (File.Exists(PRESETS_FILE_PATH))
            {
                LoadPresets();
            }

            Preset = DEFAULT_PRESET_NAME;

            BearCartPBNotification    = DEFAULT_BEARCARTPBNOTIFICATION;
            PlayBearCartSound         = DEFAULT_PLAYBEARCARTSOUND;
            BearCartSoundPath         = string.Empty;
            IsBearCartSecret          = true;
            PlayBearCartSoundOnlyOnPB = DEFAULT_PLAYBEARCARTSOUNDONLYONPB;
            LoadBearCartConfig();

            InitializeFormLogic();
            InitializeToolTab();
        }
예제 #2
0
        private void RunListenerThread()
        {
            Listener.Start();
            //ConnectedHosts = GetNetworkInfo().ToList();

            while (true)
            {
                Socket client = Listener.AcceptSocket();
                //var childSocketThread = new Thread(() =>
                //{
                String request = "";

                byte[] data = new byte[102400];
                int    size = 0;

                do
                {
                    size     = client.Receive(data);
                    request += Encoding.ASCII.GetString(data, 0, size);
                } while (client.Available > 0);

                //onReceiveCommand(request);
                List <Host> updatedNetworkInfo = new List <Host>();
                //ConnectedHosts.Clear();

                var xml = XDocument.Parse(request.Trim());
                var tmp = xml.Descendants("host");

                foreach (var node in tmp)
                {
                    updatedNetworkInfo.Add(new Host()
                    {
                        IP  = node.Descendants("ip").FirstOrDefault().Value,
                        MAC = node.Descendants("mac").FirstOrDefault().Value
                    });
                }

                var newlyConnectedHosts    = updatedNetworkInfo.Except(ConnectedHosts, new HostComparer()).ToList();
                var newlyDisconnectedHosts = ConnectedHosts.Except(updatedNetworkInfo, new HostComparer()).ToList();
                //var query = newlyConnectedHosts.Except(newlyDisconnectedHosts).Union(newlyDisconnectedHosts.Except(newlyConnectedHosts)).ToList();

                ConnectedHosts.Clear();
                foreach (Host host in updatedNetworkInfo)
                {
                    ConnectedHosts.Add(host);
                }

                onReceiveCommand(newlyConnectedHosts, newlyDisconnectedHosts);

                client.Close();
                //});
                //childSocketThread.Start();
            }
        }
예제 #3
0
        /// <summary>
        /// Sets all <see cref="CapabilityModel.Use"/> values within a list/model to a specific value.
        /// </summary>
        /// <typeparam name="T">The specific kind of <see cref="DesktopIntegration.AccessPoints.DefaultAccessPoint"/> to handle.</typeparam>
        /// <param name="model">A model represeting the underlying <see cref="Store.Model.Capabilities.DefaultCapability"/>s and their selection states.</param>
        /// <param name="value">The value to set.</param>
        public static void SetAllUse <T>([NotNull, ItemNotNull] this BindingList <T> model, bool value)
            where T : CapabilityModel
        {
            #region Sanity checks
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            #endregion

            foreach (var element in model.Except(element => element.Capability.ExplicitOnly))
            {
                element.Use = value;
            }
            model.ResetBindings();
        }
예제 #4
0
        private async Task LoadUsers()
        {
            try
            {
                var recs = await Source.GetAllSessionAsync().ConfigureAwait(true);

                IEnumerable <Session> newUsers = recs.Except(users);
                IEnumerable <Session> oldUsers = users.Except(recs);
                foreach (var oldUser in oldUsers)
                {
                    users.Remove(oldUser);
                }
                foreach (var newUser in newUsers)
                {
                    users.Add(newUser);
                }
            }
            catch (Exception)
            {
                //users.Clear();
            }
        }
예제 #5
0
 public BindingList <Patron> compareMonths(BindingList <Patron> month1, BindingList <Patron> month2)
 {
     return(new BindingList <Patron>(month1.Except(month2).Union(month2.Except(month1)).OrderBy(x => x.PatreonName).ToList()));
 }