Example #1
0
        /// <summary>
        /// Saves the contents of this MemoryDataFile to disk and returns a disk DataFile corresponding to the new file.
        /// </summary>
        /// <param name="relativeOrAbsolutePath"> The path of the new file. </param>
        /// <param name="overwrite"> If this is false, don't save the data if the file already exists on disk. </param>
        /// <returns> Null if overwrite was set to false and a file already existed </returns>
        public DataFile ConvertToFileOnDisk(string relativeOrAbsolutePath, bool overwrite = true)
        {
            if (!overwrite && Utilities.SuccFileExists(relativeOrAbsolutePath))
            {
                return(null);
            }

            string path = Utilities.AbsolutePath(relativeOrAbsolutePath);

            File.WriteAllText(path, GetRawText());
            return(new DataFile(path));
        }
Example #2
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (null != Page)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            if (ShowErrorPanel)
            {
                Panel errorPanel = BuildPanel(Error, ErrorCssClass,
                                              Utilities.AbsolutePath(ErrorIconUrl));
                Controls.Add(errorPanel);
            }

            if (ShowMessagePanel)
            {
                Panel messagePanel = BuildPanel(Message, MessageCssClass,
                                                Utilities.AbsolutePath(MessageIconUrl));
                Controls.Add(messagePanel);
            }

            base.Render(writer);
        }