2019-11-14 14:19:52 +00:00
|
|
|
|
namespace BFR.DataModels
|
2019-11-14 14:14:21 +00:00
|
|
|
|
{
|
|
|
|
|
public class FileModel
|
|
|
|
|
{
|
|
|
|
|
public string OldName { get; }
|
|
|
|
|
public string OldFullName { get; }
|
|
|
|
|
public string OldExtension { get; }
|
|
|
|
|
public string OldDirectory { get; }
|
|
|
|
|
public string OldPath { get; }
|
|
|
|
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public string Extension { get; set; }
|
|
|
|
|
public string Directory { get; set; }
|
|
|
|
|
|
|
|
|
|
public string FullName
|
|
|
|
|
{
|
|
|
|
|
get => Extension != "" ? $"{Name}.{Extension}" : Name;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Name = value.LastIndexOf('.') >= 0 ? value.Substring(0, value.LastIndexOf('.')) : value;
|
|
|
|
|
Extension = value.LastIndexOf('.') >= 0 ? value.Substring(value.LastIndexOf('.') + 1, value.Length - value.LastIndexOf('.') - 1) : "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Path
|
|
|
|
|
{
|
|
|
|
|
get => $"{Directory}{FullName}";
|
|
|
|
|
set
|
|
|
|
|
{
|
2019-12-01 16:05:00 +00:00
|
|
|
|
FullName = value.Substring(value.LastIndexOf('/') + 1);
|
|
|
|
|
Directory = value.Substring(0, value.LastIndexOf('/') + 1);
|
2019-11-14 14:14:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public FileModel(string path) =>
|
|
|
|
|
(OldPath, OldExtension, OldFullName, OldDirectory, OldName) =
|
|
|
|
|
(Path = path, Extension, FullName, Directory, Name);
|
|
|
|
|
}
|
|
|
|
|
}
|