Skip to content

Commit

Permalink
Format取消异常
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Oct 20, 2022
1 parent 5512acb commit 2478512
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions WindivertDotnet/Filter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ private Filter(Expression<Func<IFilter, bool>> expression)
}

/// <summary>
/// 格式化filter
/// 尝试格式化filter
/// </summary>
/// <param name="filter"></param>
/// <param name="layer"></param>
/// <exception cref="FormatException"></exception>
/// <param name="layer"></param>
/// <returns></returns>
[SupportedOSPlatform("windows")]
public unsafe static string Format(string filter, WinDivertLayer layer)
Expand All @@ -70,8 +69,7 @@ public unsafe static string Format(string filter, WinDivertLayer layer)
var ptr = new IntPtr(buffer);
return Marshal.PtrToStringAnsi(ptr) ?? string.Empty;
}

throw new FormatException($"{nameof(filter)}格式不正确");
return filter;
}

/// <summary>
Expand Down

0 comments on commit 2478512

Please sign in to comment.