/* * P4.Net * Copyright (c) 2007 Shawn Hladky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Text; using System.IO; namespace P4API { /// /// /// public abstract class P4Callback { private Encoding _encoding = null; internal void SetEncoding(Encoding encoding) { _encoding = (Encoding)encoding.Clone(); } private string _specDef = null; internal void SetSpecDef(string specDef) { _specDef = specDef; } /// /// Gets the spec def. /// /// The spec def. protected string SpecDef { get { return _specDef; } } /// /// Gets the content encoding. /// /// The content encoding. protected Encoding ContentEncoding { get { return _encoding; } } ///// ///// Diffs the specified f1. ///// ///// The f1. ///// The f2. ///// The diff flags. //public virtual void Diff(FileInfo f1, FileInfo f2, string diffFlags) //{ //} /// /// Edits the specified f1. /// /// The f1. public virtual void Edit(FileInfo f1) { } /// /// Prompts the specified MSG. /// /// The MSG. /// The RSP. public virtual void Prompt(string msg, ref string rsp) { } /// /// Finisheds this instance. /// public virtual void Finished() { // do nothing } /// /// Cancels this instance. /// /// public virtual bool Cancel() { return false; } /// /// Outputs the content. /// /// The buffer. /// if set to true [is text]. public virtual void OutputContent(byte[] buffer, bool IsText) { } /// /// Inputs the data. /// /// The buffer. public virtual void InputData(StringBuilder buffer) { } /// /// Outputs the record. /// /// The record. public virtual void OutputRecord(P4Record record) { } /// /// Outputs the message. /// /// The message. public abstract void OutputMessage(P4Message message); /// /// Outputs the info. /// /// The data. public virtual void OutputInfo(string data) { } /// /// Resolves the file. /// /// The merge data. /// public virtual MergeAction ResolveFile(MergeData mergeData) { return MergeAction.Quit; } } }