Code Tidy, Insert and Delete methods

Code Tidy, Insert and Delete methods

--- MongoDB.SimpleCRUD/MongoDB.SimpleCRUD/SimpleCRUD.cs
+++ MongoDB.SimpleCRUD/MongoDB.SimpleCRUD/SimpleCRUD.cs
@@ -16,16 +16,16 @@
     /// </summary>
     public class SimpleCRUD
     {
-        private readonly string _connectionString;
-        private readonly string _database;
+        MongoClient _client;
+        IMongoDatabase _db;

         #region Constructor

         public SimpleCRUD(string connectionString, string database)
         {
-            if (string.IsNullOrEmpty(connectionString)) { _connectionString = "mongodb://localhost:27017"; }
-            else { _connectionString = connectionString; }
-            _database = database;
+            if (string.IsNullOrEmpty(connectionString)) { connectionString = "mongodb://localhost:27017"; }
+            _client = new MongoClient(connectionString);
+            _db = _client.GetDatabase(database);
         }
         public SimpleCRUD(string database) : this(null, database) { }

@@ -43,15 +43,12 @@
         public T Get<T>(string key, object value)
         {
             var type = typeof(T);
-            if (string.IsNullOrEmpty(key)) { key = "Id"; }
-
-            MongoClient client = new MongoClient(_connectionString);
-            IMongoDatabase db = client.GetDatabase(_database);
-
-            string dbName = PluralizationService
-                            .CreateService(System.Globalization.CultureInfo.GetCultureInfo("en-US"))
-                            .Pluralize(type.Name.ToLower());
-            var collection = db.GetCollection<BsonDocument>(dbName);
+            if (string.IsNullOrEmpty(key)) { key = "_id"; }
+
+            string collectionName = PluralizationService
+                                   .CreateService(System.Globalization.CultureInfo.GetCultureInfo("en-US"))
+                                   .Pluralize(type.Name.ToLower());
+            var collection = _db.GetCollection<BsonDocument>(collectionName);

             var filter = Builders<BsonDocument>.Filter.Eq(key, value);

@@ -66,15 +63,12 @@
         public List<T> GetList<T>(string key, object value)
         {
             var type = typeof(T);
-            if (string.IsNullOrEmpty(key)) { key = "Id"; }
-
-            MongoClient client = new MongoClient(_connectionString);
-            IMongoDatabase db = client.GetDatabase(_database);
-
-            string dbName = PluralizationService
-                            .CreateService(System.Globalization.CultureInfo.GetCultureInfo("en-US"))
-                            .Pluralize(type.Name.ToLower());
-            var collection = db.GetCollection<BsonDocument>(dbName);
+            if (string.IsNullOrEmpty(key)) { key = "_id"; }
+
+            string collectionName = PluralizationService
+                                    .CreateService(System.Globalization.CultureInfo.GetCultureInfo("en-US"))
+                                    .Pluralize(type.Name.ToLower());
+            var collection = _db.GetCollection<BsonDocument>(collectionName);

             var filter = Builders<BsonDocument>.Filter.Eq(key, value);

@@ -118,5 +112,79 @@
         }

         #endregion
+
+        #region Insert
+
+        /// <summary>
+        /// Insert an entity
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="entityToInsert"></param>
+        /// <returns>ObjectId of the inserted entity</returns>
+        public string Insert<T>(T entityToInsert)
+        {
+            string collectionName = PluralizationService
+                                    .CreateService(System.Globalization.CultureInfo.GetCultureInfo("en-US"))
+                                    .Pluralize(typeof(T).Name.ToLower());
+            var collection = _db.GetCollection<BsonDocument>(collectionName);
+
+            BsonDocument bsonDoc = entityToInsert.ToBsonDocument();
+            var insertTask = collection.InsertOneAsync(bsonDoc);
+            insertTask.Wait();
+
+            return bsonDoc.Elements.FirstOrDefault(e => e.Value.IsObjectId).Value.ToString();
+        }
+
+        #endregion
+
+        #region Delete
+
+        /// <summary>
+        /// Delete only one document
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="key"></param>
+        /// <param name="value"></param>
+        /// <returns>success: true, fail: false</returns>
+        public bool DeleteOne<T>(string key, object value)
+        {
+            var type = typeof(T);
+            if (string.IsNullOrEmpty(key)) { key = "_id"; }
+
+            string collectionName = PluralizationService
+                                   .CreateService(System.Globalization.CultureInfo.GetCultureInfo("en-US"))
+                                   .Pluralize(type.Name.ToLower());
+            var collection = _db.GetCollection<BsonDocument>(collectionName);
+            var filter = Builders<BsonDocument>.Filter.Eq(key, value);
+
+            var deleteTask = collection.DeleteOneAsync(filter);
+            deleteTask.Wait();
+            return (deleteTask.Result.DeletedCount == 1);
+        }
+
+        /// <summary>
+        /// Delete multiple documents
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="key"></param>
+        /// <param name="value"></param>
+        /// <returns>Number of deleted documents</returns>
+        public long DeleteMany<T>(string key, object value)
+        {
+            var type = typeof(T);
+            if (string.IsNullOrEmpty(key)) { key = "_id"; }
+
+            string collectionName = PluralizationService
+                                   .CreateService(System.Globalization.CultureInfo.GetCultureInfo("en-US"))
+                                   .Pluralize(type.Name.ToLower());
+            var collection = _db.GetCollection<BsonDocument>(collectionName);
+            var filter = Builders<BsonDocument>.Filter.Eq(key, value);
+
+            var deleteTask = collection.DeleteManyAsync(filter);
+            deleteTask.Wait();
+            return deleteTask.Result.DeletedCount;
+        }
+
+        #endregion
     }
 }


Modified Material model to return proper carbon equivalent

--- WelderCalculator/WelderCalculator/Model/Material.cs
+++ WelderCalculator/WelderCalculator/Model/Material.cs
@@ -12,7 +12,26 @@

         public List<Element> Elements { get; set; }

