示例#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);
        }
示例#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);
        }
示例#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;
     }
 }