Example #1
0
    public override void Save()
    {
        string filestring = SavePath;

        Directory.CreateDirectory(filestring);
        DataContainer container = new DataContainer(FrameList, ReplayFps);

        //Save uncompressed
        if (!UseZip)
        {
            filestring += (FileName + "." + UncompressedFileExtension);
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(filestring, FileMode.OpenOrCreate);
            bf.Serialize(file, container);
            file.Close();
        }

        //If Zip is true, use Ionic.zip compression (smaller filesize, slower)
        else
        {
            filestring += (UseCompoundArchive?CompoundZipName:FileName) + ".zip";
            Compression.AddItemToCompoundArchive(filestring, FileName, container);
        }
        Debug.Log("Saved " + filestring);
    }
Example #2
0
    public void Save()
    {
        Player.Save();
        if (UseXml)
        {
            MultiReplayData data = new MultiReplayData(new FileInfo(Player.UseZip && Player.UseCompoundArchive ? Player.CompoundZipName : Player.FileName, Player.FileName, Player.UseZip));

            if (!Player.UseZip)
            {
                XmlSerializer serializer = new XmlSerializer(typeof(MultiReplayData));
                FileStream    file       = File.Open(Player.SavePath + "/" + Player.CustomDirectory + "/" + Player.FileName + ".txt", FileMode.OpenOrCreate);
                serializer.Serialize(file, data);
                file.Close();
            }
            else
            {
                string filestring = Player.SavePath + "/" + Player.CustomDirectory + "/" + (Player.UseCompoundArchive ? Player.CompoundZipName : Player.FileName) + ".zip";
                Compression.AddItemToCompoundArchive(filestring, Player.FileName + ".txt", data, new XmlSerializer(typeof(MultiReplayData)));
            }
        }
    }
Example #3
0
    public override void Save()
    {
        if (AudioSource != null && AudioSource.clip != null)
        {
            string filepath = SavePath;
            if (!UseZip)
            {
                filepath += FileName + "." + UncompressedFileExtension;

                // Make sure directory exists if user is saving to sub dir.
                Directory.CreateDirectory(SavePath);

                using (var stream = CreateEmpty(filepath))
                {
                    ConvertAndWrite(stream, AudioSource.clip);
                    WriteHeader(stream, AudioSource.clip);
                }
            }
            else
            {
                filepath += (UseCompoundArchive ? CompoundZipName : FileName) + ".zip";
                Directory.CreateDirectory(SavePath);
                using (var stream = new MemoryStream())
                {
                    byte emptyByte = new byte();

                    for (int i = 0; i < HeaderSize; i++) //preparing the header
                    {
                        stream.WriteByte(emptyByte);
                    }

                    ConvertAndWrite(stream, AudioSource.clip);
                    WriteHeader(stream, AudioSource.clip);
                    stream.Position = 0;
                    Compression.AddItemToCompoundArchive(stream, filepath, FileName + "." + UncompressedFileExtension);
                }
            }
        }
    }
Example #4
0
    public override void Save()
    {
        Directory.CreateDirectory(SavePath);

        Data.TextElements = new TextElement[SubtitleList.Count];
        for (int i = 0; i < SubtitleList.Count; i++)
        {
            Data.TextElements[i] = SubtitleList[i];
        }

        if (!UseZip)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(TextData));
            FileStream    file       = File.Open(SavePath + "/" + FileName + ".txt", FileMode.OpenOrCreate);
            serializer.Serialize(file, Data);
            file.Close();
        }
        else
        {
            string filestring = SavePath + "/" + (UseCompoundArchive ? CompoundZipName : FileName) + ".zip";
            Compression.AddItemToCompoundArchive(filestring, FileName + ".txt", Data, new XmlSerializer(typeof(TextData)));
        }
    }