#93: Making some changes to how the file extension is determined
This commit is contained in:
@@ -100,6 +100,7 @@ public class MetadataRetriever
|
||||
}
|
||||
|
||||
|
||||
|
||||
var fileType = FileTypeChecker.FileTypeValidator.GetFileType(fileStream);
|
||||
Console.WriteLine($"Filetype: {fileType}");
|
||||
Console.WriteLine($"Extension: {fileType.Extension}");
|
||||
@@ -108,6 +109,20 @@ public class MetadataRetriever
|
||||
}
|
||||
}
|
||||
|
||||
public string FileExtensionType(string path)
|
||||
{
|
||||
var extensionRaw = System.IO.Path.GetExtension(path);
|
||||
|
||||
if (extensionRaw[0] == '.')
|
||||
{
|
||||
return extensionRaw.Substring(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return extensionRaw;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSupportedFile(IFormFile file)
|
||||
{
|
||||
var supportedTypes = this._supportedAudioFileTypes;
|
||||
@@ -124,6 +139,22 @@ public class MetadataRetriever
|
||||
return supportedTypes.Contains(extensionType);
|
||||
}
|
||||
|
||||
public bool IsSupportedFile(string path)
|
||||
{
|
||||
var supportedTypes = this._supportedAudioFileTypes;
|
||||
this._supportedImageFileTypes.ForEach(t =>
|
||||
{
|
||||
if (!supportedTypes.Contains(t))
|
||||
{
|
||||
supportedTypes.Add(t);
|
||||
}
|
||||
});
|
||||
|
||||
var extensionType = this.FileExtensionType(path).ToLower();
|
||||
|
||||
return supportedTypes.Contains(extensionType);
|
||||
}
|
||||
|
||||
public Song RetrieveMetaData(string filePath)
|
||||
{
|
||||
Song song = new Song();
|
||||
|
||||
Reference in New Issue
Block a user