53 lines
1.0 KiB
C#
53 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
namespace Notes.Desktop;
|
|
|
|
class FileService: IFileService
|
|
{
|
|
public string Combine(string args0, string args1)
|
|
{
|
|
return Path.Combine(args0, args1);
|
|
}
|
|
|
|
public string GetRandomFileName()
|
|
{
|
|
return Path.GetRandomFileName();
|
|
}
|
|
|
|
public IEnumerable<string> EnumerateFiles(string path, string patten)
|
|
{
|
|
return Directory.EnumerateFiles(path,patten);
|
|
}
|
|
|
|
public string GetFileName(string filename)
|
|
{
|
|
return Path.GetFileName(filename);
|
|
}
|
|
|
|
public string ReadAllText(string filename)
|
|
{
|
|
return File.ReadAllText(filename);
|
|
}
|
|
|
|
public DateTime GetLastWriteTime(string filename)
|
|
{
|
|
return File.GetLastWriteTime(filename);
|
|
}
|
|
|
|
public bool ExistsFile(string filename)
|
|
{
|
|
return File.Exists(filename);
|
|
}
|
|
|
|
public void Delete(string path)
|
|
{
|
|
File.Delete(path);
|
|
}
|
|
|
|
public void WriteAllText(string path, string text)
|
|
{
|
|
File.WriteAllText(path,text);
|
|
}
|
|
} |