-        public double? CEq { get { return 0; }}             //TODO dokonczyc
+        public double? CEq
+        {
+            get
+            {
+                double? cReal = GetElement(Category.OfElement.C).RealValue;
+                double? mnReal = GetElement(Category.OfElement.Mn).RealValue;
+                double? crReal = GetElement(Category.OfElement.Cr).RealValue;
+                double? vReal = GetElement(Category.OfElement.V).RealValue;
+                double? moReal = GetElement(Category.OfElement.Mo).RealValue;
+                double? niReal = GetElement(Category.OfElement.Ni).RealValue;
+                double? cuReal = GetElement(Category.OfElement.Cu).RealValue;
+
+                double? CarbonEquivalent = cReal +
+                                           mnReal/6.0 +
+                                           (crReal + vReal + moReal)/5.0 +
+                                           (niReal + cuReal)/15.0;
+
+                return CarbonEquivalent;
+            }
+        }

         public double? NiEq { get { return 0; } }           //TODO dokonczyc


Added NtCreateSectionEx.

Added NtCreateSectionEx.

--- NtApiDotNet/NtSection.cs
+++ NtApiDotNet/NtSection.cs
@@ -116,7 +116,40 @@
         public IntPtr BaseAddress;
         public SectionAttributes Attributes;
         public LargeIntegerStruct Size;
-    }
+    }
+
+    public enum MemExtendedParameterType : long
+    {
+        MemExtendedParameterInvalidType,
+        MemExtendedParameterAddressRequirements,
+        MemExtendedParameterNumaNode,
+        MemExtendedParameterPartitionHandle,
+        MemExtendedParameterUserPhysicalHandle,
+        MemExtendedParameterAttributeFlags,
+        MemExtendedParameterMax
+    }
+
+    [StructLayout(LayoutKind.Explicit)]
+    public struct MemExtendedParameterValue
+    {
+        [FieldOffset(0)]
+        public ulong ULong64;
+        [FieldOffset(0)]
+        public IntPtr Pointer;
+        [FieldOffset(0)]
+        public IntPtr Size;
+        [FieldOffset(0)]
+        public IntPtr Handle;
+        [FieldOffset(0)]
+        public uint ULong;
+    }
+
+    [StructLayout(LayoutKind.Sequential)]
+    public struct MemExtendedParameter
+    {
+        public MemExtendedParameterType Type;
+        public MemExtendedParameterValue Value;
+    }

     public static partial class NtSystemCalls
     {
@@ -126,6 +159,13 @@
             [In] ObjectAttributes ObjectAttributes, [In] LargeInteger SectionSize,
             MemoryAllocationProtect Protect, SectionAttributes Attributes,
             SafeHandle FileHandle);
+
+        [DllImport("ntdll.dll")]
+        public static extern NtStatus NtCreateSectionEx(out SafeKernelObjectHandle SectionHandle,
+            SectionAccessRights DesiredAccess,
+            [In] ObjectAttributes ObjectAttributes, [In] LargeInteger SectionSize,
+            MemoryAllocationProtect Protect, SectionAttributes Attributes,
+            SafeHandle FileHandle, MemExtendedParameter[] ExtendedParameters, int ExtendedParameterCount);

         [DllImport("ntdll.dll")]
         public static extern NtStatus NtOpenSection(out SafeKernelObjectHandle SectionHandle,
@@ -346,7 +386,7 @@
         {
             SafeKernelObjectHandle section_handle;
             return NtSystemCalls.NtCreateSection(out section_handle, desired_access, object_attributes,
-                size, protection, attributes, file == null ? SafeKernelObjectHandle.Null : file.Handle).CreateResult(throw_on_error, () => new NtSection(section_handle));
+                size, protection, attributes, file.GetHandle()).CreateResult(throw_on_error, () => new NtSection(section_handle));
         }

         /// <summary>
@@ -378,12 +418,13 @@
         /// <param name="file">Optional backing file</param>
         /// <returns>The opened section</returns>
         /// <exception cref="NtException">Thrown on error.</exception>
-        public static NtSection Create(string path, NtObject root, SectionAccessRights desired_access, long? size, MemoryAllocationProtect protection, SectionAttributes attributes, NtFile file)
+        public static NtSection Create(string path, NtObject root, SectionAccessRights desired_access,
+            long? size, MemoryAllocationProtect protection, SectionAttributes attributes, NtFile file)
         {
             using (ObjectAttributes obj_attr = new ObjectAttributes(path, AttributeFlags.CaseInsensitive, root))
             {
                 return Create(obj_attr, desired_access, size.HasValue ? new LargeInteger(size.Value) : null, protection, attributes, file);
-            }
+            }
         }

         /// <summary>
@@ -396,6 +437,43 @@
         {
             return Create(null, SectionAccessRights.MaximumAllowed, new LargeInteger(size),
                 MemoryAllocationProtect.ReadWrite, SectionAttributes.Commit, null);
+        }
+
+        /// <summary>
+        /// Create a section object
+        /// </summary>
+        /// <param name="object_attributes">The object attributes</param>
+        /// <param name="desired_access">The desired access</param>
+        /// <param name="size">Optional size of the section</param>
+        /// <param name="protection">The section protection</param>
+        /// <param name="attributes">The section attributes</param>
+        /// <param name="file">Optional backing file</param>
+        /// <param name="extended_parameters">Extended parameters for section create.</param>
+        /// <param name="throw_on_error">True to throw an exception on error.</param>
+        /// <returns>The NT status code and object result.</returns>
+        public static NtResult<NtSection> CreateEx(ObjectAttributes object_attributes, SectionAccessRights desired_access, LargeInteger size,
+            MemoryAllocationProtect protection, SectionAttributes attributes, NtFile file, MemExtendedParameter[] extended_parameters, bool throw_on_error)
+        {
+            return NtSystemCalls.NtCreateSectionEx(out SafeKernelObjectHandle section_handle, desired_access, object_attributes,
+                size, protection, attributes, file.GetHandle(),
+                extended_parameters, extended_parameters?.Length ?? 0).CreateResult(throw_on_error, () => new NtSection(section_handle));
+        }
+
+        /// <summary>
+        /// Create a section object
+        /// </summary>
+        /// <param name="object_attributes">The object attributes</param>
+        /// <param name="desired_access">The desired access</param>
+        /// <param name="size">Optional size of the section</param>
+        /// <param name="protection">The section protection</param>
+        /// <param name="attributes">The section attributes</param>
+        /// <param name="file">Optional backing file</param>
+        /// <param name="extended_parameters">Extended parameters for section create.</param>
+        /// <returns>The NT status code and object result.</returns>
+        public static NtSection CreateEx(ObjectAttributes object_attributes, SectionAccessRights desired_access, LargeInteger size,
+            MemoryAllocationProtect protection, SectionAttributes attributes, NtFile file, MemExtendedParameter[] extended_parameters)
+        {
+            return CreateEx(object_attributes, desired_access, size, protection, attributes, file, extended_parameters, true).Result;
         }

         /// <summary>
