Exemplo n.º 1
0
        public MainViewModel()
        {
            _entryProvider    = ProC.GetInstance <IEntryProvider>();
            _settingsProvider = ProC.GetInstance <ISettingsProvider>();

            Initialize();
        }
Exemplo n.º 2
0
        public MainViewModel()
        {
            _entryProvider = ProC.GetInstance<IEntryProvider>();
            _settingsProvider = ProC.GetInstance<ISettingsProvider>();

            Initialize();
        }
Exemplo n.º 3
0
        public CustomFileProvider(string networkPath, string path, string name, IEntryProvider entryProvider)
        {
            Name           = name;
            NetworkPath    = networkPath;
            LocalPath      = path;
            _entryProvider = entryProvider;

            if (Directory.Exists(NetworkPath))
            {
                var files = Directory.GetFiles(NetworkPath, Name.ToLower() + "*");
                var info  = from f in files
                            where f.ToLower().EndsWith(".log") || f.ToLower().EndsWith(".txt")
                            select new FileInfo(f);

                var fullNetworkPath = info.OrderBy(x => x.LastWriteTimeUtc).LastOrDefault().FullName;

                if (NetworkPath != LocalPath)
                {
                    _logFilePath = Path.Combine(LocalPath, Path.GetFileName(fullNetworkPath));
                    if (File.Exists(_logFilePath))
                    {
                        File.Delete(_logFilePath);
                    }

                    File.Copy(fullNetworkPath, _logFilePath);
                }
                else
                {
                    _logFilePath = fullNetworkPath;
                }
            }
        }
Exemplo n.º 4
0
        private ICollection <IEntryInstance> GetFranchiseEntries(long id, IEntryProvider provider)
        {
            var relations = assembler.Assembly(id, provider);

            if (relations.Count == 0)
            {
                return(new List <IEntryInstance>());
            }
            var validEntries = GetEntries(relations);

            return(validEntries);
        }
Exemplo n.º 5
0
        private void ResolveTopEntry(IEntryProvider entryProvider)
        {
            var currentEntry = entriesToCheckTheRelations.Pop();

            if (currentEntry == null)
            {
                return;
            }
            var relations = GetRelations(currentEntry, entryProvider);

            if (IsCollectionEmpty(relations))
            {
                return;
            }
            relations = relations
                        .Where(r => relationService.IsRelationValid(r))
                        .ToList();
            series.AddRange(relations);
            StackNextRelatedEntries(relations);
        }
Exemplo n.º 6
0
        public ICollection <RelationBetweenEntries> Assembly(long entryId, IEntryProvider entryProvider)
        {
            ResetCollections();
            if (IsIgnored(entryId, entryProvider))
            {
                return(series);
            }
            var entry = entryProvider.Get(entryId);

            if (HasMultipleParentStories(entry))
            {
                return(series);
            }
            AddEntryToCheckTheRelations(entry);
            while (!IsStackEmpty())
            {
                ResolveTopEntry(entryProvider);
            }
            if (series.Count == 0)
            {
                series.Add(new RelationBetweenEntries(entry));
            }
            return(series);
        }
Exemplo n.º 7
0
        private ICollection <RelationBetweenEntries> GetRelations(IEntryInstance entry, IEntryProvider entryProvider)
        {
            var allRelatedToEntry = entry.Related.AllRelatedPositions;

            if (IsCollectionEmpty(allRelatedToEntry))
            {
                return(null);
            }
            var relations       = new List <RelationBetweenEntries>();
            var filteredEntries = allRelatedToEntry.Where(r => CanEntryBeAddedToSeries(r.MalId) && !IsIgnored(r.MalId, entryProvider));

            foreach (var subItem in filteredEntries)
            {
                var relatedEntry = entryProvider.Get(subItem.MalId);
                if (relatedEntry != null && !HasMultipleParentStories(relatedEntry))
                {
                    var relation = CreateRelation(entry, relatedEntry, subItem.RelationType);
                    relations.Add(relation);
                }
            }
            return(relations);
        }
Exemplo n.º 8
0
 private bool IsIgnored(long entryId, IEntryProvider entryProvider)
 {
     return(entryProvider.IsIgnored(entryId));
 }