/// <nodoc /> public static Xldb.Proto.ReportedFileAccess ToReportedFileAccess(this ReportedFileAccess reportedFileAccess, PathTable pathTable, NameExpander nameExpander) { return(new Xldb.Proto.ReportedFileAccess() { // No need to + 1 here since the Bxl version of the enum never conained a 0 value, so adding Unspecified=0 did not change the bxl->protobuf enum mapping CreationDisposition = (Xldb.Proto.CreationDisposition)reportedFileAccess.CreationDisposition, // No need to + 1 here since the Bxl version of the enum never conained a 0 value, so adding Unspecified=0 did not change the bxl->protobuf enum mapping // However, GENERIC_READ is of value 2^31 in bxl code, but -2^31 in protobuf enum due to 2^31 - 1 being the maximum value of an enum in protobuf. Thus special ternary assignment here. DesiredAccess = reportedFileAccess.DesiredAccess == Processes.DesiredAccess.GENERIC_READ ? Xldb.Proto.DesiredAccess.GenericRead : (Xldb.Proto.DesiredAccess)reportedFileAccess.DesiredAccess, Error = reportedFileAccess.Error, Usn = reportedFileAccess.Usn.Value, // No need to + 1 here since the Bxl version of the enum never conained a 0 value, so adding Unspecified=0 did not change the bxl->protobuf enum mapping // However, WRITE_THROUGH is of value 2^31 in bxl code, but -2^31 in protobuf enum due to 2^31 - 1 being the maximum value of an enum in protobuf. Thus special ternary assignment here. FlagsAndAttributes = reportedFileAccess.FlagsAndAttributes == Processes.FlagsAndAttributes.FILE_FLAG_WRITE_THROUGH ? Xldb.Proto.FlagsAndAttributes.FileFlagWriteThrough : (Xldb.Proto.FlagsAndAttributes)reportedFileAccess.FlagsAndAttributes, Path = reportedFileAccess.Path, ManifestPath = reportedFileAccess.ManifestPath.ToString(pathTable, PathFormat.Windows, nameExpander), Process = reportedFileAccess.Process.ToReportedProcess(), ShareMode = reportedFileAccess.ShareMode == Processes.ShareMode.FILE_SHARE_NONE ? Xldb.Proto.ShareMode.FileShareNone : (Xldb.Proto.ShareMode)((int)reportedFileAccess.ShareMode << 1), Status = (Xldb.Proto.FileAccessStatus)(reportedFileAccess.Status + 1), Method = (Xldb.Proto.FileAccessStatusMethod)(reportedFileAccess.Method + 1), RequestedAccess = reportedFileAccess.RequestedAccess == Processes.RequestedAccess.None ? Xldb.Proto.RequestedAccess.None : (Xldb.Proto.RequestedAccess)((int)reportedFileAccess.RequestedAccess << 1), Operation = (Xldb.Proto.ReportedFileOperation)(reportedFileAccess.Operation + 1), ExplicitlyReported = reportedFileAccess.ExplicitlyReported, EnumeratePattern = reportedFileAccess.EnumeratePattern }); }
/// <nodoc /> public static Xldb.Proto.ReportedFileAccess ToReportedFileAccess(this ReportedFileAccess reportedFileAccess, PathTable pathTable) { return(new Xldb.Proto.ReportedFileAccess() { CreationDisposition = (CreationDisposition)reportedFileAccess.CreationDisposition, DesiredAccess = (DesiredAccess)reportedFileAccess.DesiredAccess, Error = reportedFileAccess.Error, Usn = reportedFileAccess.Usn.Value, FlagsAndAttributes = (FlagsAndAttributes)reportedFileAccess.FlagsAndAttributes, Path = reportedFileAccess.Path, ManifestPath = reportedFileAccess.ManifestPath.ToString(pathTable, PathFormat.HostOs), Process = reportedFileAccess.Process.ToReportedProcess(), ShareMode = (ShareMode)reportedFileAccess.ShareMode, Status = (FileAccessStatus)reportedFileAccess.Status, Method = (FileAccessStatusMethod)reportedFileAccess.Method, RequestedAccess = (RequestedAccess)reportedFileAccess.RequestedAccess, Operation = (ReportedFileOperation)reportedFileAccess.Operation, ExplicitlyReported = reportedFileAccess.ExplicitlyReported, EnumeratePattern = reportedFileAccess.EnumeratePattern }); }
/// <nodoc /> public static Xldb.Proto.ReportedFileAccess ToReportedFileAccess(this ReportedFileAccess reportedFileAccess, PathTable pathTable) { return(new Xldb.Proto.ReportedFileAccess() { // No need to + 1 here since the Bxl version of the enum never conained a 0 value, so adding Invalid=0 did not change the bxl->protobuf enum mapping CreationDisposition = (CreationDisposition)reportedFileAccess.CreationDisposition, // No need to + 1 here since the Bxl version of the enum never conained a 0 value, so adding Invalid=0 did not change the bxl->protobuf enum mapping DesiredAccess = (DesiredAccess)reportedFileAccess.DesiredAccess, Error = reportedFileAccess.Error, Usn = reportedFileAccess.Usn.Value, // No need to + 1 here since the Bxl version of the enum never conained a 0 value, so adding Invalid=0 did not change the bxl->protobuf enum mapping FlagsAndAttributes = (FlagsAndAttributes)reportedFileAccess.FlagsAndAttributes, Path = reportedFileAccess.Path, ManifestPath = reportedFileAccess.ManifestPath.ToString(pathTable, PathFormat.Windows), Process = reportedFileAccess.Process.ToReportedProcess(), ShareMode = reportedFileAccess.ShareMode == Processes.ShareMode.FILE_SHARE_NONE ? ShareMode.FileShareNone : (ShareMode)((int)reportedFileAccess.ShareMode << 1), Status = (FileAccessStatus)(reportedFileAccess.Status + 1), Method = (FileAccessStatusMethod)(reportedFileAccess.Method + 1), RequestedAccess = reportedFileAccess.RequestedAccess.ToRequestedAccess(), Operation = (ReportedFileOperation)(reportedFileAccess.Operation + 1), ExplicitlyReported = reportedFileAccess.ExplicitlyReported, EnumeratePattern = reportedFileAccess.EnumeratePattern }); }