Beispiel #1
0
 /// <summary>
 /// This function tries to retrieve the data value and returns true if this was succesful
 /// </summary>
 /// <param name="key">The key at which data is stored</param>
 /// <param name="data">The string to which to write the data to</param>
 /// <param name="inherit"></param>
 /// <returns>True if the data was succesfully retrieved, false otherwise</returns>
 public bool TryGetData(string key, out dynamic data, bool inherit = false)
 {
     try
     {
         data = MtaShared.GetElementData(this.MTAElement, key, inherit);
         return(true);
     }
     catch (Exception)
     {
         data = "";
         return(false);
     }
 }
Beispiel #2
0
 /// <summary>
 /// This function tries to retrieve the data value and returns true if this was succesful
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="key">The key at which data is stored</param>
 /// <param name="data">The string to which to write the data to</param>
 /// <param name="inherit"></param>
 /// <returns>True if the data was succesfully retrieved, false otherwise</returns>
 public bool TryGetData <T>(string key, out T data, bool inherit = false)
 {
     try
     {
         data = (T)MtaShared.GetElementData(this.MTAElement, key, inherit);
         return(true);
     }
     catch (Exception)
     {
         data = default(T);
         return(false);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Gets element data
 /// </summary>
 /// <param name="key"></param>
 /// <param name="inherit"></param>
 /// <returns></returns>
 public dynamic GetData(string key, bool inherit = false)
 {
     return(MtaShared.GetElementData(this.MTAElement, key, inherit));
 }