@@ -525,8 +603,7 @@
         /// <returns>The NT status code and object result.</returns>
         public static NtResult<NtSection> Open(ObjectAttributes object_attributes, SectionAccessRights desired_access, bool throw_on_error)
         {
-            SafeKernelObjectHandle handle;
-            return NtSystemCalls.NtOpenSection(out handle, desired_access, object_attributes).CreateResult(throw_on_error, () => new NtSection(handle));
+            return NtSystemCalls.NtOpenSection(out SafeKernelObjectHandle handle, desired_access, object_attributes).CreateResult(throw_on_error, () => new NtSection(handle));
         }

         internal static NtResult<NtObject> FromName(ObjectAttributes object_attributes, AccessMask desired_access, bool throw_on_error)


- Experimental Branch Merge #222

- Experimental Branch Merge #222

git-svn-id: 61c3ae23f3a6520e9bc357b51591209af2ede9d8@1124 45b04e34-05f1-4d87-a130-40a8491d5c8b

--- Mosa/Platforms/x86/CPUx86/Intrinsics/Instruction.cs
+++ Mosa/Platforms/x86/CPUx86/Intrinsics/Instruction.cs
@@ -21,7 +21,7 @@
 	{
 		#region Static Data

-		private static Dictionary<Type, IInstruction> _map = Initialize();
+		private static Dictionary<Type, IInstruction> _map = null;

 		/// <summary>
 		///
@@ -161,6 +161,9 @@
 		/// <returns></returns>
 		public static IInstruction Get(Type type)
 		{
+			if (_map == null)
+				_map = Initialize();
+
 			return _map[type];
 		}

@@ -180,6 +183,9 @@
 			map.Add(typeof(CpuIdEcxInstruction), CpuIdEcxInstruction);
 			map.Add(typeof(CpuIdEdxInstruction), CpuIdEdxInstruction);
 			map.Add(typeof(CpuIdInstruction), CpuIdInstruction);
+			map.Add(typeof(InvlpgInstruction), InvlpgInstruction);
+
+			// TODO - finsh up the list

 			return map;
 		}


remove possible ambiguity in IEnumerable#GetEnumerator implementation

--- Core/IndexedDictionary.cs
+++ Core/IndexedDictionary.cs
@@ -379,7 +379,7 @@

         IEnumerator IEnumerable.GetEnumerator()
         {
-            return this.GetEnumerator();
+            return ((IEnumerable<KeyValuePair<TKey, TValue>>)this).GetEnumerator();
         }
     }
 }


