Ejemplo n.º 1
0
        public static HashFile CreateTextFile(HashDir parent, string name, string text)
        {
            var hashFile = CreateBaseFile(parent, name);
            var textFile = new TextFile();

            textFile.EncryptedTextContent = TextUtil.EncryptString(text);
            textFile.Story    = new Ink.Runtime.Story(text);
            hashFile.Content  = textFile;
            hashFile.FileType = HashFileType.Text;

            CacheFile(hashFile);

            return(hashFile);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates and returns a text file from the given serialized data.
        /// </summary>
        public static HashFile GetTextFileFromSerializedData(SerializedHashFileText serialized)
        {
            var file = GetFileFromSerializedData(serialized.File);

            file.FileType = HashFileType.Text;
            var txtFile = new TextFile();

            txtFile.Story = new Ink.Runtime.Story(serialized.TextAsset.text);
            StoryUtil.BindExternalFunctions(txtFile.Story);

            txtFile.EncryptedTextContent = TextUtil.EncryptString(txtFile.Story.ToString());
            file.Content = txtFile;
            return(file);
        }