public void RegisterAdded(EntityBase entity, IPersistRepository repository) { if (!Added.ContainsKey(entity)) { Added.Add(entity, repository); } }
private async Task SyncFilesAsync(IDbConnection connection, TFolder folder, Stopwatch stopwatch, IProgress <SyncProgress> progress = null) { progress?.Report(new SyncProgress() { Message = $"Getting files in {folder.Path}", Elapsed = stopwatch.Elapsed }); foreach (string mask in IncludeFileMasks) { string[] files = Directory.GetFiles(folder.Path, mask, SearchOption.TopDirectoryOnly); foreach (var fileName in files) { FileInfo fi = new FileInfo(fileName); var file = new TFile() { FolderId = folder.Id, Name = Path.GetFileName(fileName), Path = ToLocal(fileName), DateCreated = fi.CreationTimeUtc, DateModified = fi.LastWriteTimeUtc, Size = fi.Length }; Added.Add(file); file.GetMetadata(fileName); await SyncFileAsync(connection, file); } } }
public IEntry <T> Add <T>(T entity) where T : class { Debug.Assert(!isInvalidated, "Using invalidated Context"); Debug.Assert(isWriting.HasValue, "Using unlocked Context"); Added.Add(entity); return(new EmulatedEntry <T>(entity)); }
protected override void SetOpposite(string item, Dummy newParent) { if (newParent == null) { Removed.Add(item); } else { Added.Add(item); } }
/// <summary> /// Run the diff operation. Until this is called, all lists will be empty /// </summary> /// <returns>true if anything is different between index, tree, and workdir</returns> public bool Diff() { DirectoryInfo root = _index.Repository.WorkingDirectory; var visitor = new AbstractIndexTreeVisitor { VisitEntry = delegate(TreeEntry treeEntry, GitIndex.Entry indexEntry, FileInfo file) { if (treeEntry == null) { Added.Add(indexEntry.Name); _anyChanges = true; } else if (indexEntry == null) { if (!(treeEntry is Tree)) { Removed.Add(treeEntry.FullName); } _anyChanges = true; } else { if (!treeEntry.Id.Equals(indexEntry.ObjectId)) { Changed.Add(indexEntry.Name); _anyChanges = true; } } if (indexEntry != null) { if (!file.Exists) { Missing.Add(indexEntry.Name); _anyChanges = true; } else { if (indexEntry.IsModified(root, true)) { Modified.Add(indexEntry.Name); _anyChanges = true; } } } } }; new IndexTreeWalker(_index, _tree, root, visitor).Walk(); CheckUntrackedDirectory(root.FullName, ""); return(_anyChanges); }
public void Add <T>(T entity) where T : class { //if (typeof(T) == typeof(Log)) //{ // LogAdded.Add(entity); //} //else //{ Added.Add(entity); //} }
private void AddAddEvent(SystemEntity obj) { if (Added.All(info => info.ObjectBase != obj)) { EventInfo eventInfo = obj.GetEventInfo(); Added.Add(eventInfo); eventInfo.PreTransactionHandled = true; eventInfo.Publish(this, typeof(IOnAdding <>), (info, ses, t) => info.GetTypedInfo(t).ToAddingArgs(ses, t)); } }
private void Employees_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: var dto = (EmployeeDataTransfer)e.NewItems[0]; if (!Added.Contains(dto)) { Added.Add((EmployeeDataTransfer)e.NewItems[0]); } break; } }
private PathStatus OnAdded(string path, PathStatus status) { if (Options.PerPathNotificationCallback != null) { if (status == null) { status = new PathStatus(Repository, path); } status.IndexPathStatus = IndexPathStatus.Added; } Added.Add(path); AnyDifferences = true; return(status); }
void ScanAssembly(Assembly assembly) { var types = assembly.GetExportedTypes().Where(IsDataChangedEventType).ToArray(); foreach (var type in types) { var interfaceEvent = FindEventInterface(type); var dataType = GetDataType(type); if (IsDataAddedEvent(interfaceEvent)) { Added.Add(dataType, type); } else if (IsDataUpdatedEvent(interfaceEvent)) { Updated.Add(dataType, type); } else if (IsDataRemovedEvent(interfaceEvent)) { Removed.Add(dataType, type); } } }
void IOdeToFoodDb.Add <T>(T entity) { Added.Add(entity); }
public void IncludeAddedChange(IDependencyModel model) { Added.Add(model); }
public void Add <T>(T entity) where T : class { Added.Add(entity); }
public bool Expired() { return((Added.Add(Expiry)) < DateTime.Now); }
/// <summary> /// Run the diff operation. Until this is called, all lists will be empty /// </summary> /// <returns>true if anything is different between index, tree, and workdir</returns> private void UpdateDirectory(IEnumerable <string> paths, bool recursive) { RevWalk rw = new RevWalk(Repository); ObjectId id = Repository.Resolve(Constants.HEAD); var commit = id != null?rw.ParseCommit(id) : null; TreeWalk treeWalk = new TreeWalk(Repository); treeWalk.Reset(); treeWalk.Recursive = false; if (commit != null) { treeWalk.AddTree(commit.Tree); } else { treeWalk.AddTree(new EmptyTreeIterator()); } DirCache dc = Repository.ReadDirCache(); treeWalk.AddTree(new DirCacheIterator(dc)); FileTreeIterator workTree = new FileTreeIterator(Repository.WorkTree, Repository.FileSystem, WorkingTreeOptions.KEY.Parse(Repository.GetConfig())); treeWalk.AddTree(workTree); List <TreeFilter> filters = new List <TreeFilter> (); filters.Add(new SkipWorkTreeFilter(1)); var pathFilters = paths.Where(p => p != ".").Select(p => PathFilter.Create(p)).ToArray(); if (pathFilters.Length > 1) { filters.Add(OrTreeFilter.Create(pathFilters)); // Use an OR to join all path filters } else if (pathFilters.Length == 1) { filters.Add(pathFilters[0]); } if (filters.Count > 1) { treeWalk.Filter = AndTreeFilter.Create(filters); } else { treeWalk.Filter = filters[0]; } while (treeWalk.Next()) { AbstractTreeIterator treeIterator = treeWalk.GetTree <AbstractTreeIterator>(0); DirCacheIterator dirCacheIterator = treeWalk.GetTree <DirCacheIterator>(1); WorkingTreeIterator workingTreeIterator = treeWalk.GetTree <WorkingTreeIterator>(2); NGit.FileMode fileModeTree = treeWalk.GetFileMode(0); if (treeWalk.IsSubtree) { treeWalk.EnterSubtree(); continue; } int stage = dirCacheIterator != null?dirCacheIterator.GetDirCacheEntry().Stage : 0; if (stage > 1) { continue; } else if (stage == 1) { MergeConflict.Add(dirCacheIterator.EntryPathString); changesExist = true; continue; } if (treeIterator != null) { if (dirCacheIterator != null) { if (!treeIterator.EntryObjectId.Equals(dirCacheIterator.EntryObjectId)) { // in repo, in index, content diff => changed Modified.Add(dirCacheIterator.EntryPathString); changesExist = true; } } else { // in repo, not in index => removed if (!fileModeTree.Equals(NGit.FileMode.TYPE_TREE)) { Removed.Add(treeIterator.EntryPathString); changesExist = true; } } } else { if (dirCacheIterator != null) { // not in repo, in index => added Added.Add(dirCacheIterator.EntryPathString); changesExist = true; } else { // not in repo, not in index => untracked if (workingTreeIterator != null && !workingTreeIterator.IsEntryIgnored()) { Untracked.Add(workingTreeIterator.EntryPathString); changesExist = true; } } } if (dirCacheIterator != null) { if (workingTreeIterator == null) { // in index, not in workdir => missing Missing.Add(dirCacheIterator.EntryPathString); changesExist = true; } else { // Workaround to file time resolution issues long itime = dirCacheIterator.GetDirCacheEntry().LastModified; long ftime = workingTreeIterator.GetEntryLastModified(); if (itime / 1000 != ftime / 1000) { if (!dirCacheIterator.IdEqual(workingTreeIterator)) { // in index, in workdir, content differs => modified Modified.Add(dirCacheIterator.EntryPathString); changesExist = true; } } } } } }
public bool Diff(object prev, object cur, string parent = null) { Contract.Requires(prev != null); Contract.Requires(cur != null); var prevObj = ToJObject(prev); var curObj = ToJObject(cur); // Added and modified foreach (var curProp in EnumerateProperties(curObj)) { var prevProp = GetProperty(prevObj, curProp.Name); var key = curProp.Name; var prefix = parent == null ? string.Empty : parent; if (IsArray(prevObj)) { key = "[" + key + "]"; // We have a parent that's an array, use brackets } else if (parent != null) { prefix += "."; // We have a parent that's not an array, use dot notation } if (prevProp == null) // Property just created now { Added.Add(prefix + key, curProp.Value); continue; } // Property already exists if (IsValue(curProp.Value)) { if (object.Equals(curProp.Value, prevProp.Value)) { continue; // Values are the same, no change here } Modified.Add(prefix + key, curProp.Value); continue; } // This is an object Diff(prevProp.Value, curProp.Value, prefix + key); } // Deleted foreach (var prevProp in EnumerateProperties(prevObj).Where(x => !EnumerateProperties(curObj).Any(y => y.Name == x.Name))) { var key = prevProp.Name; var prefix = parent == null ? string.Empty : parent; if (IsArray(prev)) { key = "[" + key + "]"; } else if (parent != null) { prefix += "."; } Deleted.Add(prefix + key); } IsDifferent = Added.Count + Modified.Count + Deleted.Count > 0; return(IsDifferent); }
new internal void Insert(int Pos, IEvent Item) { base.Insert(Pos, Item); Added.Add(Item); }
public void Add(object content) { Added.Add(content.ToString()); }
internal void LogAdd(K key) { Added.Add(key); Removed.Remove(key); }
internal new void Add(IEvent Item) { base.Add(Item); Added.Add(Item); }
public bool TryAdd(Type service, Type implementation = null) { if (service.IsInterface && service.IsGenericType && implementation == null && (service.GetGenericTypeDefinition() == typeof(IOptionsSnapshot <>) || service.GetGenericTypeDefinition() == typeof(IOptions <>) || service.GetGenericTypeDefinition() == typeof(IOptionsMonitor <>) )) { service = service.GetGenericArguments().FirstOrDefault(); if (service == null) { return(false); } } var serviceName = $"{service}{implementation}"; if (Added.Contains(serviceName)) { return(false); } Added.Add(serviceName); var di = service.IsGenericType && ( service.GetGenericTypeDefinition() == typeof(IConfigureOptions <>) || service.GetGenericTypeDefinition() == typeof(IPostConfigureOptions <>) || service.GetGenericTypeDefinition() == typeof(IOptionsMonitor <>) ) && implementation != null?implementation.GetCustomAttribute <DIAttribute>() : service.GetCustomAttribute <DIAttribute>(); var isnew = false; if (di != null) { if (di.Additional != null) { var m = di.Additional.GetMethod("Register", BindingFlags.Public | BindingFlags.Static); m.Invoke(null, new[] { this }); } if (!service.IsInterface || implementation != null) { isnew = implementation != null?Register(service, implementation) : Register(service); if (!isnew) { return(false); } } if (service.IsInterface && implementation == null || !service.IsInterface) { if (di.Service != null) { var a = di.Service.GetInterfaces().FirstOrDefault(x => x.IsGenericType && ( x.GetGenericTypeDefinition() == typeof(IConfigureOptions <>) || x.GetGenericTypeDefinition() == typeof(IPostConfigureOptions <>) || x.GetGenericTypeDefinition() == typeof(IOptionsMonitor <>) )); if (a != null) { if (!a.ContainsGenericParameters) { var b = a.GetGenericArguments(); foreach (var g in b) { if (g != service) { TryAdd(g); if (service.IsInterface && di.Implementation == null) { TryAdd(service, g); } } } TryAdd(a, di.Service); } else { Type c = null; var a1 = a.GetGenericTypeDefinition(); var b = a.GetGenericArguments().FirstOrDefault(); if (b != null && b.IsGenericType) { var b1 = b.GetGenericTypeDefinition().MakeGenericType(service.GetGenericArguments()); TryAdd(b1); c = a1.MakeGenericType(b1); } else { c = a1.MakeGenericType(service.GetGenericArguments()); } TryAdd(c, di.Service.MakeGenericType(service.GetGenericArguments())); //a, di.Service } } else { if (di.Implementation == null) { isnew = Register(service, di.Service); TryAdd(di.Service); } else { Register(di.Service); } } } if (di.Implementation != null) { var a = di.Implementation.GetInterfaces().FirstOrDefault(x => x.IsGenericType && (x.GetGenericTypeDefinition() == typeof(IConfigureOptions <>) || x.GetGenericTypeDefinition() == typeof(IPostConfigureOptions <>) || x.GetGenericTypeDefinition() == typeof(IOptionsMonitor <>)) ); if (a != null) { if (!a.ContainsGenericParameters) { var b = a.GetGenericArguments(); foreach (var g in b) { if (g != service) { //TryAdd(g); if (service.IsInterface && implementation == null) { TryAdd(service, g); } } } TryAdd(a, di.Implementation); } else { Type c = null; var a1 = a.GetGenericTypeDefinition(); var b = a.GetGenericArguments().FirstOrDefault(); if (b != null && b.IsGenericType) { var b1 = b.GetGenericTypeDefinition().MakeGenericType(service.GetGenericArguments()); TryAdd(b1); c = a1.MakeGenericType(b1); } else { c = a1.MakeGenericType(service.GetGenericArguments()); } TryAdd(c, di.Implementation.MakeGenericType(service.GetGenericArguments())); //a, di.Service } } else { isnew = TryAdd(service, di.Implementation); } } } } if (isnew) { ConstructorInfo[] props = null; if (!service.IsInterface) { props = service.GetConstructors(); } else if (implementation != null) { props = implementation.GetConstructors(); } else if (di.Service != null) { props = di.Service.GetConstructors(); } if (props != null) { var par = props.SelectMany(r => r.GetParameters()).Distinct(); foreach (var p1 in par) { TryAdd(p1.ParameterType); } } } return(isnew); }
#pragma warning restore CS0067 public void AddToProject(ProjectLocation location, CreateFilesOperationResult creationResult) { Added.Add(Tuple.Create(location, creationResult)); }
public Task AddTemplateAsync(string repoPath) { Added.Add(repoPath); return(Task.CompletedTask); }
public override EntityEntry <T> Add(T entity) { Added.Add(entity); return(null); }
private void Db_ObjectAppended(object sender, [NotNull] ObjectEventArgs e) { Added.Add(e.DBObject.Id); ObjectAppended?.Invoke(sender, e); }