[c#/beetlex]change NpgsqlParameter to  NpgsqlParameter<T> (#5884)

* update beetlex 1.4.3

update beetlex 1.4.3

* docker add COMPlus_ReadyToRun variable
update beetlex

* update beetlex, enabled thread queue

* beetlex framework add db and queries cases

* add db code

* change result json data

* update query url

* beetlex framework add fortunes cases

* change Content-Type

* add beetlex core cases

* fix queries cases

* update config

* change try readline

* update benchmark config

* Update README.md

* Update README.md

* change versus property

* beetlex-core update .net core to v3.0

* change beetlex-core project file

* beetlex update raw db class

* beetlex update raw db

* beetlex debug plaintext

* change debug docker file

* update beetlex to 1.4.0

* update

* beetlex update core 3.1

* [c#/beetlex] add updates cases

* [c#/beetlex] change Server: TFB, change custom connection pool, add update docker

* fix errors

* change pool init

* change connection pool maxsize

* fix fortunes errors

* clear DBRaw _connectionString value.

* [c#beetlex] change update dbconnection pool size

* [c#/beetlex] udpate spanjson to v3.0.1, Npgsql v5.0.0

* [c#/beetlex] add caching sample

* set connectionstring multiplexing

* remove connection multiplexing setting

* [c#/beetlex]change NpgsqlParameter to  NpgsqlParameter<T>

--- frameworks/CSharp/beetlex/PlatformBenchmarks/DBRaw.cs
+++ frameworks/CSharp/beetlex/PlatformBenchmarks/DBRaw.cs
@@ -10,6 +10,7 @@
 using System.Runtime.InteropServices.ComTypes;
 using BeetleX.EventArgs;
 using Microsoft.Extensions.Caching.Memory;
+using Npgsql;

 namespace PlatformBenchmarks
 {
@@ -40,11 +41,8 @@
         {
             SingleCommand = new Npgsql.NpgsqlCommand();
             SingleCommand.CommandText = "SELECT id, randomnumber FROM world WHERE id = @Id";
-            var id = SingleCommand.CreateParameter();
-            id.ParameterName = "@Id";
-            id.DbType = DbType.Int32;
-            id.Value = _random.Next(1, 10001);
-            SingleCommand.Parameters.Add(id);
+            mID = new Npgsql.NpgsqlParameter<int>("@Id", _random.Next(1, 10001));
+            SingleCommand.Parameters.Add(mID);
             FortuneCommand = new Npgsql.NpgsqlCommand();
             FortuneCommand.CommandText = "SELECT id, message FROM fortune";
         }
@@ -53,12 +51,15 @@

         private DbCommand FortuneCommand;

+        private Npgsql.NpgsqlParameter<int> mID;
+
+
         public async Task<World> LoadSingleQueryRow()
         {
             using (var db = await DBConnectionGroupPool.Pop())
             {
                 SingleCommand.Connection = db.Connection;
-                SingleCommand.Parameters[0].Value = _random.Next(1, 10001);
+                mID.TypedValue = _random.Next(1, 10001);
                 return await ReadSingleRow(db.Connection, SingleCommand);

             }
@@ -125,15 +126,14 @@
                     var key = cacheKeys[id];

                     rawdb.SingleCommand.Connection = db.Connection;
-                    rawdb.SingleCommand.Parameters[0].Value = id;
-
+                    rawdb.mID.TypedValue = id;
                     for (; i < result.Length; i++)
                     {
                         var data = await _cache.GetOrCreateAsync<CachedWorld>(key, create);
                         result[i] = data;
                         id = rawdb._random.Next(1, 10001);
                         rawdb.SingleCommand.Connection = db.Connection;
-                        rawdb.SingleCommand.Parameters[0].Value = id;
+                        rawdb.mID.TypedValue = id;
                         key = cacheKeys[id];
                     }
                 }
@@ -186,25 +186,28 @@
                 var updateCmd = UpdateCommandsCached.PopCommand(count);
                 try
                 {
-                    updateCmd.Connection = db.Connection;
+                    var command = updateCmd.Command;
+                    command.Connection = (NpgsqlConnection)db.Connection;
                     SingleCommand.Connection = db.Connection;
-                    SingleCommand.Parameters[0].Value = _random.Next(1, int.MaxValue) % 10000 + 1;
+                    mID.TypedValue = _random.Next(1, int.MaxValue) % 10000 + 1;
                     var results = new World[count];
                     for (int i = 0; i < count; i++)
                     {
                         results[i] = await ReadSingleRow(db.Connection, SingleCommand);
-                        SingleCommand.Parameters[0].Value = _random.Next(1, int.MaxValue) % 10000 + 1;
+                        mID.TypedValue = _random.Next(1, int.MaxValue) % 10000 + 1;
                     }

                     for (int i = 0; i < count; i++)
                     {
                         var randomNumber = _random.Next(1, int.MaxValue) % 10000 + 1;
-                        updateCmd.Parameters[i * 2].Value = results[i].Id;
-                        updateCmd.Parameters[i * 2 + 1].Value = randomNumber;
+                        updateCmd.Parameters[i * 2].TypedValue = results[i].Id;
+                        updateCmd.Parameters[i * 2 + 1].TypedValue = randomNumber;
+                        //updateCmd.Parameters[i * 2].Value = results[i].Id;
+                        //updateCmd.Parameters[i * 2 + 1].Value = randomNumber;
                         results[i].RandomNumber = randomNumber;
                     }

-                    await updateCmd.ExecuteNonQueryAsync();
+                    await command.ExecuteNonQueryAsync();
                     return results;
                 }
                 catch (Exception e_)
@@ -242,8 +245,8 @@

     internal class UpdateCommandsCached
     {
-        private static System.Collections.Concurrent.ConcurrentStack<DbCommand>[] mCacheTable
-            = new System.Collections.Concurrent.ConcurrentStack<DbCommand>[1024];
+        private static System.Collections.Concurrent.ConcurrentStack<CommandCacheItem>[] mCacheTable
+            = new System.Collections.Concurrent.ConcurrentStack<CommandCacheItem>[1024];

         public static string[] IDParamereNames = new string[1024];

@@ -255,38 +258,40 @@
             {
                 IDParamereNames[i] = $"@Id_{i}";
                 RandomParamereNames[i] = $"@Random_{i}";
-                mCacheTable[i] = new System.Collections.Concurrent.ConcurrentStack<DbCommand>();
-            }
-        }
-
-        private static DbCommand CreatCommand(int count)
-        {
-            DbCommand cmd = new Npgsql.NpgsqlCommand();
+                mCacheTable[i] = new System.Collections.Concurrent.ConcurrentStack<CommandCacheItem>();
+            }
+        }
+
+        private static CommandCacheItem CreatCommand(int count)
+        {
+            CommandCacheItem item = new CommandCacheItem();
+            NpgsqlCommand cmd = new Npgsql.NpgsqlCommand();
             cmd.CommandText = BatchUpdateString.Query(count);
             for (int i = 0; i < count; i++)
             {
-                var id = cmd.CreateParameter();
+                var id = new NpgsqlParameter<int>();
                 id.ParameterName = IDParamereNames[i];
-                id.DbType = DbType.Int32;
                 cmd.Parameters.Add(id);
-
-                var random = cmd.CreateParameter();
+                item.Parameters.Add(id);
+
+                var random = new NpgsqlParameter<int>();
                 random.ParameterName = RandomParamereNames[i];
-                random.DbType = DbType.Int32;
                 cmd.Parameters.Add(random);
-            }
-            return cmd;
-
-        }
-
-        public static void PushCommand(int count, DbCommand cmd)
+                item.Parameters.Add(random);
+            }
+            item.Command = cmd;
+            return item;
+
+        }
+
+        public static void PushCommand(int count, CommandCacheItem cmd)
         {
             mCacheTable[count].Push(cmd);
         }

-        public static DbCommand PopCommand(int count)
-        {
-            if (mCacheTable[count].TryPop(out DbCommand cmd))
+        public static CommandCacheItem PopCommand(int count)
+        {
+            if (mCacheTable[count].TryPop(out CommandCacheItem cmd))
                 return cmd;
             return CreatCommand(count);
         }
@@ -314,6 +319,13 @@
                 return;
             }
         }
+    }
+
+    class CommandCacheItem
+    {
+        public Npgsql.NpgsqlCommand Command { get; set; }
+
+        public List<Npgsql.NpgsqlParameter<int>> Parameters { get; private set; } = new List<Npgsql.NpgsqlParameter<int>>(1024);
     }


Added SetSelected method

Added SetSelected method

--- Core2D/Project/Project.cs
+++ Core2D/Project/Project.cs
@@ -163,25 +163,7 @@
             get { return _selected; }
             set
             {
-                var item = value;
-
-                if (item is Container && _documents != null)
-                {
-                    var container = item as Container;
-                    var document = _documents.FirstOrDefault(d => d.Pages.Contains(container));
-                    if (document != null)
-                    {
-                        CurrentDocument = document;
-                        CurrentContainer = container;
-                        CurrentContainer.Invalidate();
-                    }
-                }
-                else if (item is Document)
-                {
-                    var document = item as Document;
-                    CurrentDocument = document;
-                }
-
+                SetSelected(value);
                 Update(ref _selected, value);
             }
         }
@@ -201,6 +183,31 @@
         }

         /// <summary>
+        /// Set selected value.
+        /// </summary>
+        /// <param name="value">The value instance.</param>
+        public void SetSelected(object value)
+        {
+            if (value != null)
+            {
+                if (value is Container && _documents != null)
+                {
+                    var document = _documents.FirstOrDefault(d => d.Pages.Contains(value as Container));
+                    if (document != null)
+                    {
+                        CurrentDocument = document;
+                        CurrentContainer = value as Container;
+                        CurrentContainer.Invalidate();
+                    }
+                }
+                else if (value is Document)
+                {
+                    CurrentDocument = value as Document;
+                }
+            }
+        }
+
+        /// <summary>
         /// Creates a new <see cref="Project"/> instance.
         /// </summary>
         /// <param name="name">The project name.</param>


Added missing return value documentation

--- OpenIIoT.Core/Security/WebAPI/SecurityController.cs
+++ OpenIIoT.Core/Security/WebAPI/SecurityController.cs
@@ -300,6 +300,7 @@
         /// <param name="name">The name of the User to update.</param>
         /// <param name="password">The updated plaintext password for the User.</param>
         /// <param name="role">The updated Role for the user.</param>
+        /// <returns>An HTTP response message.</returns>
         [HttpPut]
         [Route("v1/security/user/{name}")]
         [Authorize]


Code Coverage 95.80%

Code Coverage 95.80%

--- PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
+++ PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
@@ -191,6 +191,21 @@
                                     IpV6MobilityOptionReplayProtection optionReplayProtection = (IpV6MobilityOptionReplayProtection)option;
                                     Assert.IsNotNull(optionReplayProtection.Timestamp);
                                     break;
+
+                                case IpV6MobilityOptionType.Experimental:
+                                    IpV6MobilityOptionExperimental optionExperimental = (IpV6MobilityOptionExperimental)option;
+                                    Assert.IsNotNull(optionExperimental.Data);
+                                    break;
+
+                                case IpV6MobilityOptionType.PermanentHomeKeygenToken:
+                                    IpV6MobilityOptionPermanentHomeKeygenToken optionPermanentHomeKeygenToken = (IpV6MobilityOptionPermanentHomeKeygenToken)option;
+                                    Assert.IsNotNull(optionPermanentHomeKeygenToken.PermanentHomeKeygenToken);
+                                    break;
+
+                                case IpV6MobilityOptionType.Signature:
+                                    IpV6MobilityOptionSignature optionSignature = (IpV6MobilityOptionSignature)option;
+                                    Assert.IsNotNull(optionSignature.Signature);
+                                    break;
                             }
                         }
                     }
