public static void Save(Service service, DisaSettings settings)
        {
            lock (Lock)
            {
                var  path = GetPath(service);
                bool settingsFileExists = File.Exists(path);

                MemoryStream sw2;
                using (var sw = new MemoryStream())
                {
                    Save(sw, service.Information.Settings, settings);
                    sw2 = sw;
                }
                if (sw2 != null)
                {
                    File.WriteAllBytes(path, sw2.ToArray());
                    ServiceEvents.RaiseSettingsSaved(service);
                }

                if (!settingsFileExists)
                {
                    Analytics.RaiseServiceEvent(
                        Analytics.EventAction.ServiceSetup,
                        Analytics.EventCategory.Services,
                        service);
                }
            }
        }
示例#2
0
 public static void Save(Service service, DisaSettings settings)
 {
     lock (Lock)
     {
         var path = GetPath(service);
         using (var sw = new StreamWriter(path))
         {
             Save(sw, service.Information.Settings, settings);
         }
     }
 }
 public static void Save(Service service, DisaSettings settings)
 {
     lock (Lock)
     {
         var path = GetPath(service);
         using (var sw = new StreamWriter(path))
         {
             Save(sw, service.Information.Settings, settings);
         }
     }
 }
 public static void Save(Stream fs, Type settingsType, DisaSettings settings)
 {
     try
     {
         var serializerObj = new XmlSerializer(settingsType);
         serializerObj.Serialize(fs, settings);
     }
     catch (Exception ex)
     {
         Utils.DebugPrint("Failed to save settings for " + settings.GetType().Name + ": " + ex.Message);
         throw;
     }
 }
 public static void Save(Stream fs, Type settingsType, DisaSettings settings)
 {
     try
     {
         var serializerObj = new XmlSerializer(settingsType);
         serializerObj.Serialize(fs, settings);
     }
     catch (Exception ex)
     {
         Utils.DebugPrint("Failed to save settings for " + settings.GetType().Name + ": " + ex.Message);
         throw;
     }
 }
 public static void Save(Service service, DisaSettings settings)
 {
     lock (Lock)
     {
         var path = GetPath(service);
         MemoryStream sw2;
         using (var sw = new MemoryStream())
         {
             Save(sw, service.Information.Settings, settings);
             sw2 = sw;
         }
         if (sw2 != null)
         {
             File.WriteAllBytes(path, sw2.ToArray());
         }
     }
 }
示例#7
0
 public static void Save(Service service, DisaSettings settings)
 {
     lock (Lock)
     {
         var          path = GetPath(service);
         MemoryStream sw2;
         using (var sw = new MemoryStream())
         {
             Save(sw, service.Information.Settings, settings);
             sw2 = sw;
         }
         if (sw2 != null)
         {
             File.WriteAllBytes(path, sw2.ToArray());
         }
     }
 }
 public override bool Initialize(DisaSettings settings)
 {
     throw new NotImplementedException();
 }
示例#9
0
        public override bool Initialize(DisaSettings settings)
        {
            _settings = settings as TelegramSettings;
            _mutableSettings = MutableSettingsManager.Load<TelegramMutableSettings>();

            if (_settings.AuthKey == null)
            {
                return false;
            }

            return true;
        }
示例#10
0
 public abstract bool Initialize(DisaSettings settings);
示例#11
0
 public override bool Initialize(DisaSettings settings)
 {
     return(true);
 }
示例#12
0
 public override bool Initialize(DisaSettings settings)
 {
     throw new NotImplementedException();
 }