mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
feat: Initial commit of eSeekOrigin enum
This commit is contained in:
parent
38dd85d79d
commit
e4b0c9f91a
2 changed files with 41 additions and 0 deletions
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue