예제 #1
0
		public OperationResult<bool> Connect(FSAgent fsAgent, bool isPing)
		{
			try
			{
				FiresecSerializedClient = new FiresecSerializedClient();
				FiresecSerializedClient.FSAgent = fsAgent;
				FiresecSerializedClient.SubscribeFsAgentEvents();

                ConfigurationConverter = new ConfigurationConverter(FiresecSerializedClient);
				var result = ConfigurationConverter.ConvertMetadataFromFiresec();
                if (!result.HasError)
                {
                    ConfigurationCash.DriversConfiguration = result.Result;
                    return new OperationResult<bool>() { Result = true };
                }
                else
                {
					return new OperationResult<bool>(result.Error);
                }
			}
			catch (Exception e)
			{
				Logger.Error(e, "FiresecDriver.Synchronyze");
                LoadingErrorManager.Add(e);
                return new OperationResult<bool>(e.Message);
			}
		}
		public FiresecDriver(int lastJournalNo, string FS_Address, int FS_Port, string FS_Login, string FS_Password, bool isPing)
		{
			LoadingErrors = new StringBuilder();
			try
			{
				FiresecSerializedClient = new FiresecSerializedClient();
				FiresecSerializedClient.Connect(FS_Address, FS_Port, FS_Login, FS_Password, isPing);
				ConfigurationConverter = new ConfigurationConverter()
				{
					FiresecSerializedClient = FiresecSerializedClient
				};
				ConfigurationConverter.ConvertMetadataFromFiresec();
			}
			catch (Exception e)
			{
				Logger.Error(e, "FiresecDriver.Synchronyze");
				FiresecDriver.LoadingErrors.Append(e.Message);
			}
		}