Bottles.Services.Remote.AssemblyRequirement.ShouldCopyFile C# (CSharp) Метод

ShouldCopyFile() публичный Метод

public ShouldCopyFile ( string fileName, string directory ) : bool
fileName string
directory string
Результат bool
        public bool ShouldCopyFile(string fileName, string directory)
        {
            if (!fileSystem.FileExists(fileName)) return true;

            if (_copyMode == AssemblyCopyMode.Always) return true;

            if (_copyMode == AssemblyCopyMode.SemVerCompatible && Path.GetExtension(fileName) == ".dll")
            {
                var sourceVersion = _assembly.GetName().Version;
                var currentVersion = AssemblyVersionOf(fileName);

                if (!IsSemVerCompatible(sourceVersion, currentVersion))
                {
                    var template = "The versions of {0} in the source {1} ({2}) and destination directory {3} ({4}) are incompatible";
                    throw new Exception(template.ToFormat(_assembly.GetName().Name, _assembly.Location, sourceVersion.ToString(), directory, currentVersion.ToString()));
                }
            }

            return false;
        }