예제 #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
        // save the course after first saving the current files to the undo directory
        public void Save()
        {
            saveBackup();
            string file = directory + "/" + filename;

            serialize(file);
            serializeControl();
            hash.HashCode = HashStat.ReadHash(file);
            hash.Serialize(hashfile);
        }
예제 #3
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);
        }
예제 #4
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;
     }
 }
예제 #5
0
        // copy the current files to the undo directory
        private void saveBackup()
        {
            FileInfo fi = new FileInfo(directory + "/" + filename);

            if (fi.Exists)
            {
                UnDoCtr++;
                UnDoPos = 1 + UnDoCtr; // reset after save
                (new DirectoryInfo(directory + @"\" + undodir)).Create();
                string file = undoName(UnDoCtr);
                fi.CopyTo(file);
                control.Serialize(undoName(UnDoCtr, controlname));
                hash.HashCode = HashStat.ReadHash(file);
                hash.Serialize(undoName(UnDoCtr, hashname));
            }
        }