mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 05:35:07 +00:00
feat: Initial commit of eSeekOrigin enum
This commit is contained in:
@@ -99,6 +99,7 @@
|
|||||||
<Compile Include="Extensions\UshortExtensions.cs" />
|
<Compile Include="Extensions\UshortExtensions.cs" />
|
||||||
<Compile Include="IcdUriBuilder.cs" />
|
<Compile Include="IcdUriBuilder.cs" />
|
||||||
<Compile Include="IO\IcdBinaryReader.cs" />
|
<Compile Include="IO\IcdBinaryReader.cs" />
|
||||||
|
<Compile Include="IO\eSeekOrigin.cs" />
|
||||||
<Compile Include="ProcessorUtils.SimplSharp.cs" />
|
<Compile Include="ProcessorUtils.SimplSharp.cs" />
|
||||||
<Compile Include="ProcessorUtils.Standard.cs" />
|
<Compile Include="ProcessorUtils.Standard.cs" />
|
||||||
<Compile Include="ProgramUtils.SimplSharp.cs" />
|
<Compile Include="ProgramUtils.SimplSharp.cs" />
|
||||||
|
|||||||
40
ICD.Common.Utils/IO/eSeekOrigin.cs
Normal file
40
ICD.Common.Utils/IO/eSeekOrigin.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
#if SIMPLSHARP
|
||||||
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
|
#else
|
||||||
|
using System.IO;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ICD.Common.Utils.IO
|
||||||
|
{
|
||||||
|
public enum eSeekOrigin
|
||||||
|
{
|
||||||
|
Begin,
|
||||||
|
Current,
|
||||||
|
End,
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SeekOriginExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the seek origin enum to a system seek origin.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="extends"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static SeekOrigin ToSeekOrigin(this eSeekOrigin extends)
|
||||||
|
{
|
||||||
|
switch (extends)
|
||||||
|
{
|
||||||
|
case eSeekOrigin.Begin:
|
||||||
|
return SeekOrigin.Begin;
|
||||||
|
case eSeekOrigin.Current:
|
||||||
|
return SeekOrigin.Current;
|
||||||
|
case eSeekOrigin.End:
|
||||||
|
return SeekOrigin.End;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException("extends");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user