Exemplo n.º 1
0
        private IEnumerable <InpRecord> LoadInp(InpxEntry entry, CancellationToken cancellationToken)
        {
            int index = 0;

            using (StreamReader reader = new StreamReader(entry.Entry))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    if (cancellationToken.IsCancellationRequested)
                    {
                        yield break;
                    }

                    InpRecord record = InpRecord.Parse(entry.Name, index, line);
                    index++;

                    if (record.IsDeleted && SkipDeleted)
                    {
                        continue;
                    }

                    if ((Languages.Count() > 0) &&
                        (!Languages.Any(x => string.Equals(x, record.Lang, StringComparison.InvariantCultureIgnoreCase))))
                    {
                        continue;
                    }

                    yield return(record);
                }
            }
        }
Exemplo n.º 2
0
        private IEnumerable <InpxEntry> LoadInpx(CancellationToken cancellationToken)
        {
            foreach (ZipArchiveEntry entry in _zip.Entries)
            {
                if (cancellationToken.IsCancellationRequested)
                {
                    yield break;
                }

                if (!entry.FullName.EndsWith(".inp"))
                {
                    continue;
                }

                string    name = Path.ChangeExtension(entry.FullName, ".zip");
                InpxEntry inpx = new InpxEntry(name, entry.Open());

                yield return(inpx);
            }
        }