예제 #1
0
 /// <param name="str">string for initialization</param>
 /// <param name="itype">determines the use of str</param>
 public QMakeConf(string str, InitType itype)
 {
     switch (itype)
     {
         case InitType.InitQtInstallPath:
             Init(new VersionInformation(str));
             break;
         case InitType.InitQMakeConf:
             Init(str);
             break;
     }
 }
예제 #2
0
 /// <summary>
 /// Loads and initializes PCKS#11 library
 /// </summary>
 /// <param name="factories">Factories to be used by Developer and Pkcs11Interop library</param>
 /// <param name="libraryPath">Library name or path</param>
 /// <param name="appType">Type of application that will be using PKCS#11 library</param>
 /// <param name="initType">Source of PKCS#11 function pointers</param>
 /// <returns>High level PKCS#11 wrapper</returns>
 public IPkcs11 CreatePkcs11(Pkcs11InteropFactories factories, string libraryPath, AppType appType, InitType initType)
 {
     return(new MockPkcs11(factories, libraryPath, appType, initType));
 }
 /// <summary>
 /// Loads and initializes PCKS#11 library
 /// </summary>
 /// <param name="factories">Factories to be used by Developer and Pkcs11Interop library</param>
 /// <param name="libraryPath">Library name or path</param>
 /// <param name="appType">Type of application that will be using PKCS#11 library</param>
 /// <param name="initType">Source of PKCS#11 function pointers</param>
 /// <returns>High level PKCS#11 wrapper</returns>
 public IPkcs11Library LoadPkcs11Library(Pkcs11InteropFactories factories, string libraryPath, AppType appType, InitType initType)
 {
     return(_factory.LoadPkcs11Library(factories, libraryPath, appType, initType));
 }
예제 #4
0
        /// <summary>
        /// Loads and initializes PCKS#11 library
        /// </summary>
        /// <param name="factories">Factories to be used by Developer and Pkcs11Interop library</param>
        /// <param name="libraryPath">Library name or path</param>
        /// <param name="appType">Type of application that will be using PKCS#11 library</param>
        /// <param name="initType">Source of PKCS#11 function pointers</param>
        public Pkcs11(Pkcs11Factories factories, string libraryPath, AppType appType, InitType initType)
            : this(factories, libraryPath)
        {
            _logger.Debug("Pkcs11({0})::ctor3", _libraryPath);

            try
            {
                _logger.Info("Loading PKCS#11 library {0}", _libraryPath);
                _p11 = new LowLevelAPI80.Pkcs11(_libraryPath, (initType == InitType.WithFunctionList));
                Initialize(appType);
            }
            catch
            {
                if (_p11 != null)
                {
                    _logger.Info("Unloading PKCS#11 library {0}", _libraryPath);
                    _p11.Dispose();
                    _p11 = null;
                }

                throw;
            }
        }
예제 #5
0
        /// <summary>
        /// Initializes a new environment for the GOL instance
        /// </summary>
        /// <param name="sizeX"></param>
        /// <param name="it"></param>
        /// <param name="sizeY"></param>
        /// <param name="prob"></param>
        internal void Init(int sizeX, InitType it, int sizeY = -1, float prob = 0.3f)
        {
            // check whether we want a square environment
            if (sizeY == -1)
            {
                sizeY = sizeX;
            }

            this.sizeX      = sizeX;
            this.sizeY      = sizeY;
            this.generation = 1;
            bool[,] init    = new bool[sizeX, sizeY];
            this.profile    = new int[sizeX, sizeY];

            switch (it)
            {
            case InitType.Random:
                RandomInit(init, prob);
                break;

            case InitType.Empty:
                // reuse random init method with zero probability
                RandomInit(init, 0);
                break;

            case InitType.Full:
                // reuse random init method with 100% probability
                RandomInit(init, 1);
                break;

            case InitType.FullLine:
                LineInit(init, true);
                break;

            case InitType.HalfLine:
                LineInit(init, false);
                break;

            case InitType.Pentamino:
                PentominoInit(init);
                break;

            case InitType.Diagonal:
                DiagonalInit(init);
                break;

            case InitType.Gleiter:
                GleiterInit(init);
                break;

            case InitType.Blinker:
                BlinkerInit(init);
                break;

            default:
                throw new Exception("Init type is not supported");
            }

            this.envir = (bool[, ])init.Clone();
            this.init  = init;
            UpdateProfile(this.init);
        }
