2020-10-30 00:00:00 +00:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
|
* Copyright (c) Unity Technologies.
|
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
2020-03-19 00:00:00 +00:00
|
|
|
using System.IO;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Unity.VisualStudio.Editor
|
|
|
|
|
{
|
2020-10-30 00:00:00 +00:00
|
|
|
public interface IFileIO
|
|
|
|
|
{
|
|
|
|
|
bool Exists(string fileName);
|
2020-03-19 00:00:00 +00:00
|
|
|
|
2020-10-30 00:00:00 +00:00
|
|
|
string ReadAllText(string fileName);
|
|
|
|
|
void WriteAllText(string fileName, string content);
|
|
|
|
|
}
|
2020-03-19 00:00:00 +00:00
|
|
|
|
2020-10-30 00:00:00 +00:00
|
|
|
class FileIOProvider : IFileIO
|
|
|
|
|
{
|
|
|
|
|
public bool Exists(string fileName)
|
|
|
|
|
{
|
|
|
|
|
return File.Exists(fileName);
|
|
|
|
|
}
|
2020-03-19 00:00:00 +00:00
|
|
|
|
2020-10-30 00:00:00 +00:00
|
|
|
public string ReadAllText(string fileName)
|
|
|
|
|
{
|
|
|
|
|
return File.ReadAllText(fileName);
|
|
|
|
|
}
|
2020-03-19 00:00:00 +00:00
|
|
|
|
2020-10-30 00:00:00 +00:00
|
|
|
public void WriteAllText(string fileName, string content)
|
|
|
|
|
{
|
|
|
|
|
File.WriteAllText(fileName, content, Encoding.UTF8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|