Artemis.DAL.ProfileProvider.InsertGif C# (CSharp) Method

InsertGif() public static method

public static InsertGif ( IEnumerable profileModels, string layerName, Bitmap gifFile, string fileName ) : void
profileModels IEnumerable
layerName string
gifFile System.Drawing.Bitmap
fileName string
return void
        public static void InsertGif(IEnumerable<ProfileModel> profileModels, string layerName, Bitmap gifFile,
            string fileName)
        {
            // Extract the GIF file
            var gifDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\gifs";
            Directory.CreateDirectory(gifDir);
            var gifPath = gifDir + $"\\{fileName}.gif";
            gifFile.Save(gifPath);

            foreach (var profile in profileModels)
            {
                var gifLayer = profile.GetLayers().FirstOrDefault(l => l.Name == layerName);
                if (gifLayer == null)
                    continue;

                ((KeyboardPropertiesModel) gifLayer.Properties).GifFile = gifPath;
                AddOrUpdate(profile);
            }
        }