Ejemplo n.º 1
0
 /// <summary>
 /// Set the default instance of <see cref="IdGen"/>.
 /// </summary>
 /// <param name="idGen">The instace of <see cref="IdGen"/>.</param>
 public static void SetDefault(IdGen idGen = null)
 {
     if (Instance != null)
     {
         throw new InvalidOperationException("Can't set default instance of IdGen twice.");
     }
     Instance = idGen ?? new IdGen();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Specify an unique id of current machine.
 /// </summary>
 ///  <param name="machineId">An unique id of current machine.</param>
 public static void SetMachineId(ushort machineId)
 {
     if (_instance != null)
     {
         throw new InvalidOperationException("Can't set machine id twice.");
     }
     _instance = new IdGen(machineId);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Specify an unique id of current machine.
 /// </summary>
 public static void Init(
     ushort machineId,
     byte machineIdBits = DefaultMachineIdBits,
     byte sequenceBits  = DefaultSequenceBits)
 {
     if (_instance != null)
     {
         throw new InvalidOperationException("Can't set machine id twice.");
     }
     _instance = new IdGen(machineId, machineIdBits, sequenceBits);
 }