OpenKeyWord  Build Tag: jenkins-DoxyGen_EN-107, Build ID: 2015-03-08_20-51-06
 All Classes Namespaces Functions Variables Properties Pages
OKW.LogMessenger Class Reference

Public Member Functions

 LogMessenger (string fpsClassname)
 
string GetMessage (string MethodName, string TextKey)
 
string GetMessage (string MethodName, string TextKey, object Parameter_1)
 Gets the Message for the Methodename/TextKey with one Parametres. More...
 
string GetMessage (string MethodName, string TextKey, object Parameter_1, object Parameter_2)
 Gets the Message for the Methodename/TextKey with one Parametres. More...
 
string GetMessage (string MethodName, string TextKey, object Parameter_1, object Parameter_2, object Parameter_3)
 Gets the Message for the Methodename/TextKey with one Parametres. More...
 

Private Member Functions

void Init ()
 This constructor has no Parameter and uses the default values for the config-file and Actual/default language(=EN) More...
 
string ReadMessage (string ClassName, string MethodName, string TextKey)
 
Exceptions
OKWMessageNotFoundExceptionif a Message ist not found or if more then one Message is found for the Given Parmeter.
More...
 

Private Attributes

bool bInit = false
 
string cvsClassName = string.Empty
 
string MyXMLFile = string.Empty
 
XPathDocument MyXPathDocument
 
XPathNavigator MyXPathNavigator
 

Detailed Description

Author
Zoltan Hrabovszki
Date
2013_12_22

Constructor & Destructor Documentation

OKW.LogMessenger.LogMessenger ( string  fpsClassname)
Author
Zoltan Hrabovszki
Date
2013_12_22
117  {
118  this.cvsClassName = fpsClassname;
119  this.Init();
120  }

Member Function Documentation

string OKW.LogMessenger.GetMessage ( string  MethodName,
string  TextKey 
)

Gets the Message for the Methodename/TextKey without any Parametres.

Parameters
MethodNameName of the Method
TextKeyof the message
Returns
Log-Message for the given Parameter.
Author
Zoltan Hrabovszki
Date
2013.12.22
146  {
147  string lvs_Return = "Message Not Found!";
148 
149  lvs_Return = this.ReadMessage(this.cvsClassName, MethodName, TextKey);
150 
151  return lvs_Return;
152  }

Here is the caller graph for this function:

string OKW.LogMessenger.GetMessage ( string  MethodName,
string  TextKey,
object  Parameter_1 
)

Gets the Message for the Methodename/TextKey with one Parametres.

Parameters
MethodNameName of the Method
TextKeyof the message
Parameter_1One Value inserted in the Log-Message
Returns
Log-Message for the given Parameter.
Author
Zoltan Hrabovszki
Date
2013.12.22
176  {
177  string lvs_Return = string.Empty;
178 
179  lvs_Return = this.ReadMessage(this.cvsClassName, MethodName, TextKey);
180  lvs_Return = string.Format(lvs_Return, Parameter_1);
181 
182  return lvs_Return;
183  }
string OKW.LogMessenger.GetMessage ( string  MethodName,
string  TextKey,
object  Parameter_1,
object  Parameter_2 
)

Gets the Message for the Methodename/TextKey with one Parametres.

Parameters
MethodNameName of the Method
TextKeyof the message
Parameter_1First Value inserted in the Log-Message
Parameter_2Second Value inserted in the Log-Message
Returns
Log-Message for the given Parameter.
Author
Zoltan Hrabovszki
Date
2013.12.22
210  {
211  string lvs_Return = "Message Not Found!";
212 
213  lvs_Return = this.ReadMessage(this.cvsClassName, MethodName, TextKey);
214  lvs_Return = string.Format(lvs_Return, Parameter_1, Parameter_2);
215 
216  return lvs_Return;
217  }
string OKW.LogMessenger.GetMessage ( string  MethodName,
string  TextKey,
object  Parameter_1,
object  Parameter_2,
object  Parameter_3 
)

Gets the Message for the Methodename/TextKey with one Parametres.

Parameters
MethodNameName of the Method
TextKeyof the message
Parameter_1First Value inserted in the Log-Message
Parameter_2Second Value inserted in the Log-Message
Returns
Log-Message for the given Parameter.
Author
Zoltan Hrabovszki
Date
2013.12.22
245  {
246  string lvs_Return = "Message Not Found!";
247 
248  lvs_Return = this.ReadMessage(this.cvsClassName, MethodName, TextKey);
249  lvs_Return = string.Format(lvs_Return, Parameter_1, Parameter_2, Parameter_3);
250 
251  return lvs_Return;
252  }
void OKW.LogMessenger.Init ( )
private

This constructor has no Parameter and uses the default values for the config-file and Actual/default language(=EN)

Author
Zoltan Hrabovszki
Date
2013_12_22
266  {
267  if (!this.bInit)
268  {
269  try
270  {
271  this.MyXMLFile = System.IO.Path.Combine( OKW_Ini.Instance.OKW_Enviroment.PathLog, this.cvsClassName + ".xml");
272 
273  if (!System.IO.File.Exists(this.MyXMLFile))
274  {
275  System.Console.WriteLine("============================================================================================================");
276  System.Console.WriteLine("OKW Exception: File not found! -> '" + this.MyXMLFile + "'");
277  System.Console.WriteLine("============================================================================================================");
278 
279  throw new FileNotFoundException("File not found! The File was: '" + this.MyXMLFile + "'");
280  }
281  else
282  {
283  this.MyXPathDocument = new XPathDocument(this.MyXMLFile);
284  this.MyXPathNavigator = this.MyXPathDocument.CreateNavigator();
285  }
286 
287  this.bInit = true;
288  }
289  finally
290  {
291  System.Console.WriteLine(string.Empty);
292  }
293  }
294  }
string OKW.LogMessenger.ReadMessage ( string  ClassName,
string  MethodName,
string  TextKey 
)
private

Exceptions
OKWMessageNotFoundExceptionif a Message ist not found or if more then one Message is found for the Given Parmeter.

Parameters
ClassNameName of the Class.
MethodNameName of the Method.
TextKeyKey for the Text-Message.
Returns
Rreturns the Message for the given language or default language if given languae does not exist
_"Message Not Found!"_ will be returnd, if a doesn´s exist.
Author
Zoltan Hrabovszki
Date
2013_12_22
320  {
321  string lvsReturn = "Message Not Found!";
322  string myPath = "//Class[@name='" + ClassName + "']/Method[@name='" + MethodName + "']/Text[@key='" + TextKey + "']/ " + OKW.OKWLanguage.Instance.Language;
323 
324  XPathNodeIterator iter = this.MyXPathNavigator.Select(myPath);
325 
326  if (iter.Count < 1 || iter.Count > 1)
327  {
328  // Es wurde kein Wert gefunden -> Exception MsgNitFound auslösen...
329  throw new OKWMessageNotFoundException("Message not Found. Class: " + ClassName +
330  ", Method: " + MethodName +
331  ", TextKey: " + TextKey,
332  ", Gefunden Werte: " + iter.Count);
333  }
334  else
335  {
336  iter.MoveNext();
337  lvsReturn = iter.Current.Value;
338  }
339 
340  return lvsReturn;
341  }

The documentation for this class was generated from the following file: