Exemplo n.º 1
0
        /// <summary>
        /// Write a text file out with metadata that can be used if the application is closed and reopened to read logs again
        /// </summary>
        /// <param name="CacheRecord">Complete record to write out containing cache information</param>
        private ReturnCodeStruct WriteStatusCacheFile(LogRecord CacheRecord)
        {
            log.Debug("");
            log.Debug("CacheRecord - " + CacheRecord.ToJSON());

            ReturnCodeStruct returnValue;

            try
            {
                System.IO.File.WriteAllText(this.GetStatusCacheFilePath(), CacheRecord.ToJSON());
                returnValue = new ReturnCodeStruct { Status = true, Message = "" };
            }
            catch(Exception ex)
            {
                log.Error(ex);
                returnValue = new ReturnCodeStruct { Status = false, Message = ex.Message};
            }

            return returnValue;
        }