More cleanup and making some constants
This commit is contained in:
+4
-3
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Text;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
@@ -23,12 +24,12 @@ public class CoverArt
|
||||
#region Methods
|
||||
public string GenerateFilename(int flag)
|
||||
{
|
||||
const int length = 25;
|
||||
const string chars = "ABCDEF0123456789";
|
||||
int length = Constants.DirectoryPaths.FILENAME_LENGTH;
|
||||
string chars = Constants.DirectoryPaths.FILENAME_CHARACTERS;
|
||||
var random = new Random();
|
||||
var filename = new string(Enumerable.Repeat(chars, length).Select(s =>
|
||||
s[random.Next(s.Length)]).ToArray());
|
||||
var extension = Icarus.Constants.FileExtensions.JPG_EXTENSION;
|
||||
var extension = Constants.FileExtensions.JPG_EXTENSION;
|
||||
|
||||
return (flag == 0) ? filename : $"{filename}{extension}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user