예제 #6
0
 /// <summary>
 /// Create an instance of ACH-1 with the specified hash input type.
 /// </summary>
 /// <param name="initType">The initialization type for the input.</param>
 public ACH1(InitType initType) => this.initType = initType;
예제 #7
0
        // Note: ToString() is tested implicitly by Check()

        private (ITestCollection, ITestCollection) Startup(TestableType testableType, InitType initType)
        {
            var initial = initType switch
            {
                InitType.Empty => new int[] { },
                InitType.Single => new int[] { 1 },
                InitType.Asc => new int[] { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 },
                InitType.Desc => new int[] { 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 },
                InitType.Mixed => new int[] { 0, 2, -2, 5, -4, 1, 3, -1, -3, 4, -5 },
                _ => throw new ArgumentException("Unknown InitType"),
            };

            ITestCollection collection = testableType switch
            {
                TestableType.ArrayList => new ArrayList(),
                TestableType.SortedArrayList => new SortedArrayList(),
                TestableType.LinkedList => new LinkedList(),
                TestableType.ArrayStack => new ArrayStack(),
                TestableType.LinkedQueue => new LinkedQueue(),
                TestableType.BinarySearchTree => new BinarySearchTree(),
                _ => throw new ArgumentException("Unknown TestableType"),
            };

            var expected = new ControlList(collection.GetType());

            expected.Initialize(initial);
            collection.Initialize(initial);

            Check(expected, collection);
            return(expected, collection);
        }
예제 #8
0
 public Initialize(InitType InitType = InitType.InitializeAsync)
 {
 }
예제 #9
0
        /// <summary>
        /// Loads and initializes PCKS#11 library
        /// </summary>
        /// <param name="factories">Factories to be used by Developer and Pkcs11Interop library</param>
        /// <param name="libraryPath">Library name or path</param>
        /// <param name="appType">Type of application that will be using PKCS#11 library</param>
        /// <param name="initType">Source of PKCS#11 function pointers</param>
        public MockPkcs11Library(Pkcs11InteropFactories factories, string libraryPath, AppType appType, InitType initType)
            : base(factories, libraryPath)
        {
            _logger.Debug("MockPkcs11Library({0})::ctor2", _libraryPath);

            try
            {
                _logger.Info("Loading PKCS#11 library {0}", _libraryPath);
                _pkcs11Library = new LowLevelAPI81.MockPkcs11Library(libraryPath, (initType == InitType.WithFunctionList));
                Initialize(appType);
            }
            catch
            {
                if (_pkcs11Library != null)
                {
                    _logger.Info("Unloading PKCS#11 library {0}", _libraryPath);
                    _pkcs11Library.Dispose();
                    _pkcs11Library = null;
                }
                throw;
            }
        }
예제 #10
0
 /// <summary>
 /// Loads and initializes PCKS#11 library
 /// </summary>
 /// <param name="factories">Factories to be used by Developer and Pkcs11Interop library</param>
 /// <param name="libraryPath">Library name or path</param>
 /// <param name="appType">Type of application that will be using PKCS#11 library</param>
 /// <param name="initType">Source of PKCS#11 function pointers</param>
 /// <returns>High level PKCS#11 wrapper</returns>
 public IPkcs11 CreatePkcs11(Pkcs11Factories factories, string libraryPath, AppType appType, InitType initType)
 {
     return(_factory.CreatePkcs11(factories, libraryPath, appType, initType));
 }
예제 #11
0
 /// <summary>
 /// 码表初始化
 /// </summary>
 /// <param name="initType">初始化的类型</param>
 public CodeTable(InitType initType)
 {
     Init(initType);
 }