/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using System.IO; namespace JetBrains.Omea.OpenAPI { /// /// Manages the relationship between file extensions, MIME types and format resources. /// public interface IFileResourceManager { /// /// Registers a resource type for a file format resource. /// /// The name of the resource type. /// The display name of the resource type. /// The template for the display names of resources /// having the resource type. /// The flags of the resource type. /// The plugin which owns the resource type. /// The extensions corresponding to the resource type. void RegisterFileResourceType( string fileResType, string displayName, string resourceDisplayNameTemplate, ResourceTypeFlags flags, IPlugin ownerPlugin, params string[] extensions ); /// /// Removes the registration of the specified resource type as a file format /// resource type. /// /// The resource type for which the registration is removed. void DeregisterFileResourceType( string fileResType ); /// /// Associates a MIME type with a file format resource type. /// /// The file format resource type which is associated. /// The MIME type which is associated. void SetContentType( string fileResType, string contentType ); /// /// Returns the type of the file format resource which has been registered for the /// specified extension. /// /// The extension for which the resource type is retrieved. /// Resource type name, or null if no resource type has been registered /// for the extension. string GetResourceTypeByExtension( string extension ); /// /// Returns the stream from which the content of the specified file format resource /// can be loaded. /// /// The resource for which the stream is retrieved. /// The stream, or null if it was not possible to retrieve the stream. Stream GetStream( IResource resource ); /// /// Returns the stream reader from which the content of the specified file format /// resource can be loaded. /// /// The reader uses the encoding stored as the Charset property of the /// file format resource (if any) or the default encoding if the Charset property /// is not specified or is not a valid encoding name.. /// The resource for which the reader is retrieved. /// The stream, or null if it was not possible to retrieve the reader. StreamReader GetStreamReader( IResource resource ); /// /// Returns the name of a disk file containing the data of the specified /// file format resource. /// /// If the source of the specified resource is a file, returns the name /// of that file. If it's a different resource, saves the stream of the /// resource to a temporary file and returns the name of that file. /// After the plugin is done using the file, it must call /// to delete the temporary files which may have been /// created. /// /// The resource for which the file name is returned. /// The name of the file containing the data, or null if it was not possible /// to save the resource data to the file. string GetSourceFile( IResource fileResource ); /// /// Deletes the temporary files created by , if any. /// /// The resource for which the data was retrieved. /// The name of the file returned by . void CleanupSourceFile( IResource fileResource, string fileName ); /// /// Opens the specified format file in its associated application. /// /// If the source of the specified format resource is not a disk file, /// the resource is saved to a temporary file, which is then opened and deleted /// when the associated application is closed. /// The format resource to open. void OpenSourceFile( IResource fileResource ); /// /// Creates temp directory with unique name and returns its name. /// /// /// 1.0.2 string GetUniqueTempDirectory(); /// /// ID of the "Charset" property type. /// int PropCharset { get; } } }