using System; namespace P4API { internal class P4ResultCallback : P4Callback { private P4BaseRecordSet _P4Result; public P4ResultCallback(P4BaseRecordSet p4Result) { this._P4Result = p4Result; } #region P4Callback Members public override void Edit(System.IO.FileInfo f1) { throw new P4API.Exceptions.FormCommandException(); } public override void Prompt(string msg, ref string rsp) { rsp = _P4Result.RaiseOnPromptEvent(msg); } public override MergeAction ResolveFile(MergeData mergeData) { // don't handle a merge action here throw new Exceptions.MergeNotImplemented(); } public override void Finished() { _P4Result.SpecDef = base.SpecDef; _P4Result.Finished(); } public override void OutputInfo(string data) { _P4Result.AddInfo(data); } public override bool Cancel() { return false; } public override void OutputContent(byte[] buffer, bool IsText) { if (IsText) { string data = base.ContentEncoding.GetString(buffer); _P4Result.AddInfo(data); } else { _P4Result.BinaryOutput = buffer; } } public override void InputData(System.Text.StringBuilder buffer) { buffer.Append(_P4Result.InputData); } public override void OutputRecord(P4Record record) { _P4Result.AddRecord(record); } public override void OutputMessage(P4Message message) { _P4Result.AddP4Message(message); //Console.WriteLine("{0}: {1}", (int)message.Severity, message.Identity); switch (message.Severity) { case P4MessageSeverity.Empty: // E_EMPTY (0) | no error _P4Result.AddString(message.Format()); break; case P4MessageSeverity.Info: // E_INFO (1) | information, not necessarily an error _P4Result.AddInfo(message.Format()); break; case P4MessageSeverity.Warning: // E_WARN (2) | a minor error occurred _P4Result.AddWarning(message.Format()); break; case P4MessageSeverity.Failed: // E_FAILED(3) | the command was used incorrectly _P4Result.AddError(message.Format()); break; case P4MessageSeverity.Fatal: // E_FATAL (4) | fatal error, the command can't be processed _P4Result.AddError(message.Format()); break; default: //TODO throw an error... unknown severity break; } } #endregion } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 6505 | Shawn Hladky |
P4.Net: Multiple Changes 1. Update samples to VS2008 and new bin paths 2. Update MSBuild sync tasks to have IgnoredWarnings parameter 3. Added public class for P4RecordsetCallback. This allows consumers to easily migrate code that uses Recordsets to also take advantage of callback hooks. 4. Reworked method signiture of RunCallback. Removed tagged parameter and added RunCallbackUnparsed method. Made Callback parameter first so command and arguments are next to one-another. Note: this is a BREAKING CHANGE if you are using callbacks. 5. Reworked so switching between tagged and untagged runs will not disconnect/reconnect. 6. Add initial work for a file diffing object. |
||
#4 | 6457 | Shawn Hladky |
P4.Net: Added form_save overload to allow arbitrary arguments (primarily for -u flag on submitted changelists) Added unit tests for Resolve workflow. Still need work on this and test partially fails. Updated some internal data structures to use generics Added documentation comments |
||
#3 | 6353 | Shawn Hladky |
P4.Net: Implemented diff functionality Implemented Merge functionality Converted print commands to the callback interface |
||
#2 | 6243 | Shawn Hladky | P4.Net: Change Callback from interface to abstract class | ||
#1 | 6238 | Shawn Hladky |
P4.Net: More work on callback interface. Run and RunUnparsed now use the callback interface under the covers. |