1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Reflection;
- using Microsoft.InformationProtection;
- using log4net;
- using Serilog;
- using Serilog.Core;
- namespace AipGateway.AIP
- {
- public abstract class AbstractManager : IDisposable
- {
- //private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private readonly ILogger _log;
- protected readonly string _clientId;
- public AbstractManager(Logger logger, string clientId)
- {
- _log = logger.ForContext<AbstractManager>();
- _clientId = clientId;
- }
- public int LastErrNo { get; internal set; }
- public string LastErrMsg { get; internal set; }
- protected void SetError(int errNo, string errMsg1, string errMsg2 = "", bool isThrowEx = true)
- {
- LastErrNo = errNo;
- if (errMsg2 == "")
- {
- LastErrMsg = errMsg1;
- }
- else
- {
- LastErrMsg = errMsg1 + "\r\n" + errMsg2;
- }
- _log.Error("AbstractManager::SetError ==> {0}, {1}, {2}", errNo, errMsg1, errMsg2);
- if (isThrowEx && LastErrNo != 0)
- {
- throw new AipFileException(errNo, LastErrMsg);
- }
- }
- public abstract bool CreateProfile(ref MipContext mipContext);
- public abstract bool CreateEngine(ref Identity identity, ref AuthDelegateImplementation authDelegate);
- public abstract void Dispose();
- }
- }
|