Exemplo n.º 1
0
        private IEnumerable <CompositeSelectableVm> ComputeModules(IEnumerable <LogEntryVm> arg)
        {
            var allFiles   = AllEntries.Select(le => le.FileName).Distinct().Select(m => new SelectableVm(m, true)).OrderBy(m => m.Name);
            var allModules = allFiles.GroupBy(x => ModuleClassifier.GetModuleForFile(x.Name)).Select(x => new CompositeSelectableVm(x.Key, true, x.Select(y => y)));

            return(allModules.ToList());
        }
Exemplo n.º 2
0
        public void UnindentItem(ISublistEntry entry)
        {
            var currentParent = _entryProvider.GetParent(entry, AllEntries);

            if (currentParent != null)
            {
                var parentOfParent = _entryProvider.GetParent(currentParent, AllEntries);
                if (parentOfParent != null)
                {
                    entry.ParentId = parentOfParent.Id;
                    parentOfParent.AddSubEntrySafely(entry);
                    currentParent.SubEntries.Remove(entry);
                    _entryProvider.ChangeEntry(entry);
                }
                else
                {
                    entry.ParentId = 0;
                    _entryProvider.ChangeEntry(entry);
                    currentParent.SubEntries.Remove(entry);
                    AllEntries.Add(entry);
                }

                RefreshAllEntries();
            }
        }
Exemplo n.º 3
0
        private Registry(string content)
        {
            var entryBlocks = content
                              .Split(new string[] { "\n%%\n" }, StringSplitOptions.RemoveEmptyEntries)
                              .ToArray();

            FileDate = parseFileDate(entryBlocks.First());

            AllEntries = entryBlocks.Skip(1).Select(RegEntry.Parse).ToList();

            PrimaryLanguages           = AllEntries.OfType <LanguageEntry>().Where(_ => !_.IsPrivateUse).ToList();
            PrivateUsePrimaryLanguages = AllEntries.OfType <LanguageEntry>().Single(_ => _.IsPrivateUse);

            ExtLanguages = AllEntries.OfType <ExtlangEntry>().ToList();

            Scripts           = AllEntries.OfType <ScriptEntry>().Where(_ => !_.IsPrivateUse).ToList();
            PrivateUseScripts = AllEntries.OfType <ScriptEntry>().Single(_ => _.IsPrivateUse);

            Regions           = AllEntries.OfType <RegionEntry>().Where(_ => !_.IsPrivateUse).ToList();
            PrivateUseRegions = AllEntries.OfType <RegionEntry>().Where(_ => _.IsPrivateUse).ToList();

            Variants = AllEntries.OfType <VariantEntry>().ToList();

            Grandfathered = AllEntries.OfType <GrandfatheredEntry>().ToList();

            Redundand = AllEntries.OfType <RedundantEntry>().ToList();
        }
