Exemplo n.º 1
0
        private void Initialize()
        {
            // Load list
            ProfileList =
                new ObservableImmutableList <ClientProfileVm>(
                    ClientProfile.GetAllProfiles().Select(x => new ClientProfileVm(x)));

            if (MainWindowVm.Instance.SelectedWorkingProfile != null)
            {
                SelectedProfile = MainWindowVm.Instance.SelectedWorkingProfile;
            }
            else if (ProfileList == null || ProfileList.Count == 0)
            {
                SelectedProfile = new ClientProfileVm()
                {
                    Name             = "Default Profile",
                    IndexKey         = new byte[] { 0xB9, 0x9E, 0xB0, 0x02, 0x6F, 0x69, 0x81, 0x05, 0x63, 0x98, 0x9B, 0x28, 0x79, 0x18, 0x1A, 0x00 },
                    PackKey          = new byte[] { 0x22, 0xB8, 0xB4, 0x04, 0x64, 0xB2, 0x6E, 0x1F, 0xAE, 0xEA, 0x18, 0x00, 0xA6, 0xF6, 0xFB, 0x1C },
                    PackExtension    = ".epk",
                    IndexExtension   = ".eix",
                    WorkingDirectory = "WORKING_DIR",
                    UnpackDirectory  = "UNPACK_DIR"
                };

                ProfileList.Add(SelectedProfile);
            }
            else
            {
                SelectedProfile = ProfileList.FirstOrDefault(x => x.IsDefault) ?? ProfileList.First();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when the profile list is updated from the profile list
        /// </summary>
        public void UpdateProfileListFromProfilesWindow(ObservableImmutableList <ClientProfileVm> list)
        {
            string oldProfileName = "";

            if (SelectedWorkingProfile != null)
            {
                oldProfileName = SelectedWorkingProfile.Name;
            }
            ProfileList = list;

            if (!String.IsNullOrWhiteSpace(oldProfileName))
            {
                SelectedWorkingProfile = ProfileList.FirstOrDefault(x => x.Name == oldProfileName);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Internal initializer
        /// </summary>
        private void Initialize()
        {
            if (Settings.Default.UpgradeRequired)
            {
                Settings.Default.Upgrade();
                Settings.Default.UpgradeRequired = false;
                Settings.Default.Save();
            }

            Instance = this;
            Assembly        assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);

            CurrentAppVersion = String.Format("Version: {0} GunnerMBT ©", fvi.FileVersion);

            CanChangeProfile = true;

            // Default settings
            var value = Properties.Settings.Default.MaxSimFiles;

            ConstantsBase.MaxSimFiles = (value <= 0) ? 3 : value;

            // Get profile list
            var profileModelList = ClientProfile.GetAllProfiles();

            // Update view
            ProfileList =
                new ObservableImmutableList <ClientProfileVm>(
                    profileModelList.Select(x => new ClientProfileVm(x)));

            // Load default profile
            var profileName = Properties.Settings.Default.DefaultProfile;

            if (!String.IsNullOrWhiteSpace(profileName))
            {
                //SelectedWorkingProfile = new ClientProfileVm(ClientProfile.GetProfileByPredicate(p => String.Equals(p.Name, profileName, StringComparison.CurrentCultureIgnoreCase)));
                SelectedWorkingProfile = ProfileList.FirstOrDefault(x => x.Name == profileName);

                // To make sure every other class is udpated
                if (SelectedWorkingProfile != null)
                {
                    Handle(SelectedWorkingProfile);
                }
            }

            // Set update menu string to default value
            UpdateMenuString = "Check for updates";
        }