internal Artifact CreateFileData(FileDataVersionOne v1FileData, string key)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            Artifact fileData = null;

            if (v1FileData != null)
            {
                string parentKey   = v1FileData.ParentKey;
                int    parentIndex = parentKey == null
                    ? -1
                    : _v1FileKeytoV2IndexMap[parentKey];

                fileData = new Artifact
                {
                    Hashes      = v1FileData.Hashes?.Select(CreateHash).ToDictionary(p => p.Key, p => p.Value),
                    Length      = v1FileData.Length,
                    MimeType    = v1FileData.MimeType,
                    Offset      = v1FileData.Offset,
                    ParentIndex = parentIndex,
                    Properties  = v1FileData.Properties
                };

                fileData.Location           = ArtifactLocation.CreateFromFilesDictionaryKey(key, parentKey);
                fileData.Location.UriBaseId = v1FileData.UriBaseId;

                if (v1FileData.Contents != null)
                {
                    fileData.Contents = new ArtifactContent();

                    if (MimeType.IsTextualMimeType(v1FileData.MimeType))
                    {
                        fileData.Contents.Text = SarifUtilities.DecodeBase64String(v1FileData.Contents);
                    }
                    else
                    {
                        fileData.Contents.Binary = v1FileData.Contents;
                    }
                }
            }

            return(fileData);
        }
        internal FileData CreateFileData(FileDataVersionOne v1FileData)
        {
            FileData fileData = null;

            if (v1FileData != null)
            {
                fileData = new FileData
                {
                    Hashes     = v1FileData.Hashes?.Select(CreateHash).ToList(),
                    Length     = v1FileData.Length,
                    MimeType   = v1FileData.MimeType,
                    Offset     = v1FileData.Offset,
                    ParentKey  = v1FileData.ParentKey,
                    Properties = v1FileData.Properties
                };

                if (v1FileData.Uri != null)
                {
                    fileData.FileLocation = new FileLocation
                    {
                        Uri       = v1FileData.Uri,
                        UriBaseId = v1FileData.UriBaseId
                    };
                }

                if (v1FileData.Contents != null)
                {
                    fileData.Contents = new FileContent();

                    if (MimeType.IsTextualMimeType(v1FileData.MimeType))
                    {
                        fileData.Contents.Text = SarifUtilities.DecodeBase64String(v1FileData.Contents);
                    }
                    else
                    {
                        fileData.Contents.Binary = v1FileData.Contents;
                    }
                }
            }

            return(fileData);
        }