Ejemplo n.º 1
0
        public void LoadDestinationByNumbers()
        {
            if (TransferableNumbersList != null)
            {
                var dds = DestinationDirectory.EnumerateDirectories("*", SearchOption.TopDirectoryOnly);

                var innerGroupJoinQuery =
                    from dd in dds
                    join tnl in TransferableNumbersList on dd.Name equals tnl
                    select dd;
                var r = innerGroupJoinQuery.ToList();

                if (DestinationFilesList == null)
                {
                    DestinationFilesList = new List <FileInfoW>();
                }
                foreach (var ddir in innerGroupJoinQuery)
                {
                    DestinationFilesList.AddRange(lsToFileInfoW(ddir, "^(\\d{5}ГУ\\d{6})(?:_(.*))*_(\\d{8})(?:_(\\d{1,2}))*$"));
                }
                var yyy1 = DestinationFilesList.Where(sel => sel.Name.Number == null).ToList();
                CalcNumber(yyy1);
                foreach (var y in yyy1)
                {
                    y.NeedRename   = true;
                    y.Name.Date    = y.fileInfo.LastWriteTime.ToString("yyyyMMdd");
                    y.Name.Content = "";
                }
                var dgg =
                    from dfl in DestinationFilesList
                    where
                    dfl.NeedRename == false
                    group dfl by new { dfl.Name.Number, dfl.Name.Content, dfl.Name.Date } into dfl1
                where dfl1.Count() > 1
                select new { dfl1.Key.Number, dfl1.Key.Content, dfl1.Key.Date };
                var ttt = dgg.ToList();

                var dgg1 =
                    from dfl in DestinationFilesList
                    where
                    dfl.NeedRename == true
                    group dfl by new { Number = dfl.Name.Number, dfl.Name.Content, dfl.Name.Date } into dfl2
                where dfl2.Count() > 1
                select new { dfl2.Key.Number, dfl2.Key.Content, dfl2.Key.Date };;
                var ttt1 = dgg1.ToList();
                var dgg2 =
                    from ttt1i in ttt1.AsEnumerable()
                    join ttti in ttt.AsEnumerable() on ttt1i.Number equals ttti.Number
                    select new { ttti, ttt1i };
                var ttt2 = dgg2.ToList();
            }
        }
Ejemplo n.º 2
0
        public List <Task> CreateTasks()
        {
            List <Task> res      = new List <Task>();
            Task        lasttask = null;

            foreach (string Num in TransferableNumbersList)
            {
                List <FileInfoW> destlist  = DestinationFilesList.Where(w => w.Name.Number == Num).ToList();
                List <FileInfoW> translist = TransferableFilesList.Where(w => w.Name.Number == Num).ToList();
                Task             newtask   = tcreate(destlist, translist, lasttask);
                res.Add(newtask);
                lasttask = newtask;
            }
            return(res);
        }