internal LogsharkRequestTarget(string requestedTarget) { if (String.IsNullOrWhiteSpace(requestedTarget)) { throw new LogsharkRequestInitializationException("Invalid request: No logset target specified!"); } // A target can either be an MD5 logset hash or a file/UNC path. if (PathHelper.IsPathToExistingResource(requestedTarget)) { // If target is a file or directory, we want to use the absolute path and trim any trailing // directory separator characters to establish consistency. string absolutePath = PathHelper.GetAbsolutePath(requestedTarget); if (PathHelper.IsDirectory(absolutePath)) { IsDirectory = true; UncompressedSize = DiskSpaceHelper.GetDirectorySize(absolutePath); } else { IsFile = true; UncompressedSize = 0; CompressedSize = DiskSpaceHelper.GetFileSize(absolutePath); } Target = absolutePath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); } else if (requestedTarget.IsValidMD5()) { // Since this isn't a path to a file or directory and it looks like an MD5, we assume it is. IsHashId = true; Target = requestedTarget; } else { throw new LogsharkRequestInitializationException("Target must be a valid file, directory or MD5 hash!"); } OriginalTarget = Target; }