Exemplo n.º 1
0
 public void AddAdditionalParams(string key, string value)
 {
     AdditionalParams.Add(new AdditionalParam()
     {
         Name  = key,
         Value = value
     });
 }
Exemplo n.º 2
0
 public override void ConfigureFilter(IFilteredModel <SneakerReference> model)
 {
     if (AdditionalParams != null && AdditionalParams.TryGetValue("brandID", out var brandID))
     {
         model.AddHiddenFilterGroup("brandname", ExpressionType.Equal)
         .AssignParameter(Convert.ToString(brandID), Convert.ToString(brandID));
     }
     else if (AdditionalParams != null && AdditionalParams.TryGetValue("modelID", out var modelID))
     {
         model.AddHiddenFilterGroup("basemodel", ExpressionType.Equal)
         .AssignParameter(Convert.ToString(modelID), Convert.ToString(modelID));
     }
     else
     {
         model.AddFilterGroup("Brand", "brandname")
         .AssignParameters(Catalog.SneakerBrandsList);
     }
     model.AddForeignFilterGroup <SneakerProduct>("Size", "size")
     .AssignParameters(Catalog.SneakerSizesList, size =>
                       new FilterParameter(size.Europe.ToString("#.#"), size));
     model.AddFilterGroup("Color", "color", ExpressionType.Or)
     .AssignParameters(Catalog.FilterColors, color =>
                       new FilterParameter(color.Name, color.Name.ToUpper(), ExpressionType.Regex)
     {
         SourceValue = color
     });
     model.AddFilterGroup("Price", "price", ExpressionType.And)
     .AssignParameters(
         new FilterParameter("Price (min)", 0, ExpressionType.GreaterThanOrEqual)
     {
         Checked = false, ImmutableValue = false
     },
         new FilterParameter("Price (max)", 0, ExpressionType.LessThanOrEqual)
     {
         Checked = false, ImmutableValue = false
     }
         );
     model.AddForeignFilterGroup <SneakerProduct>("Condition", "condition")
     .AssignParameters(typeof(SneakerCondition));
 }
