Пример #1
0
 public static void QueueDeletion(String FileOrDir)
 {
     var dh = new DeletionHelper(FileOrDir);
     QueuedDeletions.Enqueue(dh);
 }
Пример #2
0
            public void OnDeserialization(object sender)
            {
                //task: we have a extension, and a byte array of sound data.
                //reconstruct the file, and then add it to the statically instanced SoundManager.
                if (FileExtension.StartsWith(".")) FileExtension = FileExtension.Substring(1);
                String AcquiredFile = BCBlockGameState.GetTempFile(FileExtension);

                Debug.Print("OnDeserialization of " + this.Name);
                //write our data out to this file.
                FileStream writestream = new FileStream(AcquiredFile, FileMode.Create);
                writestream.Write(SoundData, 0, SoundData.Length);
                writestream.Close();
                //if a sound with the required key already exists, obliterate it. We Assume that this sound
                //is going to be "more important" in that we are either loading the level for a new game or we are opening in the editor and thus
                //the Sound Manager data should be up to date with this.
                BCBlockGameState.AddDeleter(AcquiredFile);
                if (BCBlockGameState.Soundman.HasSound(Name))
                {
                    //the sound exists... remove it.
                    BCBlockGameState.Soundman.RemoveSound(Name);

                }
                //now we can add our sound data...
                try
                {
                    BCBlockGameState.Soundman.AddSound(AcquiredFile, Name);
                    Tdel = new DeletionHelper(AcquiredFile);
                }
                catch(Exception q)
                {
                    Debug.Print("exception + " + q.Message + "occured...");

                }
            }