diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1c1335a..771f1b4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Added ToCollection extension method for copying an enumerable to a new collection
- TableBuilder supports multi-line content
+ - Added eIcdFileMode for IO platform agnosticism
## [11.0.0] - 2020-03-20
### Added
diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj
index 7000084..baad99f 100644
--- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj
+++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj
@@ -126,6 +126,7 @@
+
diff --git a/ICD.Common.Utils/IO/IcdFile.cs b/ICD.Common.Utils/IO/IcdFile.cs
index eff436f..15753eb 100644
--- a/ICD.Common.Utils/IO/IcdFile.cs
+++ b/ICD.Common.Utils/IO/IcdFile.cs
@@ -78,9 +78,9 @@ namespace ICD.Common.Utils.IO
}
[PublicAPI]
- public static IcdFileStream Open(string path, FileMode mode)
+ public static IcdFileStream Open(string path, eIcdFileMode mode)
{
- return new IcdFileStream(File.Open(path, mode));
+ return new IcdFileStream(File.Open(path, mode.ToFileMode()));
}
[PublicAPI]
diff --git a/ICD.Common.Utils/IO/eIcdFileMode.cs b/ICD.Common.Utils/IO/eIcdFileMode.cs
new file mode 100644
index 0000000..dcb0f95
--- /dev/null
+++ b/ICD.Common.Utils/IO/eIcdFileMode.cs
@@ -0,0 +1,46 @@
+using System;
+#if SIMPLSHARP
+using Crestron.SimplSharp.CrestronIO;
+#else
+using System.IO;
+#endif
+
+namespace ICD.Common.Utils.IO
+{
+ ///
+ /// Specifies how the operating system should open a file.
+ ///
+ public enum eIcdFileMode
+ {
+ CreateNew = 1,
+ Create = 2,
+ Open = 3,
+ OpenOrCreate = 4,
+ Truncate = 5,
+ Append = 6,
+ }
+
+ public static class IcdFileModeExtensions
+ {
+ public static FileMode ToFileMode(this eIcdFileMode extends)
+ {
+ switch (extends)
+ {
+ case eIcdFileMode.CreateNew:
+ return FileMode.CreateNew;
+ case eIcdFileMode.Create:
+ return FileMode.Create;
+ case eIcdFileMode.Open:
+ return FileMode.Open;
+ case eIcdFileMode.OpenOrCreate:
+ return FileMode.OpenOrCreate;
+ case eIcdFileMode.Truncate:
+ return FileMode.Truncate;
+ case eIcdFileMode.Append:
+ return FileMode.Append;
+ default:
+ throw new ArgumentOutOfRangeException("extends");
+ }
+ }
+ }
+}