コード例 #1
0
ファイル: Program.cs プロジェクト: r9r-dev/suid
        static void Main(string[] args)
        {
            System.Console.WriteLine("Suid");
            System.Console.WriteLine(Suid.NewSuid());
            System.Console.WriteLine();

            System.Console.WriteLine("Tiny Suid");
            System.Console.WriteLine(Suid.NewTinySuid());
            System.Console.WriteLine();

            System.Console.WriteLine("Url Friendly Suid");
            System.Console.WriteLine(Suid.NewUrlFriendlySuid());
            System.Console.WriteLine();

            System.Console.WriteLine("Filename Suid");
            System.Console.WriteLine(Suid.NewFilenameSuid());
            System.Console.WriteLine();

            System.Console.WriteLine("Letters Only Suid");
            System.Console.WriteLine(Suid.NewLettersOnlySuid());
            System.Console.WriteLine();

            System.Console.WriteLine("Guid to Suid");
            System.Console.WriteLine(Guid.NewGuid().ToSuid());
            System.Console.WriteLine();

            System.Console.WriteLine("Guid to Tiny Suid");
            System.Console.WriteLine(Guid.NewGuid().ToTinySuid());
            System.Console.WriteLine();

            System.Console.ReadKey();
        }
コード例 #2
0
ファイル: PrePassVisitor.cs プロジェクト: wangscript007/Fusee
 /// <summary>
 /// Creates a new instance of type LightResult.
 /// </summary>
 /// <param name="light">The LightComponent.</param>
 public LightResult(Light light)
 {
     Light         = light;
     WorldSpacePos = float3.Zero;
     Rotation      = float4x4.Identity;
     Id            = Suid.GenerateSuid();
 }
コード例 #3
0
ファイル: Texture.cs プロジェクト: wangscript007/Fusee
 /// <summary>
 /// Constructor initializes a Texture from a pixelData byte buffer, width and height in pixels and <see cref="ImagePixelFormat"/>.
 /// </summary>
 /// <param name="pixelData">The raw pixelData byte buffer that makes up the texture.</param>
 /// <param name="width">Width in pixels.</param>
 /// <param name="height">Height in pixels.</param>
 /// <param name="colorFormat">Provides additional information about pixel encoding.</param>
 /// <param name="generateMipMaps">Defines if mipmaps are created.</param>
 /// <param name="filterMode">Defines the filter mode <see cref="TextureFilterMode"/>.</param>
 /// <param name="wrapMode">Defines the wrapping mode <see cref="TextureWrapMode"/>.</param>
 public Texture(byte[] pixelData, int width, int height, ImagePixelFormat colorFormat, bool generateMipMaps = true, TextureFilterMode filterMode = TextureFilterMode.Linear, TextureWrapMode wrapMode = TextureWrapMode.Repeat)
 {
     SessionUniqueIdentifier = Suid.GenerateSuid();
     _imageData        = new ImageData(pixelData, width, height, colorFormat);
     DoGenerateMipMaps = generateMipMaps;
     FilterMode        = filterMode;
     WrapMode          = wrapMode;
 }
コード例 #4
0
ファイル: Texture.cs プロジェクト: wangscript007/Fusee
 /// <summary>
 /// Initialize a Texture from an existing IImageData. The input IImageData will be copied into this Texture via <seealso cref="Blt"/> command.
 /// </summary>
 /// <param name="imageData">The existing <see cref="IImageData"/> that will be copied to initialize a Texture instance.</param>
 /// <param name="generateMipMaps">Defines if mipmaps are created.</param>
 /// <param name="filterMode">Defines the filter mode <see cref="TextureFilterMode"/>.</param>
 /// <param name="wrapMode">Defines the wrapping mode <see cref="TextureWrapMode"/>.</param>
 public Texture(IImageData imageData, bool generateMipMaps = true, TextureFilterMode filterMode = TextureFilterMode.Linear, TextureWrapMode wrapMode = TextureWrapMode.Repeat)
 {
     SessionUniqueIdentifier = Suid.GenerateSuid();
     _imageData = new ImageData(
         new byte[imageData.Width * imageData.Height * imageData.PixelFormat.BytesPerPixel],
         imageData.Width, imageData.Height, imageData.PixelFormat);
     _imageData.Blt(0, 0, imageData);
     DoGenerateMipMaps = generateMipMaps;
     FilterMode        = filterMode;
     WrapMode          = wrapMode;
 }
