Exemplo n.º 1
0
        public async static Task <ReconnectingSamHelper> CreateInstance(
            ReconnectingSamHelperSettings settings,
            CancellationToken token
            )
        {
            if (settings == null)
            {
                throw new ArgumentNullException(
                          MyNameof.GetLocalVarName(() => settings));
            }
            settings.CheckMe();
            var result = new ReconnectingSamHelper();

            result._settings = settings;
            await result.InitImpl(token).ConfigureAwait(false);

            result._session = result._currentImplementationHelper.Session;
            if (
                string.IsNullOrWhiteSpace(
                    settings.ImplementationHelperSettings.SessionPrivateKeys
                    )
                )
            {
                settings.ImplementationHelperSettings.SessionPrivateKeys
                    = result._session.PrivateKey;
            }
            result._stateHelper.SetInitializedState();
            return(result);
        }
Exemplo n.º 2
0
 public ReconnectingSamHelperSettings(
     ReconnectingSamHelperSettings copyFrom)
 {
     TimeoutOnIoException = copyFrom.TimeoutOnIoException;
     DelayOnConnectFailed = copyFrom.DelayOnConnectFailed;
     if(copyFrom.ImplementationHelperSettings != null)
         ImplementationHelperSettings = new SamHelperSettings(
             copyFrom.ImplementationHelperSettings);
 }
Exemplo n.º 3
0
 public ReconnectingSamHelperSettings(
     ReconnectingSamHelperSettings copyFrom)
 {
     TimeoutOnIoException = copyFrom.TimeoutOnIoException;
     DelayOnConnectFailed = copyFrom.DelayOnConnectFailed;
     if (copyFrom.ImplementationHelperSettings != null)
     {
         ImplementationHelperSettings = new SamHelperSettings(
             copyFrom.ImplementationHelperSettings);
     }
 }
Exemplo n.º 4
0
 public async static Task<ReconnectingSamHelper> CreateInstance(
     ReconnectingSamHelperSettings settings,
     CancellationToken token
 )
 {
     if(settings == null)
         throw new ArgumentNullException(
             MyNameof.GetLocalVarName(() => settings));
     settings.CheckMe();
     var result = new ReconnectingSamHelper();
     result._settings = settings;
     await result.InitImpl(token).ConfigureAwait(false);
     result._session = result._currentImplementationHelper.Session;
     if (
         string.IsNullOrWhiteSpace(
             settings.ImplementationHelperSettings.SessionPrivateKeys
         )
     )
         settings.ImplementationHelperSettings.SessionPrivateKeys 
             = result._session.PrivateKey;
     result._stateHelper.SetInitializedState();
     return result;
 }