kOS.Archive.SaveFile C# (CSharp) Méthode

SaveFile() public méthode

public SaveFile ( File file ) : bool
file System.IO.File
Résultat bool
        public override bool SaveFile(File file)
        {
            base.SaveFile(file);

            if (!CheckRange())
            {
                throw new kOSException("Volume is out of range.");
            }

            Directory.CreateDirectory(ArchiveFolder);

            try
            {
                using (StreamWriter outfile = new StreamWriter(ArchiveFolder + file.Filename + ".txt", false))
                {
                    String fileBody = file.Serialize();

                    if (Application.platform == RuntimePlatform.WindowsPlayer)
                    {
                        // Only evil windows gets evil windows line breaks
                        fileBody = fileBody.Replace("\n", "\r\n");
                    }

                    outfile.Write(fileBody);
                }
            }
            catch (Exception e)
            {
                return false;
            }

            return true;
        }