protected override bool ValidateParameters()
        {
            base.ValidateParameters();

            var retVal = true;

            if (File.Exists(DestinationArchive))
            {
                if (OverwriteDestination == true)
                {
                    Log.LogMessage(MessageImportance.Low, $"{DestinationArchive} will be overwritten");
                }
                else
                {
                    Log.LogError($"'{DestinationArchive}' already exists. Did you forget to set '{nameof(OverwriteDestination)}' to true?");

                    retVal = false;
                }
            }

            SourceDirectory = Path.GetFullPath(SourceDirectory);

            SourceDirectory = SourceDirectory.EndsWith(Path.DirectorySeparatorChar.ToString())
                ? SourceDirectory
                : SourceDirectory + Path.DirectorySeparatorChar;

            if (!Directory.Exists(SourceDirectory))
            {
                Log.LogError($"SourceDirectory '{SourceDirectory} does not exist.");

                retVal = false;
            }

            return(retVal);
        }
Esempio n. 2
0
        public Configuration FixOptionalValues()
        {
            if (string.IsNullOrWhiteSpace(SourceDirectory))
            {
                return(this);
            }

            if (MinLineForDuplicate < 5)
            {
                MinLineForDuplicate = 5;
            }

            if (MinLineForFullMethodDuplicateCheck < 5)
            {
                MinLineForFullMethodDuplicateCheck = 5;
            }

            if (!SourceDirectory.EndsWith(@"\"))
            {
                SourceDirectory += @"\";
            }

            if (string.IsNullOrWhiteSpace(CacheFileName))
            {
                CacheFileName = Path.Combine(SourceDirectory, "XsDupFinderCache.db");
            }
            if (string.IsNullOrWhiteSpace(OutputDirectory))
            {
                OutputDirectory = SourceDirectory;
            }

            return(this);
        }