2021-09-30 15:44:39 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2021-09-30 15:44:39 +08:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Database
|
|
|
|
|
{
|
|
|
|
|
public interface IModelFileManager<in TModel, in TFileModel>
|
|
|
|
|
where TModel : class
|
|
|
|
|
where TFileModel : class
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Replace an existing file with a new version.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">The item to operate on.</param>
|
|
|
|
|
/// <param name="file">The existing file to be replaced.</param>
|
|
|
|
|
/// <param name="contents">The new file contents.</param>
|
2021-11-29 17:08:02 +08:00
|
|
|
|
void ReplaceFile(TModel model, TFileModel file, Stream contents);
|
2021-09-30 15:44:39 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Delete an existing file.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">The item to operate on.</param>
|
|
|
|
|
/// <param name="file">The existing file to be deleted.</param>
|
|
|
|
|
void DeleteFile(TModel model, TFileModel file);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-12-02 16:17:12 +08:00
|
|
|
|
/// Add a new file. If the file already exists, it is overwritten.
|
2021-09-30 15:44:39 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">The item to operate on.</param>
|
|
|
|
|
/// <param name="contents">The new file contents.</param>
|
|
|
|
|
/// <param name="filename">The filename for the new file.</param>
|
|
|
|
|
void AddFile(TModel model, Stream contents, string filename);
|
|
|
|
|
}
|
|
|
|
|
}
|