ZeroInstall.Publish.RetrievalMethodUtils.UpdateSize C# (CSharp) Method

UpdateSize() private static method

Updates DownloadRetrievalMethod.Size based on the file size of a local file.
private static UpdateSize ( [ retrievalMethod, [ filePath, [ executor ) : void
retrievalMethod [ The element to update.
filePath [ The path of the file to get the size from.
executor [ Used to apply properties in an undoable fashion.
return void
        private static void UpdateSize([NotNull] DownloadRetrievalMethod retrievalMethod, [NotNull] string filePath, [NotNull] ICommandExecutor executor)
        {
            long size = new FileInfo(filePath).Length;

            var archive = retrievalMethod as Archive;
            if (archive != null) size -= archive.StartOffset;

            if (retrievalMethod.Size != size)
                executor.Execute(new SetValueCommand<long>(() => retrievalMethod.Size, value => retrievalMethod.Size = value, newValue: size));
        }
        #endregion