// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Text;
using System.Threading;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Editor;
namespace ICSharpCode.SharpDevelop
{
///
/// File service.
///
public interface IFileService
{
///
/// Gets the default file encoding.
/// This property is thread-safe.
///
Encoding DefaultFileEncoding { get; }
///
/// Gets the content of the specified file.
/// If the file is currently open in SharpDevelop, retrieves a snapshot
/// of the editor content.
///
///
/// This method is thread-safe. This method involves waiting for the main thread, so using it while
/// holding a lock can lead to deadlocks.
///
ITextSource GetFileContent(FileName fileName);
///
ITextSource GetFileContent(string fileName);
///
/// Gets the file content for a file that is currently open.
/// Returns null if the file is not open.
///
///
/// This method is thread-safe. This method involves waiting for the main thread, so using it while
/// holding a lock can lead to deadlocks.
///
ITextSource GetFileContentForOpenFile(FileName fileName);
///
/// Gets the file content from disk, ignoring open files.
///
///
/// This method is thread-safe.
///
ITextSource GetFileContentFromDisk(FileName fileName, CancellationToken cancellationToken = default(CancellationToken));
}
}