BExIS.IO.Transform.Output.AsciiWriter.CreateFile C# (CSharp) Метод

CreateFile() публичный Метод

return the filepath
public CreateFile ( long datasetId, long datasetVersionOrderNr, long dataStructureId, string title, string extention ) : string
datasetId long
datasetVersionOrderNr long
dataStructureId long
title string
extention string
Результат string
        public string CreateFile(long datasetId, long datasetVersionOrderNr, long dataStructureId, string title, string extention)
        {
            string dataPath = GetFullStorePath(datasetId, datasetVersionOrderNr, title, extention);

            try
            {
                if (!File.Exists(dataPath))
                {
                    File.Create(dataPath).Close();
                }

            }
            catch (Exception ex)
            {
                string message = ex.Message.ToString();
            }

            return dataPath;
        }

Same methods

AsciiWriter::CreateFile ( string filepath ) : string

Usage Example

Пример #1
0
        /// <summary>
        /// create a new file of given extension
        /// ns will be used to seperate from other files created of individual datasets
        /// </summary>
        /// <param name="ns">namespace</param>
        /// <param name="title"></param>
        /// <param name="ext"></param>
        /// <param name="writer"></param>
        /// <returns></returns>
        private string createDownloadFile(string ns, long datastructureId, string title, string ext, DataWriter writer, string[] columns = null)
        {
            ExcelWriter excelwriter = null;

            switch (ext)
            {
            // text based files
            case ".csv":
            case ".txt":
            case ".tsv":
                AsciiWriter asciiwriter = (AsciiWriter)writer;
                return(asciiwriter.CreateFile(ns, title, ext));

            // excel files
            case ".xlsx":
                excelwriter = (ExcelWriter)writer;
                return(excelwriter.CreateFile(ns, datastructureId, title, ext));

            case ".xlsm":
                excelwriter = (ExcelWriter)writer;
                excelwriter.VisibleColumns = columns;
                return(excelwriter.CreateFile(ns, datastructureId, title, ext));

            // no valid extension given
            default:
                return("");
            }
        }
All Usage Examples Of BExIS.IO.Transform.Output.AsciiWriter::CreateFile