public static List <TheKeyValue> ReadPlayerSectionList() { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); PlayerSection configSection = (PlayerSection)config.GetSection("PlayerSection"); return(configSection.KeyValues.Cast <TheKeyValue>().ToList()); }
public List <MenuItem> GetRecentSkinMenu() { var menu = new List <MenuItem>(); var actionPrefix = "playerskin"; if (Config.ContainsKey("RecentSkins")) { List <int> recentSkins = PlayerSection.ParseRecentSkins(Config["RecentSkins"]); foreach (var modelHash in recentSkins) { PedModelListItem info = PedModelList.GetItemByHash(modelHash); if (info != null) { menu.Add(new MenuItem() { text = info.Name, key = info.ModelHash.ToString(), action = $"{actionPrefix} {info.Model}", }); } } } if (menu.Count == 0) { menu.Add(new MenuItem() { text = "No recent skins yet!", }); } return(menu); }
public newgame() { InitializeComponent(); var GameList = new Dictionary <string, int>(); foreach (Game asd in Settings.Games) { GameList.Add(asd.Name, asd.GameId); } GamePicker.Items = GameList.Keys.ToList(); foreach (Player pls in Settings.Players) { if (pls.PlayerId == 0) { pls.Active = false; } else { var sc = new SwitchCell() { BindingContext = pls, On = pls.Active, Text = pls.Name }; PlayerCells.Add(sc, pls); sc.OnChanged += PlayerToggled; PlayerSection.Add(sc); } } }
public static TheKeyValue ReadPlayerSection(string key) { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); PlayerSection configSection = (PlayerSection)config.GetSection("PlayerSection"); var value = (from kv in configSection.KeyValues.Cast <TheKeyValue>() where kv.Key == key select kv).FirstOrDefault(); return(value); }
public SaveFile(Stream s) { MainHeader = s.ReadStruct <SaveGameMainHeader>(); while (s.Position < s.Length) { long sectionStart = s.Position; Section section = new Section(s); if (section.Size == 0 && section.Version == 0) { break; } Console.WriteLine("Got {0} ({4:X2}) at {3:X4}. Version {1:X2}, {2:X4} bytes.", section.SectionId, section.Version, section.Size, sectionStart, (uint)section.SectionId); Sections.Add(section.SectionId, section); } Player = new PlayerSection(Sections[SectionId.GSSI_PLAYER]); }
public SaveFile(Stream s) { MainHeader = s.ReadStruct <SaveGameMainHeader>(); if (MainHeader.Signature != 0x050c0914) { throw new Exception(String.Format("Got invalid signature. Expected 0x050c0914, got 0x0{0:x8}", MainHeader.Signature)); } while (s.Position < s.Length) { long sectionStart = s.Position; Section section = new Section(s); if (section.Size == 0 && section.Version == 0) { break; } Console.WriteLine("Got {0} ({4:X2}) at {3:X4}. Version {1:X2}, {2:X4} bytes.", section.SectionId, section.Version, section.Size, sectionStart, (uint)section.SectionId); Sections.Add(section.SectionId, section); } Player = new PlayerSection(Sections[GamesaveSectionIds.GSSI_PLAYER]); }