void OnFSPollCallback(int status, ref uv_stat_t prev, ref uv_stat_t curr) { Log.TraceFormat("{0} {1} callback", this.HandleType, this.InternalHandle); try { FileStatus previous = null; FileStatus current = null; OperationException error = null; if (status < 0) { error = NativeMethods.CreateError((uv_err_code)status); } else { previous = (FileStatus)prev; current = (FileStatus)curr; } this.pollCallback?.Invoke(this, new FSPollStatus(previous, current, error)); } catch (Exception exception) { Log.Error($"{this.HandleType} {this.InternalHandle} callback error.", exception); throw; } }
private void OnFSPollCallback(int status, ref uv_stat_t prev, ref uv_stat_t curr) { #if DEBUG if (Log.TraceEnabled) { Log.Trace("{} {} callback", HandleType, InternalHandle); } #endif try { FileStatus previous = null; FileStatus current = null; OperationException error = null; if ((uint)status > SharedConstants.TooBigOrNegative) // < 0 { error = NativeMethods.CreateError((uv_err_code)status); } else { previous = (FileStatus)prev; current = (FileStatus)curr; } _pollCallback?.Invoke(this, new FSPollStatus(previous, current, error)); } catch (Exception exception) { Log.Handle_callback_error(HandleType, InternalHandle, exception); throw; } }
internal FileStatus(uv_stat_t stat) { this.Device = stat.st_dev; this.Mode = stat.st_mode; this.LinkCount = stat.st_nlink; this.UserIdentifier = stat.st_uid; this.GroupIdentifier = stat.st_gid; this.DeviceType = stat.st_rdev; this.Inode = stat.st_ino; this.Size = stat.st_size; this.BlockSize = stat.st_blksize; this.Blocks = stat.st_blocks; this.Flags = stat.st_flags; this.FileGeneration = stat.st_gen; this.LastAccessTime = (DateTime)stat.st_atim; this.LastModifyTime = (DateTime)stat.st_mtim; this.LastChangeTime = (DateTime)stat.st_ctim; this.CreateTime = (DateTime)stat.st_birthtim; }
internal FileStatus(uv_stat_t stat) { Device = stat.st_dev; Mode = stat.st_mode; LinkCount = stat.st_nlink; UserIdentifier = stat.st_uid; GroupIdentifier = stat.st_gid; DeviceType = stat.st_rdev; Inode = stat.st_ino; Size = stat.st_size; BlockSize = stat.st_blksize; Blocks = stat.st_blocks; Flags = stat.st_flags; FileGeneration = stat.st_gen; LastAccessTime = (DateTime)stat.st_atim; LastModifyTime = (DateTime)stat.st_mtim; LastChangeTime = (DateTime)stat.st_ctim; CreateTime = (DateTime)stat.st_birthtim; }
static void OnFSPollCallback(IntPtr handle, int status, ref uv_stat_t prev, ref uv_stat_t curr) { var fsPoll = HandleContext.GetTarget <FSPoll>(handle); fsPoll?.OnFSPollCallback(status, ref prev, ref curr); }