@@ -1257,5 +1272,26 @@
             Packet invalidPacket = new Packet(packet.Buffer, DateTime.Now, DataLinkKind.Ethernet);
             Assert.IsFalse(invalidPacket.IsValid);
         }
+
+        [TestMethod]
+        public void IpV6MobilityOptionCareOfTestInitDataTooLong()
+        {
+            Packet packet = PacketBuilder.Build(
+                DateTime.Now,
+                new EthernetLayer(),
+                new IpV6Layer
+                {
+                    ExtensionHeaders =
+                        new IpV6ExtensionHeaders(
+                        new IpV6ExtensionHeaderMobilityBindingError(
+                            IpV4Protocol.Skip, 0, IpV6BindingErrorStatus.UnrecognizedMhTypeValue, IpV6Address.Zero,
+                            new IpV6MobilityOptions(new IpV6MobilityOptionCareOfTestInit())))
+
+                });
+            Assert.IsTrue(packet.IsValid);
+            ++packet.Buffer[14 + 40 + 24 + 1];
+            Packet invalidPacket = new Packet(packet.Buffer, DateTime.Now, DataLinkKind.Ethernet);
+            Assert.IsFalse(invalidPacket.IsValid);
+        }
     }
 }


Issue #27 - Do not through an exception if page size is in millimeter.

--- RdlDesign/ReportCtl.cs
+++ RdlDesign/ReportCtl.cs
@@ -72,26 +72,59 @@
             PrinterSettings settings = new PrinterSettings();
             cbPageSize.DisplayMember = "PaperName";

-            int width = (int)(decimal.Parse(tbPageWidth.Text.Replace("in", "").Trim()) * 100);
-            int height = (int)(decimal.Parse(tbPageHeight.Text.Replace("in", "").Trim()) * 100);
+
+            int width = MeasurementTypeAsHundrethsOfAnInch(tbPageWidth.Text);
+            int height = MeasurementTypeAsHundrethsOfAnInch(tbPageHeight.Text);
             int pageCount = settings.PaperSizes.Count;

+            // This conversion may be better converted to mm instead of hundrethds of an inch
             int count = 0;
+            bool sizeFound = false;
             foreach (PaperSize psize in settings.PaperSizes)
             {
                 cbPageSize.Items.Add(psize);

+
                 if ((psize.Width == width) &&
-                    (psize.Height == height))
-                {
+                    (psize.Height == height) &&
+                    (sizeFound == false))
+                {
                     cbPageSize.SelectedIndex = count;
+                    sizeFound = true;
                 }
                 count = count + 1;
             }
         }

+        private int MeasurementTypeAsHundrethsOfAnInch(string value)
+        {
+            string measurementType = value.Trim().ToLower();
+            string measurementValue="0";
+            if (measurementType.Length>=2)
+            {
+                measurementValue = measurementType.Substring(0, measurementType.Length-2);
+                measurementType = measurementType.Substring(measurementType.Length-2);
+            }
+
+            if (measurementType == "mm")
+            {
+                // metric.  Convert to imperial for now
+                return (int) ((decimal.Parse(measurementValue) / 25.4m) * 100);
+            }
+            else
+            {
+                // assume imperial
+                return (int)(decimal.Parse(measurementValue) * 100);
+            }
+
+
+
+        }
+
+
         private string GetPaperSizeAsInch(int paperSize)
         {
+            // paperSize is in hundredths of an inch.
             return (paperSize / 100.0).ToString() + "in";
         }


fix map entity component instance data being wrong

--- TankLib/teMapChunk.cs
+++ TankLib/teMapChunk.cs
@@ -3,7 +3,6 @@
 using System.Diagnostics;
 using System.Diagnostics.CodeAnalysis;
 using System.IO;
-using System.Linq;
 using System.Reflection;
 using System.Runtime.InteropServices;
 using TankLib.Math;
@@ -114,14 +113,14 @@

                         entity.InstanceData = new STUComponentInstanceData[entity.Header.InstanceDataCount];
                         for (int i = 0; i < entity.Header.InstanceDataCount; i++) {
-                            long beforePos = reader.BaseStream.Position;
+                            reader.BaseStream.Position = entity.m_instanceDataOffsets[i];
+
                             try {
                                 teStructuredData structuredData = new teStructuredData(reader);
                                 entity.InstanceData[i] = structuredData.GetInstance<STUComponentInstanceData>();
-                                AlignPosition(beforePos, reader, structuredData);
-                            } catch (Exception) {
+                            } catch (Exception e)
+                            {
                                 execCount++;
-                                AlignPositionInternal(reader, beforePos + 8); // try and recover
                             }
                         }
                     }
