コード例 #1
0
 public static void Save(Service service, DisaServiceUserSettings userSettings)
 {
     service.UserSettings = userSettings;
     var path = GetPath(service);
     using (var sw = new StreamWriter(path))
     {
         try
         {
             var serializerObj = new XmlSerializer(userSettings.GetType());
             serializerObj.Serialize(sw, userSettings);
         }
         catch (Exception ex)
         {
             Utils.DebugPrint("Failed to save service user settings for " + userSettings.GetType().Name
                 + ": " + ex.Message);
         }
     }
 }
コード例 #2
0
        public static void Save(Service service, DisaServiceUserSettings userSettings)
        {
            service.UserSettings = userSettings;
            var path = GetPath(service);

            using (var sw = new StreamWriter(path))
            {
                try
                {
                    var serializerObj = new XmlSerializer(userSettings.GetType());
                    serializerObj.Serialize(sw, userSettings);
                }
                catch (Exception ex)
                {
                    Utils.DebugPrint("Failed to save service user settings for " + userSettings.GetType().Name
                                     + ": " + ex.Message);
                }
            }
        }