コード例 #5
0
 /// <summary>
 /// Creates a new instance of type "WritableTexture".
 /// </summary>
 /// <param name="texType">Defines the type of the render texture.</param>
 /// <param name="colorFormat">The color format of the texture, <see cref="ImagePixelFormat"/></param>
 /// <param name="width">Width in px.</param>
 /// <param name="height">Height in px.</param>
 /// <param name="generateMipMaps">Defines if mipmaps are created.</param>
 /// <param name="filterMode">Defines the filter mode <see cref="TextureFilterMode"/>.</param>
 /// <param name="wrapMode">Defines the wrapping mode <see cref="TextureWrapMode"/>.</param>
 /// <param name="compareMode">The textures compare mode. If uncertain, leaf on NONE, this is only important for depth (shadow) textures (<see cref="TextureCompareMode"/>).</param>
 /// <param name="compareFunc">The textures compare function. If uncertain, leaf on LEESS, this is only important for depth (shadow) textures and if the CompareMode isn't NONE (<see cref="Compare"/>)</param>
 public WritableTexture(RenderTargetTextureTypes texType, ImagePixelFormat colorFormat, int width, int height, bool generateMipMaps = true, TextureFilterMode filterMode = TextureFilterMode.Linear, TextureWrapMode wrapMode = TextureWrapMode.Repeat, TextureCompareMode compareMode = TextureCompareMode.None, Compare compareFunc = Compare.Less)
 {
     SessionUniqueIdentifier = Suid.GenerateSuid();
     PixelFormat             = colorFormat;
     Width             = width;
     Height            = height;
     DoGenerateMipMaps = generateMipMaps;
     FilterMode        = filterMode;
     WrapMode          = wrapMode;
     TextureType       = texType;
     CompareMode       = compareMode;
     CompareFunc       = compareFunc;
 }
コード例 #6
0
        public async Task <User> SignUpAsync(SignUpRequest suRequest)
        {
            var existUser = await _uow.UserRepository.FindBy(u => u.Email == suRequest.Email).FirstOrDefaultAsync();;

            if (existUser != null)
            {
                if (suRequest.Social)
                {
                    return(existUser);
                }
                else
                {
                    throw new EmailInUseBadRequestException(_localizer);
                }
            }

            if (string.IsNullOrWhiteSpace(suRequest.Password) ||
                suRequest.Password.Length < 6 ||
                CheckStringWithoutSpecialChars(suRequest.Password) ||
                !CheckStringWithUppercaseLetters(suRequest.Password))
            {
                throw new PasswordRequirementsBadRequestException(_localizer);
            }

            //if (suRequest.Password != suRequest.ConfirmationPassword)
            //{
            //    throw new PasswordsDoesntMatchBadRequestException(_localizer);
            //}

            var passwordHash = GetSha256Hash(suRequest.Password);
            var user         = new User
            {
                Email      = suRequest.Email,
                FullName   = suRequest.FullName,
                BirthDate  = suRequest.Birthday,
                Phone      = suRequest.Phone,
                Password   = passwordHash,
                CreatedAt  = DateTime.UtcNow,
                ModifiedAt = DateTime.UtcNow,
                Gender     = (GenderEnum)suRequest.Gender,
                Identity   = Suid.NewLettersOnlySuid(),
                Status     = StatusEnum.ACTIVE //TODO: the validation is missing now. Fix this once we have the validation process in place.
            };

            await _uow.UserRepository.AddAsync(existUser);

            await _uow.CommitAsync();

            return(existUser);
        }
コード例 #7
0
        private async Task <string> GetUserNameAsync(string email)
        {
            var username = email.Split('@')[0];
            var exist    = await _uow.UserRepository.FindByAsync(u => u.Username == username);

            if (exist.Count > 0)
            {
                var validationObject = await ValidateUsernameAsync(username, email, "");

                if (validationObject.Suggestions.Count() == 0)
                {
                    username = username + "_" + Suid.NewLettersOnlySuid();
                }
                else
                {
                    username = validationObject.Suggestions.FirstOrDefault();
                }
            }
            return(username);
        }