public CalculatedGameSettings(Game game) { _game = game; _supportsModding = _game.SupportsMods(); _supportsMissions = _game.SupportsMissions(); _supportsServers = _game.SupportsServers(); if (_supportsModding) _modding = _game.Modding(); Signatures = new string[0]; if (!Execute.InDesignMode) { var collectionChanged = this.WhenAnyValue(x => x.Collection) .Skip(1); collectionChanged .Subscribe(HandleModSetSwitch); // TODO: Ignore out of band responses, cancel previous etc... collectionChanged .ObserveOn(ThreadPoolScheduler.Instance) .Subscribe(x => UpdateSignatures()); this.WhenAnyValue(x => x.Server) .Skip(1) .Subscribe(HandleServerSwitch); this.WhenAnyValue(x => x.Server.Mods) .Skip(1) .Subscribe(HandleServerModsChanged); this.WhenAnyValue(x => x.Mission) .Skip(1) .Subscribe(HandleMissionSwitch); } _first = true; }
protected static void ProcessSynqMods(ISupportModding modding, IContentManager modList, params GameController[] controllers) { foreach (var mod in modList.Mods.Where(x => !(x is LocalMod) && !(x is CustomRepoMod)).ToArrayLocked()) { ProcessSynqMod(controllers, mod); } }
public bool CompatibleWith(ISupportModding game) { if (game == null) { throw new ArgumentNullException(nameof(game)); } return(GameMatch(game) && BuildMatch(game)); }
public Collection(Guid id, ISupportModding game) : this(id) { if (game == null) { throw new ArgumentNullException(nameof(game)); } Game = game; GameId = ((Game)game).Id; }
public void ChangeGame(Game game) { if (game == null) { throw new ArgumentNullException(nameof(game)); } Game = game.Modding(); GameId = game.Id; }
protected GameController(ISupportContent game) { if (game == null) { throw new ArgumentNullException(nameof(game)); } Game = game; _modding = game as ISupportModding; }
public void LoadSettings(ISupportModding game) { if (Name.Equals("@ace", StringComparison.InvariantCultureIgnoreCase)) { var aceUserconfig = new AceUserconfig(game); aceUserconfig.ReadAceClientSideConfig(); UserConfig = aceUserconfig; } }
public bool GameMatch(ISupportModding game) { if (game == null) { throw new ArgumentNullException(nameof(game)); } return(this is LocalMod || game.SupportsContent(this)); }
public ModAndSynqPathsChangedEvent(ISupportModding game, ContentPaths oldPaths, ContentPaths newPaths) { if (game == null) { throw new ArgumentNullException(nameof(game)); } Game = game; OldPaths = oldPaths; NewPaths = newPaths; }
static LocalMod CreateLocalMod(string name, IAbsoluteDirectoryPath localModPath, ISupportModding game) { Contract.Requires<ArgumentNullException>(name != null); Contract.Requires<ArgumentNullException>(game != null); var localMod = new LocalMod(System.Guid.Empty) { Name = name, CustomPath = localModPath }; localMod.Controller.UpdateState(game); return localMod; }
void UpdateItems(ISupportModding game) { var repoMods = Mods .Where(x => x.GameMatch(game)) .ToArray(); repoMods.ForEach(x => x.Controller.UpdateState(game)); repoMods.SyncCollection(Items); CollectionItems = Collections.Where(x => !x.IsHidden && x.GameMatch(game)).ToArray(); }
public static LocalMod FromLocalModInfo(LocalModInfo info, ISupportModding game) { if (info == null) { throw new ArgumentNullException(nameof(info)); } if (game == null) { throw new ArgumentNullException(nameof(game)); } return(CreateLocalMod(info.Name, info.Path, game)); }
public void UpdateSynqState(ISupportModding game, PackageItem package) { Contract.Requires<ArgumentNullException>(package != null); _package = package; SetSharedState(game); _isValidSixSync = false; _isValidSixSyncPack = false; _sixSyncRepoExists = false; _sixSyncVersionInfo = null; _package.UpdateCurrentVersion(); Revision = GetSynqRevision(); DesiredRevision = GetSynqDesiredRevision(); LatestRevision = GetSynqLatestRevision(); State = !ModMatchesActiveGame(game) ? ContentState.Incompatible : GetSynqModState(); //Cheat.PublishDomainEvent(new ModInfoChangedEvent(new ModInfo(_mod))); }
// TODO: THIS NEEDS OPTIMIZATION. WE DONT WANT TO READ FROM DISK HERE, and deifnitely dont want to download!! // Low prio because missions are really not used that much atm... public IEnumerable <Mod> GetMods(ISupportModding modding, IContentManager manager) { var controller = Controller; var package = controller.GetPackageIfAvailable2(); if (package == null) { return(Enumerable.Empty <Mod>()); } var mods = package.Dependencies.Keys; return(mods.Any() ? manager.GetMods(modding, mods) : Enumerable.Empty <Mod>()); }
public AceUserconfig(ISupportModding game) { var profiles = game as ISupportProfiles; if (profiles != null) { Identities = profiles.GetProfiles().ToArray(); } _game = game; _acedefines = new Dictionary <string, List <object> > { // List<object> = value, line number, internal private variable name as string to get and set it via reflection { "ACE_IDENTITY", new List <object> { "", -1, "Identity" } }, { "ACE_CUSTOMFACE", new List <object> { "", -1, "CustomFace" } }, { "ACE_COMPASS", new List <object> { false, -1, "NewCompass" } }, { "ACE_RETICLES", new List <object> { false, -1, "Reticles" } }, { "ACE_NOVOICE", new List <object> { false, -1, "NoVoice" } }, { "ACE_NOCROSS", new List <object> { false, -1, "NoCross" } }, { "ACE_MINIMALHUD", new List <object> { false, -1, "MinimalHud" } }, { "ACE_DISABLE_RUCKLESS", new List <object> { false, -1, "DisableRuckless" } }, { "ACE_BALLTRACERS", new List <object> { false, -1, "BallTracers" } }, { "ACE_GRENADETHROW", new List <object> { false, -1, "GrenadeThrow" } }, { "ACE_NODIARYSTATISTICS", new List <object> { false, -1, "NoDiaryStats" } } }; }
public void UpdateSixSyncState(ISupportModding game) { SetSharedState(game); SetSixSyncPaths(); _sixSyncRepoExists = DoesRepoExist(); _isValidSixSync = IsValidSixSync(); _isValidSixSyncPack = IsPackValidSixSync(); _sixSyncVersionInfo = _isValidSixSync ? TryReadRepoFile(_repoYamlFile) : null; try { DesiredRevision = _mod.Version; LatestRevision = _mod.Version; Guid = GetSixSyncGuid(); Revision = GetSixSyncRevision(false); State = !ModMatchesActiveGame(game) ? ContentState.Incompatible : GetSixSyncModState(); } finally { _sixSyncVersionInfo = null; } }
public ModLibrarySetup(ModLibraryViewModel library, Game game, IContentManager contentList, UserSettings settings, IEventAggregator eventBus) { if (!(game.SupportsMods())) { throw new ArgumentException("game.SupportsMods()"); } _library = library; _game = game; _modding = game.Modding(); _settings = settings; _eventBus = eventBus; _contentList = contentList; OnlineGroup = new ModLibraryGroupViewModel(library, "Repositories", "add repo", SixIconFont.withSIX_icon_Cloud) { IsRoot = true, SortOrder = 13 }; LocalGroup = new ModLibraryGroupViewModel(library, "Local", "add folder", SixIconFont.withSIX_icon_System) { IsRoot = true, SortOrder = 12 }; CollectionsGroup = new ModLibraryGroupViewModel(library, "Collections", "new collection", SixIconFont.withSIX_icon_Folder) { IsRoot = true, SortOrder = 11 }; BuiltInGroup = new ModLibraryGroupViewModel(library, null) { IsRoot = true, SortOrder = 0 }; Groups = new LibraryGroupViewModel <ModLibraryViewModel>[] { null, BuiltInGroup, CollectionsGroup, LocalGroup, OnlineGroup }; _aIa = new BrowseContentLibraryItemViewModel <BuiltInContentContainer>(library, new BuiltInContentContainer("AllInArma"), @group: LocalGroup, isFeatured: true); SetupItems(); Items.AddRange(Groups.Where(x => x != null && x != BuiltInGroup)); CreateItemsView(); _eventBus.Subscribe(this); }
public void UpdateSixSyncState(ISupportModding game) { SetSharedState(game); SetSixSyncPaths(); _sixSyncRepoExists = DoesRepoExist(); _isValidSixSync = IsValidSixSync(); _isValidSixSyncPack = IsPackValidSixSync(); _sixSyncVersionInfo = _isValidSixSync ? TryReadRepoFile(_repoYamlFile) : null; try { DesiredRevision = _mod.Version; LatestRevision = _mod.Version; Guid = GetSixSyncGuid(); Revision = GetSixSyncRevision(false); State = !ModMatchesActiveGame(game) ? ContentState.Incompatible : GetSixSyncModState(); } finally { _sixSyncVersionInfo = null; } }
public static LocalMod FromStringIfValid(string modPath, ISupportModding game) { Contract.Requires<ArgumentNullException>(!string.IsNullOrWhiteSpace(modPath)); Contract.Requires<ArgumentNullException>(game != null); if (modPath.IsValidAbsoluteFilePath()) { var filePath = modPath.ToAbsoluteFilePath(); return CreateLocalMod(filePath.FileName, filePath.ParentDirectoryPath, game); } if (modPath.IsValidAbsoluteDirectoryPath()) { var dirPath = modPath.ToAbsoluteDirectoryPath(); return CreateLocalMod(dirPath.DirectoryName, dirPath.ParentDirectoryPath, game); } if (!FileNameValidator.IsValidName(modPath)) return null; // TODO: Horrible non-determinism; is it a file, is it a folder, is it located in the game or mod dir? var modPaths = game.ModPaths; if (modPaths.IsValid) { try { if (modPaths.Path.GetChildDirectoryWithName(modPath).Exists) return CreateLocalMod(modPath, modPaths.Path, game); } catch (Exception) {} try { if (modPaths.Path.GetChildFileWithName(modPath).Exists) return CreateLocalMod(modPath, modPaths.Path, game); } catch (Exception) {} } var installedState = game.InstalledState; if (installedState.IsInstalled) { try { if (installedState.Directory.GetChildDirectoryWithName(modPath).Exists) return CreateLocalMod(modPath, installedState.Directory, game); } catch (Exception) {} try { if (installedState.Directory.GetChildFileWithName(modPath).Exists) return CreateLocalMod(modPath, installedState.Directory, game); } catch (Exception) {} } return CreateLocalMod(modPath, null, game); }
public void UpdateSynqState(ISupportModding game, PackageItem package) { if (package == null) { throw new ArgumentNullException(nameof(package)); } _package = package; SetSharedState(game); _isValidSixSync = false; _isValidSixSyncPack = false; _sixSyncRepoExists = false; _sixSyncVersionInfo = null; _package.UpdateCurrentVersion(); Revision = GetSynqRevision(); DesiredRevision = GetSynqDesiredRevision(); LatestRevision = GetSynqLatestRevision(); State = !ModMatchesActiveGame(game) ? ContentState.Incompatible : GetSynqModState(); //Cheat.PublishDomainEvent(new ModInfoChangedEvent(new ModInfo(_mod))); }
public AceUserconfig(ISupportModding game) { var profiles = game as ISupportProfiles; if (profiles != null) Identities = profiles.GetProfiles().ToArray(); _game = game; _acedefines = new Dictionary<string, List<object>> { // List<object> = value, line number, internal private variable name as string to get and set it via reflection {"ACE_IDENTITY", new List<object> {"", -1, "Identity"}}, {"ACE_CUSTOMFACE", new List<object> {"", -1, "CustomFace"}}, {"ACE_COMPASS", new List<object> {false, -1, "NewCompass"}}, {"ACE_RETICLES", new List<object> {false, -1, "Reticles"}}, {"ACE_NOVOICE", new List<object> {false, -1, "NoVoice"}}, {"ACE_NOCROSS", new List<object> {false, -1, "NoCross"}}, {"ACE_MINIMALHUD", new List<object> {false, -1, "MinimalHud"}}, {"ACE_DISABLE_RUCKLESS", new List<object> {false, -1, "DisableRuckless"}}, {"ACE_BALLTRACERS", new List<object> {false, -1, "BallTracers"}}, {"ACE_GRENADETHROW", new List<object> {false, -1, "GrenadeThrow"}}, {"ACE_NODIARYSTATISTICS", new List<object> {false, -1, "NoDiaryStats"}} }; }
public CalculatedGameSettings(Game game) { _game = game; _supportsModding = _game.SupportsMods(); _supportsMissions = _game.SupportsMissions(); _supportsServers = _game.SupportsServers(); if (_supportsModding) { _modding = _game.Modding(); } Signatures = new string[0]; if (!Execute.InDesignMode) { var collectionChanged = this.WhenAnyValue(x => x.Collection) .Skip(1); collectionChanged .Subscribe(HandleModSetSwitch); // TODO: Ignore out of band responses, cancel previous etc... collectionChanged .ObserveOn(ThreadPoolScheduler.Instance) .Subscribe(x => UpdateSignatures()); this.WhenAnyValue(x => x.Server) .Skip(1) .Subscribe(HandleServerSwitch); this.WhenAnyValue(x => x.Server.Mods) .Skip(1) .Subscribe(HandleServerModsChanged); this.WhenAnyValue(x => x.Mission) .Skip(1) .Subscribe(HandleMissionSwitch); } _first = true; }
// TODO: Domain events should be raised by the domain, not by the application layer, // however it is very difficult in the current setup to detect if modpaths were changed due to a profile change or due to a settings change... void HandleNewModPaths(ISupportModding game, ContentPaths newPaths, ContentPaths oldPaths) { if (!newPaths.IsValid || !oldPaths.IsValid) { return; } if (!oldPaths.EqualPath(newPaths)) { if (!oldPaths.EqualRepositoryPath(newPaths)) { Cheat.PublishDomainEvent(new ModAndSynqPathsChangedEvent(game, oldPaths, newPaths)); } else { Cheat.PublishDomainEvent(new ModPathChangedEvent(game, oldPaths, newPaths)); } } else if (!oldPaths.EqualRepositoryPath(newPaths)) { Cheat.PublishDomainEvent(new SynqPathChangedEvent(game, oldPaths, newPaths)); } }
void SetPaths(ISupportModding game) { _rootPath = GetModRootPath(game); Path = _rootPath != null?_rootPath.GetChildDirectoryWithName(_mod.Name) : null; }
protected AdvancedCollection(Guid id, ISupportModding game) : base(id, game) {}
protected GameController(ISupportContent game) { Contract.Requires<ArgumentNullException>(game != null); Game = game; _modding = game as ISupportModding; }
public static LocalMod FromStringIfValid(string modPath, ISupportModding game) { if (!(!string.IsNullOrWhiteSpace(modPath))) { throw new ArgumentNullException("!string.IsNullOrWhiteSpace(modPath)"); } if (game == null) { throw new ArgumentNullException(nameof(game)); } if (modPath.IsValidAbsoluteFilePath()) { var filePath = modPath.ToAbsoluteFilePath(); return(CreateLocalMod(filePath.FileName, filePath.ParentDirectoryPath, game)); } if (modPath.IsValidAbsoluteDirectoryPath()) { var dirPath = modPath.ToAbsoluteDirectoryPath(); return(CreateLocalMod(dirPath.DirectoryName, dirPath.ParentDirectoryPath, game)); } if (!FileNameValidator.IsValidName(modPath)) { return(null); } // TODO: Horrible non-determinism; is it a file, is it a folder, is it located in the game or mod dir? var modPaths = game.ModPaths; if (modPaths.IsValid) { try { if (modPaths.Path.GetChildDirectoryWithName(modPath).Exists) { return(CreateLocalMod(modPath, modPaths.Path, game)); } } catch (Exception) {} try { if (modPaths.Path.GetChildFileWithName(modPath).Exists) { return(CreateLocalMod(modPath, modPaths.Path, game)); } } catch (Exception) {} } var installedState = game.InstalledState; if (installedState.IsInstalled) { try { if (installedState.Directory.GetChildDirectoryWithName(modPath).Exists) { return(CreateLocalMod(modPath, installedState.Directory, game)); } } catch (Exception) {} try { if (installedState.Directory.GetChildFileWithName(modPath).Exists) { return(CreateLocalMod(modPath, installedState.Directory, game)); } } catch (Exception) {} } return(CreateLocalMod(modPath, null, game)); }
IAbsoluteDirectoryPath GetModRootPath(ISupportModding game) => _mod.CustomPath ?? game.ModPaths.Path;
public SubscribedCollection(Guid collectionID, Guid subscribedAccountId, ISupportModding game) : base(Guid.NewGuid(), game) { _collectionID = collectionID; _subscribedAccountId = subscribedAccountId; }
IMod CreateLocalMod(LocalModInfo lm, ISupportModding game) => Game.Lists.Mods.FirstOrDefault(y => y.Name.Equals(lm.Name, StringComparison.OrdinalIgnoreCase)) ?? Game.Lists.Mods.FirstOrDefault(y => y.Aliases.Contains(lm.Name, StringComparer.OrdinalIgnoreCase)) ?? LocalMod.FromLocalModInfo(lm, game);
public void UpdateState(ISupportModding game) { Game = game; UpdateState(); }
void SetSharedState(ISupportModding game) { SetPaths(game); SetExistsState(); }
public BuiltInCollection(ISupportModding game) : base(Guid.Empty, game) { }
public CustomCollection(Guid id, ISupportModding game) : base(id, game) { }
public bool GameMatch(ISupportModding game) => GameMatch((Game)game);
void SetPaths(ISupportModding game) { _rootPath = GetModRootPath(game); Path = _rootPath != null ? _rootPath.GetChildDirectoryWithName(_mod.Name) : null; }
bool ModMatchesActiveGame(ISupportModding game) => game != null && _mod.GameMatch(game);
static LocalMod CreateLocalMod(string name, IAbsoluteDirectoryPath localModPath, ISupportModding game) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (game == null) { throw new ArgumentNullException(nameof(game)); } var localMod = new LocalMod(System.Guid.Empty) { Name = name, CustomPath = localModPath }; localMod.Controller.UpdateState(game); return(localMod); }
IAbsoluteDirectoryPath GetModRootPath(ISupportModding game) => _mod.CustomPath ?? game.ModPaths.Path;
public static LocalMod FromLocalModInfo(LocalModInfo info, ISupportModding game) { Contract.Requires<ArgumentNullException>(info != null); Contract.Requires<ArgumentNullException>(game != null); return CreateLocalMod(info.Name, info.Path, game); }
public void UpdateLocalModState(ISupportModding game) { _package = null; SetSharedState(game); }
public void UpdateLocalModState(ISupportModding game) { _package = null; SetSharedState(game); }
public void UpdateState(ISupportModding game) { Game = game; UpdateState(); }
public void Reset(IContentManager contentList, ISupportModding game) { UpdateModSets(contentList); UpdateMods(contentList.Mods); UpdateItems(game); }
bool ModMatchesActiveGame(ISupportModding game) => game != null && _mod.GameMatch(game);
protected AdvancedCollection(Guid id, ISupportModding game) : base(id, game) { }