public static OperationResult<SecurityConfiguration> GetSecurityConfiguration()
		{
			string error = "";
			var securityConfiguration = new SecurityConfiguration();
			try
			{
				var configDirectory = AppDataFolderHelper.GetServerAppDataPath("Config");
				if (File.Exists(Path.Combine(configDirectory, "SecurityConfiguration.xml")))
				{
					if (!File.Exists(AppDataFolderHelper.GetServerAppDataPath("Config" + Path.DirectorySeparatorChar + ".." + Path.DirectorySeparatorChar + "SecurityConfiguration.xml")))
						File.Copy(Path.Combine(configDirectory, "SecurityConfiguration.xml"), AppDataFolderHelper.GetServerAppDataPath("Config" + Path.DirectorySeparatorChar + ".." + Path.DirectorySeparatorChar + "SecurityConfiguration.xml"));
					File.Delete(Path.Combine(configDirectory, "SecurityConfiguration.xml"));
				}
				securityConfiguration = (SecurityConfiguration)GetConfiguration("SecurityConfiguration.xml", typeof(SecurityConfiguration));
				securityConfiguration.AfterLoad();
			}
			catch (Exception ex)
			{
				error = ex.Message;
			}
			return OperationResult<SecurityConfiguration>.FromError(error, securityConfiguration);
		}
Example #2
0
		public void SetSecurityConfiguration(Guid clientUID, SecurityConfiguration securityConfiguration)
		{
			securityConfiguration.Version = new ConfigurationVersion() { MinorVersion = 1, MajorVersion = 1 };
			ZipSerializeHelper.Serialize(securityConfiguration, Path.Combine(AppDataFolderHelper.GetServerAppDataPath(), "SecurityConfiguration.xml"));
		}