@@ -133,7 +132,7 @@
             }
         }

-        private void AlignPosition(long start, BinaryReader reader, teStructuredData stu) {
+        /*private void AlignPosition(long start, BinaryReader reader, teStructuredData stu) {
             long maxOffset = stu.InstanceInfoV1.Max(x => x.Offset)+start;
             AlignPositionInternal(reader, maxOffset+8);
         }
@@ -150,7 +149,7 @@
                 reader.BaseStream.Position -= 4;
                 break;
             }
-        }
+        }*/
     }

     public interface IMapPlaceable {
@@ -236,9 +235,26 @@

         public Structure Header;
         public STUComponentInstanceData[] InstanceData;
-
-        public void Read(BinaryReader reader) {
-            Header = reader.Read<Structure>();
+        public uint[] m_instanceDataOffsets;
+
+        public void Read(BinaryReader reader) {
+            long start = reader.BaseStream.Position;
+
+            Header = reader.Read<Structure>();
+
+            m_instanceDataOffsets = new uint[Header.InstanceDataCount];
+
+            const int instArrayOffset = 112;
+            reader.BaseStream.Position = start + instArrayOffset;
+            for (int i = 0; i < Header.InstanceDataCount; i++) {
+                long disStart = reader.BaseStream.Position;
+
+                var type = reader.ReadUInt32();
+                var relOffset = reader.ReadUInt32();
+
+                var offset = disStart + relOffset;
+                m_instanceDataOffsets[i] = (uint)offset;
+            }
         }
     }


Persist JSON channels

Persist JSON channels

--- SOVND.Server/Server.cs
+++ SOVND.Server/Server.cs
@@ -98,7 +98,7 @@

                 LogTo.Info("\{_.username} sent channel data for {0}: {1}", (string)_.channel, (string)_.Message);

-                Publish("/\{_.channel}/info", _.Message);
+                Publish("/\{_.channel}/info", _.Message, true);
             };

             // Handle user chat messages


Test system improvement: New Assert.ThrowsAsync

--- TestRunner/Program.cs
+++ TestRunner/Program.cs
@@ -5,6 +5,7 @@
 using System.Reflection;
 using System.Text;
 using System.Threading;
+using System.Threading.Tasks;
 using Theraot.Collections;
 using Theraot.Core;
 using Theraot.Reflection;
@@ -110,6 +111,33 @@
                 return exception;
             }
             catch (Exception exception)
