Bug fix for Upgrader

Bug fix for Upgrader

--- Lucid.Web/Utility/Upgrader.cs
+++ Lucid.Web/Utility/Upgrader.cs
@@ -28,8 +28,9 @@
                     var outFile = Path.Combine(webFolder, zipEntry.Name);
                     Directory.CreateDirectory(Path.GetDirectoryName(outFile));

-                    using (var streamWriter = File.Create(outFile))
-                        StreamUtils.Copy(zipFile.GetInputStream(zipEntry), streamWriter, buffer);
+                    if (zipEntry.IsFile)
+                        using (var streamWriter = File.Create(outFile))
+                            StreamUtils.Copy(zipFile.GetInputStream(zipEntry), streamWriter, buffer);
                 }

             var deployedZip = HostingEnvironment.MapPath("~/Deployed.zip");


Disabled AssignJob Timer

Disabled AssignJob Timer

Disabled the AssignJob timer while assigning the job.

--- Manager/Manager/JobManager.cs
+++ Manager/Manager/JobManager.cs
@@ -58,7 +58,9 @@

 		public void AssignJobToWorkerNodes()
 		{
+			_checkAndAssignJob.Enabled = false;
 			_jobRepository.AssignJobToWorkerNode();
+			_checkAndAssignJob.Enabled = true;
 		}

 		private void CheckHeartbeats_Elapsed(object sender, ElapsedEventArgs e)


Added Parse method to main class

Added Parse method to main class

--- MapParse/MapParse/MapParse.cs
+++ MapParse/MapParse/MapParse.cs
@@ -11,6 +11,9 @@
 {
 	public static class MapParse
 	{
-
+		public static MapFile Parse(string mapFileContents)
+		{
+
+		}
 	}
 }


Adding check for null widget

Adding check for null widget

--- Mapsui/Widgets/WidgetTouch.cs
+++ Mapsui/Widgets/WidgetTouch.cs
@@ -20,7 +20,8 @@
             foreach (var widget in widgets)
             {
                 // Also check for start position because it shoudl be click on the widget, not a drag that ends above the widget.
-                if (widget.Envelope.Contains(scaledScreenPosition) &&
+                if (widget.Envelope != null &&
+                    widget.Envelope.Contains(scaledScreenPosition) &&
                     widget.Envelope.Contains(scaledStartScreenPosition))
                     return widget;
             }


hiding chat div when not clicked on other user

--- MoTMe/Views/Home/Index.cshtml
+++ MoTMe/Views/Home/Index.cshtml
@@ -23,10 +23,11 @@

-

+

             <input type="text" class="" id="text" ng-model="body"/>
             <button id="button" class="btn btn-default" ng-click="AddMessage(body)">Send</button>

+
Click a user to message

alerts


A bit of gold plating.

A bit of gold plating.

--- MonitoringDemoHost/Program.cs
+++ MonitoringDemoHost/Program.cs
@@ -8,26 +8,32 @@

 class Program
 {
+    static TimeSpan MetricsReportingInterval = TimeSpan.FromSeconds(2.5);
+    static int EndpointSize = 25;
+    static int InstanceModulo = 4;
+    static int RecoverabilityImmediateRetryCount = 1;
+    static int RecoverabilityDelayedRetryCount = 5;
+    static TimeSpan RecoverabilityDelayedRetryBackoffIncrement = TimeSpan.FromSeconds(1);
+    static bool AuditForwardingEnabled = false;
+
     public static Tuple<string, IEndpointInstance>[] Instances;
     static async Task Main()
     {
         LogManager.Use<DefaultFactory>().Level(LogLevel.Error);
-        var endpointSize = 25;
-        var instanceModulo = 4;

-        var providers = new[] { "Payment", "Audit", "Approval", "Ledger", "Integration", "Broadcast", "Notification", "Identity", "Tax", "Exchange" };
-        var types = new[] { "Service", "Gateway", "Adapter", "Translator", "Provider" };
+        var providers = new[] { "Payment", "Audit", "Approval", "Ledger", "Integration", "Broadcast", "Notification", "Identity", "Report", "Exchange" };
+        var types = new[] { "Service", "Gateway", "Adapter", "Translator", "Provider", "Generator" };
         var ou = new[] { "Sales", "Transport", "Accounting", "Marketing", "Support", "Development", "Research", "HumanResourceManagement", "Production", "Purchasing" };

         var random = new Random(1337);

         Console.WriteLine("Creating instances");
         var tasks = new List<Task<Tuple<string, IEndpointInstance>>>();
-        for (int i = 0; i < endpointSize; ++i)
+        for (int i = 0; i < EndpointSize; ++i)
         {
             var endpointName = $"$ParticularLabs.{ou[random.Next(ou.Length)]}.{providers[random.Next(providers.Length)]}{types[random.Next(types.Length)]}";
             await Console.Out.WriteAsync($"Initializing {endpointName}").ConfigureAwait(false);
-            for (int j = 0; j < i % instanceModulo + 1; j++)
+            for (int j = 0; j < i % InstanceModulo + 1; j++)
             {
                 await Console.Out.WriteAsync(".").ConfigureAwait(false);
                 tasks.Add(Create(endpointName, j));
@@ -54,13 +60,13 @@
         var cfg = new EndpointConfiguration(name);
         //cfg.MakeInstanceUniquelyAddressable(instance.ToString("000"));
         if (Debugger.IsAttached) cfg.EnableInstallers();
-        //cfg.ForwardReceivedMessagesTo("audit");
+        if(AuditForwardingEnabled) cfg.ForwardReceivedMessagesTo("audit");
         cfg.UsePersistence<InMemoryPersistence>();
         cfg.SendFailedMessagesTo("error");

         cfg.Recoverability()
-            .Immediate(c => c.NumberOfRetries(1))
-            .Delayed(c => c.NumberOfRetries(5).TimeIncrease(TimeSpan.FromSeconds(1)));
+            .Immediate(c => c.NumberOfRetries(RecoverabilityImmediateRetryCount))
+            .Delayed(c => c.NumberOfRetries(RecoverabilityDelayedRetryCount).TimeIncrease(RecoverabilityDelayedRetryBackoffIncrement));

         cfg.RegisterComponents(x => x.ConfigureComponent<DelayHandler>(DependencyLifecycle.SingleInstance));
         cfg.RegisterComponents(x => x.ConfigureComponent<ChaosHandler>(DependencyLifecycle.SingleInstance));
@@ -71,13 +77,13 @@
         });
         cfg.LimitMessageProcessingConcurrencyTo(4 * Environment.ProcessorCount);
         var transport = cfg.UseTransport<MsmqTransport>();
-        transport.Transactions(TransportTransactionMode.SendsAtomicWithReceive);
+        transport.Transactions(TransportTransactionMode.SendsAtomicWithReceive); // Lower transaction mode to prevent transaction issues with MSDTC.
         transport.ApplyLabelToMessages(headers => (headers.ContainsKey(Headers.EnclosedMessageTypes) ? headers[Headers.EnclosedMessageTypes].Substring(0, Math.Min(200, headers[Headers.EnclosedMessageTypes].Length)) + "@" : string.Empty) + DateTime.UtcNow.ToString("O"));

 #pragma warning disable 618
         cfg.EnableMetrics().SendMetricDataToServiceControl(
             "Particular.ServiceControl.Monitoring",
-            TimeSpan.FromSeconds(2.5),
+            MetricsReportingInterval,
             instance.ToString("000")
             );
 #pragma warning restore 618


Moritz uses Microsoft GS Wavetable Synth

The VirtualMidiSynth version 2 beta does not
work with the old Sanford Multimedia library.

--- Moritz.Globals/Preferences.cs
+++ Moritz.Globals/Preferences.cs
@@ -76,8 +76,12 @@
             {
                 try
                 {
-                    Multimedia.Midi.OutputDevice outputDevice = new Multimedia.Midi.OutputDevice(netOutputDevice.ID);
-                    MultimediaMidiOutputDevices.Add(netOutputDevice.Name, outputDevice);
+                    // The new VirtualMidiSynth beta does not work for some reason, so just use the Microsoft GS Wavetable Synth.
+                    if(netOutputDevice.Name.Contains("Microsoft"))
+                    {
+                        Multimedia.Midi.OutputDevice outputDevice = new Multimedia.Midi.OutputDevice(netOutputDevice.ID);
+                        MultimediaMidiOutputDevices.Add(netOutputDevice.Name, outputDevice);
+                    }
                 }
                 catch
                 {


Fix platform/item/enemy sprite indices

Fix platform/item/enemy sprite indices

--- Pre2/Level.cs
+++ Pre2/Level.cs
@@ -75,7 +75,7 @@
         }
     }

-    public struct Item
+    public class Item
     {
         public Position Position;
         public short SpriteIdx;
@@ -89,7 +89,7 @@
         }
     }

-    public struct Platform
+    public class Platform
     {
         public Position Position;
         public short SpriteIdx;
@@ -150,8 +150,8 @@
         private readonly Gate[] gates = new Gate[20];
         private readonly ShiftingTileBlock[] shiftingTileBlocks = new ShiftingTileBlock[15];
         private Enemy[] enemies;
-        private ushort spriteOffsetItemPlatform;
-        private ushort spriteOffsetEnemy;
+        private short spriteOffsetItemPlatform;
+        private short spriteOffsetEnemy;
         private readonly Secret[] secrets = new Secret[80];
         private byte[] tileProps4;
         private readonly Item[] items = new Item[70];
@@ -184,8 +184,8 @@
                 }
                 byte[] enemydata = br.ReadBytes(2048);
                 enemies = Enemy.InitEnemies(enemydata);
-                spriteOffsetItemPlatform = br.ReadUInt16();
-                spriteOffsetEnemy = br.ReadUInt16();
+                spriteOffsetItemPlatform = br.ReadInt16();
+                spriteOffsetEnemy = br.ReadInt16();
                 for (var i = 0; i < secrets.Length; i++)
                 {
                     secrets[i] = new Secret(br);
@@ -201,6 +201,53 @@
                 }
                 kong = new Kong(br);
             }
+            FixSpriteIndices();
+        }
+
+        private void FixSpriteIndices()
+        {
+            short itemPlatformResultingOffset = (short) (53 - spriteOffsetItemPlatform);
+
+            // items
+            foreach (Item item in items)
+            {
+                if (item.SpriteIdx != -1)
+                {
+                    item.SpriteIdx += itemPlatformResultingOffset;
+                }
+            }
+
+            // platforms
+            foreach (Platform platform in platforms)
+            {
+                if (platform.SpriteIdx != -1)
+                {
+                    platform.SpriteIdx += itemPlatformResultingOffset;
+                }
+            }
+
+            short enemyResultingOffset = (short) (312 - spriteOffsetEnemy);
+
+            if (spriteOffsetItemPlatform != -1) // sic!
+            {
+                foreach (Enemy enemy in enemies)
+                {
+                    short spriteIdx = enemy.SpriteIdx;
+                    if (spriteIdx != -1)
+                    {
+                        if (spriteIdx >= spriteOffsetEnemy)
+                        {
+                            enemy.SpriteIdx += enemyResultingOffset;
+                        }
+                        else if (spriteIdx >= spriteOffsetItemPlatform)
+                        {
+                            enemy.SpriteIdx += itemPlatformResultingOffset;
+                        }
+                    }
+                }
+            }
+            spriteOffsetItemPlatform = 53;
+            spriteOffsetEnemy = 312;
         }
     }
 }


Add whitespace

Add whitespace

--- src/AppHarbor/Commands/DeployAppCommand.cs
+++ src/AppHarbor/Commands/DeployAppCommand.cs
@@ -145,7 +145,8 @@
 			Console.WriteLine();
 			var originalColor = Console.ForegroundColor;
 			Console.ForegroundColor = ConsoleColor.Yellow;
-			_writer.Write("Enter a deployment message:");
+			_writer.WriteLine();
+			_writer.Write("Enter a deployment message: ");
 			Console.ForegroundColor = originalColor;

 			var commitMessage = _reader.ReadLine();


Forgotten test

Forgotten test

--- tests/UnitTests/Rfc4648Tests.cs
+++ tests/UnitTests/Rfc4648Tests.cs
@@ -177,6 +177,7 @@
             Assert.Equal(b1, b2);
         }

+        [Fact]
         public void Base32_Test_Complex2_Decode()
         {
             Assert.Equal("foobar", DecodeBase32("introMZXW6YTBOI======SomeData", 5, 16));


Add/remove resource owner.

Add/remove resource owner.

--- src/Avalonia.Base/Styling/StyleChildren.cs
+++ src/Avalonia.Base/Styling/StyleChildren.cs
@@ -1,4 +1,5 @@
 using System.Collections.ObjectModel;
+using Avalonia.Controls;

 namespace Avalonia.Styling
 {
@@ -16,7 +17,10 @@

         protected override void RemoveItem(int index)
         {
-            (Items[index] as Style)?.SetParent(null);
+            var item = Items[index];
+            if (_owner.Owner is IResourceHost host)
+                (item as IResourceProvider)?.RemoveOwner(host);
+            (item as Style)?.SetParent(null);
             base.RemoveItem(index);
         }

@@ -24,6 +28,8 @@
         {
             base.SetItem(index, item);
             (item as Style)?.SetParent(_owner);
+            if (_owner.Owner is IResourceHost host)
+                (item as IResourceProvider)?.AddOwner(host);
         }
     }
 }


Fixed NUnit Stylecop issues

Fixed NUnit Stylecop issues

--- src/Cake.Common/Tools/NUnit/NUnitRunner.cs
+++ src/Cake.Common/Tools/NUnit/NUnitRunner.cs
@@ -46,7 +46,7 @@
                 throw new ArgumentNullException("settings");
             }

-            Run(settings, GetArguments(new [] { assemblyPath }, settings), settings.ToolPath);
+            Run(settings, GetArguments(new[] { assemblyPath }, settings), settings.ToolPath);
         }

         /// <summary>
@@ -74,7 +74,9 @@

             // Add the assemblies to build.
             foreach (var assemblyPath in assemblyPaths)
+            {
                 builder.AppendQuoted(assemblyPath.MakeAbsolute(_environment).FullPath);
+            }

             if (settings.Framework != null)
             {


Improve angle parsing

Improve angle parsing

--- src/Carbon.Css/Gradients/LinearGradient.cs
+++ src/Carbon.Css/Gradients/LinearGradient.cs
@@ -127,7 +127,9 @@

             text = text.Slice(read);

-            if (text.StartsWith("deg".AsSpan()))
+            if (text[0] == 'd' &&
+                text[1] == 'e' &&
+                text[2] == 'g')
             {
                 read += 3;
             }


Extract the simple type code generation

Extract the simple type code generation

--- src/Dbus.CodeGenerator/EncoderGenerator.cs
+++ src/Dbus.CodeGenerator/EncoderGenerator.cs
@@ -45,11 +45,7 @@
             else if (type == typeof(object))
                 encodeVariant(type, parameterName, parameter, resultParameter);
             else
-            {
-                Signature += SignatureString.For[type];
-                Code.Append(@"
-                    global::Dbus.Encoder.Add(sendBody" + parameter + ", ref sendIndex" + parameter + ", " + parameterName + resultParameter + ");");
-            }
+                encodeSimpleType(type, parameterName, parameter, resultParameter);
         }

         private void dictionaryKeyStep(
@@ -89,11 +85,7 @@
             else if (type == typeof(object))
                 encodeVariant(type, parameterName, parameter, resultParameter + ".Key");
             else
-            {
-                Signature += SignatureString.For[type];
-                Code.Append(@"
-                    global::Dbus.Encoder.Add(sendBody" + parameter + ", ref sendIndex" + parameter + ", " + parameterName + resultParameter + ".Key);");
-            }
+                encodeSimpleType(type, parameterName, parameter, resultParameter + ".Key");
         }

         private void dictionaryValueStep(
@@ -133,18 +125,21 @@
             else if (type == typeof(object))
                 encodeVariant(type, parameterName, parameter, resultParameter + ".Value");
             else
-            {
-                Signature += SignatureString.For[type];
-                Code.Append(@"
-                    global::Dbus.Encoder.Add(sendBody" + parameter + ", ref sendIndex" + parameter + ", " + parameterName + resultParameter + ".Value);");
-            }
+                encodeSimpleType(type, parameterName, parameter, resultParameter + ".Value");
         }

         private void encodeVariant(Type type, string parameterName, string parameter, string resultParameter)
         {
             Signature += SignatureString.For[type];
             Code.AppendLine(@"
-                    global::Dbus.Encoder.AddVariant(sendBody" + parameter + ", ref sendIndex" + parameter + ", " + parameterName + resultParameter+");");
+                    global::Dbus.Encoder.AddVariant(sendBody" + parameter + ", ref sendIndex" + parameter + ", " + parameterName + resultParameter + ");");
+        }
+
+        private void encodeSimpleType(Type type, string parameterName, string parameter, string resultParameter)
+        {
+            Signature += SignatureString.For[type];
+            Code.Append(@"
+                    global::Dbus.Encoder.Add(sendBody" + parameter + ", ref sendIndex" + parameter + ", " + parameterName + resultParameter + ");");
         }
     }
 }


modify mysql create table sql script

modify mysql create table sql script

--- src/DotNetCore.CAP.MySql/IStorage.MySql.cs
+++ src/DotNetCore.CAP.MySql/IStorage.MySql.cs
@@ -58,10 +58,8 @@
         {
             var batchSql =
                 $@"
-DROP TABLE IF EXISTS `{prefix}.queue`;
-
 CREATE TABLE IF NOT EXISTS `{prefix}.received` (
-  `Id` int(127) NOT NULL AUTO_INCREMENT,
+  `Id` bigint NOT NULL,
   `Name` varchar(400) NOT NULL,
   `Group` varchar(200) DEFAULT NULL,
   `Content` longtext,
@@ -73,7 +71,7 @@
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 CREATE TABLE IF NOT EXISTS `{prefix}.published` (
-  `Id` int(127) NOT NULL AUTO_INCREMENT,
+  `Id` bigint NOT NULL,
   `Name` varchar(200) NOT NULL,
   `Content` longtext,
   `Retries` int(11) DEFAULT NULL,
@@ -82,9 +80,6 @@
   `StatusName` varchar(40) NOT NULL,
   PRIMARY KEY (`Id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-ALTER TABLE `{prefix}.published` MODIFY Id BIGINT NOT NULL;
-ALTER TABLE `{prefix}.received` MODIFY Id BIGINT NOT NULL;
 ";
             return batchSql;
         }


Removed obsolete methods

Removed obsolete methods

--- src/Firebase/Offline/DatabaseExtensions.cs
+++ src/Firebase/Offline/DatabaseExtensions.cs
@@ -9,42 +9,6 @@

     public static class DatabaseExtensions
     {
-        /// <summary>
-        /// Create new instances of the <see cref="RealtimeDatabase{T}"/>.
-        /// </summary>
-        /// <typeparam name="T"> Type of elements. </typeparam>
-        /// <param name="filenameModifier"> Custom string which will get appended to the file name. </param>
-        /// <param name="elementRoot"> Optional custom root element of received json items. </param>
-        /// <param name="streamChanges"> Specifies whether changes should be streamed from the server. </param>
-        /// <param name="initialPullStrategy"> Specifies what strategy should be used for initial pulling of server data. </param>
-        /// <param name="pushChanges"> Specifies whether changed items should actually be pushed to the server. It this is false, then Put / Post / Delete will not affect server data. </param>
-        /// <returns> The <see cref="RealtimeDatabase{T}"/>. </returns>
-        [Obsolete("Use one of the other overloads which lets you specify how you want the realtime streaming to be run.")]
-        public static RealtimeDatabase<T> AsRealtimeDatabase<T>(this ChildQuery query, string filenameModifier = "", string elementRoot = "", bool streamChanges = true, InitialPullStrategy initialPullStrategy = InitialPullStrategy.MissingOnly, bool pushChanges = true)
-            where T: class
-        {
-            return new RealtimeDatabase<T>(query, elementRoot, query.Client.Options.OfflineDatabaseFactory, filenameModifier, streamChanges ? StreamingOptions.LatestOnly : StreamingOptions.None, initialPullStrategy, pushChanges);
-        }
-
-        /// <summary>
-        /// Create new instances of the <see cref="RealtimeDatabase{T}"/>.
-        /// </summary>
-        /// <typeparam name="T"> Type of elements. </typeparam>
-        /// <typeparam name="TSetHandler"> Type of the custom <see cref="ISetHandler{T}"/> to use. </typeparam>
-        /// <param name="filenameModifier"> Custom string which will get appended to the file name. </param>
-        /// <param name="elementRoot"> Optional custom root element of received json items. </param>
-        /// <param name="streamChanges"> Specifies whether changes should be streamed from the server. </param>
-        /// <param name="initialPullStrategy"> Specifies what strategy should be used for initial pulling of server data. </param>
-        /// <param name="pushChanges"> Specifies whether changed items should actually be pushed to the server. It this is false, then Put / Post / Delete will not affect server data. </param>
-        /// <returns> The <see cref="RealtimeDatabase{T}"/>. </returns>
-        [Obsolete("Use one of the other overloads which lets you specify how you want the realtime streaming to be run.")]
-        public static RealtimeDatabase<T> AsRealtimeDatabase<T, TSetHandler>(this ChildQuery query, string filenameModifier = "", string elementRoot = "", bool streamChanges = true, InitialPullStrategy initialPullStrategy = InitialPullStrategy.MissingOnly, bool pushChanges = true)
-            where T : class
-            where TSetHandler: ISetHandler<T>, new()
-        {
-            return new RealtimeDatabase<T>(query, elementRoot, query.Client.Options.OfflineDatabaseFactory, filenameModifier, streamChanges ? StreamingOptions.LatestOnly : StreamingOptions.None, initialPullStrategy, pushChanges, Activator.CreateInstance<TSetHandler>());
-        }
-
         /// <summary>
         /// Create new instances of the <see cref="RealtimeDatabase{T}"/>.
         /// </summary>


Changed the GetTypes method of AssemblyTypeSource.cs

The HasManyToMany determine the name of the ManyToMany table by concatenating the left and the right type of the relation as the first and the next element returned by the Assembly.GetExportedTypes. This is definetely not recommended because the exported types order is determined by the position in the IL, so it can differs from time to time

--- src/FluentNHibernate/AssemblyTypeSource.cs
+++ src/FluentNHibernate/AssemblyTypeSource.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Reflection;
+using System.Linq;

 namespace FluentNHibernate
 {
@@ -18,7 +19,7 @@

         public IEnumerable<Type> GetTypes()
         {
-            return source.GetExportedTypes();
+            return source.GetExportedTypes().OrderBy(x => x.FullName);
         }
     }
 }


PERF: Prevent unessary lookups for file storage

Directory Exists already happens for most operations or a FileNotFound exception is thrown for file reads. I wasn't sure about directory deletes.
 http://referencesource.microsoft.com/#mscorlib/system/io/directory.cs,80e8dc4729bc4b3f

We may want to look into this: https://designingefficientsoftware.wordpress.com/2011/03/03/efficient-file-io-from-csharp/

--- src/Foundatio/Storage/FolderFileStorage.cs
+++ src/Foundatio/Storage/FolderFileStorage.cs
@@ -22,33 +22,28 @@
                 folder += Path.DirectorySeparatorChar;

             Folder = folder;
-
-            if (!Directory.Exists(folder))
-                Directory.CreateDirectory(folder);
+            Directory.CreateDirectory(folder);
         }

         public string Folder { get; set; }

-        public async Task<Stream> GetFileStreamAsync(string path, CancellationToken cancellationToken = default(CancellationToken)) {
-            if (String.IsNullOrWhiteSpace(path))
-                throw new ArgumentNullException(nameof(path));
-
-            path = path.NormalizePath();
-
-            try {
-                if (!await ExistsAsync(path).AnyContext())
-                    return null;
-
-                return File.OpenRead(Path.Combine(Folder, path));
+        public Task<Stream> GetFileStreamAsync(string path, CancellationToken cancellationToken = default(CancellationToken)) {
+            if (String.IsNullOrWhiteSpace(path))
+                throw new ArgumentNullException(nameof(path));
+
+            path = path.NormalizePath();
+
+            try {
+                return Task.FromResult<Stream>(File.OpenRead(Path.Combine(Folder, path)));
             } catch (FileNotFoundException) {
-                return null;
+                return Task.FromResult<Stream>(null);
             }
         }

         public Task<FileSpec> GetFileInfoAsync(string path) {
             if (String.IsNullOrWhiteSpace(path))
                 throw new ArgumentNullException(nameof(path));
-
+
             path = path.NormalizePath();

             var info = new FileInfo(Path.Combine(Folder, path));
@@ -66,24 +61,24 @@
         public Task<bool> ExistsAsync(string path) {
             if (String.IsNullOrWhiteSpace(path))
                 throw new ArgumentNullException(nameof(path));
-
-            path = path.NormalizePath();
-
+
+            path = path.NormalizePath();
             return Task.FromResult(File.Exists(Path.Combine(Folder, path)));
         }

         public Task<bool> SaveFileAsync(string path, Stream stream, CancellationToken cancellationToken = default(CancellationToken)) {
             if (String.IsNullOrWhiteSpace(path))
                 throw new ArgumentNullException(nameof(path));
-
-            path = path.NormalizePath();
-
-            string directory = Path.GetDirectoryName(Path.Combine(Folder, path));
-            if (!Directory.Exists(directory))
+
+            path = path.NormalizePath();
+
+            string file = Path.Combine(Folder, path);
+            string directory = Path.GetDirectoryName(file);
+            if (directory != null)
                 Directory.CreateDirectory(directory);

             try {
-                using (var fileStream = File.Create(Path.Combine(Folder, path))) {
+                using (var fileStream = File.Create(file)) {
                     if (stream.CanSeek)
                         stream.Seek(0, SeekOrigin.Begin);

@@ -108,7 +103,7 @@
             try {
                 lock (_lockObject) {
                     string directory = Path.GetDirectoryName(newpath);
-                    if (directory != null && !Directory.Exists(Path.Combine(Folder, directory)))
+                    if (directory != null)
                         Directory.CreateDirectory(Path.Combine(Folder, directory));

                     string oldFullPath = Path.Combine(Folder, path);
@@ -138,7 +133,7 @@
             try {
                 lock (_lockObject) {
                     string directory = Path.GetDirectoryName(targetpath);
-                    if (directory != null && !Directory.Exists(Path.Combine(Folder, directory)))
+                    if (directory != null)
                         Directory.CreateDirectory(Path.Combine(Folder, directory));

                     File.Copy(Path.Combine(Folder, path), Path.Combine(Folder, targetpath));


Fix by Odonno

Fix by Odonno

--- src/Hangfire.LiteDB/LiteDbMonitoringApi.cs
+++ src/Hangfire.LiteDB/LiteDbMonitoringApi.cs
@@ -550,9 +550,9 @@
         {
             var jobs = connection.Job
                 .Find(_ => _.StateName == stateName)
+                .OrderByDescending(x => x.Id)
                 .Skip(from)
                 .Take(count)
-                .OrderByDescending(x => x.Id)
                 .ToList();

             List<JobDetailedDto> joinedJobs = jobs


mainline: fixed a bug in ArraySegmentList

git-svn-id: 6d1cac2d86fac78d43d5e0dd3566a1010e844f91@59799 81fbe566-5dc4-48c1-bdea-7421811ca204

--- mainline/Common/ArraySegmentList.cs
+++ mainline/Common/ArraySegmentList.cs
@@ -39,11 +39,12 @@
                     continue;

                 m_Segments.Add(new ArraySegmentInfo<T>
-                {
-                    Segment = segment,
-                    From = total,
-                    To = total + segment.Count - 1
-                });
+                    {
+                        Segment = segment,
+                        From = total,
+                        To = total + segment.Count - 1
+                    });
+
                 total += segment.Count;
             }

@@ -84,7 +85,7 @@
                 {
                     if (index >= m_PrevSegment.From && index <= m_PrevSegment.To)
                     {
-                        return m_PrevSegment.Segment.Array[index - m_PrevSegment.From];
+                        return m_PrevSegment.Segment.Array[m_PrevSegment.Segment.Offset + index - m_PrevSegment.From];
                     }
                 }

@@ -94,7 +95,7 @@
                     if (index >= segment.From && index <= segment.To)
                     {
                         m_PrevSegment = segment;
-                        return segment.Segment.Array[index - segment.From];
+                        return segment.Segment.Array[segment.Segment.Offset + index - segment.From];
                     }
                 }


Using GallerySettings Table itself

Using GallerySettings Table itself

--- src/NuGetGallery/Services/StatusService.cs
+++ src/NuGetGallery/Services/StatusService.cs
@@ -20,7 +20,7 @@
         private const string Unavailable = "Unavailable";
         private const string StatusMessageFormat = "NuGet Gallery service is {0}. SQL Azure is {1}. Storage is {2}";

-        private const string TestSqlQuery = "SELECT TOP(1) [Key] FROM Users WITH (NOLOCK)";
+        private const string TestSqlQuery = "SELECT TOP(1) [Key] FROM GallerySettings WITH (NOLOCK)";

         public StatusService(
             IEntitiesContext entities,


React to API changes in aspnet-contrib/AspNet.Security.OpenIdConnect.Server

https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/commit/1cd3216df5e07abf7d9cf966195e0d0ce7e96986

--- src/OpenIddict.Mvc/OpenIddictController.cs
+++ src/OpenIddict.Mvc/OpenIddictController.cs
@@ -43,18 +43,12 @@
         public virtual async Task<IActionResult> Authorize() {
             // Note: when a fatal error occurs during the request processing, an OpenID Connect response
             // is prematurely forged and added to the ASP.NET context by OpenIdConnectServerHandler.
-            // In this case, the OpenID Connect request is null and cannot be used.
-            // When the user agent can be safely redirected to the client application,
-            // OpenIdConnectServerHandler automatically handles the error and MVC is not invoked.
-            // You can safely remove this part and let AspNet.Security.OpenIdConnect.Server automatically
-            // handle the unrecoverable errors by switching ApplicationCanDisplayErrors to false.
-            var response = HttpContext.GetOpenIdConnectResponse();
-            if (response != null) {
-                return View("Error", response);
-            }
-
-            // Extract the authorization request from the cache,
-            // the query string or the request form.
+            var response = HttpContext.GetOpenIdConnectResponse();
+            if (response != null) {
+                return View("Error", response);
+            }
+
+            // Extract the authorization request from the ASP.NET environment.
             var request = HttpContext.GetOpenIdConnectRequest();
             if (request == null) {
                 return View("Error", new OpenIdConnectMessage {
@@ -66,8 +60,8 @@
             // Note: authentication could be theorically enforced at the filter level via AuthorizeAttribute
             // but this authorization endpoint accepts both GET and POST requests while the cookie middleware
             // only uses 302 responses to redirect the user agent to the login page, making it incompatible with POST.
-            // To work around this limitation, the OpenID Connect request is automatically saved in the cache and will
-            // be restored by the OpenID Connect server middleware after the external authentication process has been completed.
+            // To work around this limitation, the OpenID Connect request is automatically saved in the cache and will be
+            // restored by the OpenID Connect server middleware after the external authentication process has been completed.
             if (!User.Identities.Any(identity => identity.IsAuthenticated)) {
                 return new ChallengeResult(new AuthenticationProperties {
                     RedirectUri = Url.Action(nameof(Authorize), new {
@@ -76,14 +70,11 @@
                 });
             }

-            // Note: AspNet.Security.OpenIdConnect.Server automatically ensures an application
-            // corresponds to the client_id specified in the authorization request using
-            // IOpenIdConnectServerProvider.ValidateClientRedirectUri (see OpenIddictProvider.cs).
+            // Note: ASOS automatically ensures that an application corresponds to the client_id specified
+            // in the authorization request by calling IOpenIdConnectServerProvider.ValidateAuthorizationRequest.
+            // In theory, this null check shouldn't be needed, but a race condition could occur if you
+            // manually removed the application details from the database after the initial check made by ASOS.
             var application = await Manager.FindApplicationByIdAsync(request.ClientId);
-
-            // In theory, this null check is thus not strictly necessary. That said, a race condition
-            // and a null reference exception could appear here if you manually removed the application
-            // details from the database after the initial check made by AspNet.Security.OpenIdConnect.Server.
             if (application == null) {
                 return View("Error", new OpenIdConnectMessage {
                     Error = OpenIdConnectConstants.Errors.InvalidClient,
@@ -96,20 +87,11 @@

         [Authorize, HttpPost, ValidateAntiForgeryToken]
         public virtual async Task<IActionResult> Accept() {
-            // Note: when a fatal error occurs during the request processing, an OpenID Connect response
-            // is prematurely forged and added to the ASP.NET context by OpenIdConnectServerHandler.
-            // In this case, the OpenID Connect request is null and cannot be used.
-            // When the user agent can be safely redirected to the client application,
-            // OpenIdConnectServerHandler automatically handles the error and MVC is not invoked.
-            // You can safely remove this part and let AspNet.Security.OpenIdConnect.Server automatically
-            // handle the unrecoverable errors by switching ApplicationCanDisplayErrors to false.
-            var response = HttpContext.GetOpenIdConnectResponse();
-            if (response != null) {
-                return View("Error", response);
-            }
-
-            // Extract the authorization request from the cache,
-            // the query string or the request form.
+            var response = HttpContext.GetOpenIdConnectResponse();
+            if (response != null) {
+                return View("Error", response);
+            }
+
             var request = HttpContext.GetOpenIdConnectRequest();
             if (request == null) {
                 return View("Error", new OpenIdConnectMessage {
@@ -162,62 +144,39 @@
             ticket.SetResources(request.GetResources());
             ticket.SetScopes(request.GetScopes());

-            // This call will instruct AspNet.Security.OpenIdConnect.Server to serialize
-            // the specified identity to build appropriate tokens (id_token and token).
-            // Note: you should always make sure the identities you return contain either
-            // a 'sub' or a 'ClaimTypes.NameIdentifier' claim. In this case, the returned
-            // identities always contain the name identifier returned by the external provider.
+            // This call will ask ASOS to serialize the specified identity to build appropriate tokens.
+            // Note: you should always make sure the identities you return contain ClaimTypes.NameIdentifier claim.
+            // In this sample, the identity always contains the name identifier returned by the external provider.
             await HttpContext.Authentication.SignInAsync(ticket.AuthenticationScheme, ticket.Principal, ticket.Properties);

             return new EmptyResult();
         }

         [Authorize, HttpPost, ValidateAntiForgeryToken]
-        public virtual IActionResult Deny() {
-            // Note: when a fatal error occurs during the request processing, an OpenID Connect response
-            // is prematurely forged and added to the ASP.NET context by OpenIdConnectServerHandler.
-            // In this case, the OpenID Connect request is null and cannot be used.
-            // When the user agent can be safely redirected to the client application,
-            // OpenIdConnectServerHandler automatically handles the error and MVC is not invoked.
-            // You can safely remove this part and let AspNet.Security.OpenIdConnect.Server automatically
-            // handle the unrecoverable errors by switching ApplicationCanDisplayErrors to false.
-            var response = HttpContext.GetOpenIdConnectResponse();
-            if (response != null) {
-                return View("Error", response);
-            }
-
-            // Extract the authorization request from the cache,
-            // the query string or the request form.
-            var request = HttpContext.GetOpenIdConnectRequest();
-            if (request == null) {
-                return View("Error", new OpenIdConnectMessage {
-                    Error = OpenIdConnectConstants.Errors.ServerError,
-                    ErrorDescription = "An internal error has occurred"
-                });
-            }
-
-            // Notify AspNet.Security.OpenIdConnect.Server that the authorization grant has been denied.
+        public virtual async Task<IActionResult> Deny() {
+            var response = HttpContext.GetOpenIdConnectResponse();
+            if (response != null) {
+                return View("Error", response);
+            }
+
+            var request = HttpContext.GetOpenIdConnectRequest();
+            if (request == null) {
+                return View("Error", new OpenIdConnectMessage {
+                    Error = OpenIdConnectConstants.Errors.ServerError,
+                    ErrorDescription = "An internal error has occurred"
+                });
+            }
+
+            // Notify ASOS that the authorization grant has been denied by the resource owner.
             // Note: OpenIdConnectServerHandler will automatically take care of redirecting
             // the user agent to the client application using the appropriate response_mode.
-            HttpContext.SetOpenIdConnectResponse(new OpenIdConnectMessage {
-                Error = "access_denied",
-                ErrorDescription = "The authorization grant has been denied by the resource owner",
-                RedirectUri = request.RedirectUri,
-                State = request.State
-            });
+            await HttpContext.Authentication.ForbidAsync(Options.AuthenticationScheme);

             return new EmptyResult();
         }

         [HttpGet]
         public virtual async Task<ActionResult> Logout() {
-            // Note: when a fatal error occurs during the request processing, an OpenID Connect response
-            // is prematurely forged and added to the ASP.NET context by OpenIdConnectServerHandler.
-            // In this case, the OpenID Connect request is null and cannot be used.
-            // When the user agent can be safely redirected to the client application,
-            // OpenIdConnectServerHandler automatically handles the error and MVC is not invoked.
-            // You can safely remove this part and let AspNet.Security.OpenIdConnect.Server automatically
-            // handle the unrecoverable errors by switching ApplicationCanDisplayErrors to false.
             var response = HttpContext.GetOpenIdConnectResponse();
             if (response != null) {
                 return View("Error", response);
@@ -228,7 +187,6 @@
             // using AuthenticateAsync or using User when the authorization server is declared as AuthenticationMode.Active.
             var identity = await HttpContext.Authentication.AuthenticateAsync(Options.AuthenticationScheme);

-            // Extract the logout request from the ASP.NET environment.
             var request = HttpContext.GetOpenIdConnectRequest();
             if (request == null) {
                 return View("Error", new OpenIdConnectMessage {
@@ -247,11 +205,7 @@
             // after a successful authentication flow (e.g Google or Facebook).
             await HttpContext.Authentication.SignOutAsync("Microsoft.AspNetCore.Identity.Application");

-            // This call will instruct AspNet.Security.OpenIdConnect.Server to serialize
-            // the specified identity to build appropriate tokens (id_token and token).
-            // Note: you should always make sure the identities you return contain either
-            // a 'sub' or a 'ClaimTypes.NameIdentifier' claim. In this case, the returned
-            // identities always contain the name identifier returned by the external provider.
+            // Redirect the user agent to the post_logout_redirect_uri specified by the client application.
             await HttpContext.Authentication.SignOutAsync(Options.AuthenticationScheme);
         }
     }


Fix map path for single player maps

Fix map path for single player maps

--- src/OpenSage.Game/Data/Sav/GameStateMap.cs
+++ src/OpenSage.Game/Data/Sav/GameStateMap.cs
@@ -40,7 +40,7 @@
             }
             else
             {
-                game.StartSinglePlayerGame(mapPathInSaveFolder);
+                game.StartSinglePlayerGame(mapPath1);
             }
         }
     }


small fixes for bfme maps

small fixes for bfme maps

--- src/OpenSage.Game/Navigation/Navigation.cs
+++ src/OpenSage.Game/Navigation/Navigation.cs
@@ -94,9 +94,9 @@

             var area = gameObject.Collider.GetBoundingArea();

-            for (var x = -1; x < topRightNode.X - bottomLeftNode.X + 1; x++)
+            for (var x = 0; x < topRightNode.X - bottomLeftNode.X; x++)
             {
-                for (var y = - 1; y < topRightNode.Y - bottomLeftNode.Y + 1; y++)
+                for (var y = 0; y < topRightNode.Y - bottomLeftNode.Y; y++)
                 {
                     var node = _graph.GetNode(bottomLeftNode.X + x, bottomLeftNode.Y + y);
                     var position = GetNodePosition(node);


Fix dead lock issue

Fix dead lock issue

--- src/Pomelo.NetCore.Node/Hubs/ProjectHub.cs
+++ src/Pomelo.NetCore.Node/Hubs/ProjectHub.cs
@@ -139,9 +139,10 @@
             while (sequence != proc.InputSequence + 1)
                 Thread.Sleep(100);

+            ++proc.InputSequence;
+
             lock (this)
             {
-                ++proc.InputSequence;
                 proc.InputSequence = sequence;
                 proc.StandardInput.Write(inputChar);
                 return new { isSucceeded = true, @char = inputChar, sequence = sequence };


Fixed link to add a day

Fixed link to add a day

--- src/PronoFoot/Views/Edition/Details.cshtml
+++ src/PronoFoot/Views/Edition/Details.cshtml
@@ -70,7 +70,7 @@

     @if (Request.IsAuthenticated && User.IsInRole("Administrators"))
     {
-
@Html.ActionLink("Ajouter une journée...", "Create", "Day", new { competitionId = Model.Edition.EditionId }, null)

+
@Html.ActionLink("Ajouter une journée...", "Create", "Day", new { editionId = Model.Edition.EditionId }, null)

     }


Value Set builder shouldn't stop indexing when one field is empty in value sets

--- src/Umbraco.Examine/BaseValueSetBuilder.cs
+++ src/Umbraco.Examine/BaseValueSetBuilder.cs
@@ -45,7 +45,7 @@
                             continue;
                         case string strVal:
                             {
-                                if (strVal.IsNullOrWhiteSpace()) return;
+                                if (strVal.IsNullOrWhiteSpace()) continue;
                                 var key = $"{keyVal.Key}{cultureSuffix}";
                                 if (values.TryGetValue(key, out var v))
                                     values[key] = new List<object>(v) { val }.ToArray();


fixes test

fixes test

--- src/Umbraco.Tests/Models/VariationTests.cs
+++ src/Umbraco.Tests/Models/VariationTests.cs
@@ -364,6 +364,7 @@
         [Test]
         public void ContentPublishValuesWithMixedPropertyTypeVariations()
         {
+            var propertyValidationService = new PropertyValidationService(Current.Factory.GetInstance<PropertyEditorCollection>(), Current.Factory.GetInstance<ServiceContext>().DataTypeService);
             const string langFr = "fr-FR";

             // content type varies by Culture
@@ -383,9 +384,12 @@

             content.SetCultureName("hello", langFr);

-            Assert.IsFalse(content.PublishCulture(langFr)); // fails because prop1 is mandatory
+            Assert.IsTrue(content.PublishCulture(langFr));
+            Assert.IsFalse(propertyValidationService.IsPropertyDataValid(content, out _, langFr));// fails because prop1 is mandatory
+
             content.SetValue("prop1", "a", langFr);
-            Assert.IsFalse(content.PublishCulture(langFr)); // fails because prop2 is mandatory and invariant
+            Assert.IsTrue(content.PublishCulture(langFr));
+            Assert.IsFalse(propertyValidationService.IsPropertyDataValid(content, out _, langFr));// fails because prop2 is mandatory and invariant
             content.SetValue("prop2", "x");
             Assert.IsTrue(content.PublishCulture(langFr)); // now it's ok


changes from refactor of Dequeue method

changes from refactor of Dequeue method

--- tests/ServiceStack.Redis.Tests/QueueTests.cs
+++ tests/ServiceStack.Redis.Tests/QueueTests.cs
@@ -33,44 +33,44 @@
                 var batch = queue.Dequeue(numMessages/2);
                 // check that half of patient[0] messages are returned
                 for (int i = 0; i < numMessages/2; ++i)
-                    Assert.AreEqual(batch.WorkItems[i], messages0[i]);
+                    Assert.AreEqual(batch.DequeueItems[i], messages0[i]);
                 Thread.Sleep(5000);
                 Assert.IsTrue(queue.HarvestZombies());
-                for (int i = 0; i < batch.WorkItems.Count; ++i)
+                for (int i = 0; i < batch.DequeueItems.Count; ++i)
                     batch.DoneProcessedWorkItem();

                 // check that all patient[1] messages are returned
                 batch = queue.Dequeue(2*numMessages);
                 // check that batch size is respected
-                Assert.AreEqual(batch.WorkItems.Count, numMessages);
+                Assert.AreEqual(batch.DequeueItems.Count, numMessages);
                 for (int i = 0; i < numMessages; ++i)
                 {
-                    Assert.AreEqual(batch.WorkItems[i], messages1[i]);
+                    Assert.AreEqual(batch.DequeueItems[i], messages1[i]);
                     batch.DoneProcessedWorkItem();
                 }

                 // check that there are numMessages/2 messages in the queue
                 batch = queue.Dequeue(numMessages);
-                Assert.AreEqual(batch.WorkItems.Count, numMessages/2);
+                Assert.AreEqual(batch.DequeueItems.Count, numMessages/2);

                 // test pop and unlock
                 batch.DoneProcessedWorkItem();
-                int remaining = batch.WorkItems.Count-1;
+                int remaining = batch.DequeueItems.Count-1;
                 batch.PopAndUnlock();

                 batch = queue.Dequeue(numMessages);
-                Assert.AreEqual(batch.WorkItems.Count, remaining);
+                Assert.AreEqual(batch.DequeueItems.Count, remaining);

                 //process remaining items
                 batch = queue.Dequeue(remaining);
-                Assert.AreEqual(batch.WorkItems.Count, remaining);
+                Assert.AreEqual(batch.DequeueItems.Count, remaining);
                 for (int i = 0; i < numMessages; ++i)
                     batch.DoneProcessedWorkItem();

                 batch = queue.Dequeue(remaining);
-                Assert.AreEqual(batch.WorkItems.Count, 0);
+                Assert.AreEqual(batch.DequeueItems.Count, 0);

             }


Fixed CmsRecipient to use IssuerAndSerial unless SubjectKeyIdentifier is explicitly requested

--- MimeKit/Cryptography/CmsRecipient.cs
+++ MimeKit/Cryptography/CmsRecipient.cs
@@ -66,7 +66,7 @@
 			if (certificate == null)
 				throw new ArgumentNullException (nameof (certificate));

-			if (recipientIdentifierType == SubjectIdentifierType.IssuerAndSerialNumber)
+			if (recipientIdentifierType != SubjectIdentifierType.SubjectKeyIdentifier)
 				RecipientIdentifierType = SubjectIdentifierType.IssuerAndSerialNumber;
 			else
 				RecipientIdentifierType = SubjectIdentifierType.SubjectKeyIdentifier;
@@ -102,14 +102,13 @@
 			if (stream == null)
 				throw new ArgumentNullException (nameof (stream));

-			if (recipientIdentifierType == SubjectIdentifierType.IssuerAndSerialNumber)
+			if (recipientIdentifierType != SubjectIdentifierType.SubjectKeyIdentifier)
 				RecipientIdentifierType = SubjectIdentifierType.IssuerAndSerialNumber;
 			else
 				RecipientIdentifierType = SubjectIdentifierType.SubjectKeyIdentifier;

 			var parser = new X509CertificateParser ();

-			RecipientIdentifierType = SubjectIdentifierType.IssuerAndSerialNumber;
 			Certificate = parser.ReadCertificate (stream);

 			if (Certificate == null)
@@ -160,15 +159,16 @@
 			if (fileName == null)
 				throw new ArgumentNullException (nameof (fileName));

-			var parser = new X509CertificateParser ();
-
-			if (recipientIdentifierType == SubjectIdentifierType.IssuerAndSerialNumber)
-				RecipientIdentifierType = SubjectIdentifierType.IssuerAndSerialNumber;
-			else
-				RecipientIdentifierType = SubjectIdentifierType.SubjectKeyIdentifier;
-
-			using (var stream = File.OpenRead (fileName))
+			if (recipientIdentifierType != SubjectIdentifierType.SubjectKeyIdentifier)
+				RecipientIdentifierType = SubjectIdentifierType.IssuerAndSerialNumber;
+			else
+				RecipientIdentifierType = SubjectIdentifierType.SubjectKeyIdentifier;
+
+			using (var stream = File.OpenRead (fileName)) {
+				var parser = new X509CertificateParser ();
+
 				Certificate = parser.ReadCertificate (stream);
+			}

 			if (Certificate == null)
 				throw new FormatException ();
@@ -199,7 +199,7 @@
 			if (certificate == null)
 				throw new ArgumentNullException (nameof (certificate));

-			if (recipientIdentifierType == SubjectIdentifierType.IssuerAndSerialNumber)
+			if (recipientIdentifierType != SubjectIdentifierType.SubjectKeyIdentifier)
 				RecipientIdentifierType = SubjectIdentifierType.IssuerAndSerialNumber;
 			else
 				RecipientIdentifierType = SubjectIdentifierType.SubjectKeyIdentifier;


Update the perks information to remove the 15 minute text

--- MultiMiner.Win/PerksForm.Designer.cs
+++ MultiMiner.Win/PerksForm.Designer.cs
@@ -50,16 +50,16 @@
             this.panel1.Controls.Add(this.saveButton);
             this.panel1.Controls.Add(this.cancelButton);
             this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panel1.Location = new System.Drawing.Point(0, 180);
+            this.panel1.Location = new System.Drawing.Point(0, 172);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(400, 54);
+            this.panel1.Size = new System.Drawing.Size(376, 54);
             this.panel1.TabIndex = 4;
             //
             // saveButton
             //
             this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.saveButton.DialogResult = System.Windows.Forms.DialogResult.OK;
-            this.saveButton.Location = new System.Drawing.Point(204, 14);
+            this.saveButton.Location = new System.Drawing.Point(180, 14);
             this.saveButton.Name = "saveButton";
             this.saveButton.Size = new System.Drawing.Size(87, 27);
             this.saveButton.TabIndex = 0;
@@ -70,7 +70,7 @@
             //
             this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-            this.cancelButton.Location = new System.Drawing.Point(298, 14);
+            this.cancelButton.Location = new System.Drawing.Point(274, 14);
             this.cancelButton.Name = "cancelButton";
             this.cancelButton.Size = new System.Drawing.Size(87, 27);
             this.cancelButton.TabIndex = 1;
@@ -81,7 +81,7 @@
             //
             this.perksCheckBox.AutoSize = true;
             this.perksCheckBox.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.perksConfigurationBindingSource, "PerksEnabled", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.perksCheckBox.Location = new System.Drawing.Point(56, 75);
+            this.perksCheckBox.Location = new System.Drawing.Point(56, 67);
             this.perksCheckBox.Name = "perksCheckBox";
             this.perksCheckBox.Size = new System.Drawing.Size(192, 19);
             this.perksCheckBox.TabIndex = 5;
@@ -97,7 +97,7 @@
             //
             this.coinbaseCheckBox.AutoSize = true;
             this.coinbaseCheckBox.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.perksConfigurationBindingSource, "ShowExchangeRates", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.coinbaseCheckBox.Location = new System.Drawing.Point(77, 103);
+            this.coinbaseCheckBox.Location = new System.Drawing.Point(77, 95);
             this.coinbaseCheckBox.Name = "coinbaseCheckBox";
             this.coinbaseCheckBox.Size = new System.Drawing.Size(217, 19);
             this.coinbaseCheckBox.TabIndex = 6;
@@ -108,7 +108,7 @@
             //
             this.incomeCheckBox.AutoSize = true;
             this.incomeCheckBox.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.perksConfigurationBindingSource, "ShowIncomeRates", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
-            this.incomeCheckBox.Location = new System.Drawing.Point(77, 131);
+            this.incomeCheckBox.Location = new System.Drawing.Point(77, 123);
             this.incomeCheckBox.Name = "incomeCheckBox";
             this.incomeCheckBox.Size = new System.Drawing.Size(224, 19);
             this.incomeCheckBox.TabIndex = 7;
@@ -121,10 +121,10 @@
             | System.Windows.Forms.AnchorStyles.Right)));
             this.label1.Location = new System.Drawing.Point(53, 12);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(332, 49);
+            this.label1.Size = new System.Drawing.Size(308, 44);
             this.label1.TabIndex = 8;
-            this.label1.Text = "By enabling the perks in MultiMiner, your mining resources will be donated toward" +
-    "s the author for 1% (15 minutes) of each day.";
+            this.label1.Text = "By enabling the perks in MultiMiner, 1% of your mining resources will go towards " +
+    "the software\'s author.";
             //
             // pictureBox1
             //
@@ -140,7 +140,7 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.SystemColors.ControlLightLight;
-            this.ClientSize = new System.Drawing.Size(400, 234);
+            this.ClientSize = new System.Drawing.Size(376, 226);
             this.Controls.Add(this.pictureBox1);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.incomeCheckBox);


Removed exception handler in Write Callback (instead let PracticeSharpLogic catch it)

--- NAudioFLAC/Library/FLACFileReader.cs
+++ NAudioFLAC/Library/FLACFileReader.cs
@@ -227,8 +227,9 @@

         #endregion

-        #region Callbacks
-
+        #region libFlac Callbacks
+
+        //private

         /// <summary>
         /// FLAC Write Call Back - libFlac notifies back on a frame that was read from the source file and written as a frame
@@ -239,32 +240,25 @@
         /// <param name="clientData"></param>
         private void FLAC_WriteCallback(IntPtr context, IntPtr frame, IntPtr buffer, IntPtr clientData)
         {
-            try
-            {
-                // Read the FLAC Frame into a memory samples buffer (m_flacSamples)
-                LibFLACSharp.FlacFrame flacFrame = (LibFLACSharp.FlacFrame)Marshal.PtrToStructure(frame, typeof(LibFLACSharp.FlacFrame));
-
-                if (m_flacSamples == null)
-                {
-                    // First time - Create Flac sample buffer
-                    m_samplesPerChannel = flacFrame.Header.BlockSize;
-                    m_flacSamples = new int[m_samplesPerChannel * m_flacStreamInfo.Channels];
-                    m_flacSampleIndex = 0;
-                }
-
-                // Iterate on all channels, copy the unmanaged channel bits (samples) to the a managed samples array
-                for (int inputChannel = 0; inputChannel < m_flacStreamInfo.Channels; inputChannel++)
-                {
-                    // Get pointer to channel bits, for the current channel
-                    IntPtr pChannelBits = Marshal.ReadIntPtr(buffer, inputChannel * IntPtr.Size);
-
-                    // Copy the unmanaged bits to managed memory
-                    Marshal.Copy(pChannelBits, m_flacSamples, inputChannel * m_samplesPerChannel, m_samplesPerChannel);
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine("Exception in WriteCallBack: " + ex.ToString());
+            // Read the FLAC Frame into a memory samples buffer (m_flacSamples)
+            LibFLACSharp.FlacFrame flacFrame = (LibFLACSharp.FlacFrame)Marshal.PtrToStructure(frame, typeof(LibFLACSharp.FlacFrame));
+
+            if (m_flacSamples == null)
+            {
+                // First time - Create Flac sample buffer
+                m_samplesPerChannel = flacFrame.Header.BlockSize;
+                m_flacSamples = new int[m_samplesPerChannel * m_flacStreamInfo.Channels];
+                m_flacSampleIndex = 0;
+            }
+
+            // Iterate on all channels, copy the unmanaged channel bits (samples) to the a managed samples array
+            for (int inputChannel = 0; inputChannel < m_flacStreamInfo.Channels; inputChannel++)
+            {
+                // Get pointer to channel bits, for the current channel
+                IntPtr pChannelBits = Marshal.ReadIntPtr(buffer, inputChannel * IntPtr.Size);
+
+                // Copy the unmanaged bits to managed memory
+                Marshal.Copy(pChannelBits, m_flacSamples, inputChannel * m_samplesPerChannel, m_samplesPerChannel);
             }
         }


Added drRecord declaration

Added drRecord declaration

(Sent from an email from Chris yesterday.)

--- SampleCode.cs
+++ SampleCode.cs
@@ -55,6 +55,7 @@
             int intReturnLength = strReturnCheck.Trim().Length;

             DataTable dtDataTable = new DataTable();
+            DataRow drRecord;

             strPostParameters = "&content=record&format=csv&type=flat&eventName=unique";


Test fix.

Test fix.

--- Node/NodeTest/NodeUriBuilderTests.cs
+++ Node/NodeTest/NodeUriBuilderTests.cs
@@ -24,7 +24,7 @@
         }

         [Test]
-        [ExpectedException(typeof (System.UriFormatException))]
+        [ExpectedException(typeof (System.ArgumentNullException))]
         public void ShouldThrowExceptionWhenConstructorArgumentIsStringEmpty()
         {
             var nodeUriBuilderToTest = new NodeUriBuilderHelper(string.Empty);


only perform full width search on first ply. can save time in fast games.

--- NoraGrace/NoraGrace.Engine/Search.cs
+++ NoraGrace/NoraGrace.Engine/Search.cs
@@ -411,7 +411,7 @@
                 SearchArgs.TimeManager.StartMove(move);
                 int nodeCountBeforeMove = this.CountAIValSearch;

-				if (depth.ToPly() <= 3)
+				if (depth.ToPly() <= 1)
 				{
 					//first couple nodes search full width
 					score = -ValSearchPVS(depth - 1, 1, move_num, -beta, -alpha);


Hide non-public members

Hide non-public members

--- NuGetCalcWeb/FilePreviewGenerator.cs
+++ NuGetCalcWeb/FilePreviewGenerator.cs
@@ -12,7 +12,7 @@
 using ICSharpCode.Decompiler;
 using ICSharpCode.Decompiler.Ast;
 using ICSharpCode.ILSpy.XmlDoc;
-using ICSharpCode.NRefactory.Documentation;
+using ICSharpCode.NRefactory.CSharp;
 using Mono.Cecil;

 namespace NuGetCalcWeb
@@ -84,6 +84,7 @@
             {
                 module = ModuleDefinition.ReadModule(input.FullName, new ReaderParameters()
                 {
+                    ReadingMode = ReadingMode.Immediate,
                     AssemblyResolver = new MyAssemblyResolver()
                 });
             }
@@ -199,6 +200,22 @@
             var context = new DecompilerContext(module);
             var astBuilder = new AstBuilder(context) { DecompileMethodBodies = false };
             astBuilder.AddType(type);
+
+            if (!(type.IsEnum || type.IsDelegate()))
+            {
+                var typeNode = astBuilder.SyntaxTree.GetTypes(false).First();
+
+                // Remove nested types
+                foreach (var node in typeNode.Children)
+                    if (node is TypeDeclaration)
+                        node.Remove();
+
+                // Remove non-public members
+                foreach (var member in typeNode.Members)
+                    if (!(member.HasModifier(Modifiers.Public) || member.HasModifier(Modifiers.Protected)))
+                        member.Remove();
+            }
+
             astBuilder.RunTransformations();
             AddXmlDocTransform.Run(astBuilder.SyntaxTree);
             var output = new PlainTextOutput();


Version 1.3.6.0.

Version 1.3.6.0.

--- Oogi/Oogi/Properties/AssemblyInfo.cs
+++ Oogi/Oogi/Properties/AssemblyInfo.cs
@@ -31,5 +31,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("1.3.5.0")]
-[assembly: AssemblyFileVersion("1.3.5.0")]
+[assembly: AssemblyVersion("1.3.6.0")]
+[assembly: AssemblyFileVersion("1.3.6.0")]


W00t! It loads a DB!

W00t! It loads a DB!

--- OpenGridServices.AssetServer/Main.cs
+++ OpenGridServices.AssetServer/Main.cs
@@ -32,11 +32,13 @@
 using System.Text;
 using System.Timers;
 using System.Net;
-using System.Reflection;
+using System.Reflection;
+using System.Threading;
 using libsecondlife;
 using OpenSim.Framework;
 using OpenSim.Framework.Sims;
 using OpenSim.Framework.Console;
+using OpenSim.Framework.Types;
 using OpenSim.Framework.Interfaces;
 using OpenSim.GridInterfaces.Local;		// REFACTORING IS NEEDED!!!!!!!!!!!
 using OpenSim.Servers;
@@ -83,21 +85,14 @@
         }

         public void Startup()
-        {
-            /*m_console.WriteLine("Main.cs:Startup() - Loading configuration");
-            Cfg = this.LoadConfigDll(this.ConfigDll);
-            Cfg.InitConfig();
-*/
-
-
+        {
+	    m_console.WriteLine("Main.cs:Startup() - Setting up asset DB");
+ 	    setupDB();
+
             m_console.WriteLine("Main.cs:Startup() - Starting HTTP process");
             BaseHttpServer httpServer = new BaseHttpServer(8003);

-            /*httpServer.AddRestHandler("GET", "/sims/", m_simProfileManager.RestGetSimMethod);
-            httpServer.AddRestHandler("POST", "/sims/", m_simProfileManager.RestSetSimMethod);
-	    httpServer.AddRestHandler("GET", "/regions/", m_simProfileManager.RestGetRegionMethod);
-	    httpServer.AddRestHandler("POST", "/regions/", m_simProfileManager.RestSetRegionMethod);
-*/
+
 	    httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod);

@@ -109,6 +104,132 @@
 		return "";
 	}

+	public void setupDB() {
+		bool yapfile=System.IO.File.Exists("assets.yap");
+		try
+	            {
+	                db = Db4oFactory.OpenFile("assets.yap");
+	                OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:setupDB() - creation");
+	            }
+	        catch (Exception e)
+	            {
+	                db.Close();
+	                OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:setupDB() - Exception occured");
+	                OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
+	            }
+	        if (!yapfile)
+	            {
+	                this.LoadDB();
+	            }
+	}
+
+	public void LoadDB() {
+		try
+	            {
+
+	                Console.WriteLine("setting up Asset database");
+
+	                AssetBase Image = new AssetBase();
+	                Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
+	                Image.Name = "Bricks";
+	                this.LoadAsset(Image, true, "bricks.jp2");
+	                AssetStorage store = new AssetStorage();
+	                store.Data = Image.Data;
+	                store.Name = Image.Name;
+	                store.UUID = Image.FullID;
+	                db.Set(store);
+	                db.Commit();
+
+	                Image = new AssetBase();
+                	Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
+	                Image.Name = "Plywood";
+	                this.LoadAsset(Image, true, "plywood.jp2");
+	                store = new AssetStorage();
+	                store.Data = Image.Data;
+	                store.Name = Image.Name;
+	                store.UUID = Image.FullID;
+	                db.Set(store);
+	                db.Commit();
+
+	                Image = new AssetBase();
+	                Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
+	                Image.Name = "Rocks";
+	                this.LoadAsset(Image, true, "rocks.jp2");
+	                store = new AssetStorage();
+	                store.Data = Image.Data;
+	                store.Name = Image.Name;
+	                store.UUID = Image.FullID;
+	                db.Set(store);
+	                db.Commit();
+
+	                Image = new AssetBase();
+	                Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
+                	Image.Name = "Granite";
+	                this.LoadAsset(Image, true, "granite.jp2");
+	                store = new AssetStorage();
+	                store.Data = Image.Data;
+	                store.Name = Image.Name;
+	                store.UUID = Image.FullID;
+	                db.Set(store);
+	                db.Commit();
+
+	                Image = new AssetBase();
+	                Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
+	                Image.Name = "Hardwood";
+	                this.LoadAsset(Image, true, "hardwood.jp2");
+	                store = new AssetStorage();
+	                store.Data = Image.Data;
+	                store.Name = Image.Name;
+	                store.UUID = Image.FullID;
+	                db.Set(store);
+	                db.Commit();
+
+	                Image = new AssetBase();
+	                Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
+	                Image.Name = "Prim Base Texture";
+	                this.LoadAsset(Image, true, "plywood.jp2");
+	                store = new AssetStorage();
+	                store.Data = Image.Data;
+	                store.Name = Image.Name;
+	                store.UUID = Image.FullID;
+	                db.Set(store);
+	                db.Commit();
+
+        	        Image = new AssetBase();
+	                Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
+	                Image.Name = "Shape";
+	                this.LoadAsset(Image, false, "base_shape.dat");
+	                store = new AssetStorage();
+	                store.Data = Image.Data;
+	                store.Name = Image.Name;
+	                store.UUID = Image.FullID;
+	                db.Set(store);
+	                db.Commit();
+	            }
+	            catch (Exception e)
+	            {
+	                Console.WriteLine(e.Message);
+	            }
+	}
+
+ 	private void LoadAsset(AssetBase info, bool image, string filename)
+        {
+
+
+            string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
+            string fileName = Path.Combine(dataPath, filename);
+            FileInfo fInfo = new FileInfo(fileName);
+            long numBytes = fInfo.Length;
+            FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+            byte[] idata = new byte[numBytes];
+            BinaryReader br = new BinaryReader(fStream);
+            idata = br.ReadBytes((int)numBytes);
+            br.Close();
+            fStream.Close();
+            info.Data = idata;
+            //info.loaded=true;
+        }
+
         /*private GridConfig LoadConfigDll(string dllName)
         {
             Assembly pluginAssembly = Assembly.LoadFrom(dllName);


Remove unused index parameter from BotManager.startupBot().  Rename startupBot() => StartBot()

--- OpenSim/Tools/pCampBot/BotManager.cs
+++ OpenSim/Tools/pCampBot/BotManager.cs
@@ -136,7 +136,7 @@
                 if (behaviourSwitches.Contains("g"))
                     behaviours.Add(new GrabbingBehaviour());

-                startupBot(i, this, behaviours, firstName, lastName, password, loginUri);
+                StartBot(this, behaviours, firstName, lastName, password, loginUri);
             }
         }

@@ -156,22 +156,21 @@
 //            int newlen = len + botcount;
 //            for (int i = len; i < newlen; i++)
 //            {
-//                startupBot(i, Config);
+//                startupBot(Config);
 //            }
 //        }

         /// <summary>
         /// This starts up the bot and stores the thread for the bot in the thread array
         /// </summary>
-        /// <param name="pos">The position in the thread array to stick the bot's thread</param>
         /// <param name="bm"></param>
         /// <param name="behaviours">Behaviours for this bot to perform.</param>
         /// <param name="firstName">First name</param>
         /// <param name="lastName">Last name</param>
         /// <param name="password">Password</param>
         /// <param name="loginUri">Login URI</param>
-        public void startupBot(
-             int pos, BotManager bm, List<IBehaviour> behaviours,
+        public void StartBot(
+             BotManager bm, List<IBehaviour> behaviours,
              string firstName, string lastName, string password, string loginUri)
         {
             Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri);


Added comments about SwitchDevice

Added comments about SwitchDevice

--- Palaso.Media/Naudio/AudioRecorder.cs
+++ Palaso.Media/Naudio/AudioRecorder.cs
@@ -126,7 +126,19 @@
 		}

 		/// <summary>
-		/// Switch device after we have started, typically because the user plugged in a new one.
+		/// Switch device after we have started monitoring, typically because the user plugged in a new one.
+		/// One way to detect a new device (see e.g. HearThis, RecordingToolControl.checkNewMicTimer_Tick)
+		/// is to keep a set of the ProductNames derived using (from d in RecordingDevice.Devices select d.ProductName),
+		/// and periodically compare it with the current set of RecordingDevice.Devices, which (at least on
+		/// Win7 with USB mics) seems to update as things are connected and disconnected.
+		/// Then if the current set of product names has one that isn't in the set, SwitchDevice to
+		/// the new device. This can also be used to detect that the current device is no longer available,
+		/// and switch to (e.g.) the current default recording device, if any.
+		/// It could also be used with some sort of control to allow the user to choose recording device.
+		/// (One idea would be to make the RecordingDeviceButton respond to a click by cycling through
+		/// the available devices, or pop up a chooser...though that is probably overdoing things, users
+		/// are unlikely to have more than two.)
+		/// I'm not sure this approach will detect the plugging and unplugging of non-USB mics.
 		/// </summary>
 		/// <param name="device"></param>
 		public void SwitchDevice(RecordingDevice device)


Add the ability to go to the previous spine item. Still buggy. Fix several potential exceptions.

--- Papyrus/Papyrus.UI/Parchment.xaml.cs
+++ Papyrus/Papyrus.UI/Parchment.xaml.cs
@@ -111,7 +111,8 @@
             var contents = await Source.GetContentsAsync(navPoint);
             var converter = new Converter();
             converter.Convert(contents);
-            BuildView(converter.ConvertedBlocks);
+            await BuildViewAsync(converter.ConvertedBlocks);
+            IsBusy = false;
         }

         public async Task LoadContentAsync(SpineItem spineItem)
@@ -121,13 +122,20 @@
             var contents = await Source.GetContentsAsync(spineItem);
             var converter = new Converter();
             converter.Convert(contents);
-            BuildView(converter.ConvertedBlocks);
-        }
-
-        private void BuildView(IEnumerable<Block> blocks)
+            await BuildViewAsync(converter.ConvertedBlocks);
+            IsBusy = false;
+        }
+
+        private async Task BuildViewAsync(IEnumerable<Block> blocks)
         {
             MainFlipView.ItemsSource = null;
             MainFlipView.Items.Clear();
+
+            var previousIndex = Source.Spine.IndexOf(_currentSpineItem) - 1;
+
+            if (previousIndex >= 0)
+                MainFlipView.Items.Add(new FlipViewItem());
+
             var ContentTextBlock = new RichTextBlock
             {
                 IsTextSelectionEnabled = false
@@ -139,24 +147,26 @@
             foreach (var block in blocks)
                 ContentTextBlock.Blocks.Add(block);

-            Overflow(ContentTextBlock);
             MainFlipView.Items.Add(ContentTextBlock);
-            IsBusy = false;
-        }
-
-        private async void Overflow(RichTextBlock rtb)
+
+            if (MainFlipView.Items.FirstOrDefault() is FlipViewItem)
+                MainFlipView.SelectedIndex = 1;
+
+            await Overflow(ContentTextBlock);
+        }
+
+        private async Task Overflow(RichTextBlock rtb)
         {
             async Task Flow()
             {
                 if (rtb.HasOverflowContent && rtb.OverflowContentTarget == null)
                 {
-                    var index = MainFlipView.Items.IndexOf(rtb);
                     var target = new RichTextBlockOverflow();
                     target.SetBinding(RichTextBlockOverflow.PaddingProperty, _paddingBinding);
                     rtb.OverflowContentTarget = target;
                     await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                     {
-                        MainFlipView.Items.Insert(index + 1, target);
+                        MainFlipView.Items.Add(target);
                     });
                     await OverflowAsync(target);
                 }
@@ -180,34 +190,18 @@
             });
         }

-        private async void MainFlipView_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            if (MainFlipView.SelectedIndex == MainFlipView.Items.Count - 2 && !(MainFlipView.Items.LastOrDefault() is FlipViewItem))
-            {
-                // We're on the next to last page. Tell the FlipView it can go further.
-                MainFlipView.Items.Add(new FlipViewItem());
-            }
-
-            else if (MainFlipView.SelectedIndex == MainFlipView.Items.Count - 1 && MainFlipView.SelectedItem is FlipViewItem)
-            {
-                var currentIndex = Source.Spine.IndexOf(_currentSpineItem);
-                await LoadContentAsync(Source.Spine[++currentIndex]);
-            }
-        }
-
         private async Task OverflowAsync(RichTextBlockOverflow rtb)
         {
             async Task Flow()
             {
                 if (rtb.HasOverflowContent && rtb.OverflowContentTarget == null)
                 {
-                    var index = MainFlipView.Items.IndexOf(rtb);
                     var target = new RichTextBlockOverflow();
                     target.SetBinding(RichTextBlockOverflow.PaddingProperty, _paddingBinding);
                     rtb.OverflowContentTarget = target;
                     await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                     {
-                        MainFlipView.Items.Insert(index + 1, target);
+                        MainFlipView.Items.Add(target);
                     });
                     await OverflowAsync(target);
                 }
@@ -247,5 +241,55 @@

             await Flow();
         }
+
+        private async void MainFlipView_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            if (IsBusy)
+                return;
+
+            if (MainFlipView.SelectedIndex == MainFlipView.Items.Count - 1)
+            {
+                // We're on the last page.
+                var nextIndex = Source.Spine.IndexOf(_currentSpineItem) + 1;
+
+                if (nextIndex > Source.Spine.Count - 1)
+                    return;
+
+                if (!(MainFlipView.SelectedItem is FlipViewItem))
+                {
+                    // Tell the FlipView it can go further.
+                    MainFlipView.Items.Add(new FlipViewItem());
+                }
+
+                else
+                {
+                    // Load the next spine item.
+                    await LoadContentAsync(Source.Spine[nextIndex]);
+                }
+            }
+
+            else if (MainFlipView.SelectedIndex == 0)
+            {
+                // We're on the first page.
+                var previousIndex = Source.Spine.IndexOf(_currentSpineItem) - 1;
+
+                if (previousIndex < 0)
+                    return;
+
+                if (!(MainFlipView.SelectedItem is FlipViewItem))
+                {
+                    // Tell the FlipView it can go further.
+                    MainFlipView.Items.Insert(0, new FlipViewItem());
+                }
+
+                else
+                {
+                    // Load the previous spine item.
+                    await LoadContentAsync(Source.Spine[previousIndex]);
+
+                    MainFlipView.SelectedItem = MainFlipView.Items.LastOrDefault();
+                }
+            }
+        }
     }
 }


Compile error fix

Compile error fix

OnGameUpdate to OnUpdate

--- PastingSharp/PastingSharp/Program.cs
+++ PastingSharp/PastingSharp/Program.cs
@@ -28,7 +28,7 @@
             menu.AddToMainMenu();
             Game.PrintChat("PastingSharp loaded. Press P to paste.");

-            Game.OnGameUpdate += Game_OnGameUpdate;
+            Game.OnUpdate += Game_OnGameUpdate;
         }
         public static void Game_OnGameUpdate(EventArgs args)
         {


Revert "fixed null e's"

Revert "fixed null e's"

This reverts commit 3ef6d26db97dcdf2ed43ea1a47f9d27e356eecc9.

--- PastingSharp/PastingSharp/Program.cs
+++ PastingSharp/PastingSharp/Program.cs
@@ -9,18 +9,17 @@

 namespace PastingSharp
 {
-     class Program
+    public class Program
     {
-         static string contents = "";
-         static string[] linestoprint;
-         static Menu menu;
-         static int _lastPaste;
-         static void Main(string[] args)
+        public static string contents = "";
+        public static string[] linestoprint;
+        public static Menu menu;
+        public static void Main(string[] args)
         {
             CustomEvents.Game.OnGameLoad += Game_OnGameLoad;
         }

-         static void Game_OnGameLoad(EventArgs args)
+        public static void Game_OnGameLoad(EventArgs args)
         {

             menu = new Menu("PastingSharp", "pasting", true);
@@ -31,7 +30,7 @@

             Game.OnGameUpdate += Game_OnGameUpdate;
         }
-         static void Game_OnGameUpdate(EventArgs args)
+        public static void Game_OnGameUpdate(EventArgs args)
         {

             if (forms.Clipboard.ContainsText())
@@ -46,56 +45,23 @@

             if (menu.Item("paste").GetValue<KeyBind>().Active)
             {
-
+                if (linestoprint == null)
+                {
+                    Game.Say(contents);
+                }
+                else
+                {
+                    foreach (string s in linestoprint)
+                    {
+                        Game.Say(s);
+                    }
+                    var linestoprintsize = contents.Count();
+                    Array.Clear(linestoprint, 0, linestoprintsize);
+                }
                 var sleep = (menu.Item("sleep").GetValue<int>()) * 1000;
-                if (sleep == 0)
-                {
-                    if (linestoprint == null && contents != null)
-                    {
-                        Game.Say(contents);
-                        _lastPaste = Environment.TickCount;
-                    }
-                    else if (linestoprint != null)
-                    {
-                        foreach (string s in linestoprint)
-                        {
-                            Game.Say(s);
-                        }
-                        var linestoprintsize = contents.Count();
-                        Array.Clear(linestoprint, 0, linestoprintsize);
-                        _lastPaste = Environment.TickCount;
-                    }
-                    if (linestoprint == null && contents == null)
-                    {
-                        Game.PrintChat("Your clipboard is empty, are you sure you copied something?");
-                    }
-                }
                 if (sleep != 0)
                 {
-                    if (Environment.TickCount - _lastPaste > sleep || _lastPaste == 0)
-                    {
-                        if (linestoprint == null && contents != null)
-                        {
-                            Game.Say(contents);
-                            _lastPaste = Environment.TickCount;
-                        }
-                        else if (linestoprint != null)
-                        {
-                            foreach (string s in linestoprint)
-                            {
-                                Game.Say(s);
-                            }
-                            var linestoprintsize = contents.Count();
-                            Array.Clear(linestoprint, 0, linestoprintsize);
-                            _lastPaste = Environment.TickCount;
-                        }
-                        if (linestoprint == null && contents == null)
-                        {
-                            Game.PrintChat("Your clipboard is empty, are you sure you copied something?");
-                        }
-
-
-                    }
+                    System.Threading.Thread.Sleep(sleep);
                 }
             }


Renamed unknown-1 to list-icon-id, to match SpellInfo2.

--- PlayOnline.FFXI/IThings/SpellInfo.cs
+++ PlayOnline.FFXI/IThings/SpellInfo.cs
@@ -47,7 +47,7 @@
 	  "mp-cost",
 	  "casting-time",
 	  "recast-delay",
-	  "unknown-1",
+	  "list-icon-id",
 	  "japanese-name",
 	  "english-name",
 	  "japanese-description",
@@ -72,7 +72,7 @@
     private ushort?      RecastDelay_;
     private byte[]       LevelRequired_;
     private ushort?      ID_;
-    private byte?        Unknown1_;
+    private byte?        ListIconID_;
     private string       JapaneseName_;
     private string       EnglishName_;
     private string       JapaneseDescription_;
@@ -91,7 +91,7 @@
       this.RecastDelay_         = null;
       this.LevelRequired_       = null;
       this.ID_                  = null;
-      this.Unknown1_            = null;
+      this.ListIconID_          = null;
       this.JapaneseName_        = null;
       this.EnglishName_         = null;
       this.JapaneseDescription_ = null;
@@ -115,11 +115,11 @@
 	case "element":              return this.Element_.HasValue;
 	case "id":                   return this.ID_.HasValue;
 	case "index":                return this.Index_.HasValue;
+	case "list-icon-id":         return this.ListIconID_.HasValue;
 	case "magic-type":           return this.MagicType_.HasValue;
 	case "mp-cost":              return this.MPCost_.HasValue;
 	case "recast-delay":         return this.RecastDelay_.HasValue;
 	case "skill":                return this.Skill_.HasValue;
-	case "unknown-1":            return this.Unknown1_.HasValue;
 	case "valid-targets":        return this.ValidTargets_.HasValue;
 	default:                     return false;
       }
@@ -150,12 +150,11 @@
 	case "element":              return (!this.Element_.HasValue      ? String.Empty : String.Format("{0}", this.Element_.Value));
 	case "id":                   return (!this.ID_.HasValue           ? String.Empty : String.Format("{0:000}", this.ID_.Value));
 	case "index":                return (!this.ID_.HasValue           ? String.Empty : String.Format("{0:000}", this.Index_.Value));
+	case "list-icon-id":         return (!this.ListIconID_.HasValue   ? String.Empty : String.Format("{0}", this.ListIconID_.Value));
 	case "magic-type":           return (!this.MagicType_.HasValue    ? String.Empty : String.Format("{0}", this.MagicType_.Value));
 	case "mp-cost":              return (!this.MPCost_.HasValue       ? String.Empty : String.Format("{0}", this.MPCost_.Value));
 	case "skill":                return (!this.Skill_.HasValue        ? String.Empty : String.Format("{0}", this.Skill_.Value));
 	case "valid-targets":        return (!this.ValidTargets_.HasValue ? String.Empty : String.Format("{0}", this.ValidTargets_.Value));
-	// Nullables - Hex Values
-	case "unknown-1":            return (!this.Unknown1_.HasValue     ? String.Empty : String.Format("{0:X2} ({0})", this.Unknown1_.Value));
 	// Nullables - Time Values
 	case "casting-time":         return (!this.CastingTime_.HasValue  ? String.Empty : this.FormatTime(this.CastingTime_.Value / 4.0));
 	case "recast-delay":         return (!this.RecastDelay_.HasValue  ? String.Empty : this.FormatTime(this.RecastDelay_.Value / 4.0));
@@ -176,11 +175,11 @@
 	case "element":              return (!this.Element_.HasValue      ? null : (object) this.Element_.Value);
 	case "id":                   return (!this.ID_.HasValue           ? null : (object) this.ID_.Value);
 	case "index":                return (!this.Index_.HasValue        ? null : (object) this.Index_.Value);
+	case "list-icon-id":         return (!this.ListIconID_.HasValue   ? null : (object) this.ListIconID_.Value);
 	case "magic-type":           return (!this.MagicType_.HasValue    ? null : (object) this.MagicType_.Value);
 	case "mp-cost":              return (!this.MPCost_.HasValue       ? null : (object) this.MPCost_.Value);
 	case "recast-delay":         return (!this.RecastDelay_.HasValue  ? null : (object) this.RecastDelay_.Value);
 	case "skill":                return (!this.Skill_.HasValue        ? null : (object) this.Skill_.Value);
-	case "unknown-1":            return (!this.Unknown1_.HasValue     ? null : (object) this.Unknown1_.Value);
 	case "valid-targets":        return (!this.ValidTargets_.HasValue ? null : (object) this.ValidTargets_.Value);
 	default:                     return null;
       }
@@ -198,11 +197,11 @@
 	case "japanese-description": this.JapaneseDescription_ =               this.LoadTextField           (Node); break;
 	case "japanese-name":        this.JapaneseName_        =               this.LoadTextField           (Node); break;
 	case "level-required":       this.LevelRequired_       =               this.LoadByteArray           (Node); break;
+	case "list-icon-id":         this.ListIconID_          = (byte)        this.LoadUnsignedIntegerField(Node); break;
 	case "magic-type":           this.MagicType_           = (MagicType)   this.LoadHexField            (Node); break;
 	case "mp-cost":              this.MPCost_              = (ushort)      this.LoadUnsignedIntegerField(Node); break;
 	case "recast-delay":         this.RecastDelay_         = (ushort)      this.LoadUnsignedIntegerField(Node); break;
 	case "skill":                this.Skill_               = (Skill)       this.LoadHexField            (Node); break;
-	case "unknown-1":            this.Unknown1_            = (byte)        this.LoadUnsignedIntegerField(Node); break;
 	case "valid-targets":        this.ValidTargets_        = (ValidTarget) this.LoadHexField            (Node); break;
       }
     }
@@ -222,7 +221,7 @@
     // 00d-00d U8  Recast Delay (1/4 second)
     // 00e-025 U8  Level required (1 byte per job, 0xff if not learnable; first is for the NUL job, so always 0xff; only 24 slots despite 32 possible job flags)
     // 026-027 U16 ID (0 for "unused" spells; starts out equal to the index, but doesn't stay that way)
-    // 028-028 U8  Unknown
+    // 028-028 U8  List Icon ID (not sure what this is an index of, but it seems to match differences in item icon)
     // 029-03c CHR Japanese Name (20 bytes)
     // 03d-051 CHR English Name (20 bytes)
     // 052-0d1 CHR Japanese Description (128 bytes)
@@ -249,7 +248,7 @@
       this.RecastDelay_   = BR.ReadByte();
       this.LevelRequired_ = BR.ReadBytes(24);
       this.ID_            = BR.ReadUInt16();
-      this.Unknown1_      = BR.ReadByte();
+      this.ListIconID_    = BR.ReadByte();
       FFXIEncoding E = new FFXIEncoding();
       this.JapaneseName_        = E.GetString(BR.ReadBytes( 20)).TrimEnd('\0');
       this.EnglishName_         = E.GetString(BR.ReadBytes( 20)).TrimEnd('\0');