示例#1
0
        /// <summary>Returns the type needed for the generator needs</summary>
        /// <param name="Version">The version of the generator to use</param>
        /// <param name="Variant">The variant of the generator to use</param>
        /// <param name="ForMultipleUUIDGeneration">Marks if there should be multiple items or single</param>
        /// <returns>Returns the type needed for the generator needs</returns>
        public static Type GetContext(Int32 Version, Int32 Variant, Boolean ForMultipleUUIDGeneration = false)
        {
            GeneratorInfo Info = UUIDFactory.GetInfo(Version, Variant);

            return(ForMultipleUUIDGeneration ?
                   Info.ContextType.MakeArrayType() :
                   Info.ContextType);
        }
示例#2
0
 /// <summary>Creates a new instance of <see cref="UUIDFactory"/></summary>
 static UUIDFactory()
 {
     UUIDFactory._Generators = new GeneratorInfo[5][];
     UUIDFactory.Load();
 }
        /// <summary>Generate a <see cref="UUID"/>[] using the specified version and variant and specified amount</summary>
        /// <param name="Amount">The amount of UUID to generate</param>
        /// <param name="Version">The version of the generator</param>
        /// <param name="Variant">The variant of the generator</param>
        /// <param name="Context">The context needed to generate the UUID(s)</param>
        /// <returns>Generate a <see cref="UUID"/>[] using the specified version and variant and specified amount</returns>
        public static UUID[] CreateUUIDs(Int32 Amount, Int32 Version, Int32 Variant, Object[] Context = default)
        {
            IUUIDGenerator generator = UUIDFactory.CreateGenerator(Version, Variant);

            return(generator.Generate(Amount, Context));
        }
        /// <summary>Generate a <see cref="UUID"/> using the specified version and variant</summary>
        /// <param name="Version">The version of the generator</param>
        /// <param name="Variant">The variant of the generator</param>
        /// <param name="Context">The context needed to generate the UUID(s)</param>
        /// <returns>Generate a <see cref="UUID"/> using the specified version and variant and specified amount</returns>
        public static UUID CreateUUID(Int32 Version, Int32 Variant, Object Context = default)
        {
            IUUIDGenerator generator = UUIDFactory.CreateGenerator(Version, Variant);

            return(generator.Generate(Context));
        }
示例#5
0
        /// <summary>Returns if the specified generator needs context</summary>
        /// <param name="Version">The version of the generator to use</param>
        /// <param name="Variant">The variant of the generator to use</param>
        /// <returns>Returns if the specified generator needs context</returns>
        public static Boolean?NeedContext(Int32 Version, Int32 Variant)
        {
            GeneratorInfo Info = UUIDFactory.GetInfo(Version, Variant);

            return(Info.NeedContext);
        }