mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-15 05:04:16 +01:00
.
This commit is contained in:
parent
7710cfadfa
commit
2d6fd6015d
88 changed files with 2304 additions and 383 deletions
40
GlamourerOld/Services/FilenameService.cs
Normal file
40
GlamourerOld/Services/FilenameService.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Designs;
|
||||
|
||||
namespace Glamourer.Services;
|
||||
|
||||
public class FilenameService
|
||||
{
|
||||
public readonly string ConfigDirectory;
|
||||
public readonly string ConfigFile;
|
||||
public readonly string DesignFileSystem;
|
||||
public readonly string MigrationDesignFile;
|
||||
public readonly string DesignDirectory;
|
||||
|
||||
public FilenameService(DalamudPluginInterface pi)
|
||||
{
|
||||
ConfigDirectory = pi.ConfigDirectory.FullName;
|
||||
ConfigFile = pi.ConfigFile.FullName;
|
||||
DesignFileSystem = Path.Combine(ConfigDirectory, "sort_order.json");
|
||||
MigrationDesignFile = Path.Combine(ConfigDirectory, "Designs.json");
|
||||
DesignDirectory = Path.Combine(ConfigDirectory, "designs");
|
||||
}
|
||||
|
||||
public IEnumerable<FileInfo> Designs()
|
||||
{
|
||||
if (!Directory.Exists(DesignDirectory))
|
||||
yield break;
|
||||
|
||||
foreach (var file in Directory.EnumerateFiles(DesignDirectory, "*.json", SearchOption.TopDirectoryOnly))
|
||||
yield return new FileInfo(file);
|
||||
}
|
||||
|
||||
public string DesignFile(Design design)
|
||||
=> DesignFile(design.Identifier.ToString());
|
||||
|
||||
public string DesignFile(string identifier)
|
||||
=> Path.Combine(DesignDirectory, $"{identifier}.json");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue