// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // AWS GameKit using AWS.GameKit.Common.Models; namespace AWS.GameKit.Common { /// /// Manages common file access patterns for AWS GameKit samples. /// public interface IFileManager { /// /// Gets the directory used by GameKit to store any metadata, should be broken down further according to your use-case. /// /// The file path for the GameKit save directory. public string GetGameKitSaveDirectory(); /// /// Enumerates all files in a directory with a name that matches the provided pattern. /// /// The relative or absolute path to the directory to search. /// The search pattern to match against file names in the specified path. Allows literal characters, as well as * and ? wildcards. /// An array of matching file names within the specified directory. public string[] ListFiles(string filePath, string pattern); /// /// Reads the contents of the specified file into a byte array. /// /// The absolute or relative path to the file. /// The raw contents of the file, in the form of a byte array. public byte[] ReadAllBytes(string filePath); /// /// Writes the contents of the provided byte array to the specified file. /// /// The absolute or relative path to the file. /// The raw data to be written to the file. public void WriteAllBytes(string filePath, byte[] data); /// /// Gets the Linux epoch time that the file was last modified in milliseconds. /// /// The absolute or relative path to the file. /// Epoch time when the file was last modified, in milliseconds public long GetFileLastModifiedMilliseconds(string filePath); /// /// Deletes the specified file. /// /// The absolute or relative path to the file. public void DeleteFile(string filePath); /// /// Checks if the specified file exists. /// /// The absolute or relative path to the file. /// True if the file specified exists, false otherwise. public bool FileExists(string filePath); } }