Refactor and enhance codebase for maintainability
Refactored and reorganized the codebase to improve readability, performance, and maintainability. Introduced new interfaces and structs for better resource management, updated project configuration files, and refactored shader and graphics pipeline management. Improved error handling, code formatting, and removed unused code and namespaces. Updated DLL references and method signatures for consistency and maintainability.
This commit is contained in:
@@ -75,29 +75,29 @@ internal partial class ProjectService
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(projectDirectory) || !Directory.Exists(projectDirectory))
|
||||
{
|
||||
return Result<ProjectMetadataInfo>.Failure("Project directory is invalid or does not exist.");
|
||||
return Result<ProjectMetadataInfo>.Fail("Project directory is invalid or does not exist.");
|
||||
}
|
||||
|
||||
var projectAssetsPath = Path.Combine(projectDirectory, ASSETS_FOLDER);
|
||||
var projectConfigPath = Path.Combine(projectDirectory, CONFIG_FOLDER);
|
||||
if (!Directory.Exists(projectAssetsPath) || !Directory.Exists(projectConfigPath))
|
||||
{
|
||||
return Result<ProjectMetadataInfo>.Failure("Project folder structure is invalid.");
|
||||
return Result<ProjectMetadataInfo>.Fail("Project folder structure is invalid.");
|
||||
}
|
||||
|
||||
var metadataPath = Directory.GetFiles(projectDirectory, $"*.{ProjectMetadata.PROJECT_EXTENSION}", SearchOption.TopDirectoryOnly).FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(metadataPath) || !File.Exists(metadataPath))
|
||||
{
|
||||
return Result<ProjectMetadataInfo>.Failure("Project metadata file not found.");
|
||||
return Result<ProjectMetadataInfo>.Fail("Project metadata file not found.");
|
||||
}
|
||||
|
||||
var metadata = await LoadMetadataAsync(metadataPath);
|
||||
if (metadata == null)
|
||||
{
|
||||
return Result<ProjectMetadataInfo>.Failure("Project metadata file is corrupted or invalid.");
|
||||
return Result<ProjectMetadataInfo>.Fail("Project metadata file is corrupted or invalid.");
|
||||
}
|
||||
|
||||
return Result<ProjectMetadataInfo>.Success(new(metadataPath, metadata));
|
||||
return new ProjectMetadataInfo(metadataPath, metadata);
|
||||
}
|
||||
|
||||
private static async ValueTask SetupRequestFolderAsync(string projectDirectory, string templateDirectory)
|
||||
@@ -201,7 +201,7 @@ internal partial class ProjectService
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Result<ProjectMetadataInfo>.Failure($"Failed to create project: {e.Message}");
|
||||
return Result<ProjectMetadataInfo>.Fail($"Failed to create project: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ internal partial class ProjectService
|
||||
|
||||
if (await HasProjectAsync(result.value.Path))
|
||||
{
|
||||
return Result<ProjectMetadataInfo>.Failure("Project already exists.");
|
||||
return Result<ProjectMetadataInfo>.Fail("Project already exists.");
|
||||
}
|
||||
|
||||
await AddProjectAsync(result.value.Metadata.Name, result.value.Path);
|
||||
|
||||
Reference in New Issue
Block a user