示例#1
0
        internal bool ExportStrippedFile(string path)
        {
            if (path == string.Empty)
            {
                return(false);
            }

            string compiledText = FileCont.ToString(true);

            if (compiledText == string.Empty)
            {
                return(false);
            }

            File.WriteAllText(path, compiledText);
            return(true);
        }
示例#2
0
        internal bool SaveToFile(string path)
        {
            if (path == string.Empty)
            {
                return(false);
            }

            FileCont.Path = path;

            string compiledFileText = FileCont.ToString();

            if (compiledFileText == string.Empty)
            {
                return(false);
            }

            File.WriteAllText(FileCont.Path, compiledFileText);
            return(true);
        }
示例#3
0
        internal bool LoadFromString(string content)
        {
            try
            {
                if (content.Contains("- " + nameof(FileContainer.Message.Page.SpokenLine)))
                {
                    Deserializer yDeserializer = new DeserializerBuilder().WithTypeConverter(new ContainerTypeConverter()).Build();
                    FileCont = yDeserializer.Deserialize <FileContainer>(content);
                    return(true);
                }

                string[] splitContent = content.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
                return(FileCont.PopulateContainer(splitContent));
            }
            catch
            {
                return(false);
            }
        }