Beispiel #1
0
        // save an image to file in the images directory
        private void saveImage(Bitmap image)
        {
            string dir = Directory + @"\" + imagedir;

            ImageFile = nextName(dir);
            image.Save(dir + @"\" + ImageFile);
            // hash the file to prevent tampering / vandalism
            imagehash = HashStat.ReadHash2(dir + @"\" + ImageFile);
        }
Beispiel #2
0
        // Method to save an audio stream
        private void saveSound(Stream audio)
        {
            string dir = directory + @"\" + sounddir;

            soundfile = nextName(dir);
            FileStream fs = new FileStream(dir + @"\" + soundfile, FileMode.CreateNew);

            readWriteStream(audio, fs);
            fs.Close();
            // The hash of the sound file prevents tampering / vandalism.
            soundhash = HashStat.ReadHash2(dir + @"\" + soundfile);
        }
Beispiel #3
0
 // Method to save a sound file.
 // The file is copied to the sounds directory with a serial name
 // and that name is saved with the Screen instance.
 private void saveSound(string file)
 {
     if (file.Length > 0)
     {
         string dir = directory + @"\" + sounddir;
         soundfile = nextName(dir);
         (new FileInfo(file)).CopyTo(dir + @"\" + soundfile);
         // The hash of the sound file prevents tampering / vandalism.
         soundhash = HashStat.ReadHash2(dir + @"\" + soundfile);
     }
     else
     {
         soundfile = null;
     }
 }