+            {
+                if (message != null)
+                {
+                    throw new AssertionFailedException($"Expected: {typeof(TException).Name} - Found: {exception} - Message: {message}", exception);
+                }
+                throw new AssertionFailedException($"Expected: {typeof(TException).Name} - Found: {exception}", exception);
+            }
+            if (message != null)
+            {
+                throw new AssertionFailedException($"Expected: {typeof(TException).Name} - Message: {message}");
+            }
+            throw new AssertionFailedException($"Expected: {typeof(TException).Name}");
+        }
+
+        public static TException ThrowsAsync<TException>(Func<Task> func, string message = null)
+            where TException : Exception
+        {
+            try
+            {
+                func().Wait();
+            }
+            catch (AggregateException aggregateException) when (aggregateException.InnerException is TException exception)
+            {
+                GC.KeepAlive(exception);
+                return exception;
+            }
+            catch (AggregateException aggregateException) when (aggregateException.InnerException is Exception exception)
             {
                 if (message != null)
                 {


Tweaking of CRUD test

Tweaking of CRUD test

--- Tests/API/ApiTests.cs
+++ Tests/API/ApiTests.cs
@@ -860,22 +860,39 @@
             Assert.IsTrue(result.Success);
         }

+        /// <summary>
+        /// Create, Read, Update, and Delete a node!
+        /// </summary>
         [Test]
         public void CRUDNodes()
         {
-            //First Create a Node
-            var createNodeRequest = _api.CreateNode("testA", _testOrg, "B2-8");
-            Assert.IsTrue(createNodeRequest.Success);
-
-            //Then read the nodes from the org
+            var nodeName = "name1";
+            var nodeName2 = "name2";
+
+            // First create a new node
+            //var createNodeRequest = _api.CreateNode(nodeName, _testOrg, "B2-8");
+            //Assert.IsTrue(createNodeRequest.Success);
+
+            // Then read the nodes from the org
             var readNodeRequest = _api.ReadNode(_testOrg);
             Assert.IsTrue(readNodeRequest.Success);

-            //GET THE NODEID FROM EITHER CREATE OR READ???
-            var nodeId = "abc";
+            //Attempt to find the Node we created and collect its ID
+            //For now it only look at the Backtest nodes :/
+            string nodeId = null;
+            foreach (var Node in readNodeRequest.BacktestNodes)
+            {
+                if (Node.Name == nodeName)
+                {
+                    nodeId = Node.Id;
+                }
+            }
+
+            Assert.IsNotNull(nodeId);
+

             //Update that node with a new name
-            var updateNodeRequest = _api.UpdateNode(nodeId, "TestB", _testOrg);
+            var updateNodeRequest = _api.UpdateNode(nodeId, nodeName2, _testOrg);
             Assert.IsTrue(updateNodeRequest.Success);

             //Delete this node


small fix

small fix

--- Debugger/SceneExplorer.cs
+++ Debugger/SceneExplorer.cs
@@ -1716,11 +1716,12 @@
             if (GUILayout.Button("Find"))
             {
                 ClearExpanded();
-                var gameObject = GameObject.Find(findGameObjectFilter.Trim());
+                var go = GameObject.Find(findGameObjectFilter.Trim());
                 sceneRoots.Clear();
-                sceneRoots.Add(gameObject, true);
+                expandedGameObjects.Add(new ReferenceChain().Add(go), true);
+                sceneRoots.Add(go, true);
                 scrollPosition = Vector2.zero;
-                searchDisplayString = String.Format("Showing results for GameObject.Find(\"{0}\"", findGameObjectFilter);
+                searchDisplayString = String.Format("Showing results for GameObject.Find(\"{0}\")", findGameObjectFilter);
             }

             if (GUILayout.Button("Reset"))


FileTargetTests: Fix DateArchive_SkipPeriod test.

--- tests/NLog.UnitTests/Targets/FileTargetTests.cs
+++ tests/NLog.UnitTests/Targets/FileTargetTests.cs
@@ -915,6 +915,12 @@
             try
             {
                 var timeSource = new TimeSourceTests.ShiftedTimeSource(timeKind);
+                if (timeSource.Time.Minute == 59)
+                {
+                    // Avoid double-archive due to overflow of the hour.
+                    timeSource.AddToLocalTime(TimeSpan.FromMinutes(1));
+                    timeSource.AddToSystemTime(TimeSpan.FromMinutes(1));
+                }
                 TimeSource.Current = timeSource;

                 var ft = new FileTarget


Minor bug fix with null object

Minor bug fix with null object

--- Rest.Net/RestClient.cs
+++ Rest.Net/RestClient.cs
@@ -26,8 +26,7 @@
         private readonly HttpClient _httpClient = new HttpClient();
         private bool _useStats = false;
         private long _totalTime = 0;
-        private string _absolutePath;
-
+        private string _absolutePath = string.Empty;

         public RestClient()
         {


Adding length counter to trianle generator

--- DotNES/DotNES/Core/APU.cs
+++ DotNES/DotNES/Core/APU.cs
@@ -97,18 +97,25 @@
                     case 0x4008:
                         TRIANGLE.LENGTH_COUNTER_HALT = (((val >> 7) & 0x1) == 1);
                         TRIANGLE.LINEAR_COUNTER_LOAD = (byte)(val & 0x7F);
+                        TRIANGLE.current_linear_counter = TRIANGLE.LINEAR_COUNTER_LOAD;
+                        break;
+                    case 0x4009: // Unused register
                         break;
                     case 0x400A:
                         TRIANGLE.TIMER = (ushort)((TRIANGLE.TIMER & 0xFF00) | val);
                         break;
                     case 0x400B:
                         TRIANGLE.LENGTH_COUNTER_LOAD = (byte)((val >> 3) & 0x1F);
+                        TRIANGLE.current_length_counter = lengthCounterLookupTable[TRIANGLE.LENGTH_COUNTER_LOAD];
+                        TRIANGLE.current_linear_counter = TRIANGLE.LINEAR_COUNTER_LOAD;
                         TRIANGLE.TIMER = (ushort)((TRIANGLE.TIMER & 0x00FF) | ((val & 0x7) << 8));
                         break;
                     case 0x400C:
                         NOISE.ENVELOPE_LOOP = (((val >> 5) & 0x1) == 1);
                         NOISE.CONSTANT_VOLUME = (((val >> 4) & 0x1) == 1);
                         NOISE.VOLUME_ENVELOP = (byte)(val & 0xF);
+                        break;
+                    case 0x400D: // Unused register
                         break;
                     case 0x400E:
                         NOISE.LOOP_NOISE = (((val >> 7) & 0x1) == 1);
@@ -230,6 +237,7 @@
             {
                 tickLengthCounter(PULSE_ONE);
                 tickLengthCounter(PULSE_TWO);
+                tickLengthCounter(TRIANGLE);
                 tickSweep(PULSE_ONE);
                 tickSweep(PULSE_TWO);
             }
@@ -273,6 +281,18 @@
                 if (pulse.current_length_counter < 0)
                 {
                     pulse.current_length_counter = 0;
+                }
+            }
+        }
+
+        private void tickLengthCounter(Triangle triangle)
+        {
+            if (!triangle.LENGTH_COUNTER_HALT)
+            {
+                triangle.current_length_counter -= 1;
+                if (triangle.current_length_counter < 0)
+                {
+                    triangle.current_length_counter = 0;
                 }
             }
         }
@@ -350,7 +370,7 @@

         public float getTriangleAudio(Triangle triangle, int timeInSamples)
         {
-            if (!triangle.ENABLED || triangle.LINEAR_COUNTER_LOAD == 0)
+            if (!triangle.ENABLED || triangle.current_linear_counter == 0 || triangle.current_length_counter == 0)
             {
                 return 0.0f;
             }
@@ -507,6 +527,9 @@
         // 0x400A - 0x400B
         public ushort TIMER { get; set; }                  // 11 bits
         public byte LENGTH_COUNTER_LOAD { get; set; }      // 5 bits
+
+        public int current_length_counter { get; set; } = 0;
+        public int current_linear_counter { get; set; } = 0;
     }

     public class Noise


Better checks for Dogs and Fleas

Better checks for Dogs and Fleas

--- Agency.cs
+++ Agency.cs
@@ -34,7 +34,6 @@

             var toFind = DogToFind();
             dogs.Add(toFind);
-            dogs.Add(toFind);
             return dogs;
         }

@@ -69,7 +68,31 @@
             var toFind = Agency.DogToFind();
             if (!dogs.Contains(toFind))
             {
-                throw new Exception("Can't find the dog. Please try again.");
+                Console.WriteLine("Can't find one of the dogs. Something's wrong with the code.\n");
+            }
+            var flea1 = new Flea { Name = "xqzrbn" };
+            var flea2 = new Flea { Name = "xqzrbn" };
+            var flea3 = new Flea { Name = "krumld" };
+
+            if (typeof(Flea).GetMethod("Equals").DeclaringType == typeof(Flea))
+            {
+                if (!flea1.Equals(flea2) || flea1.Equals(flea3))
+                {
+                    Console.WriteLine("Flea equality doesn't work.\nTwo fleas are the same if they have the same name.\n");
+                }
+            }
+
+            var dog1 = new Dog { Name = "xqzrbn" };
+            dog1.AddFlea(flea1);
+            var dog2 = new Dog { Name = "xqzrbn" };
+            dog2.AddFlea(flea2);
+            var dog3 = new Dog { Name = "krumld" };
+            dog3.AddFlea(flea2);
+            var dog4 = new Dog { Name = "xqzrbn" };
+            dog4.AddFlea(flea3);
+            if (!dog1.Equals(dog2) || dog1.Equals(dog3) || dog1.Equals(dog4))
+            {
+                Console.WriteLine("Dog equality doesn't work.\nTwo dogs are the same if they have the same name and they have the same fleas (regardless of the order).\n");
             }
         }


--- DragonSpark/Reflection.cs
+++ DragonSpark/Reflection.cs
@@ -7,7 +7,7 @@
 {
 	// ReSharper disable once MismatchedFileName

-	public static partial class ExtensionMethods // Testing
+	public static partial class ExtensionMethods
 	{
 		public static T Attribute<T>(this ICustomAttributeProvider @this) where T : Attribute
 			=> Reflection.Attribute<T>.Default.Get(@this);


Add TempDirInDataDir option to override temp dir

--- EDDiscovery/EDDOptions.cs
+++ EDDiscovery/EDDOptions.cs
@@ -121,6 +121,8 @@
                     case "no3dmap": No3DMap = true; break;
                     case "notitleinfo": DisableShowDebugInfoInTitle = true; break;
                     case "resetlanguage": ResetLanguage = true; break;
+                    case "tempdirindatadir": TempDirInDataDir = true; break;
+                    case "notempdirindatadir": TempDirInDataDir = false; break;
                     default:
                         System.Diagnostics.Debug.WriteLine($"Unrecognized option -{opt}");
                         break;
@@ -183,6 +185,7 @@
         public string Font { get; set; }                           // override font, null if not
         public string Commander { get; set; }                   // set commander, null if not
         public string Profile { get; set; }                   // set profile, null if not
+        public bool TempDirInDataDir { get; set; }

         public string SubAppDirectory(string subfolder)     // ensures its there.. name without \ slashes
         {
@@ -256,12 +259,15 @@
             if (!Directory.Exists(AppDataDirectory))        // make sure its there..
                 Directory.CreateDirectory(AppDataDirectory);

-            var tempdir = Path.Combine(AppDataDirectory, "Temp");
-            if (!Directory.Exists(tempdir))
-                Directory.CreateDirectory(tempdir);
-
-            Environment.SetEnvironmentVariable("TMP", tempdir);
-            Environment.SetEnvironmentVariable("TEMP", tempdir);
+            if (TempDirInDataDir == true)
+            {
+                var tempdir = Path.Combine(AppDataDirectory, "Temp");
+                if (!Directory.Exists(tempdir))
+                    Directory.CreateDirectory(tempdir);
+
+                Environment.SetEnvironmentVariable("TMP", tempdir);
+                Environment.SetEnvironmentVariable("TEMP", tempdir);
+            }
         }

         private void SetVersionDisplayString()


Add timer change event handler

Add timer change event handler

--- Tron/Tron/TronGame.cs
+++ Tron/Tron/TronGame.cs
@@ -6,6 +6,7 @@
 using System.Timers;
 using Microsoft.Xna.Framework.Graphics;
 using Tron.CarData;
+using Tron.EventArgs;
 using Tron.Exceptions;

 namespace Tron
@@ -41,6 +42,7 @@
             {
                 this.AddPlayer();
             }
+
             this.Cars = new List<Car>(12);

             // Initalize other properties
@@ -60,6 +62,11 @@
         }

         /// <summary>
+        /// Fires when the timer changes.
+        /// </summary>
+        public event EventHandler<TimerChangedEventArgs> TimerChaged;
+
+        /// <summary>
         /// Gets or sets the car list.
         /// </summary>
         public List<Car> Cars { get; set; }
@@ -371,5 +378,20 @@
         {
             this.DecTimer();
         }
+
+        /// <summary>
+        /// Fires the timer changed event.
+        /// </summary>
+        /// <param name="origin"> The origin on the event. </param>
+        /// <param name="e"> The event arguments. </param>
+        protected void OnTimerChange(object origin, TimerChangedEventArgs e)
+        {
+            EventHandler<TimerChangedEventArgs> handler = this.TimerChaged;
+
+            if (handler != null)
+            {
+                handler(origin, e);
+            }
+        }
     }
 }


