Exemplo n.º 1
0
 protected void SaveFile(string fileNameGif)
 {
     if (System.IO.File.Exists(fileNameGif))
     {
         System.IO.File.Delete(fileNameGif);
     }
     using (System.IO.FileStream fs = new System.IO.FileStream(fileNameGif, System.IO.FileMode.Create))
     {
         _gifEncoder.Save(fs);
     }
 }
Exemplo n.º 2
0
        public static void Save(string Output)
        {
            System.Windows.Media.Imaging.GifBitmapEncoder G = new System.Windows.Media.Imaging.GifBitmapEncoder();

            List <System.IO.FileStream> X = new List <System.IO.FileStream>();

            foreach (string Fi in Directory.GetFiles(tempDir, "*.png", SearchOption.TopDirectoryOnly))
            {
                System.IO.FileStream TempStream = new System.IO.FileStream(Fi, System.IO.FileMode.Open);
                System.Windows.Media.Imaging.BitmapFrame Frame = System.Windows.Media.Imaging.BitmapFrame.Create(TempStream);
                X.Add(TempStream);
                G.Frames.Add(Frame);
            }
            System.IO.FileStream FS = new System.IO.FileStream(Output, System.IO.FileMode.OpenOrCreate);
            G.Save(FS);
            FS.Close();

            foreach (System.IO.FileStream St in X)
            {
                St.Close();
            }
        }