Exemplo n.º 3
0
        internal string GetCmdLineParams(string sourceDirectory = null, string destDirectory = null)
        {
            StringBuilder cmdText = new StringBuilder();

            if (!sourceDirectory.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" \"{0}\"", DirSafeguard(sourceDirectory));
            }
            else if (!SourceDirectory.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" \"{0}\"", DirSafeguard(SourceDirectory));
            }

            if (!destDirectory.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" \"{0}\"", DirSafeguard(destDirectory));
            }
            else if (!DestDirectory.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" \"{0}\"", DirSafeguard(DestDirectory));
            }

            if (!Files.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" {0}", Files);
            }
            else
            {
                cmdText.Append("*.*");
            }

            //Copy Options
            if (CopyNoEmptySubDirectories)
            {
                cmdText.Append(" /S");
            }
            if (CopySubDirectories)
            {
                cmdText.Append(" /E");
            }
            if (OnlyCopyNLevels > 0)
            {
                cmdText.AppendFormat(" /LEV:{0}", OnlyCopyNLevels);
            }
            if (CopyFilesRestartableMode)
            {
                cmdText.Append(" /Z");
            }
            if (CopyFilesBackupMode)
            {
                cmdText.Append(" /B");
            }
            if (FallbackCopyFilesMode)
            {
                cmdText.Append(" /ZB");
            }
            if (UnbufferredIOCopy)
            {
                cmdText.Append(" /J");
            }

            if (EncrptFileEFSRawMode)
            {
                cmdText.Append(" /EFSRAW");
            }
            if (!CopyFlags.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /COPY:{0}", (from f in CopyFlags.SplitNTrim()
                                                    where !f.IsNullOrWhiteSpace()
                                                    select((ChoCopyFlags)Enum.Parse(typeof(ChoCopyFlags), f)).ToDescription()).Join(""));
            }
            if (CopyDirTimestamp)
            {
                cmdText.Append(" /DCOPY:T");
            }
            if (CopyFilesWithSecurity)
            {
                cmdText.Append(" /SEC");
            }

            if (CopyFilesWithFileInfo)
            {
                cmdText.Append(" /COPYALL");
            }
            if (CopyFilesWithNoFileInfo)
            {
                cmdText.Append(" /NOCOPY");
            }
            if (FixFileSecurityOnFiles)
            {
                cmdText.Append(" /SECFIX");
            }
            if (FixFileTimeOnFiles)
            {
                cmdText.Append(" /TIMFIX");
            }

            if (DelDestFileDirIfNotExistsInSource)
            {
                cmdText.Append(" /PURGE");
            }
            if (MirrorDirTree)
            {
                cmdText.Append(" /MIR");
            }
            if (MoveFiles)
            {
                cmdText.Append(" /MOV");
            }
            if (MoveFilesNDirs)
            {
                cmdText.Append(" /MOVE");
            }
            if (!AddFileAttributes.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /A+:{0}", (from f in AddFileAttributes.SplitNTrim()
                                                  where !f.IsNullOrWhiteSpace()
                                                  select((ChoFileAttributes)Enum.Parse(typeof(ChoFileAttributes), f)).ToDescription()).Join(""));
            }
            if (!RemoveFileAttributes.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /A-:{0}", (from f in RemoveFileAttributes.SplitNTrim()
                                                  where !f.IsNullOrWhiteSpace()
                                                  select((ChoFileAttributes)Enum.Parse(typeof(ChoFileAttributes), f)).ToDescription()).Join(""));
            }
            if (CreateDirTree)
            {
                cmdText.Append(" /CREATE");
            }
            if (CreateFATFileNames)
            {
                cmdText.Append(" /FAT");
            }
            if (TurnOffLongPath)
            {
                cmdText.Append(" /256");
            }

            if (RunAgainWithNoChangesSeen > 0)
            {
                cmdText.AppendFormat(" /MON:{0}", RunAgainWithNoChangesSeen);
            }
            if (RunAgainWithChangesSeenInMin > 0)
            {
                cmdText.AppendFormat(" /MOT:{0}", RunAgainWithChangesSeenInMin);
            }
            if (RunHourStartTime != TimeSpan.Zero &&
                RunHourEndTime != TimeSpan.Zero &&
                RunHourStartTime < RunHourEndTime)
            {
                cmdText.AppendFormat(" /RH:{0}-{1}", RunHourStartTime.ToString("hhmm"), RunHourEndTime.ToString("hhmm"));
            }
            if (CheckRunHourPerFileBasis)
            {
                cmdText.Append(" /PF");
            }
            if (InterPacketGapInMS > 0)
            {
                cmdText.AppendFormat(" /IPG:{0}", InterPacketGapInMS);
            }
            if (CopySymbolicLinks)
            {
                cmdText.Append(" /SL");
            }
            if (MultithreadCopy > 0)
            {
                cmdText.AppendFormat(" /MT:{0}", MultithreadCopy);
            }
            if (CopyNODirInfo)
            {
                cmdText.Append(" /NODCOPY");
            }
            if (CopyWithoutWindowsCopyOffload)
            {
                cmdText.Append(" /NOOFFLOAD");
            }

            //File Selection Options
            if (CopyOnlyFilesWithArchiveAttributes)
            {
                cmdText.Append(" /A");
            }
            if (CopyOnlyFilesWithArchiveAttributesAndReset)
            {
                cmdText.Append(" /M");
            }
            if (!IncludeFilesWithGivenAttributes.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /IA:{0}", (from f in IncludeFilesWithGivenAttributes.SplitNTrim()
                                                  where !f.IsNullOrWhiteSpace()
                                                  select((ChoFileSelectionAttributes)Enum.Parse(typeof(ChoFileSelectionAttributes), f)).ToDescription()).Join(""));
            }
            if (!ExcludeFilesWithGivenAttributes.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /XA:{0}", (from f in ExcludeFilesWithGivenAttributes.SplitNTrim()
                                                  where !f.IsNullOrWhiteSpace()
                                                  select((ChoFileSelectionAttributes)Enum.Parse(typeof(ChoFileSelectionAttributes), f)).ToDescription()).Join(""));
            }
            if (!ExcludeFilesWithGivenNames.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(@" /XF {0}", String.Join(" ", ExcludeFilesWithGivenNames.Split(";").Select(f => f).Select(f => f.Contains(" ") ? String.Format(@"""{0}""", f) : f)));
            }
            if (!ExcludeDirsWithGivenNames.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(@" /XD {0}", String.Join(" ", ExcludeDirsWithGivenNames.Split(";").Select(f => f).Select(f => f.Contains(" ") ? String.Format(@"""{0}""", f) : f)));
            }
            if (ExcludeChangedFiles)
            {
                cmdText.Append(" /XC");
            }
            if (ExcludeNewerFiles)
            {
                cmdText.Append(" /XN");
            }
            if (ExcludeOlderFiles)
            {
                cmdText.Append(" /XO");
            }
            if (ExcludeExtraFilesAndDirs)
            {
                cmdText.Append(" /XX");
            }
            if (ExcludeLonelyFilesAndDirs)
            {
                cmdText.Append(" /XL");
            }
            if (IncludeSameFiles)
            {
                cmdText.Append(" /IS");
            }
            if (IncludeTweakedFiles)
            {
                cmdText.Append(" /IT");
            }

            if (ExcludeFilesBiggerThanNBytes > 0)
            {
                cmdText.AppendFormat(" /MAX:{0}", ExcludeFilesBiggerThanNBytes);
            }
            if (ExcludeFilesSmallerThanNBytes > 0)
            {
                cmdText.AppendFormat(" /MIN:{0}", ExcludeFilesSmallerThanNBytes);
            }

            if (ExcludeFilesOlderThanNDays > 0)
            {
                cmdText.AppendFormat(" /MAXAGE:{0}", ExcludeFilesOlderThanNDays);
            }
            if (ExcludeFilesNewerThanNDays > 0)
            {
                cmdText.AppendFormat(" /MINAGE:{0}", ExcludeFilesNewerThanNDays);
            }
            if (ExcludeFilesUnusedSinceNDays > 0)
            {
                cmdText.AppendFormat(" /MAXLAD:{0}", ExcludeFilesUnusedSinceNDays);
            }
            if (ExcludeFilesUsedSinceNDays > 0)
            {
                cmdText.AppendFormat(" /MINLAD:{0}", ExcludeFilesUsedSinceNDays);
            }

            if (ExcludeJunctionPoints)
            {
                cmdText.Append(" /XJ");
            }
            if (AssumeFATFileTimes)
            {
                cmdText.Append(" /FFT");
            }
            if (CompensateOneHourDSTTimeDiff)
            {
                cmdText.Append(" /DST");
            }
            if (ExcludeJunctionPointsForDirs)
            {
                cmdText.Append(" /XJD");
            }
            if (ExcludeJunctionPointsForFiles)
            {
                cmdText.Append(" /XJF");
            }

            //Retry Options
            if (NoOfRetries.ToString() != DefaultNoOfRetries && NoOfRetries >= 0)
            {
                cmdText.AppendFormat(" /R:{0}", NoOfRetries);
            }
            if (WaitTimeBetweenRetries.ToString() != DefaultWaitTimeBetweenRetries && WaitTimeBetweenRetries >= 0)
            {
                cmdText.AppendFormat(" /W:{0}", WaitTimeBetweenRetries);
            }
            if (SaveRetrySettingsToRegistry)
            {
                cmdText.Append(" /REG");
            }
            if (WaitForSharenames)
            {
                cmdText.Append(" /TBD");
            }

            //Logging Options
            if (ListOnly)
            {
                cmdText.Append(" /L");
            }
            if (ReportExtraFiles)
            {
                cmdText.Append(" /X");
            }
            if (VerboseOutput)
            {
                cmdText.Append(" /V");
            }
            if (IncludeSourceFileTimestamp)
            {
                cmdText.Append(" /TS");
            }
            if (IncludeFullPathName)
            {
                cmdText.Append(" /FP");
            }
            if (PrintByteSizes)
            {
                cmdText.Append(" /BYTES");
            }
            if (NoFileSizeLog)
            {
                cmdText.Append(" /NS");
            }
            if (NoFileClassLog)
            {
                cmdText.Append(" /NC");
            }
            if (NoFileNameLog)
            {
                cmdText.Append(" /NFL");
            }
            if (NoDirListLog)
            {
                cmdText.Append(" /NDL");
            }
            if (NoProgress)
            {
                cmdText.Append(" /NP");
            }
            if (ShowEstTimeOfArrival)
            {
                cmdText.Append(" /ETA");
            }
            if (!OutputLogFilePath.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /LOG:\"{0}\"", OutputLogFilePath);
            }
            if (!AppendOutputLogFilePath.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /LOG+:\"{0}\"", AppendOutputLogFilePath);
            }
            if (!UnicodeOutputLogFilePath.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /UNILOG:\"{0}\"", UnicodeOutputLogFilePath);
            }
            if (!AppendUnicodeOutputLogFilePath.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" /UNILOG+:\"{0}\"", AppendUnicodeOutputLogFilePath);
            }
            if (NoJobHeader)
            {
                cmdText.Append(" /NJH");
            }
            if (NoJobSummary)
            {
                cmdText.Append(" /NJS");
            }

            if (!AdditionalParams.IsNullOrWhiteSpace())
            {
                cmdText.AppendFormat(" {0}", AdditionalParams);
            }

            return(cmdText.ToString());
        }