Пример #1
0
 public AutoLogonSettings GetAutoLogonSettings()
 {
     if (_autoLogonSettings == null)
     {
         _autoLogonSettings = IOUtil.LoadObject <AutoLogonSettings>(_autoLogonSettingsFilePath);
     }
     return(_autoLogonSettings);
 }
Пример #2
0
        public void SaveAutoLogonSettings(AutoLogonSettings autoLogonSettings)
        {
            Trace.Info("Saving autologon settings.");
            if (File.Exists(_autoLogonSettingsFilePath))
            {
                // Delete existing autologon settings file first, since the file is hidden and not able to overwrite.
                Trace.Info("Delete existing autologon settings file.");
                IOUtil.DeleteFile(_autoLogonSettingsFilePath);
            }

            IOUtil.SaveObject(autoLogonSettings, _autoLogonSettingsFilePath);
            Trace.Info("AutoLogon settings Saved.");
            File.SetAttributes(_autoLogonSettingsFilePath, File.GetAttributes(_autoLogonSettingsFilePath) | FileAttributes.Hidden);
        }