Пример #1
0
        private static string _SaveImage(CBase64Image imageDate, string name, string folder)
        {
            Image  avatarImage = imageDate.GetImage();
            string extension   = imageDate.GetImageType();

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            string file = CHelper.GetUniqueFileName(folder, name + "." + extension);

            avatarImage.Save(file);
            return(file);
        }
Пример #2
0
        private static CAvatar _AddAvatar(CBase64Image avatarData)
        {
            try
            {
                string filename = _SaveImage(avatarData, "snapshot", CConfig.ProfileFolders[0]);

                CAvatar avatar = CAvatar.GetAvatar(filename);
                if (avatar != null)
                {
                    CProfiles.AddAvatar(avatar);
                    return(avatar);
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }