fix API doc for OAuth API client

fix API doc for OAuth API client

--- Octokit/Clients/AuthorizationsClient.cs
+++ Octokit/Clients/AuthorizationsClient.cs
@@ -7,41 +7,53 @@
 namespace Octokit
 {
     ///
-    /// Client for the OAuth2 API.
+    /// A client for GitHub's OAuth API.
     ///
     /// <remarks>
-    /// See OAuth API documentation for more details.
+    /// See the OAuth API documentation for more details.
     /// </remarks>
     public class AuthorizationsClient : ApiClient, IAuthorizationsClient
     {
         static readonly Uri _authorizationsEndpoint = new Uri("/authorizations", UriKind.Relative);

+        ///
+        /// Initializes a new GitHub OAuth API client.
+        ///
+        /// <param name="client">An API connection.</param>
         public AuthorizationsClient(IApiConnection client) : base(client)
         {
         }

         ///
-        /// Get all <see cref="Authorization"/>s for the authenticated user. This method requires basic auth.
-        ///
-        /// <remarks>
-        /// See API documentation for more
-        /// details.
-        /// </remarks>
-        /// <returns>An <see cref="Authorization"/></returns>
+        /// Gets all <see cref="Authorization"/>s for the authenticated user.
+        ///
+        /// <remarks>
+        /// This method requires authentication.
+        /// See the API documentation for more information.
+        /// </remarks>
+        /// <exception cref="AuthorizationException">
+        /// Thrown when the current user does not have permission to make the request.
+        /// </exception>
+        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
+        /// <returns>A list of <see cref="Authorization"/>s.</returns>
         public async Task<IReadOnlyList<Authorization>> GetAll()
         {
             return await Client.GetAll<Authorization>(_authorizationsEndpoint);
         }

         ///
-        /// Get a specific <see cref="Authorization"/> for the authenticated user. This method requires basic auth.
-        ///
-        /// <remarks>
-        /// See API documentation for
-        /// more details.
-        /// </remarks>
-        /// <param name="id">The id of the <see cref="Authorization"/></param>
-        /// <returns>An <see cref="Authorization"/></returns>
+        /// Gets a specific <see cref="Authorization"/> for the authenticated user.
+        ///
+        /// <remarks>
+        /// This method requires authentication.
+        /// See the API documentation for more information.
+        /// </remarks>
+        /// <param name="id">The ID of the <see cref="Authorization"/> to get.</param>
+        /// <exception cref="AuthorizationException">
+        /// Thrown when the current user does not have permission to make this request.
+        /// </exception>
+        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
+        /// <returns>The specified <see cref="Authorization"/>.</returns>
         public async Task<Authorization> Get(int id)
         {
             var endpoint = "/authorizations/{0}".FormatUri(id);
@@ -49,22 +61,24 @@
         }

         ///
-        /// This method will create a new authorization for the specified OAuth application, only if an authorization
-        /// for that application doesn’t already exist for the user. It returns the user’s token for the application
-        /// if one exists. Otherwise, it creates one.
-        ///
-        /// <remarks>
-        /// See API
-        /// documentation for more details.
-        /// </remarks>
-        /// <param name="clientId">Client ID for the OAuth application that is requesting the token</param>
-        /// <param name="clientSecret">The client secret</param>
-        /// <param name="newAuthorization">Defines the scopes and metadata for the token</param>
-        /// <exception cref="AuthorizationException">Thrown when the user does not have permission to make
-        /// this request. Check </exception>
-        /// <exception cref="TwoFactorRequiredException">Thrown when the current account has two-factor
-        /// authentication enabled.</exception>
-        /// <returns></returns>
+        /// Creates a new authorization for the specified OAuth application if an authorization for that application doesn’t already
+        /// exist for the user; otherwise, returns the user’s existing authorization for that application.
+        ///
+        /// <remarks>
+        /// This method requires authentication.
+        /// See the API documentation for more information.
+        /// </remarks>
+        /// <param name="clientId">Client ID of the OAuth application for the token.</param>
+        /// <param name="clientSecret">The client secret.</param>
+        /// <param name="newAuthorization">Describes the new authorization to create.</param>
+        /// <exception cref="AuthorizationException">
+        /// Thrown when the current user does not have permission to make this request.
+        /// </exception>
+        /// <exception cref="TwoFactorRequiredException">
+        /// Thrown when the current account has two-factor authentication enabled and an authentication code is required.
+        /// </exception>
+        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
+        /// <returns>The created <see cref="Authorization"/>.</returns>
         public async Task<Authorization> GetOrCreateApplicationAuthentication(
             string clientId,
             string clientSecret,
@@ -87,23 +101,25 @@
         }

         ///
-        /// This method will create a new authorization for the specified OAuth application, only if an authorization
-        /// for that application doesn’t already exist for the user. It returns the user’s token for the application
-        /// if one exists. Otherwise, it creates one.
-        ///
-        /// <remarks>
-        /// See API
-        /// documentation for more details.
-        /// </remarks>
-        /// <param name="clientId">Client ID for the OAuth application that is requesting the token</param>
-        /// <param name="clientSecret">The client secret</param>
-        /// <param name="newAuthorization">Defines the scopes and metadata for the token</param>
-        /// <param name="twoFactorAuthenticationCode"></param>
-        /// <exception cref="AuthorizationException">Thrown when the user does not have permission to make
-        /// this request. Check </exception>
-        /// <exception cref="TwoFactorChallengeFailedException">Thrown when the two-factor code is not
-        /// valid.</exception>
-        /// <returns></returns>
+        /// Creates a new authorization for the specified OAuth application if an authorization for that application doesn’t already
+        /// exist for the user; otherwise, returns the user’s existing authorization for that application.
+        ///
+        /// <remarks>
+        /// This method requires authentication.
+        /// See the API documentation for more information.
+        /// </remarks>
+        /// <param name="clientId">Client ID of the OAuth application for the token.</param>
+        /// <param name="clientSecret">The client secret.</param>
+        /// <param name="newAuthorization">Describes the new authorization to create.</param>
+        /// <param name="twoFactorAuthenticationCode">The two-factor authentication code in response to the current user's previous challenge.</param>
+        /// <exception cref="AuthorizationException">
+        /// Thrown when the current user does not have permission to make this request.
+        /// </exception>
+        /// <exception cref="TwoFactorRequiredException">
+        /// Thrown when the current account has two-factor authentication enabled and an authentication code is required.
+        /// </exception>
+        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
+        /// <returns>The created <see cref="Authorization"/>.</returns>
         public async Task<Authorization> GetOrCreateApplicationAuthentication(
             string clientId,
             string clientSecret,
@@ -138,11 +154,20 @@
         }

         ///
-        /// Update the specified <see cref="Authorization"/>.
-        ///
-        /// <param name="id">The id of the <see cref="Authorization"/></param>
-        /// <param name="authorizationUpdate">The changes to make to the authorization</param>
-        /// <returns></returns>
+        /// Updates the specified <see cref="Authorization"/>.
+        ///
+        /// <remarks>
+        /// This method requires authentication.
+        /// See the API
+        /// documentation for more details.
+        /// </remarks>
+        /// <param name="id">ID of the <see cref="Authorization"/> to update.</param>
+        /// <param name="authorizationUpdate">Describes the changes to make to the authorization.</param>
+        /// <exception cref="AuthorizationException">
+        /// Thrown when the current user does not have permission to make the request.
+        /// </exception>
+        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
+        /// <returns>The updated <see cref="Authorization"/>.</returns>
         public async Task<Authorization> Update(int id, AuthorizationUpdate authorizationUpdate)
         {
             Ensure.ArgumentNotNull(authorizationUpdate, "authorizationUpdate");
@@ -152,10 +177,18 @@
         }

         ///
-        /// Create a new <see cref="Authorization"/>.
-        ///
-        /// <param name="newAuthorization"></param>
-        /// <returns></returns>
+        /// Creates a new <see cref="Authorization"/>.
+        ///
+        /// <remarks>
+        /// This method requires authentication.
+        /// See the API documentation for more information.
+        /// </remarks>
+        /// <param name="newAuthorization">Describes the new authorization to create</param>
+        /// <exception cref="AuthorizationException">
+        /// Thrown when the current user does not have permission to make the request.
+        /// </exception>
+        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
+        /// <returns>The created <see cref="Authorization"/>.</returns>
         public async Task<Authorization> Create(NewAuthorization newAuthorization)
         {
             Ensure.ArgumentNotNull(newAuthorization, "newAuthorization");
@@ -164,10 +197,19 @@
         }

         ///
-        /// Deletes an <see cref="Authorization"/>.
-        ///
-        /// <param name="id">The systemwide id of the authorization</param>
-        /// <returns></returns>
+        /// Deletes the specified <see cref="Authorization"/>.
+        ///
+        /// <remarks>
+        /// This method requires authentication.
+        /// See the API
+        /// documentation for more details.
+        /// </remarks>
+        /// <param name="id">The system-wide ID of the authorization to delete.</param>
+        /// <exception cref="AuthorizationException">
+        /// Thrown when the current user does not have permission to make the request.
+        /// </exception>
+        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
+        /// <returns>A <see cref="Task"/> for the request's execution.</returns>
         public async Task Delete(int id)
         {
             var endpoint = "/authorizations/{0}".FormatUri(id);


Make this 1

Make this 1

--- PolarisServer/Packets/Handlers/Login.cs
+++ PolarisServer/Packets/Handlers/Login.cs
@@ -109,11 +109,11 @@
                 resp.Write(0x41200000); //10
                 resp.Write(0x40A00000); //14
                 resp.Write(11);         //18
-                resp.Write(0x3F800000); //1C
+                resp.Write(0x3F800000); //1C (1 as a float)
                 resp.Write(0x42960000); //20
                 resp.Write(40);         //24
                 resp.Write(0x41200000); //28
-                resp.Write(0);          //2C? (Not set in ctor)
+                resp.Write(1);          //2C?

                 //WHAT
                 for(int i = 0; i < 10; i++)


Fix bug with Camera following

Fix bug with Camera following

--- Sharp2D/Sharp2D/Core/Graphics/Camera.cs
+++ Sharp2D/Sharp2D/Core/Graphics/Camera.cs
@@ -83,7 +83,7 @@
             else if (toFollow.Count > 0)
             {
                 Vector2 center = MathUtils.CenterOf(toFollow.AsVector2List());
-                X = center.X;
+                X = -center.X;
                 Y = center.Y;
             }
         }


Comment out odd (and no longer working) code.

--- cslatest/Csla.Test/DataPortal/StronglyTypedDP.cs
+++ cslatest/Csla.Test/DataPortal/StronglyTypedDP.cs
@@ -82,27 +82,27 @@
             _ID = criteria._ID;
             Csla.ApplicationContext.GlobalContext.Add("StronglyTypedDP", "Created");

-            System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
+            //System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();

-            //change 16 to whatever you want (chops off the nunit calls that get made every time)
-            for (int i = 0; i < st.FrameCount - 16; i++)
-            {
-                string className = st.GetFrame(i).GetMethod().ReflectedType.ToString();
-                string methodName = st.GetFrame(i).GetMethod().Name;
-                string parameters = "";
-                System.Reflection.ParameterInfo[] paramArray = st.GetFrame(i).GetMethod().GetParameters();
+            ////change 16 to whatever you want (chops off the nunit calls that get made every time)
+            //for (int i = 0; i < st.FrameCount - 16; i++)
+            //{
+            //    string className = st.GetFrame(i).GetMethod().ReflectedType.ToString();
+            //    string methodName = st.GetFrame(i).GetMethod().Name;
+            //    string parameters = "";
+            //    System.Reflection.ParameterInfo[] paramArray = st.GetFrame(i).GetMethod().GetParameters();

-                foreach (System.Reflection.ParameterInfo pInfo in paramArray)
-                {
-                    parameters += pInfo.Name;
+            //    foreach (System.Reflection.ParameterInfo pInfo in paramArray)
+            //    {
+            //        parameters += pInfo.Name;

-                    if (pInfo.Name != paramArray[paramArray.Length - 1].Name)
-                        parameters += ", ";
-                }
+            //        if (pInfo.Name != paramArray[paramArray.Length - 1].Name)
+            //            parameters += ", ";
+            //    }

-                Console.WriteLine(className + "." + methodName + "(" + parameters + ")");
-                Console.WriteLine();
-            }
+            //    Console.WriteLine(className + "." + methodName + "(" + parameters + ")");
+            //    Console.WriteLine();
+            //}
         }

         protected void DataPortal_Fetch(StronglyTypedDP.Criteria criteria)


Fized bug where assets with null data caused NRE

--- Source/LibWhipLru/Cache/CacheManager.cs
+++ Source/LibWhipLru/Cache/CacheManager.cs
@@ -392,8 +392,11 @@
 			// Remember it's important that this method does not throw exceptions.
 			LightningException lightningException;

+			ulong spaceNeeded;
+
 			using (var memStream = new MemoryStream()) {
 				ProtoBuf.Serializer.Serialize(memStream, asset); // This can throw, but only if something is VERY and irrecoverably wrong.
+				spaceNeeded = (ulong)memStream.Length;
 				memStream.Position = 0;

 				try {
@@ -421,8 +424,8 @@
 				case LightningDB.Native.Lmdb.MDB_MAP_FULL:
 					LOG.Warn($"Got storage space full during local asset storage for {asset.Id}, clearing some room...", lightningException);

-					uint bytesRemoved;
-					var removedAssetIds = _activeIds.Remove(asset.Data.Length * 3, out bytesRemoved);
+					ulong bytesRemoved;
+					var removedAssetIds = _activeIds.Remove(spaceNeeded * 2, out bytesRemoved);

 					try {
 						using (var tx = _dbenv.BeginTransaction()) {


Updated HttpClientProvider to always use compression.

--- Source/Sugar.Http/HttpClientProvider.cs
+++ Source/Sugar.Http/HttpClientProvider.cs
@@ -1,7 +1,6 @@
 using System;
 using System.Net;
 using System.Net.Http;
-using System.Net.Http.Headers;
 using System.Threading.Tasks;

 namespace Sugar.Http
@@ -50,37 +49,23 @@
         /// <returns></returns>
         public HttpClient Create(HttpMessageHandler innerMessageHandler, bool configureRetryIntercept = true)
         {
-            HttpClient client;
-
             if (innerMessageHandler == null)
             {
-                client = RetryIntercept == null || configureRetryIntercept == false
-                    ? new HttpClient()
-                    : new HttpClient(new RetryDelegatingHandler
-                                     {
-                                         InnerHandler =
-                                             new HttpClientHandler
-                                             {
-                                                 AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
-                                             },
-                                         RetryIntercept = RetryIntercept
-                                     });
-            }
-            else
-            {
-                client = RetryIntercept == null || configureRetryIntercept == false
-                    ? new HttpClient(innerMessageHandler)
-                    : new HttpClient(new RetryDelegatingHandler
-                                     {
-                                         RetryIntercept = RetryIntercept,
-                                         InnerHandler = innerMessageHandler
-                                     });
+                innerMessageHandler = new HttpClientHandler
+                {
+                    AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
+                };
             }

-            if (InitialiseWith != null)
-            {
-                InitialiseWith(client);
-            }
+            var client = RetryIntercept == null || configureRetryIntercept == false
+                ? new HttpClient(innerMessageHandler)
+                : new HttpClient(new RetryDelegatingHandler
+                {
+                    RetryIntercept = RetryIntercept,
+                    InnerHandler = innerMessageHandler
+                });
+
+            InitialiseWith?.Invoke(client);

             return client;
         }


Updated IGridDownloader to use standard log functions for external operation feedback processing.

--- Source/Tools/IGridDownloader/Program.cs
+++ Source/Tools/IGridDownloader/Program.cs
@@ -34,6 +34,7 @@
 using GSF.Parsing;
 using Ionic.Zip;
 using openMIC.Model;
+using static openMIC.SharedAssets.LogFunctions;

 namespace IGridDownloader
 {
@@ -75,31 +76,37 @@
                         const string EventIDKey = "EventId";
                         const string StartTimeKey = "StartTime";

-                        Func<string, string> getLocalFileName = eventID => $"Event{eventID}.pqd";
-
-                        Func<string, DateTime> getEventStartTime = text =>
-                        {
-                            DateTime eventStartTime;
-
-                            if (DateTime.TryParse(text, out eventStartTime))
+                        string getLocalFileName(string eventID) => $"Event{eventID}.pqd";
+
+                        DateTime getEventStartTime(string text)
+                        {
+                            if (DateTime.TryParse(text, out DateTime eventStartTime))
                                 return eventStartTime;

                             int index = text.LastIndexOf(' ');
                             string modifiedText = (index >= 0) ? text.Remove(index) : text;

-                            if (DateTime.TryParse(modifiedText, out eventStartTime))
-                                return eventStartTime;
-
-                            return DateTime.Now;
-                        };
+                            return DateTime.TryParse(modifiedText, out eventStartTime) ? eventStartTime : DateTime.Now;
+                        }

                         Console.WriteLine("Downloading list of events from I-Grid web service...");

-                        string eventInfo = client.GetStringAsync(string.Format(ExportEventListURL, s_baseUrl, s_serialNumber, startTime, endTime)).Result;
+                        string eventInfo;
+
+                        try
+                        {
+                            eventInfo = client.GetStringAsync(string.Format(ExportEventListURL, s_baseUrl, s_serialNumber, startTime, endTime)).Result;
+                            LogConnectionSuccess("Connection succeeded, downloading event files.");
+                        }
+                        catch (Exception ex)
+                        {
+                            LogConnectionFailure(ex.Message);
+                            throw;
+                        }

                         string[][] table = eventInfo.Split(new [] { "\r\n", "\n" }, StringSplitOptions.None)
-                            .Select(line => line.Split('\t'))
-                            .ToArray();
+                                                    .Select(line => line.Split('\t'))
+                                                    .ToArray();

                         List<Dictionary<string, string>> eventList = table
                             .Select(line => new Dictionary<string, string>())
@@ -144,13 +151,15 @@
                             {
                                 zipEntry.CopyTo(fileStream);
                             }
-                            #pragma warning restore SG0018 // Path traversal
+
+                        #pragma warning restore SG0018 // Path traversal

                             if (!Directory.Exists(localPath))
                                 Directory.CreateDirectory(localPath);

                             File.Move(tempFilePath, localFilePath);
-                            Console.WriteLine($"openMIC :: Log Downloaded File :: {Path.Combine(localPath, localFileName)}");
+
+                            LogDownloadedFile(Path.Combine(localPath, localFileName));
                             Console.WriteLine($"Downloaded \"{localFileName}\", {++processedFiles} out of {eventList.Count} files complete...");
                         }

@@ -248,9 +257,7 @@

         private static DateTime ParseTimeTag(string timeTag)
         {
-            DateTime dateTime;
-
-            if (DateTime.TryParse(timeTag, out dateTime))
+            if (DateTime.TryParse(timeTag, out DateTime dateTime))
                 return dateTime;

             string strippedTimeTag = new string(timeTag.Where(c => !char.IsWhiteSpace(c)).ToArray());
@@ -262,9 +269,8 @@
                 return DateTime.Today;

             char unit = strippedTimeTag.Last();
-            int offset;
-
-            if (!int.TryParse(strippedTimeTag.Substring(1, strippedTimeTag.Length - 2), out offset))
+
+            if (!int.TryParse(strippedTimeTag.Substring(1, strippedTimeTag.Length - 2), out int offset))
                 throw new FormatException($"\"{timeTag}\" is not recognized as a valid time tag.");

             switch (unit)


version

version

--- StatsDisplay/Properties/AssemblyInfo.cs
+++ StatsDisplay/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.6.3")]
-[assembly: AssemblyFileVersion("0.6.3")]
+[assembly: AssemblyVersion("0.6.4")]
+[assembly: AssemblyFileVersion("0.6.4")]


Testing to see if timeout is an issue

Testing to see if timeout is an issue

--- Streamus/Dao/NHibernateConfiguration.cs
+++ Streamus/Dao/NHibernateConfiguration.cs
@@ -28,7 +28,7 @@
             //  You are responsible to bind and unbind an ISession instance with static methods of class CurrentSessionContext.
             configuration.SetProperty("current_session_context_class", "web");
             configuration.SetProperty("connection.isolation", "ReadUncommitted");
-            configuration.SetProperty(Environment.CommandTimeout, TimeSpan.FromSeconds(15).TotalSeconds.ToString());
+            //configuration.SetProperty(Environment.CommandTimeout, TimeSpan.FromSeconds(15).TotalSeconds.ToString());
 #if DEBUG
             configuration.SetProperty("default_schema", "[Streamus].[dbo]");
             configuration.SetProperty("generate_statistics", "true");


Add sync setting load from history function.

--- SunSync/SunSync/SyncSettingPage.xaml.cs
+++ SunSync/SunSync/SyncSettingPage.xaml.cs
@@ -44,22 +44,30 @@
         //upload entry domain
         private string uploadEntryDomain;

+        private Dictionary<int, int> defaultChunkDict;
+        private Dictionary<string, int> defaultUploadEntryDict;
         private MainWindow mainWindow;
         private SyncSetting syncSetting;
         public SyncSettingPage(MainWindow mainWindow)
         {
             InitializeComponent();
             this.mainWindow = mainWindow;
+            this.defaultChunkDict = new Dictionary<int, int>();
+            this.defaultChunkDict.Add(128 * 1024, 0);
+            this.defaultChunkDict.Add(256 * 1024, 1);
+            this.defaultChunkDict.Add(512 * 1024, 2);
+            this.defaultChunkDict.Add(1 *1024 * 1024, 3);
+            this.defaultChunkDict.Add(2*1024 * 1024, 4);
+            this.defaultChunkDict.Add(4*1024 * 1024, 5);
+            this.defaultUploadEntryDict = new Dictionary<string, int>();
+            this.defaultUploadEntryDict.Add("http://up.qiniu.com", 0);
+            this.defaultUploadEntryDict.Add("http://upload.qiniu.com", 1);
+            this.defaultUploadEntryDict.Add("http://up.qiniug.com", 2);
         }

         public void LoadSyncSetting(SyncSetting syncSetting)
         {
             this.syncSetting = syncSetting;
-            if (this.syncSetting != null)
-            {
-                this.SyncLocalFolderTextBox.Text = syncSetting.SyncLocalDir;
-                this.SyncTargetBucketTextBox.Text = syncSetting.SyncTargetBucket;
-            }
         }

         private void BackToHome_EventHandler(object sender, MouseButtonEventArgs e)
@@ -198,13 +206,37 @@

         private void SyncSettingPageLoaded_EventHandler(object sender, RoutedEventArgs e)
-        {
+        {
+            this.SyncSettingTabControl.SelectedIndex = 0;
             if (this.syncSetting == null)
             {
-                //use defaults for ui
-                this.SyncSettingTabControl.SelectedIndex = 0;
                 this.makeBasicSettingsDefault();
                 this.makeAdvancedSettingsDefault();
+            }
+            else
+            {
+                //basic settings
+                this.SyncLocalFolderTextBox.Text = syncSetting.SyncLocalDir;
+                this.SyncTargetBucketTextBox.Text = syncSetting.SyncTargetBucket;
+
+                //advanced settings
+                this.PrefixTextBox.Text = syncSetting.SyncPrefix;
+                this.OverwriteFileCheckBox.IsChecked = syncSetting.OverwriteFile;
+                this.IgnoreRelativePathCheckBox.IsChecked = syncSetting.IgnoreDir;
+                this.ThreadCountSlider.Value = syncSetting.SyncThreadCount;
+                this.ChunkUploadThresholdSlider.Value = syncSetting.ChunkUploadThreshold/1024/1024;
+                int defaultChunkSizeIndex = 2;
+                int defaultUploadEntryIndex = 1;
+                if (this.defaultChunkDict.ContainsKey(syncSetting.DefaultChunkSize))
+                {
+                    defaultChunkSizeIndex = this.defaultChunkDict[syncSetting.DefaultChunkSize];
+                }
+                this.ChunkDefaultSizeComboBox.SelectedIndex = defaultChunkSizeIndex;
+                if (this.defaultUploadEntryDict.ContainsKey(syncSetting.UploadEntryDomain))
+                {
+                    defaultUploadEntryIndex = this.defaultUploadEntryDict[syncSetting.UploadEntryDomain];
+                }
+                this.UploadEntryDomainComboBox.SelectedIndex = defaultUploadEntryIndex;
             }
         }

@@ -223,7 +255,6 @@
             this.ChunkUploadThresholdSlider.Value = 10;//10MB
             this.ThreadCountSlider.Value = 1;
             this.UploadEntryDomainComboBox.SelectedIndex = 1;
-            this.ThreadCountLabel.Content = "1";
         }

     }


Fix to avoid SA1002 and SA1009

Fix to avoid SA1002 and SA1009

--- ThScoreFileConverter/Models/Squirrel.cs
+++ ThScoreFileConverter/Models/Squirrel.cs
@@ -70,7 +70,7 @@
         public const SQObjectType OTUserPointer =
             SQObjectType.RTUserPointer;
         public const SQObjectType OTThread =
-            (SQObjectType.RTThread | SQObjectType.SQObjectRefCounted) ;
+            (SQObjectType.RTThread | SQObjectType.SQObjectRefCounted);
         public const SQObjectType OTFuncProto =
             (SQObjectType.RTFuncProto | SQObjectType.SQObjectRefCounted);
         public const SQObjectType OTClass =


More debug

More debug

--- TorSharp/Tools/Tor/TorPasswordHasher.cs
+++ TorSharp/Tools/Tor/TorPasswordHasher.cs
@@ -13,8 +13,8 @@
             {
                 StartInfo =
                 {
-                    FileName = tor.ExecutablePath,
-                    Arguments = $"--hash-password {password}",
+                    FileName = "cmd.exe",
+                    Arguments = $"/c \"{tor.ExecutablePath} --hash-password {password} | more\"",
                     RedirectStandardError = true,
                     RedirectStandardOutput = true,
                     UseShellExecute = false
@@ -24,9 +24,7 @@
             var stdout = new StringBuilder();
             var stderr = new StringBuilder();

-            process.OutputDataReceived += (sender, args) => { Console.WriteLine("!!!! " + args.Data);
-                                                                stdout.AppendLine(args.Data);
-            };
+            process.OutputDataReceived += (sender, args) => stdout.AppendLine(args.Data);
             process.ErrorDataReceived += (sender, args) => stderr.AppendLine(args.Data);

             process.Start();


Added retrieval of clipboard as text or HTML frag. Expanded paste event.

See https://msdn.microsoft.com/en-us/library/windows/desktop/ms649015(v=vs.85).aspx for more on HTML Clipboard Format.

HandlePaste now fires if ctrl *or* alt is held down during a V press to catch more combos.

--- UWPBox/org/rufwork/UI/widgets/UWPBox.cs
+++ UWPBox/org/rufwork/UI/widgets/UWPBox.cs
@@ -114,6 +114,62 @@

             var res = await dialog.ShowAsync();
             return (int)res.Id;
+        }
+
+        /// <summary>
+        /// Will return a Microsoft formatted HTML snippet if the clipboard contains it.
+        /// Passing returnHtmlInFragmentFormat as true will return it in "raw" fragment format.
+        /// See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms649015(v=vs.85).aspx
+        /// Passing returnHtmlInFragmentFormat as false, the default, will only return the html fragment
+        /// without any metadata or <html> tags.
+        ///
+        /// If clipboard isn't in HTML format, this will attempt to return the clipboard's contents as text.
+        /// </summary>
+        /// <param name="returnHtmlInFragmentFormat">If true, full Microsoft html fragment format will
+        /// be returned. False will return only the html fragment without metadata or html tags.</param>
+        /// <returns>Returns ONE of
+        /// 1.) Full html Microsoft fragment format as text,
+        /// 2.) The html fragment as text, or
+        /// 3.) Non-html format clipboard contents as text.</returns>
+        public static async Task<string> ClipboardAsHtml(bool returnHtmlInFragmentFormat = false)
+        {
+            string ret = string.Empty;
+            DataPackageView dataPackageView = Clipboard.GetContent();
+
+            if (dataPackageView.Contains(StandardDataFormats.Html))
+            {
+                ret = await Clipboard.GetContent().GetHtmlFormatAsync();
+
+                if (!returnHtmlInFragmentFormat)
+                {
+                    string delimiterStartAfter = "<!--StartFragment-->";
+                    string delimiterEndBefore = "<!--EndFragment-->";
+
+                    if (-1 < ret.IndexOf(delimiterStartAfter))
+                    {
+                        ret = ret.Substring(ret.IndexOf(delimiterStartAfter) + delimiterStartAfter.Length);
+                        if (-1 < ret.IndexOf(delimiterEndBefore))
+                        {
+                            ret = ret.Substring(0, ret.IndexOf(delimiterEndBefore));
+                        }
+                        else
+                        {
+                            ret = string.Empty;  // No luck, Ending not after Start; go back to nothing.
+                        }
+                    }
+                }
+            }
+            else if (dataPackageView.Contains(StandardDataFormats.Text))
+            {
+                ret = await Clipboard.GetContent().GetTextAsync();
+            }
+
+            return ret;
+        }
+
+        public static async Task<string> ClipboardAsText()
+        {
+            return await Clipboard.GetContent().GetTextAsync();
         }
     }
     //=========================================================================
@@ -581,7 +637,7 @@

                     // Reimplementing Paste
                     case VirtualKey.V:
-                        if (isCtrlDown)
+                        if (isCtrlDown || isAltDown)
                             this.HandlePaste(isCtrlDown, isShiftDown, isAltDown);
                         break;

@@ -636,7 +692,7 @@
             {
                 try
                 {
-                    string strClipboard = await Clipboard.GetContent().GetTextAsync();
+                    string strClipboard = await UWPBoxExtensions.ClipboardAsText();
                     this.SelectedText = strClipboard;   // TODO: Be more careful about things that don't have text.

                     this.SelectionStart += this.SelectionLength;
@@ -923,8 +979,6 @@
 > before coffin warehouses, and bringing up the rear of
 > every funeral I meet;

-<style>table { margin: 0 auto; }</style>
-
 |First| Second     |Third     |Fourth|
 |-----|:----------:|----------|-----:|
 |and  | especially |whenever  |my    |


Add ability to determine the current line and column for an IndentStringBuilder

--- WootzJs.Compiler/IndentStringBuilder.cs
+++ WootzJs.Compiler/IndentStringBuilder.cs
@@ -39,6 +39,7 @@
         private int currentIndentLevel;
         private StringBuilder builder = new StringBuilder();
         private StringBuilder currentLine = new StringBuilder();
+        private int currentLineNumber;
         private bool isCompacting;

         public IndentStringBuilder(int indentSize = 4)
@@ -49,6 +50,16 @@
         public string CurrentIndent
         {
             get { return currentIndent; }
+        }
+
+        public int CurrentLineNumber
+        {
+            get { return currentLineNumber; }
+        }
+
+        public int CurrentLinePosition
+        {
+            get { return currentLine.Length; }
         }

         public bool IsCompacting
@@ -133,6 +144,7 @@
             if (!IsCompacting)
                 builder.AppendLine();
             currentLine.Length = 0;
+            currentLineNumber++;
         }

         public override string ToString()


[WPF] Don't show the dialog button bar if there are no buttons

--- Xwt.WPF/Xwt.WPFBackend/DialogBackend.cs
+++ Xwt.WPF/Xwt.WPFBackend/DialogBackend.cs
@@ -73,6 +73,7 @@
 			this.rootPanel.RowDefinitions.Add (new RowDefinition { Height = new GridLength (0, GridUnitType.Auto) });
 			Grid.SetRow (this.buttonContainer, 3);
 			this.rootPanel.Children.Add (this.buttonContainer);
+			this.buttonContainer.Visibility = Visibility.Collapsed;
 		}

 		public override void SetMinSize (Size s)
@@ -112,7 +113,7 @@

 		void UpdateSeparatorVisibility ()
 		{
-			separator.Visibility = buttons.Any (b => b.Visible) ? Visibility.Visible : Visibility.Collapsed;
+			buttonContainer.Visibility = separator.Visibility = buttons.Any (b => b.Visible) ? Visibility.Visible : Visibility.Collapsed;
 		}

 		public void RunLoop (IWindowFrameBackend parent)


Fix associations of Evaluate-based combinator rules

Unite rules about Evaluate-based combinator rules to fix operator associations.

--- Yacq/LanguageServices/PatternGrammar.cs
+++ Yacq/LanguageServices/PatternGrammar.cs
@@ -117,47 +117,45 @@

             #region Terms

-            // Texts
-            this.Add("term", "text", g => Alternative.Get["term", "text"]
-                .Select(e => YacqExpression.TypeCandidate(typeof(YacqCombinators))
-                    .Method("Evaluate")
-                    .Method("Where", e)
+            this.Add("root", "term", g =>
+                Combinator.Choice(
+                    Standard.Get["term", "text"],
+                    Standard.Get["term", "number"],
+                    '#'.Satisfy().Right(Combinator.Choice(
+                        Standard.Get["term", "list"],
+                        Standard.Get["term", "vector"],
+                        Standard.Get["term", "lambdaList"]
+                    )),
+                    // Identifiers
+                    Combinator.Choice(
+                        Chars.Digit()
+                            .Not()
+                            .Right(Chars.Space()
+                                .Or(punctuation)
+                                .Not()
+                                .Right(Chars.Any())
+                                .Many(1)
+                            )
+                    ).Select(cs =>
+                        YacqExpression.Identifier(default(Char), new String(cs.ToArray()))
+                    )
                 )
-            );
-
-            // Numbers
-            this.Add("term", "number", g => Alternative.Get["term", "number"]
-                .Select(e => YacqExpression.TypeCandidate(typeof(YacqCombinators))
-                    .Method("Evaluate")
-                    .Method("Where", e)
-                )
-            );
-
-            // Identifiers
-            this.Add("term", "identifier", g => SetPosition(
-                Combinator.Choice(
-                    Chars.Digit()
-                        .Not()
-                        .Right(Chars.Space()
-                            .Or(punctuation)
-                            .Not()
-                            .Right(Chars.Any())
-                            .Many(1)
-                        )
-                ).Select(cs =>
-                    YacqExpression.Identifier(default(Char), new String(cs.ToArray()))
-                ).Select(ei => ei.Reduce().If(
+                .Let(ps => Prims.Pipe(
+                    ps,
+                    '.'.Satisfy()
+                        .Right(ps)
+                        .Many(),
+                    (h, t) => t.Aggregate(h, (l, r) =>
+                        YacqExpression.List(YacqExpression.Identifier("."), l, r)
+                    )
+                ))
+                .Select(et => et.Reduce().If(
                     e => e.Type().IsAppropriate(typeof(Parser<Expression, Expression>)),
-                    e => (YacqExpression) ei,
+                    e => et,
                     e => YacqExpression.TypeCandidate(typeof(YacqCombinators))
                         .Method("Evaluate")
                         .Method("Where", e)
                 ))
-            ));
-
-            this.Add("root", "term", g => g["term"]
-                .Choice()
-                .Between(g["root", "ignore"], g["root", "ignore"])
             );

             #endregion
@@ -246,7 +244,7 @@
                 )))
             );

-            // Dots
+            // Colons
             this.Add("operator", "colon", g => g["operator", "dot"]
                 .Let(parent => SetPosition(Prims.Pipe(
                     parent,


Fixed null value bug in AVL tree

Fixed null value bug in AVL tree

--- data-structures-csharp/data-structures-csharp/AvlTree/AvlTree.cs
+++ data-structures-csharp/data-structures-csharp/AvlTree/AvlTree.cs
@@ -57,12 +57,12 @@
             {
                 int i = root.Data.CompareTo(element);

-                if (i < 0)
+                if (i > 0)
                 {
                     root.Left = Add(root.Left, element, height + 1);
                     root = RebalanceLeft(root);
                 }
-                else if (i > 0)
+                else if (i < 0)
                 {
                     root.Right = Add(root.Right, element, height + 1);
                     root = RebalanceRight(root);
@@ -103,8 +103,8 @@

             Node<T> left = root.Left;
             Node<T> right = root.Right;
-            int leftHeight = root.Left.Height;
-            int rightHeight = root.Right.Height;
+            int leftHeight = (root.Left == null) ? 0 : root.Left.Height;
+            int rightHeight = (root.Right == null) ? 0 : root.Right.Height;

             if (leftHeight > (rightHeight + 1))
             {
@@ -140,8 +140,8 @@

             Node<T> left = root.Left;
             Node<T> right = root.Right;
-            int leftHeight = root.Left.Height;
-            int rightHeight = root.Right.Height;
+            int leftHeight = (root.Left == null) ? 0 : root.Left.Height;
+            int rightHeight = (root.Right == null) ? 0 : root.Right.Height;

             if (rightHeight > (leftHeight + 1))
             {
@@ -251,7 +251,10 @@
             Contract.Requires<ArgumentNullException>(stack != null);

             while (x != null)
-            { stack.Push(x); x = x.Left; }
+            {
+                stack.Push(x);
+                x = x.Left;
+            }
         }

         public IEnumerator<T> GetEnumerator()


v1.1.4.5 * Enabled submit form for branch

--- HamstarHelpersMod.cs
+++ HamstarHelpersMod.cs
@@ -185,7 +185,7 @@

 		////////////////

-		/*public override void ModifyInterfaceLayers( List<GameInterfaceLayer> layers ) {
+		public override void ModifyInterfaceLayers( List<GameInterfaceLayer> layers ) {
 			var modworld = this.GetModWorld<MyModWorld>();

 			if( modworld.Logic.IsReady() ) {
@@ -212,6 +212,6 @@
 					layers.Insert( idx, interface_layer );
 				}
 			}
-		}*/
+		}
 	}
 }


Changed assembly version to 1.2

Changed assembly version to 1.2

--- Isop/AssemblyInfo.cs
+++ Isop/AssemblyInfo.cs
@@ -5,7 +5,7 @@
 // Change them to the values specific to your project.

 [assembly: AssemblyTitle("Isop")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("Command line helper library.")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("")]
@@ -17,7 +17,7 @@
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.

-[assembly: AssemblyVersion("1.1.*")]
+[assembly: AssemblyVersion("1.2.*")]

 // The following attributes are used to specify the signing key for the assembly,
 // if desired. See the Mono documentation for more information about signing.


UPDATE Code cleanup und Commit Test

UPDATE Code cleanup und Commit Test

--- eRechnungWordPlugIn/ebIViewModels/ViewModels/InvoiceViewModel.cs
+++ eRechnungWordPlugIn/ebIViewModels/ViewModels/InvoiceViewModel.cs
@@ -1345,7 +1345,6 @@
             }
             else
             {
-                // string fn = @"C:\Users\jbogad\Documents\eRechnung\Vorlagen\2013-0010-StandardBund.XML";
                 _openDlg.InitialDirectory = PlugInSettings.Default.PathToInvoiceTemplates;
                 _openDlg.Filter = "Vorlagen (*.xmlt,*.xml)|*.xmlt;*xml|All files (*.*)|*.*";
                 DialogResult rc = _dlg.ShowOpenFileDialog(_openDlg);


Lobby implementations skeleton

Lobby implementations skeleton

--- fierce-galaxy/FierceGalaxyServer/MatchingModule/ByLobby/Lobby.cs
+++ fierce-galaxy/FierceGalaxyServer/MatchingModule/ByLobby/Lobby.cs
@@ -8,5 +8,67 @@
 {
     public class Lobby : ILobby
     {
+        public IReadOnlyMap CurrentMap
+        {
+            get
+            {
+                throw new NotImplementedException();
+            }
+
+            set
+            {
+                throw new NotImplementedException();
+            }
+        }
+
+        public int MaxPlayers
+        {
+            get
+            {
+                throw new NotImplementedException();
+            }
+
+            set
+            {
+                throw new NotImplementedException();
+            }
+        }
+
+        public IReadOnlyList<IReadOnlyPlayer> PlayerList
+        {
+            get
+            {
+                throw new NotImplementedException();
+            }
+        }
+
+        public event EventHandler MapChange;
+        public event EventHandler PlayerJoin;
+        public event EventHandler PlayerQuit;
+
+        public void Join(IReadOnlyPlayer player)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void KickUser(IReadOnlyPlayer player)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void Leave(IReadOnlyPlayer player)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SetPlayerColor(IPlayer player, Color c)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SetSpawn(IReadOnlyPlayer player, IReadOnlyNode node)
+        {
+            throw new NotImplementedException();
+        }
     }
 }


Libraries/DAL: added more server side functionality

--- Libraries/DAL/DAL.cs
+++ Libraries/DAL/DAL.cs
@@ -213,7 +213,7 @@
 			else
 			{
 				var res = client.Cypher
-					.Match ("user-[:HOSTING]->(event:Event)")
+					.Match ("(user:User)-[:HOSTING]->(event:Event)")
 					.Where ("user.Id = {uid}")
 					.WithParam ("uid", uid)
 					.Return (() => new {
@@ -225,5 +225,39 @@
 				return res.First ().hosting;
 			}
 		}
+
+		public static void UpdateEvent (string uid, Event e)
+		{
+			client.Cypher
+				.Match ("user-[:HOSTING]->(event:Event {info})")
+				.Where ("user.Id = {uid}")
+				.AndWhere ("event.Id = eid AND event.uid = uid")
+				.WithParam ("uid", uid)
+				.WithParam ("eid", e.eid)
+				.Set ("info = {newinfo}")
+				.WithParam ("newinfo", e)
+				.ExecuteWithoutResultsAsync ();
+		}
+
+		public static void DeleteEvent (string uid, int eid)
+		{
+			client.Cypher
+				.Match ("user-[:HOSTING]->(event:Event)<-[r]-()")
+				.WithParam ("user.Id", uid)
+				.Delete ("r, event")
+				.ExecuteWithoutResultsAsync ();
+		}
+
+		public static void CancelRegistration (string uid, Event e)
+		{
+			client.Cypher
+				.Match ("(user:User)-[a:ATTENDS]->(event:Event)")
+				.Where ("user.Id = {uid} AND event.uid = {euid} AND event.eid = {eid}")
+				.WithParam ("uid", uid)
+				.WithParam ("euid", e.uid)
+				.WithParam ("eid", e.eid)
+				.Delete ("a")
+				.ExecuteWithoutResultsAsync ();
+		}
 	}
 }


Have our own private instance of the channel list, so we don't go changing the list supplied by the config.

--- MeidoBot/MeidoBot.cs
+++ MeidoBot/MeidoBot.cs
@@ -24,6 +24,7 @@
         readonly MeidoComm meidoComm;

         readonly MeidoConfig conf;
+        readonly List<string> currentChannels;

         public Meido(MeidoConfig config)
@@ -33,6 +34,7 @@

             // We need these parameters for events, store them.
             conf = config;
+            currentChannels = new List<string>(conf.Channels);

             // Initialize the IrcComm with the IrcClient for this server/instance.
             ircComm = new IrcComm(irc);
@@ -113,8 +115,9 @@
             irc.Login(conf.Nickname, "Meido Bot", 0, "MeidoBot");
             log.Message("Connected as {0} to {1}", irc.Nickname, irc.Address);

-            log.Message("Joining channels: " + string.Join(" ", conf.Channels));
-            irc.RfcJoin(conf.Channels.ToArray());
+            // Join current channels, since those might differ from the configured channels due to invites.
+            log.Message("Joining channels: " + string.Join(" ", currentChannels));
+            irc.RfcJoin(currentChannels.ToArray());

             irc.Listen();
         }
@@ -124,9 +127,10 @@
         {
             log.Message("Received invite from {0} for {1}", e.Who, e.Channel);

-            if (!conf.Channels.Contains(e.Channel))
-            {
-                conf.Channels.Add(e.Channel);
+            // Keep track of channels we're invited to, so that we may rejoin after disconnects.
+            if (!currentChannels.Contains(e.Channel))
+            {
+                currentChannels.Add(e.Channel);
                 irc.SendMessage(SendType.Notice, e.Who,
                     "If you want your channel on the auto-join list, please contact the owner.");
             }


Init parameter collection with the param count

- to reduce resizes

--- Mono.Cecil/Import.cs
+++ Mono.Cecil/Import.cs
@@ -711,9 +711,8 @@
 				if (!method.HasParameters)
 					return reference;

-				var reference_parameters = reference.Parameters;
-
 				var parameters = method.Parameters;
+				var reference_parameters = reference.parameters = new ParameterDefinitionCollection (reference, parameters.Count);
 				for (int i = 0; i < parameters.Count; i++)
 					reference_parameters.Add (
 						new ParameterDefinition (ImportType (parameters [i].ParameterType, context)));


Add initial Loading to  Quartz

Add initial Loading to  Quartz

--- NoAdsHere/Program.cs
+++ NoAdsHere/Program.cs
@@ -15,6 +15,8 @@
 using System.Linq;
 using System.Collections.Generic;
 using NoAdsHere.Common;
+using Quartz;
+using Quartz.Impl;

 namespace NoAdsHere
 {
@@ -31,6 +33,7 @@
         private readonly Logger _discordLogger = LogManager.GetLogger("Discord");
         private readonly bool ReadyExecuted = false;
         private IServiceProvider provider;
+        private IScheduler _scheduler;

         public async Task RunAsync()
         {
@@ -50,6 +53,7 @@

             _config = Config.Load();
             _mongo = CreateDatabaseConnection();
+            _scheduler = await StartQuartz();

             provider = ConfigureServices();

@@ -71,6 +75,8 @@

                 await AntiAds.Install(provider);
                 await AntiAds.StartServiceAsync();
+
+                await JobQueue.Install(provider);
             }
         }

@@ -105,6 +111,14 @@
                 await collection.InsertManyAsync(newPenalties);
         }

+        private async Task<IScheduler> StartQuartz()
+        {
+            StdSchedulerFactory factory = new StdSchedulerFactory();
+            var scheduler = await factory.GetScheduler();
+            await scheduler.Start();
+            return scheduler;
+        }
+
         private MongoClient CreateDatabaseConnection()
         {
             _logger.Info("Connecting to MongoDb Database");
@@ -118,6 +132,7 @@
                 .AddSingleton(_client)
                 .AddSingleton(_config)
                 .AddSingleton(_mongo)
+                .AddSingleton(_scheduler)
                 .AddSingleton(new CommandService(new CommandServiceConfig { CaseSensitiveCommands = false, ThrowOnError = false, LogLevel = LogSeverity.Verbose }));

             var provider = servies.BuildServiceProvider();


Trim whitespace from macro names.

Trim whitespace from macro names.

--- Organic/Assembler.cs
+++ Organic/Assembler.cs
@@ -462,7 +462,7 @@
                         if (macroDefinition.Contains("("))
                         {
                             string paramDefinition = macroDefinition.Substring(macroDefinition.IndexOf("(") + 1);
-                            macro.Name = macroDefinition.Remove(macroDefinition.IndexOf("("));
+                            macro.Name = macroDefinition.Remove(macroDefinition.IndexOf("(")).Trim();
                             if (!paramDefinition.EndsWith(")"))
                             {
                                 listEntry.ErrorCode = ErrorCode.InvalidMacroDefintion;
@@ -563,7 +563,7 @@
                         userMacro.Args = new string[0];
                         string macroDefinition = line;
                         string paramDefinition = macroDefinition.Substring(macroDefinition.IndexOf("(") + 1);
-                        userMacro.Name = macroDefinition.Remove(macroDefinition.IndexOf("("));
+                        userMacro.Name = macroDefinition.Remove(macroDefinition.IndexOf("(")).Trim();
                         if (!paramDefinition.EndsWith(")"))
                         {
                             listEntry.ErrorCode = ErrorCode.InvalidMacroDefintion;


Extended the zoom range to x10000

Extended the zoom range to x10000

git-svn-id: 6b7e1e5d0861e268462ba7828ef63c1bcab52a9b@149 d3cde5d6-82b8-4669-8b62-43054d6781d8

--- PanView/Waterfall.cs
+++ PanView/Waterfall.cs
@@ -27,7 +27,7 @@
         public const float MinimumLevel = 130.0f;

         public const int CursorSnapDistance = 4;
-        public const float MaxZoom = 3.0f;
+        public const float MaxZoom = 4.0f;

         private readonly static double _attack = GetDoubleSetting("waterfallAttack", 0.9);
         private readonly static double _decay = GetDoubleSetting("waterfallDecay", 0.5);


Fixed new-line and  space handling in shared strings; Added validation for pane widths and height

--- PicoXLSX/LowLevel.cs
+++ PicoXLSX/LowLevel.cs
@@ -178,12 +178,37 @@
             sb.Append("\">");
             foreach (string str in sharedStrings.Keys)
             {
-                sb.Append("<si><t>");
-                sb.Append(EscapeXmlChars(str));
-                sb.Append("</t></si>");
+                AppendSharedString(sb, EscapeXmlChars(str));
             }
             sb.Append("</sst>");
             return sb.ToString();
+        }
+
+        ///
+        /// Method to append shared string values and to handle leading or trailing spaces
+        ///
+        /// <param name="sb">StringBuilder instance</param>
+        /// <param name="value">Escaped string value (not null)</param>
+        private void AppendSharedString(StringBuilder sb, string value)
+        {
+            int len = value.Length;
+            sb.Append("<si>");
+            if (len == 0)
+            {
+                sb.Append("<t></t>");
+            }
+            else
+            {
+                if (value[0] == ' ' || value[len - 1] == ' ')
+                {
+                    sb.Append("<t xml:space=\"preserve\">").Append(value).Append("</t>");
+                }
+                else
+                {
+                    sb.Append("<t>").Append(value).Append("</t>");
+                }
+            }
+            sb.Append("</si>");
         }

         ///
@@ -1606,8 +1631,13 @@
         /// <param name="maxDigitWidth">Maximum digit with of the default font (default is 7.0 for Calibri, size 11)</param>
         /// <param name="textPadding">Text padding of the default font (default is 5.0 for Calibri, size 11)</param>
         /// <returns>The internal column width in characters, used in worksheet XML documents</returns>
+        /// <exception cref="FormatException">Throws a FormatException if the column width is out of range</exception>
         public static float GetInternalColumnWidth(float columnWidth, float maxDigitWidth = 7f, float textPadding = 5f)
         {
+            if (columnWidth < Worksheet.MIN_COLUMN_WIDTH || columnWidth > Worksheet.MAX_COLUMN_WIDTH)
+            {
+                throw new FormatException("The column width " + columnWidth + " is not valid. The valid range is between " + Worksheet.MIN_COLUMN_WIDTH + " and " + Worksheet.MAX_COLUMN_WIDTH);
+            }
             if (columnWidth <= 0f || maxDigitWidth <= 0f)
             {
                 return 0f;
@@ -1630,8 +1660,13 @@
         /// Therefore, the originally defined row height will slightly deviate, based on this pixel snap</remarks>
         /// <param name="rowHeight">Target row height (displayed in Excel)</param>
         /// <returns>The internal row height which snaps to the nearest pixel</returns>
+        /// <exception cref="FormatException">Throws a FormatException if the row height is out of range</exception>
         public static float GetInternalRowHeight(float rowHeight)
         {
+            if (rowHeight < Worksheet.MIN_ROW_HEIGHT || rowHeight > Worksheet.MAX_ROW_HEIGHT)
+            {
+                throw new FormatException("The row height " + rowHeight + " is not valid. The valid range is between " + Worksheet.MIN_ROW_HEIGHT + " and " + Worksheet.MAX_ROW_HEIGHT);
+            }
             if (rowHeight <= 0f)
             {
                 return 0f;
@@ -1649,7 +1684,7 @@
         /// See also <see cref="GetInternalColumnWidth(float, float, float)"/> for additional details.

         /// This method is derived from the Perl implementation by John McNamara (https://stackoverflow.com/a/5010899)

         /// See also: ECMA-376, Part 1, Chapter 18.3.1.13

-        /// The two optional parameters maxDigitWidth and textPadding probably don't have to be changed ever.
+        /// The two optional parameters maxDigitWidth and textPadding probably don't have to be changed ever. Negative column widths are automatically transformed to 0.
         /// </remarks>
         /// <param name="width">Target column(s) width (one or more columns, displayed in Excel)</param>
         /// <param name="maxDigitWidth">Maximum digit with of the default font (default is 7.0 for Calibri, size 11)</param>
@@ -1658,6 +1693,10 @@
         public static float GetInternalPaneSplitWidth(float width, float maxDigitWidth = 7f, float textPadding = 5f)
         {
             float pixels;
+            if (width < 0)
+            {
+                width = 0;
+            }
             if (width <= 1f)
             {
                 pixels = (float)Math.Floor(width / SPLIT_WIDTH_MULTIPLIER + SPLIT_WIDTH_OFFSET);
@@ -1675,12 +1714,17 @@
         ///
         /// <remarks>
         /// The internal split height is based on the height of one or more rows. It also depends on various constants.

-        /// This method is derived from the Perl implementation by John McNamara (https://stackoverflow.com/a/5010899)
+        /// This method is derived from the Perl implementation by John McNamara (https://stackoverflow.com/a/5010899).

+        /// Negative row heights are automatically transformed to 0.
         /// </remarks>
         /// <param name="height">Target row(s) height (one or more rows, displayed in Excel)</param>
         /// <returns>The internal pane height, used in worksheet XML documents in case of worksheet splitting</returns>
         public static float GetInternalPaneSplitHeight(float height)
         {
+            if (height < 0)
+            {
+                height = 0f;
+            }
             return (float)Math.Floor(SPLIT_POINT_DIVIDER * height + SPLIT_HEIGHT_POINT_OFFSET);
         }


[ci skip]

[ci skip]

--- Qiniu/Conf/Config.cs
+++ Qiniu/Conf/Config.cs
@@ -26,7 +26,7 @@
         /// <summary>
         /// 七牛资源上传服务器地址.
         /// </summary>
-        public static string UP_HOST = "http://upload.qiniu.com";
+        public static string UP_HOST = "http://up.qiniu.com";
         /// <summary>
         /// 七牛资源列表服务器地址.
         /// </summary>


changes to try to get file log

changes to try to get file log

--- RepoStats/Program.cs
+++ RepoStats/Program.cs
@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Globalization;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -10,14 +11,24 @@
 {
     class Program
     {
+        class GitFileInfo
+        {
+            public string Path { get; set; }
+            public int NumberOfCommits { get; set; }
+            public int LinesAdded { get; set; }
+            public int LinesDeleted { get; set; }
+        }
+
         static void Main(string[] args)
         {
             Console.WriteLine("Hello world");
-
-            using (var repo = new Repository("C:\\rdnext\\Azure\\Compute"))
+            string repoRoot = "C:\\rdnext\\Azure\\Compute";
+
+            using (var repo = new Repository(repoRoot))
             {
                 var RFC2822Format = "ddd dd MMM HH:mm:ss yyyy K";

+                int commitCount = repo.Commits.Count();
                 foreach (Commit c in repo.Commits.Take(15))
                 {
                     Console.WriteLine(string.Format("commit {0}", c.Id));
@@ -34,6 +45,25 @@
                     Console.WriteLine(c.Message);
                     Console.WriteLine();
                 }
+
+                // build change vector by file.
+                // note: Not efficient at all.
+                //foreach(string file in Directory.GetFiles(repoRoot, "*", SearchOption.AllDirectories))
+                //{
+                //    string fileEntry = file.Substring(repoRoot.Length + 1);
+                //    Console.WriteLine(fileEntry);
+                //    foreach (LogEntry log in repo.Commits.QueryBy(fileEntry))
+                //    {
+                //        Console.WriteLine("\t " + log.Commit.Sha);
+                //    }
+                //}
+
+                foreach (IndexEntry e in repo.Index)
+                {
+                    Console.WriteLine("{0} {1} {2}       {3}",
+                        Convert.ToString((int)e.Mode, 8),
+                        e.Id.ToString(), (int)e.StageLevel, e.Path);
+                }
             }
         }
     }


Removed unused code

Removed unused code

git-svn-id: 6b7e1e5d0861e268462ba7828ef63c1bcab52a9b@759 d3cde5d6-82b8-4669-8b62-43054d6781d8

--- SDRSharp/MainForm.cs
+++ SDRSharp/MainForm.cs
@@ -947,12 +947,7 @@
             if (openDlg.ShowDialog() == DialogResult.OK)
             {
                 StopRadio();
-                if (_waveFile != openDlg.FileName)
-                {
-                    _iqBalancer.Reset();
-                }
                 _waveFile = openDlg.FileName;
-                //StartRadio();
             }
         }


Fixed the security problems with generation of log files and execution of ScheduledTask process. #154

--- ScheduledTask.cshtml
+++ ScheduledTask.cshtml
@@ -26,7 +26,7 @@

     // Finishing: save log on disk
     try {
-        System.IO.File.AppendAllText(Server.MapPath(UrlUtil.AppPath + "_ScheduledTaskLog.txt"), log.ToString());
+        System.IO.File.AppendAllText(Server.MapPath(UrlUtil.RenderAppPath + "_logs/ScheduledTaskLog.txt"), log.ToString());
     }catch {
     }
 }


debugging speed problems

debugging speed problems

--- Source/Tasks/Task.cs
+++ Source/Tasks/Task.cs
@@ -198,6 +198,9 @@
 					break;
 					case ENodeName.speed:
 					{
+						//TODO: speed nodes are not getting set up correctly
+
+						Debug.Assert(null != Node);
 						bullet.GetFireData().speedInit = true;
 						bullet.Velocity = Node.GetValue(this);
 					}


Fix server

Fix server

--- TGS.Server/Server.cs
+++ TGS.Server/Server.cs
@@ -323,7 +323,6 @@
 			AddEndpoint(host, typeof(ITGChat));
 			AddEndpoint(host, typeof(ITGCompiler));
 			AddEndpoint(host, typeof(ITGConfig));
-			AddEndpoint(host, typeof(ITGConnectivity));
 			AddEndpoint(host, typeof(ITGDreamDaemon));
 			AddEndpoint(host, typeof(ITGInstance));
 			AddEndpoint(host, typeof(ITGInterop));


minor comment

minor comment

--- UOCApp/UOCApp/App.cs
+++ UOCApp/UOCApp/App.cs
@@ -19,6 +19,7 @@
         public readonly DatabaseHelper databaseHelper;

         //TODO refactor App.x stuff into separate Singleton
+        //for now try (Application)(App.Current).databaseHelper

 		public App ()
 		{


Made cherry pick have a (small) chance of working

--- VersionrCore/Area.cs
+++ VersionrCore/Area.cs
@@ -887,7 +887,7 @@
                     var tempFileNew = GetTemporaryFile(newRecord);
                     RestoreRecord(newRecord, DateTime.Now, tempFileNew.FullName);
                     var tempFileOld = GetTemporaryFile(oldRecord);
-                    RestoreRecord(newRecord, DateTime.Now, tempFileOld.FullName);
+                    RestoreRecord(oldRecord, DateTime.Now, tempFileOld.FullName);

                     tempFileNew = new FileInfo(tempFileNew.FullName);
                     tempFileOld = new FileInfo(tempFileOld.FullName);


Disabled managing unhandled exceptions in Debug mode

--- ViCommV2/App.xaml.cs
+++ ViCommV2/App.xaml.cs
@@ -16,10 +16,12 @@
 		public App()
 			: base()
 		{
+#if !DEBUG
 			App.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
 			Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
 			App.Current.Dispatcher.UnhandledException += Dispatcher_UnhandledException;
 			AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+#endif

 			App.Current.Run(new FormHelper());
 		}


Remove unused private field

Remove unused private field

--- Web/EditorControl.cs
+++ Web/EditorControl.cs
@@ -46,11 +46,6 @@
         /// The provider type.
         /// </summary>
         private const string ProviderType = "htmlEditor";
-
-        /// <summary>
-        /// Has MS Ajax Installed?
-        /// </summary>
-        private static bool? _hasMsAjax;

         /// <summary>
         /// The portal settings.


Track indents in a better way

Track indents in a better way

--- YarnSpinner/Lexer.cs
+++ YarnSpinner/Lexer.cs
@@ -302,7 +302,9 @@
 		LexerState defaultState;
 		LexerState currentState;

-		Stack<int> indentationStack;
+		// tracks indentation levels, and whether an
+		// indent token was emitted for each level
+		Stack<KeyValuePair<int,bool>> indentationStack;
 		bool shouldTrackNextIndentation;

 		public Lexer ()
@@ -446,8 +448,8 @@
 		{

 			// Do some initial setup
-			indentationStack = new Stack<int> ();
-			indentationStack.Push (0);
+			indentationStack = new Stack<KeyValuePair<int,bool>> ();
+			indentationStack.Push (new KeyValuePair<int, bool>(0, false));
 			shouldTrackNextIndentation = false;

 			var tokens = new TokenList();
@@ -487,28 +489,34 @@
 			var thisIndentation = LineIndentation (line);
 			var previousIndentation = indentationStack.Peek ();

-			if (shouldTrackNextIndentation && thisIndentation > previousIndentation) {
+			if (shouldTrackNextIndentation && thisIndentation > previousIndentation.Key) {
 				// If we are more indented than before, emit an
 				// indent token and record this new indent level
-				indentationStack.Push (thisIndentation);
-
-				var indent = new Token (TokenType.Indent, lineNumber, previousIndentation);
-				indent.value = "".PadLeft (thisIndentation - previousIndentation);
+				indentationStack.Push (new KeyValuePair<int, bool>(thisIndentation, true));
+
+				var indent = new Token (TokenType.Indent, lineNumber, previousIndentation.Key);
+				indent.value = "".PadLeft (thisIndentation - previousIndentation.Key);

 				shouldTrackNextIndentation = false;

 				lineTokens.Push (indent);

-			} else if (thisIndentation < previousIndentation) {
+			} else if (thisIndentation < previousIndentation.Key) {

 				// If we are less indented, emit a dedent for every
-				// indentation level that we passed on the way back to 0;
+				// indentation level that we passed on the way back to 0 that also
+				// emitted an indentation token.
 				// at the same time, remove those indent levels from the stack

-				while (thisIndentation < indentationStack.Peek ()) {
-					var dedent = new Token (TokenType.Dedent, lineNumber, 0);
-					lineTokens.Push (dedent);
-					indentationStack.Pop ();
+				while (thisIndentation < indentationStack.Peek ().Key) {
+
+					var topLevel = indentationStack.Pop ();
+
+					if (topLevel.Value) {
+						var dedent = new Token (TokenType.Dedent, lineNumber, 0);
+						lineTokens.Push (dedent);
+					}
+
 				}
 			}

@@ -595,6 +603,13 @@
 							throw new TokeniserException (lineNumber, columnNumber, "Unknown tokeniser state " + rule.entersState);
 						}
 						EnterState (states [rule.entersState]);
+
+						if (shouldTrackNextIndentation == true) {
+							if (indentationStack.Peek().Key < thisIndentation) {
+								indentationStack.Push (new KeyValuePair<int, bool>(thisIndentation, false));
+							}
+
+						}
 					}

 					matched = true;


Test for equivalence, not for ordering

Test for equivalence, not for ordering

--- anagram/AnagramTest.cs
+++ anagram/AnagramTest.cs
@@ -9,7 +9,7 @@
         var detector = new Anagram("diaper");
         var words = new[] { "hello", "world", "zombies", "pants" };
         var results = new string[0];
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

     [Ignore]
@@ -19,7 +19,7 @@
         var detector = new Anagram("ant");
         var words = new[] { "tan", "stand", "at" };
         var results = new[] { "tan" };
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

     [Ignore]
@@ -29,7 +29,7 @@
         var detector = new Anagram("master");
         var words = new[] { "stream", "pigeon", "maters" };
         var results = new[] { "maters", "stream" };
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

     [Ignore]
@@ -39,7 +39,7 @@
         var detector = new Anagram("galea");
         var words = new[] { "eagle" };
         var results = new string[0];
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

     [Ignore]
@@ -49,7 +49,7 @@
         var detector = new Anagram("corn");
         var words = new[] { "corn", "dark", "Corn", "rank", "CORN", "cron", "park" };
         var results = new[] { "cron" };
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

     [Ignore]
@@ -59,7 +59,7 @@
         var detector = new Anagram("mass");
         var words = new[] { "last" };
         var results = new string[0];
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

     [Ignore]
@@ -69,7 +69,7 @@
         var detector = new Anagram("good");
         var words = new[] { "dog", "goody" };
         var results = new string[0];
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

     [Ignore]
@@ -79,7 +79,7 @@
         var detector = new Anagram("allergy");
         var words = new[] { "gallery", "ballerina", "regally", "clergy", "largely", "leading" };
         var results = new[] { "gallery", "largely", "regally" };
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

     [Ignore]
@@ -89,7 +89,7 @@
         var detector = new Anagram("Orchestra");
         var words = new[] { "cashregister", "Carthorse", "radishes" };
         var results = new[] { "Carthorse" };
-        Assert.That(detector.Match(words), Is.EqualTo(results));
+        Assert.That(detector.Match(words), Is.EquivalentTo(results));
     }

 }


Enable .NET 4.5 performance optimizations in CityHash

--- BlobCache/BlobCache/CityHash/CityHash.cs
+++ BlobCache/BlobCache/CityHash/CityHash.cs
@@ -34,6 +34,8 @@
 // Original code: https://code.google.com/p/cityhash/
 //

+#define NET45
+
 using System;
 using System.Diagnostics;
 using System.Text;


array sort functions

array sort functions

- sort,asort,ksort,rsort,arsort,krsort

--- src/Runtime/pchplib/Arrays.cs
+++ src/Runtime/pchplib/Arrays.cs
@@ -4,6 +4,7 @@
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading.Tasks;

@@ -819,7 +820,7 @@
             }

             return array.ContainsKey(key);
-
+
             //if (Core.Convert.ObjectToArrayKey(key, out array_key))
             //    return array.ContainsKey(array_key);

@@ -1194,7 +1195,7 @@
         public static PhpArray range(Context ctx, PhpValue low, PhpValue high, PhpValue step)
         {
             PhpNumber num_low, num_high, num_step;
-
+
             // converts each parameter to a number, determines what type of number it is (int/double)
             // and whether it wholly represents that number:
             var info_step = step.ToNumber(out num_step);
@@ -1283,5 +1284,211 @@
         }

         #endregion
+
+        #region sort,asort,ksort,rsort,arsort,krsort
+
+        /// <summary>
+        /// Sorts an array using regular comparison method for comparing values.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool sort(Context ctx, [In, Out]PhpArray array)
+        {
+            return sort(ctx, array, ComparisonMethod.Regular);
+        }
+
+        /// <summary>
+        /// Sorts an array using specified comparison method for comparing values.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <param name="comparisonMethod">The method to be used for comparison of values.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool sort(Context ctx, [In, Out]PhpArray array, ComparisonMethod comparisonMethod)
+        {
+            if (array == null)
+            {
+                //PhpException.ReferenceNull("array");
+                //return false;
+                throw new ArgumentNullException();
+            }
+
+            array.Sort(GetComparer(ctx, comparisonMethod, SortingOrder.Ascending, false));
+            array.ReindexAll();
+            array.RestartIntrinsicEnumerator();
+
+            return true;
+        }
+
+        /// <summary>
+        /// Sorts an array using regular comparison method for comparing values preserving key-value associations.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool asort(Context ctx, [In, Out]PhpArray array)
+        {
+            return asort(ctx, array, ComparisonMethod.Regular);
+        }
+
+        /// <summary>
+        /// Sorts an array using specified comparison method for comparing values preserving key-value associations.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <param name="comparisonMethod">The method to be used for comparison of values.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool asort(Context ctx, [In, Out]PhpArray array, ComparisonMethod comparisonMethod)
+        {
+            if (array == null)
+            {
+                //PhpException.ReferenceNull("array");
+                //return false;
+                throw new ArgumentNullException();
+            }
+
+            array.Sort(GetComparer(ctx, comparisonMethod, SortingOrder.Ascending, false));
+            array.RestartIntrinsicEnumerator();
+
+            return true;
+        }
+
+        /// <summary>
+        /// Sorts an array using regular comparison method for comparing keys.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool ksort(Context ctx, [In, Out]PhpArray array)
+        {
+            return ksort(ctx, array, ComparisonMethod.Regular);
+        }
+
+        /// <summary>
+        /// Sorts an array using specified comparison method for comparing keys.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <param name="comparisonMethod">The method to be used for comparison of keys.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool ksort(Context ctx, [In, Out]PhpArray array, ComparisonMethod comparisonMethod)
+        {
+            if (array == null)
+            {
+                //PhpException.ReferenceNull("array");
+                //return false;
+                throw new ArgumentNullException();
+            }
+
+            array.Sort(GetComparer(ctx, comparisonMethod, SortingOrder.Ascending, true));
+            array.RestartIntrinsicEnumerator();
+
+            return true;
+        }
+
+        /// <summary>
+        /// Sorts an array using regular comparison method for comparing values in reverse order.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool rsort(Context ctx, [In, Out]PhpArray array)
+        {
+            return rsort(ctx, array, ComparisonMethod.Regular);
+        }
+
+        /// <summary>
+        /// Sorts an array using specified comparison method for comparing values in reverse order.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <param name="comparisonMethod">The method to be used for comparison of keys.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool rsort(Context ctx, [In, Out]PhpArray array, ComparisonMethod comparisonMethod)
+        {
+            if (array == null)
+            {
+                //PhpException.ReferenceNull("array");
+                //return false;
+                throw new ArgumentNullException();
+            }
+
+            array.Sort(GetComparer(ctx, comparisonMethod, SortingOrder.Descending, false));
+            array.ReindexAll();
+            array.RestartIntrinsicEnumerator();
+
+            return true;
+        }
+
+        /// <summary>
+        /// Sorts an array using regular comparison method for comparing values in reverse order
+        /// preserving key-value associations.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool arsort(Context ctx, [In, Out]PhpArray array)
+        {
+            return arsort(ctx, array, ComparisonMethod.Regular);
+        }
+
+        /// <summary>
+        /// Sorts an array using specified comparison method for comparing values in reverse order
+        /// preserving key-value associations.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <param name="comparisonMethod">The method to be used for comparison of values.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool arsort(Context ctx, [In, Out]PhpArray array, ComparisonMethod comparisonMethod)
+        {
+            if (array == null)
+            {
+                //PhpException.ReferenceNull("array");
+                //return false;
+                throw new ArgumentNullException();
+            }
+
+            array.Sort(GetComparer(ctx, comparisonMethod, SortingOrder.Descending, false));
+            array.RestartIntrinsicEnumerator();
+
+            return true;
+        }
+
+        /// <summary>
+        /// Sorts an array using regular comparison method for comparing keys in reverse order.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool krsort(Context ctx, [In, Out] PhpArray array)
+        {
+            return krsort(ctx, array, ComparisonMethod.Regular);
+        }
+
+        /// <summary>
+        /// Sorts an array using specified comparison method for comparing keys in reverse order.
+        /// </summary>
+        /// <param name="array">The array to be sorted.</param>
+        /// <param name="comparisonMethod">The method to be used for comparison of keys.</param>
+        /// <remarks>Resets <paramref name="array"/>'s intrinsic enumerator.</remarks>
+        /// <returns>True on success, False on failure.</returns>
+        public static bool krsort(Context ctx, [In, Out] PhpArray array, ComparisonMethod comparisonMethod)
+        {
+            if (array == null)
+            {
+                //PhpException.ReferenceNull("array");
+                //return false;
+                throw new ArgumentNullException();
+            }
+
+            array.Sort(GetComparer(ctx, comparisonMethod, SortingOrder.Descending, true));
+            array.RestartIntrinsicEnumerator();
+
+            return true;
+        }
+
+        #endregion
     }
 }


Removed tabs

Removed tabs

The NuGetTasks.cs file had a mix of tabs and spaces.  This made made the code difficult to
read on GitHub as the formatting was visible incorrect (code shifted left / right).

--- demos/CoreClrConsoleApplications/NuGetTasks/NuGetTasks/NuGetTasks.cs
+++ demos/CoreClrConsoleApplications/NuGetTasks/NuGetTasks/NuGetTasks.cs
@@ -7,29 +7,29 @@
 namespace Microsoft.NuGet
 {
     public class ResolvePackages : Task
-	{
-		[Required]
-		public string PackagesDirectory { get; set; }
+    {
+        [Required]
+        public string PackagesDirectory { get; set; }

-		[Required]
-		public string PackagesConfig { get; set; }
+        [Required]
+        public string PackagesConfig { get; set; }

-		public ITaskItem[] Environment { get; private set; }
+        public ITaskItem[] Environment { get; private set; }

-		[Output]
-		public ITaskItem[] References { get; private set; }
+        [Output]
+        public ITaskItem[] References { get; private set; }

-		[Output]
+        [Output]
         public ITaskItem[] Dependencies { get; private set; }
-
-		public override bool Execute()
-		{
+
+        public override bool Execute()
+        {
             Log.LogMessage(MessageImportance.Low, "Using PackagesDirectory: {0}", PackagesDirectory);
             string nuGetDirectory = Path.Combine(PackagesDirectory, @"NuGetExe");
             string nuGetPath = Path.Combine(nuGetDirectory, @"nuget.exe");

             PackageManager.InstallNugetExe(nuGetPath);
-            if(!PackageManager.InstallPackages(PackagesDirectory, PackagesConfig, nuGetPath, Log)) { return false; }
+            if (!PackageManager.InstallPackages(PackagesDirectory, PackagesConfig, nuGetPath, Log)) { return false; }

             List<ITaskItem> references = new List<ITaskItem>();
             List<ITaskItem> dependencies = new List<ITaskItem>();
@@ -42,10 +42,10 @@
                 // add contracts
                 bool thereWereNoContracts = true;
                 var contractsRoot = Path.Combine(packageRoot, "ref\\any");
-				if (Directory.Exists(contractsRoot))
-				{
-					foreach (var file in Directory.EnumerateFiles(contractsRoot))
-					{
+                if (Directory.Exists(contractsRoot))
+                {
+                    foreach (var file in Directory.EnumerateFiles(contractsRoot))
+                    {
                         if (file.EndsWith("_._"))
                         {
                             thereWereNoContracts = false;
@@ -56,23 +56,23 @@
                             references.Add(new TaskItem(Path.Combine(contractsRoot, file)));
                             thereWereNoContracts = false;
                         }
-					}
-				}
-
+                    }
+                }
+
                 // add portable assemblies
-				var portableRoot = Path.Combine(packageRoot, @"lib\any");
-				if (Directory.Exists(portableRoot))
-				{
-					foreach (var file in Directory.EnumerateFiles(portableRoot))
-					{
-						dependencies.Add(new TaskItem(Path.Combine(portableRoot, file)));
+                var portableRoot = Path.Combine(packageRoot, @"lib\any");
+                if (Directory.Exists(portableRoot))
+                {
+                    foreach (var file in Directory.EnumerateFiles(portableRoot))
+                    {
+                        dependencies.Add(new TaskItem(Path.Combine(portableRoot, file)));

-						if (thereWereNoContracts)
-						{
-							references.Add(new TaskItem(Path.Combine(portableRoot, file)));
-						}
-					}
-				}
+                        if (thereWereNoContracts)
+                        {
+                            references.Add(new TaskItem(Path.Combine(portableRoot, file)));
+                        }
+                    }
+                }

                 // add CoreFx specific
                 var runtimeRoot = Path.Combine(packageRoot, @"lib\aspnetcore50");
@@ -86,17 +86,17 @@

                 // add environment specific assemblies (these are specified in the csproj file
                 foreach (var environment in Environment)
-				{
-					var environmentDependencies = Path.Combine(packageRoot, environment.ItemSpec);
-					if (Directory.Exists(environmentDependencies))
-					{
-						Log.LogMessage("Environment dependencies included: {0}", environmentDependencies);
-						foreach (var file in Directory.EnumerateFiles(environmentDependencies))
-						{
-							dependencies.Add(new TaskItem(Path.Combine(environmentDependencies, file)));
-						}
-					}
-				}
+                {
+                    var environmentDependencies = Path.Combine(packageRoot, environment.ItemSpec);
+                    if (Directory.Exists(environmentDependencies))
+                    {
+                        Log.LogMessage("Environment dependencies included: {0}", environmentDependencies);
+                        foreach (var file in Directory.EnumerateFiles(environmentDependencies))
+                        {
+                            dependencies.Add(new TaskItem(Path.Combine(environmentDependencies, file)));
+                        }
+                    }
+                }
             }

             References = references.ToArray();
@@ -104,5 +104,5 @@

             return true;
         }
-	}
+    }
 }


Serialize the result from Retrieve as well.

--- src/SparkPost/Suppressions.cs
+++ src/SparkPost/Suppressions.cs
@@ -40,28 +40,16 @@

             var results = JsonConvert.DeserializeObject<dynamic>(response.Content).results;

-            var suppressions = new List<Suppression>();
-
-            foreach (var result in results)
-            {
-                suppressions.Add(new Suppression()
-                {
-                    Description = result.description,
-                    Transactional = result.transactional,
-                    NonTransactional = result.non_transactional,
-                    Email = result.recipient
-                });
-            }
             return new SuppressionListResponse()
             {
                 ReasonPhrase = response.ReasonPhrase,
                 StatusCode = response.StatusCode,
                 Content = response.Content,
-                Suppressions = suppressions
+                Suppressions = ConvertResultsToAListOfSuppressions(results)
             };
         }

-        public async Task<Response> Retrieve(string email)
+        public async Task<SuppressionListResponse> Retrieve(string email)
         {
             var request = new Request()
             {
@@ -71,11 +59,15 @@

             var response = await requestSender.Send(request);
             if (response.StatusCode != HttpStatusCode.OK) throw new ResponseException(response);
-            return new Response()
+
+            var results = JsonConvert.DeserializeObject<dynamic>(response.Content).results;
+
+            return new SuppressionListResponse()
             {
                 ReasonPhrase = response.ReasonPhrase,
                 StatusCode = response.StatusCode,
                 Content = response.Content,
+                Suppressions = ConvertResultsToAListOfSuppressions(results)
             };
         }

@@ -130,5 +122,22 @@
             return response.StatusCode == HttpStatusCode.NoContent;
         }

+        private static IEnumerable<Suppression> ConvertResultsToAListOfSuppressions(dynamic results)
+        {
+            var suppressions = new List<Suppression>();
+
+            foreach (var result in results)
+            {
+                suppressions.Add(new Suppression()
+                {
+                    Description = result.description,
+                    Transactional = result.transactional,
+                    NonTransactional = result.non_transactional,
+                    Email = result.recipient
+                });
+            }
+            return suppressions;
+        }
+
     }
 }