/// <summary>Synchronize cached information with actual data.</summary> public void Refresh() { IList <ConfigParameterData> config; switch (_configFile) { case ConfigFile.Other: config = _configAccessor.QueryConfig.Invoke( new QueryConfigParameters(_fileName)); break; case ConfigFile.Repository: config = _configAccessor.QueryConfig.Invoke( new QueryConfigParameters()); break; case ConfigFile.System: case ConfigFile.User: config = _configAccessor.QueryConfig.Invoke( new QueryConfigParameters(_configFile)); break; default: throw new ApplicationException( string.Format(CultureInfo.InvariantCulture, "Unknown ConfigFile value: {0}", _configFile)); } lock (SyncRoot) { if (_repository != null) { CacheUpdater.UpdateObjectDictionary( _parameters, null, null, config, configParameterData => ObjectFactories.CreateConfigParameter(_repository, configParameterData), ObjectFactories.UpdateConfigParameter, InvokeCreated, InvokeDeleted, true); } else { CacheUpdater.UpdateObjectDictionary( _parameters, null, null, config, configParameterData => ObjectFactories.CreateConfigParameter(_configAccessor, configParameterData), ObjectFactories.UpdateConfigParameter, InvokeCreated, InvokeDeleted, true); } } }
/// <summary>Updates remote branch cache.</summary> /// <param name="branches">Actual remote branch data.</param> private void RefreshInternal(IEnumerable <BranchData> branches) { lock (SyncRoot) { CacheUpdater.UpdateObjectDictionary <RemoteBranch, BranchData>( ObjectStorage, null, branchData => branchData.IsRemote, branches, remoteBranchData => ObjectFactories.CreateRemoteBranch(Repository, remoteBranchData), ObjectFactories.UpdateRemoteBranch, InvokeObjectAdded, InvokeObjectRemoved, true); } }
private void RefreshInternal(IEnumerable <TagData> tagDataList) { lock (SyncRoot) { CacheUpdater.UpdateObjectDictionary( ObjectStorage, null, null, tagDataList, tagData => ObjectFactories.CreateTag(Repository, tagData), ObjectFactories.UpdateTag, InvokeObjectAdded, InvokeObjectRemoved, true); } }
public void Refresh() { var notes = Repository.Accessor.QueryNotes.Invoke( new QueryNotesParameters()); lock (SyncRoot) { CacheUpdater.UpdateObjectDictionary <Note, NoteData>( _notes, null, null, notes, noteData => ObjectFactories.CreateNote(Repository, noteData), ObjectFactories.UpdateNode, InvokeCreated, InvokeDeleted, true); } }
public void Refresh() { var config = Repository.Accessor.QueryConfig.Invoke( new QueryConfigParameters()); lock (SyncRoot) { CacheUpdater.UpdateObjectDictionary <ConfigParameter, ConfigParameterData>( _parameters, null, null, config, configParameterData => ObjectFactories.CreateConfigParameter(Repository, configParameterData), ObjectFactories.UpdateConfigParameter, InvokeParameterCreated, InvokeParameterDeleted, true); } }
public void Refresh() { var users = Repository.Accessor.QueryUsers.Invoke( new QueryUsersParameters()); lock (SyncRoot) { CacheUpdater.UpdateObjectDictionary <User, UserData>( ObjectStorage, null, null, users, userData => ObjectFactories.CreateUser(Repository, userData), ObjectFactories.UpdateUser, InvokeObjectAdded, InvokeObjectRemoved, true); } }
/// <summary>Sync information on remotes: removes non-existent, adds new, updates url.</summary> public void Refresh() { var remotes = Repository.Accessor.QueryRemotes.Invoke( new QueryRemotesParameters()); lock (SyncRoot) { CacheUpdater.UpdateObjectDictionary <Remote, RemoteData>( ObjectStorage, null, null, remotes, remoteData => ObjectFactories.CreateRemote(Repository, remoteData), ObjectFactories.UpdateRemote, InvokeObjectAdded, InvokeObjectRemoved, true); } }
public void Refresh() { var submodules = new Dictionary <string, SubmoduleData>(); var cfg = Path.Combine(Repository.WorkingDirectory, GitConstants.SubmodulesConfigFile); bool skipUpdate = false; if (File.Exists(cfg)) { ConfigurationFile cfgFile = null; try { cfgFile = new ConfigurationFile(Repository, GitConstants.SubmodulesConfigFile, true); } catch (Exception exc) when(!exc.IsCritical()) { skipUpdate = true; } if (cfgFile != null) { foreach (var param in cfgFile) { if (param.Name.StartsWith("submodule.")) { int p = param.Name.LastIndexOf('.', param.Name.Length - 1, param.Name.Length - "submodule.".Length); if (p != -1 && p != param.Name.Length - 1) { var p3 = param.Name.Substring(p + 1); bool valueIsPath = false; bool valueIsUrl = false; switch (p3) { case "path": valueIsPath = true; break; case "url": valueIsUrl = true; break; default: continue; } var name = param.Name.Substring("submodule.".Length, p - "submodule.".Length); SubmoduleData info; if (!submodules.TryGetValue(name, out info)) { info = new SubmoduleData(name); submodules.Add(name, info); } if (valueIsPath) { info.Path = param.Value; } if (valueIsUrl) { info.Url = param.Value; } } } } } } if (!skipUpdate) { lock (SyncRoot) { CacheUpdater.UpdateObjectDictionary <Submodule, SubmoduleData>( ObjectStorage, null, null, submodules, submoduleData => ObjectFactories.CreateSubmodue(Repository, submoduleData), ObjectFactories.UpdateSubmodule, InvokeObjectAdded, InvokeObjectRemoved, true); } } }