internal static void OnStartup()
        {
            //Read config file
            ResponseEnvelopeWithDataResult <ConfigurationModel> callResult = ConfigurationManager.ReadConfigFromFile();

            if (callResult.CallSuccessfull)
            {
                UpdateConfig(callResult.DataResult);
            }
        }
Beispiel #2
0
 internal static ResponseEnvelopeWithDataResult <object> ReadFromXmlFile(string fileLocation, Type objectType)
 {
     if (string.IsNullOrEmpty(fileLocation))
     {
         return(null);
     }
     try
     {
         ResponseEnvelopeWithDataResult <object> result = new ResponseEnvelopeWithDataResult <object>();
         XmlSerializer deserializer = new XmlSerializer(objectType);
         StreamReader  reader       = new StreamReader(fileLocation);
         result.DataResult = deserializer.Deserialize(reader);
         reader.Close();
         result.CallSuccessfull = true;
         return(result);
     }
     catch (Exception ex)
     {
         return(new ResponseEnvelopeWithDataResult <object>(ex));
     }
 }