- /*
- * 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.Collections;
- using System.Text;
- namespace P4API
- {
- public enum P4MessageSeverity
- {
- Empty = 0,
- Info = 1,
- Warning = 2,
- Failed = 3,
- Fatal = 4
- }
- public class P4Message
- {
- //private p4dn.Error _error = null;
- private Hashtable _vars = null;
- private string _format = null;
- private int _id = 0;
- private P4MessageSeverity _severity;
- internal P4Message(p4dn.Error error)
- {
- // cache all the data from the error so we don't have to implement IDisposable
- _vars = new Hashtable();
- error.GetVariables(_vars);
- _id = error.GetErrorID().code;
- _severity = (P4MessageSeverity) error.GetErrorID().Severity();
- _format = error.Fmt();
- }
- public override string ToString()
- {
- return this.Format();
- }
- public P4MessageSeverity Severity
- {
- get
- {
- return _severity;
- }
- }
- public string Format()
- {
- return _format;
- }
- public string[] Variables
- {
- get
- {
- string[] ret = new string[_vars.Keys.Count];
- int i = 0;
- foreach (string s in _vars.Keys)
- {
- ret[i] = s;
- i++;
- }
- return ret;
- }
- }
- public int Identity
- {
- get
- {
- return _id;
- }
- }
- public string GetValue(string var)
- {
- return (string)_vars[(string)var];
- }
- }
- }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 6335 | Jim Gomes | Branch P4.Net. | 17 years ago | |
//guest/shawn_hladky/P4.Net/main/src/P4API/P4Message.cs | |||||
#2 | 6238 | Shawn Hladky | P4.Net: More work on callback interface. Run and RunUnparsed now use the callback... interface under the covers. « |
17 years ago | |
#1 | 6182 | Shawn Hladky | P4.Net. First stab at a callback interface for real-time handling of perforce outpu...t. Upgrade to VS 2008. « |
17 years ago |