Exemplo n.º 4
0
        public void AddEntry(Entry entity, int todayIndex)
        {
            Db.Entries.InsertOnSubmit(entity);
            Db.SubmitChanges();

            AllEntries.Add(entity);
            AllDates[todayIndex].Entries.Add(entity);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Gets all change log entries of the specified type
 /// </summary>
 /// <param name="commitType"></param>
 /// <returns></returns>
 public ChangeLogEntryGroup this[CommitType commitType]
 {
     get
     {
         var entries = AllEntries.Where(x => x.Type == commitType);
         return(new ChangeLogEntryGroup(commitType, entries));
     }
 }
Exemplo n.º 6
0
        public void DeleteEntry(Entry entity)
        {
            AllEntries.Remove(entity);

            // delete image in isolate storage
            using (IsolatedStorageFile isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (entity.ImgSrc != null && isolatedStorage.FileExists(entity.ImgSrc))
                {
                    isolatedStorage.DeleteFile(entity.ImgSrc);
                }
            }

            Db.Entries.DeleteOnSubmit(entity);
            Db.SubmitChanges();
        }
Exemplo n.º 7
0
        public void CreateEntry(ISublistEntry parent)
        {
            var newEntry = new SublistEntry();

            if (parent != null)
            {
                parent.AddSubEntrySafely(newEntry);
            }
            else
            {
                AllEntries.Add(newEntry);
            }

            _entryProvider.StoreNewEntry(newEntry);

            RefreshAllEntries();
        }
Exemplo n.º 8
0
        public void DeleteSelectedEntries(IEnumerable <ISublistEntry> entries)
        {
            foreach (var sublistEntry in entries.ToList())
            {
                _entryProvider.DeleteEntry(sublistEntry);

                var parent = _entryProvider.GetParent(sublistEntry, AllEntries);
                if (parent == null)
                {
                    AllEntries.Remove(sublistEntry);
                }
                else
                {
                    parent.SubEntries.Remove(sublistEntry);
                }
            }
        }
Exemplo n.º 9
0
        public void Add(Entry entry)
        {
            if (_quadrants == null && _entries.Count >= EntriesBeforeSplit)
            {
                Split();
            }

            if (!_bounds.Contains(entry.Bounds))
            {
                if (!_isRoot)
                {
                    throw new InvalidOperationException("Should never attempt to add uncontained item to non-root node");
                }

                var allEntries = AllEntries.ToList();
                Clear();
                _bounds = Rect.Union(_bounds, entry.Bounds);
                foreach (var e in allEntries)
                {
                    Add(e);                     // NOTE: should never recurse
                }
            }

            if (null != _quadrants)
            {
                var midX = _bounds.X + _bounds.Width / 2;
                var midY = _bounds.Y + _bounds.Height / 2;


                var isNorth = entry.Bounds.Bottom < midY;
                var isSouth = !isNorth && entry.Bounds.Top >= midY;
                if (isNorth || isSouth)
                {
                    var isWest = entry.Bounds.Right < midX;
                    var isEast = !isWest && entry.Bounds.Left >= midX;

                    if (isWest || isEast)
                    {
                        _quadrants[(isNorth ? 0 : 2) + (isWest ? 0 : 1)].Add(entry);
                        return;
                    }
                }

                _entries.Add(entry);
            }
        }
Exemplo n.º 10
0
        public void DeleteDateData(DateData entity)
        {
            AllDates.Remove(entity);

            Entry[] clone = new Entry[AllEntries.Count];
            AllEntries.CopyTo(clone, 0);
            foreach (Entry e in clone)
            {
                if (e.Date == entity)
                {
                    DeleteEntry(e);
                }
            }

            Db.Dates.DeleteOnSubmit(entity);
            Db.SubmitChanges();
        }
Exemplo n.º 11
0
        public void IndentItem(ISublistEntry entry, ISublistEntry newParent)
        {
            if (newParent != null)
            {
                var oldParent = _entryProvider.GetParent(entry, AllEntries);
                if (oldParent != null && oldParent.SubEntries.First() == entry)
                {
                    return;
                }

                entry.ParentId = newParent.Id;
                newParent.AddSubEntrySafely(entry);
                oldParent?.SubEntries.Remove(entry);
                AllEntries.Remove(entry);
                _entryProvider.ChangeEntry(entry);

                RefreshAllEntries();
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Called everytime the window is displayed.
        /// </summary>
        public void OnPresented()
        {
            this.ShowFirstColumn = Properties.SubSearchSettings.Default.ShowFirstColumn;
            this.GetFullPath     = Properties.SubSearchSettings.Default.TargetDirectory;
            this.IsPathSet       = string.IsNullOrWhiteSpace(GetFullPath);

            AllEntries.Clear();

            if (Directory.Exists(GetFullPath))
            {
                Task.Run(() =>
                {
                    // Fill grid content async:
                    AddDirectoryContent(AllEntries, GetFullPath);
                });
            }
            this.SelectedEntry = null;
            this.TotalEntries  = AllEntries;
        }
Exemplo n.º 13
0
 private IEnumerable <SelectableVm> ComputeFilter(IEnumerable <LogEntryVm> arg, Func <LogEntryVm, string> selector)
 {
     return(AllEntries.Select(selector).Distinct().Select(m => new SelectableVm(m, true)).OrderBy(m => m.Name).ToList());
 }
Exemplo n.º 14
0
 private IEnumerable <SelectableVm> ComputeLevels(IEnumerable <LogEntryVm> arg)
 {
     return(AllEntries.Select(le => le.Level).Distinct().Select(m => new SelectableVm(m, true)).OrderBy(m => m.Name).ToList());
 }
Exemplo n.º 15
0
 /// <inheritdoc />
 IEnumerator IEnumerable.GetEnumerator() => AllEntries.GetEnumerator();
Exemplo n.º 16
0
 /// <inheritdoc />
 public IEnumerator <ChangeLogEntry> GetEnumerator() => AllEntries.GetEnumerator();