Skip to content

Commit

Permalink
added importing of project files
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Aug 28, 2024
1 parent 0407685 commit 2565b01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
13 changes: 2 additions & 11 deletions AudioCuesheetEditor/Model/IO/Projectfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace AudioCuesheetEditor.Model.IO
{
public class Projectfile
public class Projectfile(Cuesheet cuesheet)
{
public const String MimeType = "text/*";
public const String FileExtension = ".ace";
Expand All @@ -39,16 +39,7 @@ public class Projectfile
return JsonSerializer.Deserialize<Cuesheet>(json, Options);
}

public Projectfile(Cuesheet cuesheet)
{
if (cuesheet == null)
{
throw new ArgumentNullException(nameof(cuesheet));
}
Cuesheet = cuesheet;
}

public Cuesheet Cuesheet { get; private set; }
public Cuesheet Cuesheet { get; private set; } = cuesheet;

/// <summary>
/// Generate a ProjectFile
Expand Down
2 changes: 2 additions & 0 deletions AudioCuesheetEditor/Pages/ViewModeImport.razor
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ along with Foobar. If not, see
<ModalDialog @ref="modalDialog" />

@code {
//TODO: Hide fileContent if importing a project file
//TODO: Hide edit import options im importing a cuesheet file
String selectedStep = "selectFiles";
String dragNDropUploadFilter = String.Join(',', TextImportfile.MimeType, Cuesheet.FileExtension, Projectfile.FileExtension);
Boolean cuesheetDataVisible = true;
Expand Down
15 changes: 7 additions & 8 deletions AudioCuesheetEditor/Services/IO/ImportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ public async Task<Dictionary<IFileEntry, ImportFileType>> ImportFilesAsync(IEnum
{
if (IOUtility.CheckFileMimeType(file, Projectfile.MimeType, Projectfile.FileExtension))
{
//TODO
//var fileContent = await ReadFileContentAsync(file);
//var cuesheet = Projectfile.ImportFile(fileContent.ToArray());
//if (cuesheet != null)
//{
// _sessionStateContainer.ImportCuesheet = cuesheet;
//}
//importFileTypes.Add(file, ImportFileType.ProjectFile);
var fileContent = await ReadFileContentAsync(file);
var cuesheet = Projectfile.ImportFile(fileContent.ToArray());
if (cuesheet != null)
{
_sessionStateContainer.ImportCuesheet = cuesheet;
}
importFileTypes.Add(file, ImportFileType.ProjectFile);
}
if (IOUtility.CheckFileMimeType(file, Cuesheet.MimeType, Cuesheet.FileExtension))
{
Expand Down

0 comments on commit 2565b01

Please sign in to comment.