Finding articulation points handles the current position correctly.

--- TronBattle/Program.cs
+++ TronBattle/Program.cs
@@ -75,8 +75,10 @@
 		var map = new Map(mapString.Where(c => new[] { '.', '*' }.Contains(c)).Select(c => c == '.' ? null : (int?)29).ToArray(), 10);
 		printMap(map);

-		var APs = new ArticulationPoints(map, new Point(0, 1, 4, 0, 0), true).Find();
-
+		var startingPoint = new Point(0, 1, 4, 0, 0);
+		var AP = new ArticulationPoints(map, startingPoint, true);
+		var APs = AP.Find();
+		ArticulationPoints.printApMap(map, AP.vertexes, startingPoint);
 	}

 	private static Direction selectNextHeading(Map map, Point me, bool firstStep)
@@ -377,8 +379,12 @@
 	public ArticulationPoints(Map map, Point startingPoint, bool firstStep)
 	{
 		vertexes = Enumerable.Repeat(0, map.Length).Select((x, index) => new Vertex(index)).ToArray();
+		var startingToken = map[startingPoint];
+		map[startingPoint] = null;
+
 		Traverse(map, vertexes, startingPoint, firstStep);
-		//printApMap(map, vertexes, new Point(0, 100, 100, 0, 0));
+
+		map[startingPoint] = startingToken;
 	}

 	public bool[] Find()
@@ -427,7 +433,7 @@
 		}
 	}

-	private static void printApMap(Map map, Vertex[] vertexes, Point point)
+	public static void printApMap(Map map, Vertex[] vertexes, Point point)
 	{
 		var pointIndex = map.IndexOf(point);
 		Player.printMap(vertexes.Select((x, index) =>


Implemented RemoveFile.

Implemented RemoveFile.

--- Client.cs
+++ Client.cs
@@ -99,10 +99,33 @@
                 session.FormatAPIServerUrl("/fileops/copy"), parameters));
         }

-
+        /// <summary>
+        /// Copies a file or folder to a new location.
+        /// </summary>
+        /// <param name="Path">The file or folder to be copied from relative to root</param>
+        /// <param name="Destination">Specifies the destination path, including the new name for the file or folder,
+        /// relative to root.</param>
+        /// <returns>FileEntry for the copy of the file or folder</returns>
         public FileEntry CopyFile(string Path, string Destination)
         {
             return CopyFile(Path, Destination, false);
+        }
+
+        /// <summary>
+        /// Deletes a file or folder.
+        /// </summary>
+        /// <param name="Path">The path to the file or folder to be deleted.</param>
+        /// <returns>FileEntry for the deleted file or folder.</returns>
+        public FileEntry RemoveFile(string Path)
+        {
+            List<QueryParameter> parameters = new List<QueryParameter>();
+
+            parameters.Add(new QueryParameter("root", session.AccessType));
+            parameters.Add(new QueryParameter("locale", session.Locale.ToString()));
+            parameters.Add(new QueryParameter("path", Path));
+
+            return new FileEntry((JsonDictionary)session.Request(RequestMethod.POST, RequestType.JSON,
+                session.FormatAPIServerUrl("/fileops/delete"), parameters));
         }

         /// <summary>