protected internal FileLoggerCallbackArgs(string filePath, FileLoggerAction action, FileLoggerResult status, Exception error = null)
 {
     FilePath = filePath;
     Action   = action;
     Status   = status;
     Error    = error;
 }
Exemple #2
0
        internal override void Close()
        {
            if (FileStream == null || _currentAction == FileLoggerAction.Closed)
            {
                return;
            }

            if (_currentAction != FileLoggerAction.Closing)
            {
                _currentAction = FileLoggerAction.Closing;
                InvokeFileActionEvent(FilePath, FileLoggerAction.Closing, FileLoggerResult.Success);
            }
            if (_isWriting)
            {
                return;
            }

            try
            {
                //FileStream.Flush();
                FileStream.Dispose();
                FileStream = null;

                if (!IsFileCompressionEnabled)
                {
                    InvokeFileActionEvent(FilePath, FileLoggerAction.Closed, FileLoggerResult.Success);
                    return;
                }
#if !UNITY_WSA
                CompressFile();
#else
                // TODO Implement for UWP
#endif
            }
            catch (Exception e)
            {
                InvokeFileActionEvent(FilePath, FileLoggerAction.Closed, FileLoggerResult.Error, e);
            }
            finally
            {
                _currentAction = FileLoggerAction.Closed;
            }
        }
Exemple #3
0
        internal static void InvokeFileActionEvent(EventHandler <FileLoggerCallbackArgs> callback,
                                                   object sender, string filePath, string text, byte[] data,
                                                   FileLoggerAction action, FileLoggerResult status, Exception error = null)
        {
#if !UNITY_3D && !UNITY3D
            if (status != FileLoggerResult.Success)
            {
                Debug.WriteLine("action: {0}, status: {1}\r\nerror:{2}", action, status, error);
            }
#endif
            if (callback == null)
            {
                return;
            }
            callback(sender, new FileLoggerCallbackArgs
            {
                FilePath = filePath,
                Text     = text,
                Data     = data,
                Action   = action,
                Status   = status,
                Error    = error
            });
        }
Exemple #4
0
 internal void InvokeFileActionEvent(string filePath, FileLoggerAction action, FileLoggerResult status,
                                     Exception error = null)
 {
     InvokeFileActionEvent(Callback, this, filePath, null, null, action, status, error);
 }
 protected internal FileLoggerCallbackArgs(byte[] data, string filePath,
                                           FileLoggerAction action, FileLoggerResult status, Exception error = null) : this(filePath, action, status, error)
 {
     Data = data;
 }
 protected internal FileLoggerCallbackArgs(string text, string filePath,
                                           FileLoggerAction action, FileLoggerResult status, Exception error = null) :
     this(filePath, action, status, error)
 {
     Text = text;
 }