make _nestDepth private, as it is basically an implementation detail.. who would REALLY ever need to change this??

--- MarkdownSharp/Markdown.cs
+++ MarkdownSharp/Markdown.cs
@@ -113,7 +113,8 @@

         /// <summary>
         /// Tabs are automatically converted to spaces as part of the transform
-        /// this variable determines how "wide" those tabs become in spaces
+        /// this variable determines how "wide" those tabs become in spaces
+        /// WARNING: this configuration option does NOT work yet!
         /// </summary>
         public static int TabWidth
         {
@@ -121,16 +122,6 @@
             set { _tabWidth = value; }
         }
         private static int _tabWidth = 4;
-
-        /// <summary>
-        /// maximum nested depth of [] and () supported by the transform
-        /// </summary>
-        public static int NestingDepth
-        {
-            get { return _nestDepth; }
-            set { _nestDepth = value; }
-        }
-        private static int _nestDepth = 6;

         /// <summary>
         /// when false, email addresses will never be auto-linked
@@ -201,6 +192,11 @@
             public TokenType Type;
             public string Value;
         }
+
+        /// <summary>
+        /// maximum nested depth of [] and () supported by the transform; implementation detail
+        /// </summary>
+        private static int _nestDepth = 6;

         private const string _markerUL = @"[*+-]";
         private const string _markerOL = @"\d+[.]";


Default allowing gamepads as hotkeys to true

--- LiveSplit/LiveSplit.Core/Options/SettingsFactories/StandardSettingsFactory.cs
+++ LiveSplit/LiveSplit.Core/Options/SettingsFactories/StandardSettingsFactory.cs
@@ -30,6 +30,7 @@
                             GlobalHotkeysEnabled = false,
                             DeactivateHotkeysForOtherPrograms = false,
                             DoubleTapPrevention = true,
+                            AllowGamepadsAsHotkeys = true,
                             HotkeyDelay = 0f
                         }
                     }


MeidoCommon: Some cosmetic changes

MeidoCommon: Some cosmetic changes

--- MeidoCommon/XmlConfig2.cs
+++ MeidoCommon/XmlConfig2.cs
@@ -8,7 +8,7 @@
 {
     public class XmlConfig2<T>
     {
-        public delegate T XmlParser(XElement root);
+        public delegate T XmlParser(XElement xml);

         readonly XElement defaultConfig;
         readonly XmlParser parser;
@@ -41,7 +41,7 @@
         }

-        public void ReadConfig(string path)
+        public void LoadConfig(string path)
         {
             if (path == null)
                 throw new ArgumentNullException(nameof(path));


Small cleanups.

Small cleanups.

--- NtApiDotNet/Win32/Security/Authentication/Kerberos/Ndr/PacDeviceInfoParser.cs
+++ NtApiDotNet/Win32/Security/Authentication/Kerberos/Ndr/PacDeviceInfoParser.cs
@@ -30,6 +30,8 @@

 using NtApiDotNet.Ndr.Marshal;

+using NtApiDotNet.Win32.Rpc;
+
 using System.Linq;

@@ -374,7 +376,7 @@

             m.Write_2(IdentifierAuthority);

-            m.Write_9(NtApiDotNet.Win32.Rpc.RpcUtils.CheckNull(SubAuthority, "SubAuthority"), SubAuthorityCount);
+            m.Write_9(RpcUtils.CheckNull(SubAuthority, "SubAuthority"), SubAuthorityCount);

         }

@@ -452,7 +454,7 @@

         {

-            m.Write_10(NtApiDotNet.Win32.Rpc.RpcUtils.CheckNull(Value, "Value"));
+            m.Write_10(RpcUtils.CheckNull(Value, "Value"));

         }


Fix error with merge on TModLoader GameState.

--- Project-Aurora/Project-Aurora/Profiles/TModLoader/GSI/GameState_TModLoader.cs
+++ Project-Aurora/Project-Aurora/Profiles/TModLoader/GSI/GameState_TModLoader.cs
@@ -8,7 +8,7 @@
 using System.Threading.Tasks;

 namespace Aurora.Profiles.TModLoader.GSI {
-    public class GameState_TModLoader : GameState<GameState_TModLoader> {
+    public class GameState_TModLoader : GameState {
         public ProviderNode Provider => NodeFor<ProviderNode>("provider");

         public WorldNode World => NodeFor<WorldNode>("world");


Tweaked the Facebook WP7 hack where buttons are off screen (now no longer needs any intervention from end-developer)

--- Samples/Phone/WP7/CS/WP7/Facebook.Samples.AuthenticationTool/MainPage.xaml.cs
+++ Samples/Phone/WP7/CS/WP7/Facebook.Samples.AuthenticationTool/MainPage.xaml.cs
@@ -18,10 +18,7 @@
     public partial class MainPage : PhoneApplicationPage
     {
         private const string apiKey = "Your Application ID goes here";
-        private string requestedFbPermissions = "user_about_me"; //"email,user_likes,user_checkins,publish_checkins"; //etc.
-
-        // Manual step: you need to look at the number of permissions you require and see how the allow dialog looks in the emulate and adjust this accordingly
-        private string allowButtonPosition = "250px"; // Facebook will eventually fix their HTML and resolve this issue
+        private string requestedFbPermissions = "user_about_me,"; //email,user_likes,user_checkins"; //"email,user_likes,user_checkins,publish_checkins"; //etc

         private string accessToken;

@@ -69,8 +66,8 @@
             try
             {
                 // HACK: Giant flaming hack to resolve an issue with Facebook's HTML in the allow screen
-                // You need to adjust this accordingly
-                FacebookLoginBrowser.InvokeScript("eval", string.Format("document.getElementById('platform_dialog_bottom_bar').style.top=\"{0}\"", allowButtonPosition));
+                // Eventually this will be unneeded, but for now it should resolve the issue and won't hurt things in the future
+                FacebookLoginBrowser.InvokeScript("eval", "(function() { var aboveFooter=document.getElementById('platform_dialog_bottom_bar').previousSibling; document.getElementById('platform_dialog_bottom_bar').style.top=aboveFooter.offsetHeight + aboveFooter.offsetTop + 'px' })()");
             }
             catch (Exception ex) { }
         }


Extend command to handle scripting from currently selected grid cell

--- SSMScripter/Commands/ScriptCommand.cs
+++ SSMScripter/Commands/ScriptCommand.cs
@@ -31,10 +31,8 @@
         public void Bind()
         {
             var commandBars = (CommandBars)_context.Application.CommandBars;
-            CommandBar commandBar = commandBars["SQL Files Editor Context"];
             var commands = (Commands2)_context.Application.Commands;
             object[] guids = null;
-

             Command command = commands.AddNamedCommand2(
                 _context.AddIn,
@@ -47,10 +45,14 @@
                 (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled,
                 (int)vsCommandStyle.vsCommandStylePictAndText,
                 vsCommandControlType.vsCommandControlTypeButton);
-
-            command.Bindings = new object[] { "Global::F12" };

-            command.AddControl(commandBar);
+            command.Bindings = new object[] { "SQL Query Editor::F12" };
+
+            CommandBar resultGridCommandBar = commandBars["SQL Results Grid Tab Context"];
+            command.AddControl(resultGridCommandBar);
+
+            CommandBar sqlEditorCommandBar = commandBars["SQL Files Editor Context"];
+            command.AddControl(sqlEditorCommandBar);
         }

@@ -58,26 +60,23 @@
         public string Execute()
         {
             Editor editor = _context.GetCurrentEditor();
-            EditedLine line = editor.GetEditedLine();
-
-            ScripterParserInput parserInput = new ScripterParserInput
-            {
-                ContentLine = line.Line,
-                Index = line.CaretPos
-            };

+            ScripterParserInput parserInput = null;
             ScripterParserResult parserResult = null;
-
+
+            if (!TryGetParserInput(editor, out parserInput))
+                return "Cannot find any input";
+
             if (!_parser.TryParse(parserInput, out parserResult))
                 return parserResult.Error;

             var scripterInput = new ScripterInput()
             {
                 Schema = parserResult.Schema,
-                Name = parserResult.Name,
+                Name = parserResult.Name,
             };

-            ScripterResult scripterResult = null;
+            ScripterResult scripterResult = null;

             if (!_scripter.TryScript(scripterInput, out scripterResult))
                 return scripterResult.Error;
@@ -87,5 +86,35 @@

             return "Success";
         }
+
+
+        private bool TryGetParserInput(Editor editor, out ScripterParserInput input)
+        {
+            input = null;
+
+            string value = String.Empty;
+            int caret = 0;
+
+            ResultGrid grid = editor.GetFocusedResultGrid();
+
+            if (grid != null)
+            {
+                value = grid.GetSelectedValue();
+                caret = 0;
+            }
+            else
+            {
+                EditedLine line = editor.GetEditedLine();
+                value = line.Line;
+                caret = line.CaretPos;
+            }
+
+            input = new ScripterParserInput()
+            {
+                ContentLine = value, Index = caret
+            };
+
+            return true;
+        }
     }
 }


Bumped the version no.

Bumped the version no.

--- SceneQuery/Properties/AssemblyInfo.cs
+++ SceneQuery/Properties/AssemblyInfo.cs
@@ -32,5 +32,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.0.4.0")]
-[assembly: AssemblyFileVersion("1.0.4.0")]
+[assembly: AssemblyVersion("1.0.5.0")]
+[assembly: AssemblyFileVersion("1.0.5.0")]


InstandePortLists draw element include children

--- Scripts/Editor/NodeEditorGUILayout.cs
+++ Scripts/Editor/NodeEditorGUILayout.cs
@@ -303,7 +303,7 @@
                             return;
                         }
                         SerializedProperty itemData = arrayData.GetArrayElementAtIndex(index);
-                        EditorGUI.PropertyField(rect, itemData);
+                        EditorGUI.PropertyField(rect, itemData, true);
                     } else EditorGUI.LabelField(rect, port.fieldName);
                     Vector2 pos = rect.position + (port.IsOutput?new Vector2(rect.width + 6, 0) : new Vector2(-36, 0));
                     NodeEditorGUILayout.PortField(pos, port);


looping tidied

looping tidied

So I lost a bit of my progress due to being a goof, just as a headsup,
but at least it loops neatly now!

--- Scripts/Metronome/SimpleBeatScript.cs
+++ Scripts/Metronome/SimpleBeatScript.cs
@@ -8,7 +8,11 @@
 	[Range(1,4)]
 	public int onBeat = 2; // every onBeat beats, play a note
 	public bool isPlayingFully = false;
+	[Range(0f,1f)]
+	public float loopTransitionTime; // if a beat occurs this many seconds before the end
+										// of the clip, don't wait for the clip to end--restart it
 	int beatCount = 0; // how many beats have we listened to?
+	int measureCount = 0;
 	bool pause = false;
 	AudioSource source;

@@ -31,8 +35,10 @@

 	void Play(int beat) {
 		if (isPlayingFully && source.isPlaying) {
+			if (source.time > source.clip.length - loopTransitionTime)
+				source.Play ();
 		} else {
-			if (beatCount % onBeat == 0) {
+			if (beat % onBeat == 0) {
 				if (source.isPlaying) { // we'll be a little more sophisticated than this, I promise.
 					source.Stop ();
 				}
@@ -41,7 +47,11 @@
 					colourise ();
 				}
 			}
-			beatCount++;
+			beat++;
+		}
+		beatCount++;
+		if (beatCount > 4) {
+			measureCount++;
 		}
 	}


Improve AppModel

Improve AppModel

--- PlanetClock/PlanetClock/AppModel.cs
+++ PlanetClock/PlanetClock/AppModel.cs
@@ -9,24 +9,34 @@
     public class AppModel
     {
         public IObservable<DateTime> JustMinutesArrived { get; private set; }
+        public IObservableGetProperty<DateTime> JustMinutes { get; private set; }
+
         public IObservableGetProperty<int> Hour { get; private set; }
         public IObservableGetProperty<int> Minute { get; private set; }

         public AppModel()
         {
-            JustMinutesArrived = new PeriodicTimer2(TimeSpan.FromMinutes(1), GetNextJustTime);
+            var initialTime = DateTime.Now;
+
+            JustMinutesArrived = new PeriodicTimer2(TimeSpan.FromMinutes(1), () => GetNextJustTime(initialTime));
+            JustMinutes = JustMinutesArrived.ToGetProperty(GetJustTime(initialTime));
+
             Hour = JustMinutesArrived
                 .Map(dt => dt.Hour)
-                .ToGetProperty(DateTime.Now.Hour);
+                .ToGetProperty(initialTime.Hour);
             Minute = JustMinutesArrived
                 .Map(dt => dt.Minute)
-                .ToGetProperty(DateTime.Now.Minute);
+                .ToGetProperty(initialTime.Minute);
         }

-        static DateTime GetNextJustTime()
+        static DateTime GetJustTime(DateTime dt)
         {
-            var n = DateTime.Now.AddMinutes(1);
-            return new DateTime(n.Year, n.Month, n.Day, n.Hour, n.Minute, 0);
+            return new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0);
+        }
+
+        static DateTime GetNextJustTime(DateTime dt)
+        {
+            return GetJustTime(dt.AddMinutes(1));
         }
     }
 }


This instead?

This instead?

--- PolarisServer/Database/PolarisEF.cs
+++ PolarisServer/Database/PolarisEF.cs
@@ -7,6 +7,7 @@
 using PolarisServer.Models;
 using System.ComponentModel.DataAnnotations.Schema;
 using System.Data.Entity.Infrastructure;
+using System.ComponentModel;

 namespace PolarisServer.Database
 {
@@ -21,7 +22,7 @@

     public class Player
     {
-        [Key, Range(10000000, UInt32.MaxValue)]
+        [Key, DefaultValue(10000000)]
         public int PlayerID { get; set; }

         public string Username { get; set; }


Full tree with position and names

Full tree with position and names

--- ProgramingStudy/Job/PZLStructure.cs
+++ ProgramingStudy/Job/PZLStructure.cs
@@ -7,59 +7,44 @@

 namespace ProgramingStudy.Job
 {
-
+    public class Employee
+    {
+        public string Id { get; set; }
+        public string Name { get; set; }
+        public string BossId { get; set; }
+        public string Position { get; set; }
+        public string OrganizationUnit { get; set; }
+
+    }
+
     public class PZLStructure : IStudyTest
     {
-
-
-
-        public class Emp
-        {
-            public string Id { get; set; }
-            public string Name { get; set; }
-            public string Boss_Id { get; set; }
-            public string Stanowsiko { get; set; }
-            public string JOrg { get; set; }
-
-        }
         public void Study()
         {
-            var empList = File.ReadAllLines("BeeOffice_11.09_h.csv").Skip(1).Select(s =>
-            {
-                var row = s.Split(new[] { ";" }, StringSplitOptions.None);
+            var employeesList = GetEmployeesFromFile("BeeOffice_11.09_h.csv");

-                return new Emp
-                {
-                    Id = row[6],
-                    Name = row[0] + " " + row[1],
-                    Boss_Id = row[3],
-                    Stanowsiko = row[2],
-                    JOrg = row[4]
-                };
-            });
+            var allStringEmployees = new List<List<Employee>>();
+            var errorList = new List<List<Employee>>();
+            var notEmp = new List<List<Employee>>();
+            var notJOrg = new List<List<Employee>>();

-            var list = new List<List<Emp>>();
-            var errorList = new List<List<Emp>>();
-            var notEmp = new List<List<Emp>>();
-            var notJOrg = new List<List<Emp>>();
-
-            foreach (var item in empList)
+            foreach (var employee in employeesList)
             {
                 var hasError = false;

-                var train = new List<Emp>
+                var train = new List<Employee>
                 {
-                    item
+                    employee
                 };

-                var whileEmp = item;
-
+                var currentEmployee = employee;

-                while (string.IsNullOrEmpty(whileEmp.Boss_Id) == false)
+
+                while (string.IsNullOrEmpty(currentEmployee.BossId) == false)
                 {
-                    var boss = empList.FirstOrDefault(e => e.Id == whileEmp.Boss_Id);
+                    var boss = employeesList.FirstOrDefault(e => e.Id == currentEmployee.BossId);

-                     if (whileEmp.Boss_Id == whileEmp.Id)
+                    if (currentEmployee.BossId == currentEmployee.Id)
                     {
                         errorList.Add(train);
                         //hasError = true;
@@ -73,81 +58,102 @@
                         break;
                     }

-                    if (string.IsNullOrEmpty(item.JOrg))
+                    if (string.IsNullOrEmpty(employee.OrganizationUnit))
                     {
                         notJOrg.Add(train);
                         hasError = true;
                         break;
                     }

-                    if (boss != null && whileEmp.Boss_Id != whileEmp.Id)
+                    if (boss != null && currentEmployee.BossId != currentEmployee.Id)
                     {
                         train.Add(boss);
                     }

-
+                    currentEmployee = boss;
+                }

-                    whileEmp = boss;
-                }
                 if (hasError == false)
                 {
-                    list.Add(train);
+                    allStringEmployees.Add(train);
                 }
-
-            }
-
-            var root = new TreeNode("Zarząd");
-            var tempRoot = root;
-
-
-
-            foreach (var train in list)
-            {
-                train.Reverse();
-
-
-
-
-                foreach (var item in train)
-                {
-
-                    var g = root.Find(item.JOrg);
-
-                    if (g==null)
-                    {
-                        var newroot = new TreeNode(item.JOrg);
-                        tempRoot.Add(newroot);
-                        tempRoot = newroot;
-                    }
-                    else
-                    {
-
-                    }
-
-
-                }
-
-
-
-
-
-                tempRoot = root;
-

             }

-            foreach (var item in empList)
+            TreeNode tree = GenerateTreeNodes(employeesList, allStringEmployees);
+
+            ShowAllTree(tree);
+        }
+
+        private TreeNode GenerateTreeNodes(IEnumerable<Employee> employeesList, List<List<Employee>> allStringEmployees)
+        {
+            var rootNode = new TreeNode("Zarząd");
+            var tempNode = rootNode;
+
+            foreach (var employeesString in allStringEmployees)
             {
-                var node = root.Find(item.JOrg);
+                AddOrganizationUnit(rootNode, tempNode, employeesString);
+            }

-                if (node.Find(item.Stanowsiko) == null)
+            AddPositions(rootNode, employeesList);
+            return rootNode;
+        }
+
+        private IEnumerable<Employee> GetEmployeesFromFile(string fileName) =>
+
+            File.ReadAllLines(fileName).Skip(1).Select(s =>
+            {
+                var row = s.Split(new[] { ";" }, StringSplitOptions.None);
+
+                return new Employee
                 {
-                    node.Add(new TreeNode(item.Stanowsiko));
+                    Id = row[6],
+                    Name = row[0] + " " + row[1],
+                    BossId = row[3],
+                    Position = row[2],
+                    OrganizationUnit = row[4]
+                };
+            });
+
+
+        private void AddOrganizationUnit(TreeNode rootNode, TreeNode tempNode, List<Employee> employeesString)
+        {
+            employeesString.Reverse();
+
+            foreach (var employee in employeesString)
+            {
+                if (rootNode.Find(employee.OrganizationUnit) == null)
+                {
+                    var newroot = new TreeNode(employee.OrganizationUnit);
+                    tempNode.Add(newroot);
+                    tempNode = newroot;
                 }
+            }

+            tempNode = rootNode;
+        }
+
+        private void AddPositions(TreeNode rootNode, IEnumerable<Employee> employeesList)
+        {
+            foreach (var employee in employeesList)
+            {
+                var node = rootNode.Find(employee.OrganizationUnit);
+
+                if (node.Find(employee.Position) == null)
+                {
+                    var positionNode = new TreeNode(employee.Position);
+
+                    node.Add(positionNode);
+
+                    positionNode.Add(new TreeNode(employee.Name));
+
+                }
             }
-                Console.WriteLine(TreeNode.BuildString(root));
+        }

+        private void ShowAllTree(TreeNode rootNode)
+        {
+           File.WriteAllText("tree.txt", TreeNode.BuildString(rootNode));
         }
     }
 }


Refactored to improve readability

Refactored to improve readability

--- NET/API/Treehopper/Spi.cs
+++ NET/API/Treehopper/Spi.cs
@@ -275,18 +275,18 @@
                 }

                 // no need to wait if we're not reading anything
-                if (mode == BurstMode.BurstTx)
-                    return returnedData;
-
-                bytesRemaining = transactionLength;
-                srcIndex = 0;
-                while (bytesRemaining > 0)
-                {
-                    int numBytesToTransfer = bytesRemaining > 64 ? 64 : bytesRemaining;
-                    receivedData = await device.receiveCommsResponsePacket((uint)numBytesToTransfer);
-                    Array.Copy(receivedData, 0, returnedData, srcIndex, receivedData.Length); // just in case we don't get what we're expecting
-                    srcIndex += numBytesToTransfer;
-                    bytesRemaining -= numBytesToTransfer;
+                if (mode != BurstMode.BurstTx)
+                {
+                    bytesRemaining = transactionLength;
+                    srcIndex = 0;
+                    while (bytesRemaining > 0)
+                    {
+                        int numBytesToTransfer = bytesRemaining > 64 ? 64 : bytesRemaining;
+                        receivedData = await device.receiveCommsResponsePacket((uint)numBytesToTransfer);
+                        Array.Copy(receivedData, 0, returnedData, srcIndex, receivedData.Length); // just in case we don't get what we're expecting
+                        srcIndex += numBytesToTransfer;
+                        bytesRemaining -= numBytesToTransfer;
+                    }
                 }
             }


do not allow saving if edit wasn't completed yet


rename tables

rename tables

--- QBitNinja/QBitNinjaConfiguration.cs
+++ QBitNinja/QBitNinjaConfiguration.cs
@@ -66,7 +66,7 @@

         public CloudTable GetCallbackTable()
         {
-            return Indexer.GetTable("rapidcallbacks");
+            return Indexer.GetTable("callbacks");
         }

         private CloudTable GetCrudTable()
@@ -76,7 +76,7 @@

         private CloudTable GetChainCacheCloudTable()
         {
-            return Indexer.GetTable("rapidchainchache");
+            return Indexer.GetTable("chainchache");
         }


Deleted one line

Deleted one line

--- RTSGame/RTSEngine/Data/Collision.cs
+++ RTSGame/RTSEngine/Data/Collision.cs
@@ -147,7 +147,6 @@
                 if (dx <= rect.width / 2 ||
                     dy <= rect.height / 2 ||
                     cornerDistSqr <= circle.radius * circle.radius) {
-                    Vector2 dir = rect.Center - circle.Center;
                     // Create a collision boundary around the rectangle, in which collision occurs
                     float top = rect.Center.Y + rect.height / 2 + circle.radius;
                     float bottom = rect.Center.Y - rect.height / 2 - circle.radius;


Fixed multipart/form-data issues

Fixed multipart/form-data issues

--- RedditSharp/MultipartFormBuilder.cs
+++ RedditSharp/MultipartFormBuilder.cs
@@ -51,14 +51,14 @@
         public void AddString(string name, string value)
         {
             TextBuffer.Write("{0}\r\nContent-Disposition: form-data; name=\"{1}\"\r\n\r\n{2}\r\n",
-                Boundary, name, value);
+                "--" + Boundary, name, value);
             TextBuffer.Flush();
         }

         public void AddFile(string name, string filename, byte[] value, string contentType)
         {
             TextBuffer.Write("{0}\r\nContent-Disposition: form-data; name=\"{1}\"; filename=\"{2}\"\r\nContent-Type: {3}\r\n\r\n",
-                Boundary, name, filename, contentType);
+                "--" + Boundary, name, filename, contentType);
             TextBuffer.Flush();
             Buffer.Write(value, 0, value.Length);
             Buffer.Flush();
@@ -68,7 +68,7 @@

         public void Finish()
         {
-            TextBuffer.Write(Boundary + "--");
+            TextBuffer.Write("--" + Boundary + "--");
             TextBuffer.Flush();
             var stream = Request.GetRequestStream();
             Buffer.Seek(0, SeekOrigin.Begin);


Replaced all the "libjasper.dylib" strings with a single const string

git-svn-id: baf6e02d125cf6f9bfcfe153b2eb83d6e1f5ace6@337 52acb1d6-8a22-11de-b505-999d5b087335

--- applications/JasperWrapper/JasperWrapper.cs
+++ applications/JasperWrapper/JasperWrapper.cs
@@ -81,20 +81,22 @@

 /* jas_stream_t and jas_image_t are opaque types, therefore we may save ourselves
    a lot of effort by just keeping them as IntPtrs in the functions below. */
-class JasperWrapper {
-	[DllImport("libjasper.dylib")]
-	private static extern int jas_init();
-
-	[DllImport("libjasper.dylib")]
-	private static extern IntPtr jas_getversion();
-
-	[DllImport("libjasper.dylib")]
-	private static extern int jas_setdbglevel(int level);
-
-	[DllImport("libjasper.dylib")]
-	private static extern IntPtr jas_stream_fopen(string filename, string mode);
-
-	[DllImport("libjasper.dylib")]
+class JasperWrapper {
+    const string JASPER_LIBRARY = "libjasper.dll";
+
+    [DllImport(JASPER_LIBRARY)]
+	private static extern int jas_init();
+
+    [DllImport(JASPER_LIBRARY)]
+	private static extern IntPtr jas_getversion();
+
+    [DllImport(JASPER_LIBRARY)]
+	private static extern int jas_setdbglevel(int level);
+
+    [DllImport(JASPER_LIBRARY)]
+	private static extern IntPtr jas_stream_fopen(string filename, string mode);
+
+    [DllImport(JASPER_LIBRARY)]
 	private static extern IntPtr jas_stream_memopen(IntPtr buf, int bufsize);

 	public static IntPtr jas_stream_memopen(byte[] buf) {
@@ -102,29 +104,29 @@
 		Marshal.Copy(buf,0,bufPtr,buf.Length);

 		return jas_stream_memopen(bufPtr, buf.Length);
-	}
-
-	[DllImport("libjasper.dylib")]
-	private static extern int jas_stream_flush(IntPtr stream);
-
-	[DllImport("libjasper.dylib")]
-	private static extern int jas_stream_close(IntPtr stream);
-
-	[DllImport("libjasper.dylib")]
-	private static extern int jas_image_getfmt(IntPtr stream);
-
-	[DllImport("libjasper.dylib")]
-	private static extern int jas_image_fmtfromname(string filename);
-
-	[DllImport("libjasper.dylib")]
+	}
+
+    [DllImport(JASPER_LIBRARY)]
+	private static extern int jas_stream_flush(IntPtr stream);
+
+    [DllImport(JASPER_LIBRARY)]
+	private static extern int jas_stream_close(IntPtr stream);
+
+    [DllImport(JASPER_LIBRARY)]
+	private static extern int jas_image_getfmt(IntPtr stream);
+
+    [DllImport(JASPER_LIBRARY)]
+	private static extern int jas_image_fmtfromname(string filename);
+
+    [DllImport(JASPER_LIBRARY)]
 	private static extern int jas_image_encode(IntPtr image,
-							IntPtr out_stream, int fmt, string optstr);
-
-    [DllImport("libjasper.dylib")]
+							IntPtr out_stream, int fmt, string optstr);
+
+    [DllImport(JASPER_LIBRARY)]
 	private static extern IntPtr jas_image_decode(IntPtr in_stream, int fmt,
-														string optstr);
-
-    [DllImport("libjasper.dylib")]
+														string optstr);
+
+    [DllImport(JASPER_LIBRARY)]
 	private static extern IntPtr jas_image_destroy(IntPtr image_ptr);

 	private static int jas_image_cmpttype(jas_image_t image, int cmptno) {
@@ -132,10 +134,10 @@
 			(jas_image_cmpt_t)Marshal.PtrToStructure(Marshal.ReadIntPtr(image.cmpts, cmptno*4),
 													 typeof(jas_image_cmpt_t));
 		return cmpt.type;
-	}
-
-
-    [DllImport("libjasper.dylib")]
+	}
+
+
+    [DllImport(JASPER_LIBRARY)]
 	public static extern int jas_image_readcmpt(IntPtr image_ptr, int cmptno,
 		  int x, int y, int width, int height, IntPtr data);

@@ -144,9 +146,9 @@
 		string text = Marshal.PtrToStringAuto(jas_getversion());
 		if(text==null) throw new Exception("jas_getversion returned NULL\n");
 		return text;
-	}
-
-    [DllImport("libjasper.dylib")]
+	}
+
+    [DllImport(JASPER_LIBRARY)]
 	public static extern IntPtr jas_matrix_create(int width, int height);


xvm patching method is deprecated

xvm patching method is deprecated

--- RelicModManager/Utils/PatchUtils.cs
+++ RelicModManager/Utils/PatchUtils.cs
@@ -837,7 +837,8 @@
             toWrite = toWrite.Replace(@"""[dollar]", @"$").Replace(@"[lbracket]", @"{").Replace(@"[quote]", @"""").Replace(@"[colon]",@":").Replace(@"[rbracket]""", @"}");
             File.WriteAllText(p.completePath, toWrite);
         }
-
+        #region old patching system to be replaced
+        //generic version of xvm patch (without bootfile)?
         public static void PMODPatch(Patch p, bool testMods = false, string testXVMBootLoc = "")
         {
             NumByteReads = 0;
@@ -861,7 +862,7 @@
             NumByteReads = 0;
             ReadInside(pathArray, p.completePath, p.replace, p.search, p.mode, p.path);
         }
-
+        //xvm version of xvm patch
         public static void XVMPatch(Patch p, bool testMods = false, string testXVMBootLoc = "")
         {
             NumByteReads = 0;
@@ -1528,6 +1529,7 @@
             }
             return temp;
         }
+        #endregion
         //returns the folder(s) to get to the xvm config folder directory
         public static string GetXVMBootLoc(string tanksLocation, string customBootFileLoc = null, bool writeToLog = true)
         {


Fit: more direct and slightly faster implementation; add MultiDim

--- src/Numerics/Fit.cs
+++ src/Numerics/Fit.cs
@@ -62,12 +62,31 @@
         }

         /// <summary>
+        /// Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) to a linear surface y : X -> p0*x0 + p1*x1 + ... + pk*xk,
+        /// returning its best fitting parameters as [p0, p1, p2, ..., pk] array.
+        /// </summary>
+        public static double[] MultiDim(double[][] x, double[] y)
+        {
+            return MultipleRegression.NormalEquations(x, y);
+        }
+
+        /// <summary>
+        /// Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) to a linear surface y : X -> p0*x0 + p1*x1 + ... + pk*xk,
+        /// returning a function y' for the best fitting combination.
+        /// </summary>
+        public static Func<double[], double> MultiDimFunc(double[][] x, double[] y)
+        {
+            var parameters = MultipleRegression.NormalEquations(x, y);
+            return z => Control.LinearAlgebraProvider.DotProduct(parameters, z);
+        }
+
+        /// <summary>
         /// Least-Squares fitting the points (x,y) to a k-order polynomial y : x -> p0 + p1*x + p2*x^2 + ... + pk*x^k,
         /// returning its best fitting parameters as [p0, p1, p2, ..., pk] array, compatible with Evaluate.Polynomial.
         /// </summary>
         public static double[] Polynomial(double[] x, double[] y, int order)
         {
-            var design = Matrix<double>.Build.DenseOfColumns(x.Length, order + 1, Enumerable.Range(0, order + 1).Select(j => x.Select(xi => Math.Pow(xi, j))));
+            var design = Matrix<double>.Build.Dense(x.Length, order + 1, (i, j) => Math.Pow(x[i], j));
             return MultipleRegression.QR(design, Vector<double>.Build.Dense(y)).ToArray();
         }

@@ -87,7 +106,7 @@
         /// </summary>
         public static double[] LinearCombination(double[] x, double[] y, params Func<double,double>[] functions)
         {
-            var design = Matrix<double>.Build.DenseOfColumns(x.Length, functions.Length, functions.Select(f => x.Select(xi => f(xi))));
+            var design = Matrix<double>.Build.Dense(x.Length, functions.Length, (i, j) => functions[j](x[i]));
             return MultipleRegression.QR(design, Vector<double>.Build.Dense(y)).ToArray();
         }

@@ -107,7 +126,7 @@
         /// </summary>
         public static double[] LinearMultiDim(double[][] x, double[] y, params Func<double[], double>[] functions)
         {
-            var design = Matrix<double>.Build.DenseOfRows(x.Select(xi => functions.Select(f => f(xi))));
+            var design = Matrix<double>.Build.Dense(x.Length, functions.Length, (i, j) => functions[j](x[i]));
             return MultipleRegression.QR(design, Vector<double>.Build.Dense(y)).ToArray();
         }

@@ -127,7 +146,7 @@
         /// </summary>
         public static double[] LinearGeneric<T>(T[] x, double[] y, params Func<T, double>[] functions)
         {
-            var design = Matrix<double>.Build.DenseOfRows(x.Select(xi => functions.Select(f => f(xi))));
+            var design = Matrix<double>.Build.Dense(x.Length, functions.Length, (i, j) => functions[j](x[i]));
             return MultipleRegression.QR(design, Vector<double>.Build.Dense(y)).ToArray();
         }


minor

minor

--- staging/api/Parts/SendMail.cs
+++ staging/api/Parts/SendMail.cs
@@ -15,27 +15,20 @@
     var workflow = AsList(App.Data["Workflow"]).Where(w => w.WorkflowId == workflowId).FirstOrDefault();

     // rewrite the keys to be a nicer format, based on the configuration
-    var valuesWithMailLabels = RewriteKeys(contactFormRequest, workflow.MailLabels ?? "");
+    var valuesRelabled = RewriteKeys(contactFormRequest, workflow.MailLabels ?? "");

     // assemble all settings to send the mail
-    // background: some settings are made in this module,
-    // but if they are missing we use fallback settings
-    // which are taken from the Settings
-    var settings = new
-    {
-      MailFrom = !String.IsNullOrEmpty(Content.MailFrom) ? Content.MailFrom : Settings.DefaultMailFrom,
-      OwnerMail = !String.IsNullOrEmpty(Content.OwnerMail) ? Content.OwnerMail : Settings.DefaultOwnerMail
-    };
+    // background: some settings are made in this module, but if they are missing we use fallback settings
+    var from = Text.Has(Content.MailFrom) ? Content.MailFrom : Settings.DefaultMailFrom;
+    var owner = Text.Has(Content.OwnerMail) ? Content.OwnerMail : Settings.DefaultOwnerMail;

     // Send Mail to owner
-    if (Content.OwnerSend != null && Content.OwnerSend)
+    if (Content.OwnerSend == true)
     {
       Log.Add("Send Mail to Owner");
       try
       {
-        Send(
-          workflow.OwnerMailTemplate, valuesWithMailLabels, settings.MailFrom, settings.OwnerMail, Content.OwnerMailCC, custMail, files
-        );
+        Send(workflow.OwnerMailTemplate, valuesRelabled, from, owner, Content.OwnerMailCC, custMail, files);
       }
       catch (Exception ex)
       {
@@ -44,14 +37,12 @@
     }

     // Send Mail to customer
-    if (Content.CustomerSend != null && Content.CustomerSend && !String.IsNullOrEmpty(custMail))
+    if (Content.CustomerSend == true && Text.Has(custMail))
     {
       Log.Add("Send Mail to Customer");
       try
       {
-        Send(
-          workflow.CustomerMailTemplate, valuesWithMailLabels, settings.MailFrom, custMail, Content.CustomerMailCC, settings.OwnerMail, files
-        );
+        Send(workflow.CustomerMailTemplate, valuesRelabled, from, custMail, Content.CustomerMailCC, owner, files);
       }
       catch (Exception ex)
       {
@@ -60,48 +51,33 @@
     }
   }

-  public void Send(
-    string emailTemplateFilename,
-    Dictionary<string, object> valuesWithMailLabels,
-    string MailFrom,
-    string MailTo,
-    string MailCC,
-    string MailReply,
-    List<ToSic.Sxc.Adam.IFile> files)
+  public void Send(string emailTemplateFilename, Dictionary<string, object> valuesWithMailLabels,
+    string from, string to, string cc, string replyTo, List<ToSic.Sxc.Adam.IFile> files)
   {
     // Log what's happening in case we run into problems
-    var wrapLog = Log.Call("template:" + emailTemplateFilename + ", from:" + MailFrom + ", to:" + MailTo + ", cc:" + MailCC + ", reply:" + MailReply);
+    var wrapLog = Log.Call("template:" + emailTemplateFilename + ", from:" + from + ", to:" + to + ", cc:" + cc + ", reply:" + replyTo);

     Log.Add("Get MailEngine");
     var mailEngine = CreateInstance("../../email-templates/" + emailTemplateFilename);
     var mailBody = mailEngine.Message(valuesWithMailLabels).ToString();
-    var mailSubj = mailEngine.Subject(valuesWithMailLabels);
+    var subject = mailEngine.Subject(valuesWithMailLabels);

     // Send Mail
     // Note that if an error occurs, this will bubble up, the caller will convert it to format for the client
     Log.Add("sending...");
     var mailService = GetService<IMailService>();
-    mailService.Send(
-      from: MailFrom,
-      to: MailTo,
-      cc: MailCC,
-      bcc: "",
-      replyTo: MailReply,
-      subject: mailSubj,
-      body: mailBody,
-      attachments: files);
+    mailService.Send(from: from, to: to, cc: cc, replyTo: replyTo, subject: subject, body: mailBody, attachments: files);

     // Log to Platform - just as a last resort in case something is lost, to track down why
     var message = new StringBuilder()
-      .AppendLine("MailFrom: " + MailFrom)
-      .AppendLine("MailTo: "+ MailTo)
-      .AppendLine("MailCC: "+ MailCC)
-      .AppendLine("MailReply: "+ MailReply)
-      .AppendLine("MailSubject: "+ mailSubj)
+      .AppendLine("MailFrom: " + from)
+      .AppendLine("MailTo: "+ to)
+      .AppendLine("MailCC: "+ cc)
+      .AppendLine("MailReply: "+ replyTo)
+      .AppendLine("MailSubject: "+ subject)
       .ToString();

-    var platformLogService = GetService<ILogService>();
-    platformLogService.Add("SendMail", message.ToString());
+    GetService<ILogService>().Add("SendMail", message);

     wrapLog("ok");
   }


Reloc import directory to new section #147

--- src/PeNet/PeFile.cs
+++ src/PeNet/PeFile.cs
@@ -654,12 +654,12 @@
             var importSize = ImageNtHeaders.OptionalHeader.DataDirectory[(int)DataDirectoryType.Import].Size;

             ImageSectionHeader getImportSection()
-                => ImageSectionHeaders.First(sh => sh.VirtualAddress >= importRva);
+                => ImageSectionHeaders.First(sh => sh.VirtualAddress + sh.VirtualSize >= importRva);

             var impSection = getImportSection();

-            int getSizeForNewImpSec()
+            int getAdditionalNeededSpace()
             {
                 var sizeOfHint = 2;
                 var sizeOfZeroTerm = 1;
@@ -667,17 +667,24 @@
                 var sizeThunkArray = (imports.Select(i => i.Name).Count() + 1) * sizeOfThunkData;
                 var sizeOfImpByNameArray = imports.Select(i => i.Name?.Length + sizeOfZeroTerm + sizeOfHint).Sum()!.Value;

-                return (int)(impSection!.SizeOfRawData
-                    + sizeOfImpByNameArray
+                return sizeOfImpByNameArray
                     + sizeOfThunkData
-                    + sizeOfImpByNameArray);
-            }
-
-            var newSecSize = getSizeForNewImpSec();
-            AddSection(".addImp", getSizeForNewImpSec(), impSection.Characteristics);
+                    + sizeOfImpByNameArray;
+            }
+
+            var additionalSpace = getAdditionalNeededSpace();

             // First copy the current import section to a new section with additional space
             // for the new import
+            AddSection(".addImp", (int)(impSection!.SizeOfRawData + additionalSpace), impSection.Characteristics);
+            var newImpSec = ImageSectionHeaders.First(sh => sh.Name == ".addImp");
+            var oldImpSecBytes = RawFile.AsSpan(impSection.PointerToRawData, impSection.SizeOfRawData);
+            RawFile.WriteBytes(newImpSec.PointerToRawData, oldImpSecBytes);
+
+            // Set the import data directory to the new import section and adjust the size
+            ImageNtHeaders.OptionalHeader.DataDirectory[(int)DataDirectoryType.Import].VirtualAddress = importRva - impSection.VirtualAddress + newImpSec.VirtualAddress;
+            ImageNtHeaders.OptionalHeader.DataDirectory[(int)DataDirectoryType.Import].Size = (uint)(impSection.SizeOfRawData + additionalSpace);
+

             /* Add additional imports to new import section
@@ -690,13 +697,12 @@
                 - Add zero filled IMPORT_DESCRIPTOR to end of import table
             */

-            // Set the import data directory to the new import section and adjust the size
-
-            //

             // Optional: Delete the old import section

             // Optional: Rename the new import section to ".idata"
+
+            // Reparse imports

             // Write to disc to test


Flag target line for updating when target not selected

--- src/SailControls.cs
+++ src/SailControls.cs
@@ -252,6 +252,7 @@
 	public bool showFinal = true;
 	public bool showFinalElements = false;
 	public bool showTargetErr = false;
+	bool updateTargetLine = false;
 	public SailPreview preview;
 	public string previewButtonText = "Show Preview";

@@ -444,10 +445,15 @@
 	    }

 	    // Target error
+	    // Target line will need updating when target isn't selected
+	    if (FlightGlobals.fetch.VesselTarget == null) {
+		updateTargetLine = true;
+	    }
 	    if (FlightGlobals.fetch.VesselTarget != null && showPreview && preview.orbitf != null) {
 		// Calculate target line & errors if target selected but line is null
-		if (FlightGlobals.fetch.VesselTarget != null && preview.lineT == null) {
+		if (FlightGlobals.fetch.VesselTarget != null && updateTargetLine) {
 		    preview.CalculateTargetLine();
+		    updateTargetLine = false;
 		}
 		// GUI to show target errors
 		GUILayout.BeginHorizontal();


refactor: upgrade C#

refactor: upgrade C#

--- src/hw.nuget/hw.UnitTest/UnitTest/TestType.cs
+++ src/hw.nuget/hw.UnitTest/UnitTest/TestType.cs
@@ -5,6 +5,7 @@
 using hw.DebugFormatter;
 using hw.Helper;
 using JetBrains.Annotations;
+
 // ReSharper disable CheckNamespace

 namespace hw.UnitTest
@@ -12,11 +13,19 @@
     sealed class TestType : DumpableObject, ValueCache.IContainer
     {
         public bool IsStarted { get; set; }
-        internal readonly List<TestMethod> FailedMethods = new List<TestMethod>();
+        internal readonly List<TestMethod> FailedMethods = new();
+        internal readonly Type Type;
         internal bool IsComplete { get; set; }
-        internal readonly Type Type;
         bool IsSuspended;
+
+        TestMethod[] UnitTestMethodsCache;
         internal TestType(Type type) => Type = type;
+
+        ValueCache ValueCache.IContainer.Cache { get; } = new();
+
+        public override string ToString() => ConfigurationString;
+
+        protected override string GetNodeDump() => Type.PrettyName();

         public string ConfigurationString
         {
@@ -40,25 +49,14 @@

         internal bool IsSuccessful => IsComplete && FailedMethods.Count == 0;

-        TestMethod[] UnitTestMethodsCache;
-
         internal TestMethod[] UnitTestMethods => UnitTestMethodsCache ??= GetUnitTestMethods();
-
-        TestMethod[] GetUnitTestMethods()
-        => Type
-                .GetMethods()
-                .Where(IsUnitTestMethod)
-                .Select(methodInfo => new TestMethod(methodInfo))
-                .Concat(DefaultTestMethods)
-                .Concat(InterfaceMethods)
-                .ToArray();

         IEnumerable<TestMethod> InterfaceMethods
         {
             get
             {
                 if(Type.Is<ITestFixture>())
-                    yield return new TestMethod(Type);
+                    yield return new(Type);
             }
         }

@@ -68,7 +66,7 @@
             {
                 var testAttribute = Type.GetAttribute<UnitTestAttribute>(true);
                 if(testAttribute?.DefaultMethod != null)
-                    yield return new TestMethod(Type.GetMethod(testAttribute.DefaultMethod));
+                    yield return new(Type.GetMethod(testAttribute.DefaultMethod));
             }
         }

@@ -90,26 +88,41 @@
         {
             get
             // ReSharper disable once StringLiteralTypo
-                => !IsStarted || IsSuspended? "notrun" :
-                    IsSuccessful? "success" :
-                    IsComplete? "error" :
-                    UnitTestMethods.Any(m=>m.IsActive)? "active":
-                    // ReSharper disable once StringLiteralTypo
-                    "dependanterror";
+                => !IsStarted || IsSuspended
+                    ? "notrun"
+                    : IsSuccessful
+                        ? "success"
+                        : IsComplete
+                            ? "error"
+                            : UnitTestMethods.Any(m => m.IsActive)
+                                ? "active"
+                                :
+                                // ReSharper disable once StringLiteralTypo
+                                "dependanterror";
             set
             {
-                if(value == "success" )
+                if(value == "success")
                     IsSuspended = true;
             }
         }

         internal int ConfigurationModePriority
-            => !IsStarted || IsSuspended? 4 :
-                IsSuccessful? 2 :
-                IsComplete? 1 :
-                3;
+            => !IsStarted || IsSuspended
+                ? 4
+                : IsSuccessful
+                    ? 2
+                    : IsComplete
+                        ? 1
+                        : 3;

-        ValueCache ValueCache.IContainer.Cache { get; } = new ValueCache();
+        TestMethod[] GetUnitTestMethods()
+            => Type
+                .GetMethods()
+                .Where(IsUnitTestMethod)
+                .Select(methodInfo => new TestMethod(methodInfo))
+                .Concat(DefaultTestMethods)
+                .Concat(InterfaceMethods)
+                .ToArray();

         [PublicAPI]
         [Obsolete("Use CanBeStarted", true)]
@@ -118,20 +131,20 @@

         public bool CanBeStarted(Func<Type, bool> isLevel) => !IsStarted && !IsSuspended && isLevel(Type);

-        public override string ToString() => ConfigurationString;
-
         static bool IsUnitTestMethod(MethodInfo methodInfo)
-            => methodInfo.GetAttribute<UnitTestAttribute>(true) != null
-               || TestRunner.RegisteredFrameworks.Any(item => item.IsUnitTestMethod(methodInfo));
+            => methodInfo.GetAttribute<UnitTestAttribute>(true) != null ||
+                TestRunner.RegisteredFrameworks.Any(item => item.IsUnitTestMethod(methodInfo));

         public int GetPriority(TestMethod method)
-            => method.IsActive? 0 :
-                !IsStarted || IsSuspended? 4 :
-                IsSuccessful? 2 :
-                IsComplete? 1 :
-                3;
-
-        protected override string GetNodeDump() => Type.PrettyName();
+            => method.IsActive
+                ? 0
+                : !IsStarted || IsSuspended
+                    ? 4
+                    : IsSuccessful
+                        ? 2
+                        : IsComplete
+                            ? 1
+                            : 3;

         public string GetMode(TestMethod method) => method.IsActive? "active" : ConfigurationMode;
     }


show/hide buttons.

show/hide buttons.

--- WinFormTagsEditor/WinFormTagsEditor.cs
+++ WinFormTagsEditor/WinFormTagsEditor.cs
@@ -28,15 +28,7 @@
 }}
 .del {{
     background-color: {4};
-    opacity:0.30;
-    display: inline-block;
-    filter:alpha(opacity=30);
-}}
-.delin {{
-    background-color: {4};
-    opacity:1.0;
-    display: inline-block;
-    filter:alpha(opacity=100);
+    visibility:hidden;
 }}
 .plus {{
     background-color: {4};
@@ -62,7 +54,7 @@
     if (clickedon) {
         if (clickedon == 'plus') {
             window.external._addTag();
-        } else {
+        } else if (clickedon.match('del$')){
             var n = parseInt(clickedon);
             if (n != NaN)
                 window.external._delTag(n);
@@ -75,6 +67,9 @@
     if (overelem) {
         if (overelem == 'plus') {
             event.srcElement.className = 'plusin';
+        } else if (overelem.match('tag$') || overelem.match('del$')) {
+            var tid = parseInt(overelem);
+            document.getElementById(tid+'del').style.visibility = 'visible';
         }
     }
 });
@@ -84,6 +79,9 @@
     if (overelem) {
         if (overelem == 'plus') {
             event.srcElement.className = 'plus';
+        } else if (overelem.match('tag$') || overelem.match('del$')) {
+            var tid = parseInt(overelem);
+            document.getElementById(tid+'del').style.visibility = 'hidden';
         }
     }
 });
@@ -100,9 +98,9 @@
 ";

         private string templatetag =
-            @"{0}";
+            @"{1}";
         private string templatedel =
-            @"✗"; // BALLOT
+            @"✗"; // BALLOT

         private List<string> tagslist = new List<string>();
@@ -143,9 +141,9 @@
                 sb.AppendLine("➕"); // HEAVY PLUS SIGN
             int i = 0;
             foreach (var t in this.tagslist) {
-                sb.Append(string.Format(templatetag, t));
+                sb.Append(string.Format(templatetag, ++i, t));
                 if (!ReadOnly)
-                    sb.Append(string.Format(templatedel, ++i));
+                    sb.Append(string.Format(templatedel, i));
                 sb.AppendLine();
             }
             return sb.ToString();
@@ -172,7 +170,7 @@
             }

             this.tagslist.AddRange(
-                newtag.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
+                newtag.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries)
                 .Select(t => t.Trim())
                 .Where(t => t != "")
             );


Hid until complete

Hid until complete

--- Windows.Shell/IDataObjectExtensions.cs
+++ Windows.Shell/IDataObjectExtensions.cs
@@ -11,7 +11,7 @@
 namespace Vanara.Windows.Shell
 {
 	// TODO
-	public static class DataObjectExtensions
+	internal static class DataObjectExtensions
 	{
 		public static IReadOnlyList<string> GetFileNameMap(this DataObject dobj)
 		{


Update VGADriver.cs

Update VGADriver.cs

--- source/Cosmos.HAL2/Drivers/Video/VGADriver.cs
+++ source/Cosmos.HAL2/Drivers/Video/VGADriver.cs
@@ -817,7 +817,7 @@
             }
         }

-		private readonly Color[] _Palette = new Color[256];
+        private readonly Color[] _Palette = new Color[256];

         //Get all the colors from the palette
         public void ReadPalette()
@@ -838,6 +838,12 @@
         public Color GetPaletteEntry(int aIndex)
         {
             return _Palette[aIndex];
+        }
+
+        public void SetPaletteEntry(int aIndex, Color aColor)
+        {
+            _Palette[aIndex] = aColor;
+            SetPaletteEntry(aIndex, aColor.R, aColor.G, aColor.B);
         }

         /// <summary>
@@ -855,7 +861,6 @@
             _IO.DAC_Data.Byte = (byte)(aG >> 2);
             _IO.DAC_Data.Byte = (byte)(aB >> 2);
         }
-

         #region FONTS


Update version

Update version

--- XUnitRemote/Properties/AssemblyInfo.cs
+++ XUnitRemote/Properties/AssemblyInfo.cs
@@ -32,5 +32,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.0.0.13")]
-[assembly: AssemblyFileVersion("1.0.0.13")]
+[assembly: AssemblyVersion("1.0.0.14")]
+[assembly: AssemblyFileVersion("1.0.0.14")]


Use base64 attachment to create collection image

The image upload via external images often breaks. Best to just use base64.

--- ShopifySharp.Tests/Collect_Tests.cs
+++ ShopifySharp.Tests/Collect_Tests.cs
@@ -120,7 +120,7 @@
                 Published = false,
                 Image = new CustomCollectionImage()
                 {
-                    Src = "https://placekitten.com/250/250"
+                    Attachment = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
                 }
             });


Fix the texturestab rendering when the it doesnt need to scroll.

--- source/SharpFlame.Gui/Sections/TexturesTab.cs
+++ source/SharpFlame.Gui/Sections/TexturesTab.cs
@@ -340,22 +340,35 @@

             var tileset = App.Tilesets[App.UiOptions.Textures.TilesetNum];

-            TextureCount = new XYInt
-                {
-                    X = (int)(Math.Floor((scrollTextureView.Size.Width - 20) / 64.0D)),
-                    Y = (int)(Math.Ceiling((double)tileset.Tiles.Count / TextureCount.X))
-                };
-
-            var height = TextureCount.Y * 64;
-            // TODO: See how thick the scroll is on winforms and mac, 20px seems to be right on GTK.
-            var glSize = this.GLSurface.GLSize = new Size(scrollTextureView.Size.Width - 20, height);
-
+            var glSize = new Size (0, 0);
+            TextureCount = new XYInt {
+                X = (int)(Math.Floor (scrollTextureView.ClientSize.Width / 64.0D)),
+                Y = (int)(Math.Ceiling ((double)tileset.Tiles.Count / TextureCount.X))
+            };
+
+            Console.WriteLine ("Test xy:{0}, size:{1}, csize:{2}", TextureCount, scrollTextureView.Size, scrollTextureView.ClientSize);
+            if (TextureCount.Y * 64 >= scrollTextureView.Size.Height)
+            {
+                // TODO: See how thick the scroll is on winforms and mac, 20px seems to be right on GTK.
+                glSize = GLSurface.GLSize = new Size(scrollTextureView.ClientSize.Width - 20, TextureCount.Y * 64);
+            }
+            else
+            {
+                TextureCount = new XYInt {
+                    X = (int)(Math.Floor (GLSurface.Size.Width / 64.0D)),
+                    Y = (int)(Math.Ceiling (GLSurface.Size.Height / 64.0D))
+                };
+                glSize = GLSurface.GLSize = scrollTextureView.ClientSize;
+            }
+
             // send the resize event to the Graphics card.
             GL.Viewport(0, 0, glSize.Width, glSize.Height);
             GL.MatrixMode(MatrixMode.Projection);
             GL.LoadIdentity();
             GL.Ortho(-1.0, 1.0, -1.0, 1.0, 0.0, 4.0);
-
+            GL.MatrixMode (MatrixMode.Modelview);
+
+            GL.Disable (EnableCap.DepthTest);
             GL.Clear(ClearBufferMask.ColorBufferBit);

             var xyInt = new XYInt();
@@ -366,9 +379,8 @@
             var texCoord3 = new XYDouble();

             GL.MatrixMode(MatrixMode.Projection);
-            var temp_mat = Matrix4.CreateOrthographicOffCenter(0.0F, glSize.Width, glSize.Height, 0.0F, -1.0F, 1.0F);
-            // var temp_mat = Matrix4.CreateOrthographic(glSize.Width, glSize.Height, 1.0f, 1000.0f);
-            GL.LoadMatrix(ref temp_mat);
+            GL.LoadIdentity();
+            GL.Ortho (0, glSize.Width, glSize.Height, 0, 0, 1);
             GL.MatrixMode(MatrixMode.Modelview);
             GL.LoadIdentity();

@@ -517,6 +529,8 @@
                 GL.End();
             }

+            GL.Enable (EnableCap.DepthTest);
+
             GL.Flush();
             this.GLSurface.SwapBuffers();
         }


fix UpdateSqlSync  sub-entities of '{0}' are modified

--- Signum.Engine/Schema/Schema.Save.cs
+++ Signum.Engine/Schema/Schema.Save.cs
@@ -642,6 +642,9 @@
             if (ident.Modified == ModifiedState.Clean || ident.Modified == ModifiedState.Sealed)
                 return null;

+            if (ident.Modified == ModifiedState.Modified)
+                throw new InvalidOperationException("Some sub-entities of '{0}' are modified but not the entity itself".FormatWith(ident));
+
             var uc = updater.Value;
             SqlPreCommandSimple update = new SqlPreCommandSimple(uc.SqlUpdatePattern(suffix, false),
                 uc.UpdateParameters(ident, (ident as Entity)?.Ticks ?? -1, new Forbidden(), suffix)).AddComment(comment);


temporalId as Guid

temporalId as Guid

--- Signum.Entities/ModifiableEntity.cs
+++ Signum.Entities/ModifiableEntity.cs
@@ -257,20 +257,18 @@
                 handler(this, new PropertyChangedEventArgs(propertyName));
         }

-        static long temporalIdCounter = 0;
-
+
         #region Temporal ID
         [Ignore]
-        internal int temporalId;
+        internal Guid temporalId = Guid.NewGuid();

         internal ModifiableEntity()
         {
-            temporalId = unchecked((int)Interlocked.Increment(ref temporalIdCounter));
         }

         public override int GetHashCode()
         {
-            return GetType().FullName.GetHashCode() ^ temporalId;
+            return GetType().FullName.GetHashCode() ^ temporalId.GetHashCode();
         }
         #endregion


Cache can be disabled when 0 cache pages count is set

--- source/Xamvvm.Forms/Factory/FactoryCaching.cs
+++ source/Xamvvm.Forms/Factory/FactoryCaching.cs
@@ -33,9 +33,14 @@
 			}

 			var page = GetPageAsNewInstance(pageModel);
-			RemoveUnusedPagesFromCache();
-			_pageCache.Add(key, page);
-			IncreaseCacheHits(key);
+
+			if (_maxPageCacheItems > 0)
+			{
+				RemoveUnusedPagesFromCache();
+				_pageCache.Add(key, page);
+				IncreaseCacheHits(key);
+			}
+
 			return page;
 		}

@@ -88,9 +93,14 @@
 			}

 			var page = GetPageAsNewInstance(pageModelType);
-			RemoveUnusedPagesFromCache();
-			_pageCache.Add(key, page);
-			IncreaseCacheHits(key);
+
+			if (_maxPageCacheItems > 0)
+			{
+				RemoveUnusedPagesFromCache();
+				_pageCache.Add(key, page);
+				IncreaseCacheHits(key);
+			}
+
 			return page;
 		}

@@ -150,6 +160,9 @@

 		internal void RemoveUnusedPagesFromCache()
 		{
+			if (_maxPageCacheItems <= 0)
+				return;
+
 			var ordered = _pageCacheHits
 				.OrderByDescending(v => v.Value)
 				.Skip(_maxPageCacheItems);


#563 Configured audit log json serializer to skip empty fields

--- Smartling.API/Model/BaseAuditLog.cs
+++ Smartling.API/Model/BaseAuditLog.cs
@@ -36,18 +36,40 @@
     /// </example>
     public string envId { get; set; }

+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string fileUri { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string translationJobUid { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string translationJobName { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string translationJobDueDate { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public bool translationJobAuthorize { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string batchUid { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string sourceLocaleId { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public List<string> targetLocaleIds { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string description { get; set; }

+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string clientUserId { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string clientUserEmail { get; set; }
+
+    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
     public string clientUserName { get; set; }
   }
 }


Oppgraderer versjonsnummeret for bugfiks til 4.1.2 🤯

--- SolutionItems/SharedAssemblyInfo.cs
+++ SolutionItems/SharedAssemblyInfo.cs
@@ -4,8 +4,8 @@
 [assembly: AssemblyTrademark("Posten Norge AS")]
 [assembly: AssemblyProduct("Posten Signature API Client")]
 [assembly: AssemblyDescription("Posten Signature Client library for API integration.")]
-[assembly: AssemblyVersion("4.1.1")]
-[assembly: AssemblyFileVersion("4.1.1")]
-[assembly: AssemblyInformationalVersion("4.1.1")]
+[assembly: AssemblyVersion("4.1.2")]
+[assembly: AssemblyFileVersion("4.1.2")]
+[assembly: AssemblyInformationalVersion("4.1.2")]
 [assembly: AssemblyCulture("")]
 [assembly: AssemblyCopyright("© 2015-2017 Posten Norge AS")]


Fixed so that the WriteCalls-extensions works on any type of fake object calls.

--- Source/FakeItEasy/FakeExtensions.cs
+++ Source/FakeItEasy/FakeExtensions.cs
@@ -138,20 +138,20 @@
         /// </summary>
         /// <param name="calls">The calls to write.</param>
         /// <param name="writer">The writer to write the calls to.</param>
-        public static void Write(this IEnumerable<IFakeObjectCall> calls, TextWriter writer)
+        public static void Write<T>(this IEnumerable<T> calls, TextWriter writer) where T : IFakeObjectCall
         {
             Guard.AgainstNull(calls, "calls");
             Guard.AgainstNull(writer, "writer");
-
+
             var callWriter = ServiceLocator.Current.Resolve<CallWriter>();
-            callWriter.WriteCalls(0, calls, writer);
+            callWriter.WriteCalls(0, calls.Cast<IFakeObjectCall>(), writer);
         }

         /// <summary>
         /// Writes all calls in the collection to the console.
         /// </summary>
         /// <param name="calls">The calls to write.</param>
-        public static void WriteToConsole(this IEnumerable<IFakeObjectCall> calls)
+        public static void WriteToConsole<T>(this IEnumerable<T> calls) where T : IFakeObjectCall
         {
             calls.Write(Console.Out);
         }


line fixes

line fixes

--- Source/Glass.Mapper.Sc/GlassHtml.cs
+++ Source/Glass.Mapper.Sc/GlassHtml.cs
@@ -48,7 +48,7 @@
     {
         private static readonly Type ImageType = typeof(Fields.Image);
         private static readonly Type LinkType = typeof(Fields.Link );
-        public const string Parameters = "Parameters";
+        public const string Parameters = "Parameters";

         /// <summary>


Fixed failing test with empty data file.

--- source/icu.net/Collation/RuleBasedCollator.cs
+++ source/icu.net/Collation/RuleBasedCollator.cs
@@ -247,6 +247,11 @@
 		public static IList<string> GetAvailableCollationLocales()
 		{
 			List<string> locales = new List<string>();
+			// The ucol_openAvailableLocales call failes when there are no locales available, so check first.
+			if (NativeMethods.ucol_countAvailable() == 0)
+			{
+				return locales;
+			}
 			ErrorCode ec;
 			SafeEnumeratorHandle en = NativeMethods.ucol_openAvailableLocales(out ec);
 			ExceptionFromErrorCode.ThrowIfError(ec);
@@ -648,10 +653,9 @@
  * @see ucol_getAvailable
  * @stable ICU 2.0
  */
-			/*
 			[DllImport(ICU_I18N_LIB, EntryPoint = "ucol_countAvailable"+ICU_VERSION_SUFFIX)]
 			public static extern Int32 ucol_countAvailable();
-			*/
+

 			/**
  * Create a string enumerator of all locales for which a valid


Map NotFoundException to exception message

--- Source/Miruken.Http/ErrorMapping.cs
+++ Source/Miruken.Http/ErrorMapping.cs
@@ -118,9 +118,9 @@
         }

         [Maps, Format(typeof(Exception))]
-        public string MapNotFoundException( NotFoundException exception)
+        public string MapNotFoundException(NotFoundException exception)
         {
-            return exception.ToString();
+            return exception.Message;
         }

         [Maps, Format(typeof(Exception))]


#784 Fix possible NullReferenceException when rendering AreaSeries

--- Source/OxyPlot/Series/AreaSeries.cs
+++ Source/OxyPlot/Series/AreaSeries.cs
@@ -191,8 +191,13 @@
         public override void Render(IRenderContext rc)
         {
             var actualPoints = this.ActualPoints;
+            if (actualPoints == null || actualPoints.Count == 0)
+            {
+                return;
+            }
+
             var actualPoints2 = this.ActualPoints2;
-            if (actualPoints.Count == 0)
+            if (actualPoints2 == null || actualPoints2.Count == 0)
             {
                 return;
             }


added redirect on re-index

added redirect on re-index

--- Server/Controllers/PostsController.cs
+++ Server/Controllers/PostsController.cs
@@ -60,7 +60,7 @@
         public ActionResult ReIndex()
         {
             _yamlIndexer.IndexContentFiles();
-            return Ok();
+            return Redirect("/");
         }

         [HttpGet]


Fixed Disposable.

Fixed Disposable.

--- SharpToolkit.Extensions/Disposable.cs
+++ SharpToolkit.Extensions/Disposable.cs
@@ -8,38 +8,39 @@
     public abstract class Disposable : IDisposable
     {
         private bool disposed = false;
-        private bool throwOnFinalize;
-
+
         /// <summary>
-        /// Initializes new instance of Disposable, that doesn't throw on finalize.
-        /// </summary>
-        public Disposable() { }
-
-        /// <summary>
-        /// Can be overriden to track finalizer call, in cases when such call is considered a bug.
+        /// Enables tracking of finalizer calls, in cases when those are considered bugs.
         /// </summary>
         protected virtual void ReportFinalization() { }

         /// <summary>
-        /// This methods does the actual disposing.
+        /// Disposes of managed resources.
         /// </summary>
-        protected abstract void DisposeImpl();
+        protected abstract void DisposeManaged();

+        /// <summary>
+        /// Disposes of unmanaged resources.
+        /// </summary>
+        protected abstract void DisposeUnmanaged();
+
         public void Dispose()
         {
             Dispose(true);
             GC.SuppressFinalize(this);
         }

-        protected void Dispose(bool disposing)
+        private void Dispose(bool disposing)
         {
             if (disposed)
                 return;

             if (disposing)
             {
-                DisposeImpl();
+                DisposeManaged();
             }
+
+            DisposeUnmanaged();

             disposed = true;
         }


add AvoidOpenOpenSqlFileRetry default to true (looks like is not an issue anymore)

--- Signum.Engine/Engine/SqlPreCommand.cs
+++ Signum.Engine/Engine/SqlPreCommand.cs
@@ -86,12 +86,14 @@
                 .Select(s => new SqlPreCommandSimple(s))
                 .Combine(Spacing.Simple);
         }
+
+        public static bool AvoidOpenOpenSqlFileRetry = true;

         public static void OpenSqlFileRetry(this SqlPreCommand command)
         {
             SafeConsole.WriteLineColor(ConsoleColor.Yellow, "There are changes!");
             string file = command.OpenSqlFile();
-            if (SafeConsole.Ask("Open again?"))
+            if (!AvoidOpenOpenSqlFileRetry && SafeConsole.Ask("Open again?"))
                 Process.Start(file);
         }


change answer order

change answer order

--- Signum.Engine/Engine/SqlPreCommand.cs
+++ Signum.Engine/Engine/SqlPreCommand.cs
@@ -88,7 +88,7 @@

         Console.WriteLine("Script saved in:  " + Path.Combine(Directory.GetCurrentDirectory(), fileName));
         Console.WriteLine("Check the synchronization script before running it!");
-        var answer = SafeConsole.AskRetry("Open or run?", "open", "run", "exit");
+        var answer = SafeConsole.AskRetry("Open or run?", "run", "open", "exit");

         if (answer == "open")
         {


Timer should be disabled and events detached if no longer needed. So IDisposable is introduced which handles the above...

--- SpotifyAPI/Local/SpotifyLocalAPI.cs
+++ SpotifyAPI/Local/SpotifyLocalAPI.cs
@@ -8,7 +8,7 @@

 namespace SpotifyAPI.Local
 {
-    public class SpotifyLocalAPI
+    public class SpotifyLocalAPI : IDisposable
     {
         [DllImport("user32.dll")]
         private static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
@@ -49,7 +49,7 @@
         private const int KeyeventfKeyup = 0x2;

         private readonly RemoteHandler _rh;
-        private readonly Timer _eventTimer;
+        private Timer _eventTimer;
         private StatusResponse _eventStatusResponse;

         public event EventHandler<TrackChangeEventArgs> OnTrackChange;
@@ -64,9 +64,21 @@
         {
             _rh = new RemoteHandler();

+            AttachTimer(50);
+        }
+
+        public SpotifyLocalAPI(int timerIntervall)
+        {
+            _rh = new RemoteHandler();
+
+            AttachTimer(timerIntervall);
+        }
+
+        private void AttachTimer(int intervall)
+        {
             _eventTimer = new Timer
             {
-                Interval = 50,
+                Interval = intervall,
                 AutoReset = false,
                 Enabled = false
             };
@@ -333,5 +345,13 @@
                 Process.Start(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"spotify\spotifywebhelper.exe"));
             }
         }
+
+        public void Dispose()
+        {
+            if (_eventTimer == null)
+                return;
+            _eventTimer.Enabled = false;
+            _eventTimer.Elapsed -= ElapsedTick;
+        }
     }
 }


made TradeOffer.Accept function with old signature for compatibility

--- SteamTrade/TradeOffer/TradeOffer.cs
+++ SteamTrade/TradeOffer/TradeOffer.cs
@@ -155,21 +155,46 @@

         /// <summary>
         /// Accepts the current offer
+        /// </summary>
+        /// <returns>TradeOfferAcceptResponse object containing accept result</returns>
+        public TradeOfferAcceptResponse Accept()
+        {
+            if (TradeOfferId == null)
+            {
+                return new TradeOfferAcceptResponse { TradeError = "Can't accept a trade without a tradeofferid" };
+            }
+            if (!IsOurOffer && OfferState == TradeOfferState.TradeOfferStateActive)
+            {
+                return Session.Accept(TradeOfferId);
+            }
+            //todo: log wrong state
+            return new TradeOfferAcceptResponse { TradeError = "Can't accept a trade that is not active" };
+        }
+
+
+        /// <summary>
+        /// Accepts the current offer. Old signature for compatibility
         /// </summary>
         /// <param name="tradeId">the tradeid if successful</param>
         /// <returns>true if successful, otherwise false</returns>
-        public TradeOfferAcceptResponse Accept()
-        {
-            if (TradeOfferId == null)
-            {
-                return new TradeOfferAcceptResponse { TradeError = "Can't accept a trade without a tradeofferid" };
-            }
-            if (!IsOurOffer && OfferState == TradeOfferState.TradeOfferStateActive)
-            {
-                return Session.Accept(TradeOfferId);
-            }
-            //todo: log wrong state
-            return new TradeOfferAcceptResponse { TradeError = "Can't accept a trade that is not active" };
+        [Obsolete("Use TradeOfferAcceptResponse Accept()")]
+        public bool Accept(out string tradeId)
+        {
+            tradeId = String.Empty;
+            if (TradeOfferId == null)
+            {
+                //throw like original function did
+                throw new ArgumentException("TradeOfferId");
+            }
+            else
+            {
+                TradeOfferAcceptResponse result = Accept();
+                if (result.Accepted)
+                {
+                    tradeId = result.TradeId;
+                }
+                return result.Accepted;
+            }
         }

         /// <summary>


Forgot to check-in StringResources.

Forgot to check-in StringResources.

--- SimpleInjector.NET/StringResources.cs
+++ SimpleInjector.NET/StringResources.cs
@@ -563,5 +563,10 @@
             return
                 "Root registrations can't be determined before Verify is called. Please call Verify first.";
         }
+
+        internal static string VisualizeObjectGraphShouldBeCalledAfterTheExpressionIsCreated()
+        {
+            return "This method can only be called after GetInstance() or BuildExpression() have been called.";
+        }
     }
 }


support update appointed plugin

support update appointed plugin

--- Sync/Tools/Builtin/PluginCommand.cs
+++ Sync/Tools/Builtin/PluginCommand.cs
@@ -73,7 +73,13 @@
                     return Search(arg[1]);

                 case "update":
-                    return Update();
+                        if (arg.Count>1)
+                        {
+                            var part_plugin_name = arg[1];
+                            return Update(part_plugin_name,arg.Any(a => a == "--no_ask"));
+                        }
+                        else
+                            return Update(arg.Any(a=>a=="--no_ask"));

                 case "install":
                     return Install(arg[1]);
@@ -92,34 +98,58 @@
             }
         }

-        private bool Update()
+        private bool InternalUpdate(string plugin_name,string plugin_author,string plugin_guid)
+        {
+            try
+            {
+                IO.CurrentIO.Write($"Fetch update: {plugin_name} by {plugin_author} [{plugin_guid}]");
+                var result = Serializer<UpdateData>($"http://sync.mcbaka.com/api/Update/plugin/{plugin_guid}");
+                var target = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins", result.fileName);
+
+                if (MD5HashFile(target).ToLower() != result.latestHash)
+                {
+                    IO.CurrentIO.Write($"Download: {result.downloadUrl}...");
+
+                    if (!DownloadSingleFile(result.downloadUrl, target, result.fileName))
+                    {
+                        throw new Exception("Download update files failed!");
+                    }
+                }
+                else
+                {
+                    IO.CurrentIO.Write(string.Format(LANG_VERSION_LATEST, result.name));
+                }
+
+                return true;
+            }
+            catch (Exception e)
+            {
+                IO.CurrentIO.WriteColor(string.Format(LANG_UPDATE_ERROR, e.TargetSite.Name, e.Message), ConsoleColor.Red);
+                return false;
+            }
+        }
+
+        private bool Update(bool no_ask = false)
         {
             IEnumerable<Plugin> plugins = SyncHost.Instance.EnumPluings();
             foreach (var item in plugins)
             {
-                try
-                {
-                    IO.CurrentIO.Write($"Fetch update: {item.Name} by {item.Author} [{item.getGuid()}]");
-                    var result = Serializer<UpdateData>($"http://sync.mcbaka.com/api/Update/plugin/{item.getGuid()}");
-                    var target = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins", result.fileName);
-                    if (MD5HashFile(target).ToLower() != result.latestHash)
-                    {
-                        IO.CurrentIO.Write($"Download: {result.downloadUrl}...");
-                        if (!DownloadSingleFile(result.downloadUrl, target, result.fileName))
-                        {
-                            IO.CurrentIO.WriteColor("Download Failed!", ConsoleColor.Red);
-                        }
-                    }
-                    else
-                    {
-                        IO.CurrentIO.Write(string.Format(LANG_VERSION_LATEST, result.name));
-                    }
-                }
-                catch (Exception e)
-                {
-                    IO.CurrentIO.Write(string.Format(LANG_UPDATE_ERROR, e.TargetSite.Name, e.Message));
-                    continue;
-                }
+                InternalUpdate(item.Name, item.Author, item.getGuid());
+            }
+
+            RequireRestart(LANG_UPDATE_DONE);
+            return true;
+        }
+
+        private bool Update(string part_plugin_name,bool no_ask=false)
+        {
+            IEnumerable<Plugin> plugins =from plugin in SyncHost.Instance.EnumPluings()
+                                         where plugin.Name.ToLower().Contains(part_plugin_name.ToLower())
+                                         select plugin;
+
+            foreach (var item in plugins)
+            {
+                InternalUpdate(item.Name, item.Author, item.getGuid());
             }

             RequireRestart(LANG_UPDATE_DONE);
@@ -379,12 +409,12 @@
                     File.Delete(zip);
                 }

-                IO.CurrentIO.Write($"[{name}] Done.");
+                IO.CurrentIO.WriteColor($"[{name}] Done.", ConsoleColor.Green);
                 return true;
             }
             catch (Exception e)
             {
-                IO.CurrentIO.Write($"Error while {e.TargetSite.Name} : {e.Message}");
+                IO.CurrentIO.WriteColor($"Error while {e.TargetSite.Name} : {e.Message}",ConsoleColor.Red);
                 return false;
             }
         }


Fixed FBO initialization on a linux laptop with an integrated intel card

--- SimpleScene/Lights/SSShadowMapBase.cs
+++ SimpleScene/Lights/SSShadowMapBase.cs
@@ -94,16 +94,15 @@
 				PixelFormat.DepthComponent, PixelType.Float, IntPtr.Zero);
 			GL.BindTexture (TextureTarget.Texture2D, 0);

-			GL.Ext.BindFramebuffer(FramebufferTarget.Framebuffer, m_frameBufferID);
+			GL.Ext.BindFramebuffer(FramebufferTarget.FramebufferExt, m_frameBufferID);

 			GL.DrawBuffer(DrawBufferMode.None);
-			GL.ReadBuffer(ReadBufferMode.None);
 			GL.Viewport (0, 0, m_textureWidth, m_textureHeight);

-			GL.Ext.FramebufferTexture(FramebufferTarget.Framebuffer,FramebufferAttachment.DepthAttachment,
-				m_textureID, 0);
-			GL.Ext.FramebufferTexture (FramebufferTarget.Framebuffer, FramebufferAttachment.Color,
-				(int)All.None, 0);
+			GL.Ext.FramebufferTexture2D(FramebufferTarget.FramebufferExt,FramebufferAttachment.DepthAttachment,
+				TextureTarget.Texture2D, m_textureID, 0);
+			//GL.Ext.FramebufferTexture (FramebufferTarget.FramebufferExt, FramebufferAttachment.Color,
+			//(int)All.None, 0);

 			if(!assertFramebufferOK ()) return;


Formatted Ledger excel output

Formatted Ledger excel output

--- FinancialPlanner.Web/Areas/Display/Controllers/LedgerController.cs
+++ FinancialPlanner.Web/Areas/Display/Controllers/LedgerController.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.IO;
 using System.Linq;
 using System.Web.Mvc;
@@ -10,6 +11,7 @@
 using FinancialPlanner.Web.Properties;
 using Microsoft.AspNet.Identity;
 using OfficeOpenXml;
+using OfficeOpenXml.Style;

 namespace FinancialPlanner.Web.Areas.Display.Controllers
 {
@@ -108,7 +110,23 @@
                     ws.Cells[currRow, 8].Value = item.Name;
                     ws.Cells[currRow, 9].Value = item.Amount;
                 }
-                //輸出
+
+                ws.SelectedRange["A:A"].Style.Numberformat.Format = @"mm/dd/yy;@";
+                ws.SelectedRange["B:B,C:C,D:D,I:I,E:E"].Style.Numberformat.Format = @"[Blue]_($* #,##0.00_);[Magenta]_($* (#,##0.00);[Black]_(* ""-""??_);_(@_)";
+
+                var selectedRange = ws.SelectedRange["A1:I1"];
+                selectedRange.Style.Border.Left.Style = ExcelBorderStyle.Thin;
+                selectedRange.Style.Border.Left.Color.SetColor(Color.Black);
+                selectedRange.Style.Border.Right.Style = ExcelBorderStyle.Thin;
+                selectedRange.Style.Border.Right.Color.SetColor(Color.Black);
+                selectedRange.Style.Border.BorderAround(ExcelBorderStyle.Thick, Color.Black);
+                selectedRange.Style.Fill.PatternType = ExcelFillStyle.Solid;
+                selectedRange.Style.Fill.BackgroundColor.SetColor(Color.DimGray);
+                selectedRange.Style.Font.Color.SetColor(Color.White);
+                selectedRange.AutoFilter = true;
+                ws.View.FreezePanes(2, 1);
+                ws.SelectedRange["A:A,B:B,C:C,D:D,E:E,F:F,G:G,H:H,I:I"].AutoFitColumns();
+
                 var stream = new MemoryStream();
                 package.SaveAs(stream);
                 var fileName = string.Format("Ledger-{0}.xlsx", DateTime.Today.ToString("yyyy-MM-dd"));


More documentation

More documentation

--- System.Extensions/IO/IFilesystem.cs
+++ System.Extensions/IO/IFilesystem.cs
@@ -53,9 +53,9 @@
 		Task DeleteDirectory(string path, bool recursive);

 		/// <summary>
-		///     Tests if a directory with the given path exists.
-		/// </summary>
-		/// <param name="path"></param>
+		///     Determines whether the given path refers to an existing directory on disk.
+		/// </summary>
+		/// <param name="path">The path to test.</param>
 		/// <returns></returns>
 		Task<bool> DirectoryExists(string path);

@@ -121,12 +121,15 @@
 		/// </summary>
 		/// <param name="fileName"></param>
 		/// <returns></returns>
+		/// <exception cref="ArgumentException"><paramref name="fileName"/> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.</exception>
+		/// <exception cref="ArgumentNullException"><paramref name="fileName"/> is null.</exception>
+		/// <exception cref="PathTooLongException">The specified <paramref name="fileName"/> exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.</exception>
 		IFileInfoAsync GetFileInfo(string fileName);

 		/// <summary>
-		///     Tests if a file with the given path exists.
-		/// </summary>
-		/// <param name="path"></param>
+		///     Determines whether the specified file exists.
+		/// </summary>
+		/// <param name="path">The file to check.</param>
 		/// <returns></returns>
 		Task<bool> FileExists(string path);


Make PropertyBinding able to handle objects of different types. Fixes #48

--- Source/Eto/Binding/PropertyBinding.cs
+++ Source/Eto/Binding/PropertyBinding.cs
@@ -29,21 +29,28 @@
 				property = value;
 				descriptor = null;
 			}
-		}
+		}
+
+		/// <summary>
+		/// Gets or sets whether the <see cref="Property"/> specified is case-sensitive or not
+		/// </summary>
+		public bool IgnoreCase { get; set; }

 		/// <summary>
 		/// Initializes a new instance of the PropertyBinding with the specified property
 		/// </summary>
-		/// <param name="property">property to use to get/set values for this binding</param>
-		public PropertyBinding (string property)
+		/// <param name="property">Property to use to get/set values for this binding</param>
+		/// <param name="ignoreCase">True to ignore case for the property, false to be case sensitive</param>
+		public PropertyBinding (string property, bool ignoreCase = true)
 		{
-			this.Property = property;
+			this.Property = property;
+			this.IgnoreCase = ignoreCase;
 		}

 		void EnsureProperty (object dataItem)
-		{
-			if (descriptor == null && dataItem != null) {
-				descriptor = TypeDescriptor.GetProperties (dataItem).Find (Property, true);
+		{
+			if (dataItem != null && (descriptor == null || !descriptor.ComponentType.IsAssignableFrom(dataItem.GetType()))) {
+				descriptor = TypeDescriptor.GetProperties (dataItem).Find (Property, IgnoreCase);
 			}
 		}


make code pretty

make code pretty

--- PatchDirDiffer/Program.cs
+++ PatchDirDiffer/Program.cs
@@ -2,27 +2,22 @@
 {
     using System;
     using System.Collections.Generic;
+    using System.Diagnostics;
+    using System.IO;
     using System.Linq;
     using System.Security.Cryptography;
     using System.Text;
     using System.Text.RegularExpressions;
-    using System.IO;
-    using System.Diagnostics;
+    using Bunseki;
     using DiffMatchPatch;
-    using Bunseki;
-
-    class Program
+
+    ///
+    /// The main program class to be run upon execution.
+    ///
+    public class Program
     {
-        private static void PrintUsage()
-        {
-            Console.WriteLine("usage: " + Process.GetCurrentProcess().ProcessName + " <unpatched dir> <patched dir>");
-        }
-
-        // TODO: make link at top of document to jump directly to the changes made in files
-        // TODO: display number of bytes deleted/inserted
-        // TODO: display stats at the top of the page
-
-        static void Main(string[] args)
+        // TODO: Display information about files that are not in one or the other relative directory lists.
+        public static void Main(string[] args)
         {
             if (args.Length != 2)
             {
@@ -57,8 +52,6 @@

             // Get a set of common relative directory paths.
             string[] sharedRelativeDirFiles = relativePatchedDirFiles.Intersect(relativeUnpatchedDirFiles).ToArray();
-
-            // TODO: Display information about files that are not in one or the other relative directory lists.

             StringBuilder totalHtml = new StringBuilder();
             StringBuilder currentHtml = new StringBuilder();
@@ -72,31 +65,17 @@
             {
                 string absoluteUnpatchedPath = unpatchedDir + relativePath;
                 string absolutePatchedPath = patchedDir + relativePath;
-                if (AreFileContentsEqual(absoluteUnpatchedPath, absolutePatchedPath))
-                {
-                    //Console.WriteLine("Equal: " + relativePath);
-                }
-                else
+                if (!AreFileContentsEqual(absoluteUnpatchedPath, absolutePatchedPath))
                 {
                     Console.WriteLine("Not equal: " + relativePath);
-                    // Do something like diffing based on filetype.
-                    // e.g.:
-                    //  - exe/dll: disassembled and then compared
-                    //  - txt: simple text diff
-
                     string extension = Path.GetExtension(absoluteUnpatchedPath);
-                    // Assume plaintext for the following:
-                    // - no file extension
-                    // - txt
-                    // - xml
-
                     string unpatchedText = string.Empty;
                     string patchedText = string.Empty;
                     string diffData = string.Empty;
                     ChangeStats cs = new ChangeStats();
                     cs.RelativePath = relativePath;

-                    switch(extension)
+                    switch (extension)
                     {
                         // Plaintext
                         case ".txt":
@@ -151,11 +130,11 @@
             }

             // Display diff stats in a table at the top. Re-write the whole file to add this information.
-            totalHtml.Insert(
-                0,
+            string introHtml =
                 "");
+                "</style>";
+            totalHtml.Insert(0, introHtml);
             StringBuilder statsHtml = new StringBuilder();
             statsHtml.Append("
");
             statsHtml.Append("
");
@@ -188,6 +167,11 @@
             return;
         }

+        private static void PrintUsage()
+        {
+            Console.WriteLine("usage: " + Process.GetCurrentProcess().ProcessName + " <unpatched dir> <patched dir>");
+        }
+
         ///
         /// Determines if two files have equal contents.
         ///
@@ -303,42 +287,43 @@
             diff_match_patch dmp = new diff_match_patch();
             List<Diff> diffs = dmp.diff_main(s1, s2, true);
             dmp.diff_cleanupSemantic(diffs);
-            return my_diff_prettyHtml(diffs, cs);
-        }
-
-        /**
-         * Convert a Diff list into a pretty HTML report.
-         * @param diffs List of Diff objects.
-         * @return HTML representation.
-         */
-        private static string my_diff_prettyHtml(List<Diff> diffs, ChangeStats cs)
+            return DiffsToHtml(diffs, cs);
+        }
+
+        ///
+        /// Convert a Diff list into a pretty HTML report.
+        ///
+        /// <param name="diffs">The diffs to be converted to HTML format.</param>
+        /// <param name="cs">The change statistics for this set of Diffs.</param>
+        /// <returns>the HTML representation of the diffs</returns>
+        private static string DiffsToHtml(List<Diff> diffs, ChangeStats cs)
         {
             StringBuilder html = new StringBuilder();
             ulong numBytesInserted = 0;
             ulong numBytesDeleted = 0;
             ulong numBytesEqual = 0;
-            foreach (Diff aDiff in diffs)
+            foreach (Diff diff in diffs)
             {
                 string text =
-                    aDiff.text.Replace("&", "&")
+                    diff.text.Replace("&", "&")
                               .Replace("<", "<")
                               .Replace(">", ">")
                               .Replace(" ", " ")
                               .Replace("\r", string.Empty)
                               .Replace("\n", "
");

-                switch (aDiff.operation)
+                switch (diff.operation)
                 {
                     case Operation.INSERT:
-                        numBytesInserted += (ulong)aDiff.text.Length;
+                        numBytesInserted += (ulong)diff.text.Length;
                         html.Append("").Append(text).Append("");
                         break;
                     case Operation.DELETE:
-                        numBytesDeleted += (ulong)aDiff.text.Length;
+                        numBytesDeleted += (ulong)diff.text.Length;
                         html.Append("").Append(text).Append("");
                         break;
                     case Operation.EQUAL:
-                        numBytesEqual += (ulong)aDiff.text.Length;
+                        numBytesEqual += (ulong)diff.text.Length;
                         html.Append("").Append(text).Append("");
                         break;
                 }
@@ -367,6 +352,14 @@
             return output.ToString();
         }

+        ///
+        /// Remove lines that were unchanged in the diff. Optionally state how many lines above and below differences
+        /// will be shown.
+        ///
+        /// <param name="html">The html representation of the diffs.</param>
+        /// <param name="numLinesBefore">The number of equal lines above each difference to be shown.</param>
+        /// <param name="numLinesAfter">The number of equal lines below each difference to be shown.</param>
+        /// <returns>the reduced HTML representation of the diffs</returns>
         private static string RemoveUnchangedLines(string html, int numLinesBefore = 1, int numLinesAfter = 1)
         {
             StringBuilder filteredLines = new StringBuilder();
@@ -433,8 +426,11 @@
         private class DiffedLine
         {
             public bool Show { get; set; }
+
             public bool IsChange { get; set; }
+
             public string Text { get; set; }
+
             public int LineNumber { get; set; }
         }

@@ -447,11 +443,17 @@
                     return GetMD5OfString(this.RelativePath);
                 }
             }
+
             public string RelativePath { get; set; }
+
             public double PercentChanged { get; set; }
+
             public ulong NumBytesInserted { get; set; }
+
             public ulong NumBytesDeleted { get; set; }
+
             public ulong NumBytesOld { get; set; }
+
             public ulong NumBytesNew { get; set; }
         }
     }


Make number of iterations more easily configurable

--- TestEWSSearchPerformance/Program.cs
+++ TestEWSSearchPerformance/Program.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 using System.Diagnostics;
 using Microsoft.Exchange.WebServices.Data;

@@ -9,6 +8,7 @@
     {
         const int NumberOfMessagesToCreate = 10000;
         const int NumberOfSearchesToPerform = 50;
+        const int NumberOfIterations = 5;
         static readonly Guid MyNamedPropertyNamespaceGuid = new Guid("6755f378-6d50-4b26-84ae-95824b6b7a1d");
         static readonly ExtendedPropertyDefinition MyNamedProp =
             new ExtendedPropertyDefinition(
@@ -41,28 +41,28 @@

             Console.WriteLine();
             Console.WriteLine("Seeking the folder directly.");
-            for (var x = 0; x < 5; x++)
+            for (var x = 0; x < NumberOfIterations; x++)
             {
                 SearchBySeek(inboxFolder);
             }

             Console.WriteLine();
             Console.WriteLine("Seeking the search folder.");
-            for (var x = 0; x < 5; x++)
+            for (var x = 0; x < NumberOfIterations; x++)
             {
                 SearchBySeek(searchFolder);
             }

             Console.WriteLine();
             Console.WriteLine("FindItems on the folder without sorting.");
-            for (var x = 0; x < 5; x++)
+            for (var x = 0; x < NumberOfIterations; x++)
             {
                 SearchByFilter(inboxFolder, false);
             }

             Console.WriteLine();
             Console.WriteLine("FindItems on the folder with a sort applied to the view.");
-            for (var x = 0; x < 5; x++)
+            for (var x = 0; x < NumberOfIterations; x++)
             {
                 SearchByFilter(inboxFolder, true);
             }


Updates for user managers that don't support claims

--- source/AspNetIdentityUserService/AspNetIdentityUserService.cs
+++ source/AspNetIdentityUserService/AspNetIdentityUserService.cs
@@ -137,11 +137,14 @@

         protected virtual async Task<string> GetDisplayNameForAccountAsync(TKey userID)
         {
-            var claims = await userManager.GetClaimsAsync(userID);
-            var nameClaim = claims.FirstOrDefault(x => x.Type == Thinktecture.IdentityServer.Core.Constants.ClaimTypes.Name);
-            if (nameClaim == null) nameClaim = claims.FirstOrDefault(x => x.Type == ClaimTypes.Name);
-            if (nameClaim != null) return nameClaim.Value;
-
+            if (userManager.SupportsUserClaim)
+            {
+                var claims = await userManager.GetClaimsAsync(userID);
+                var nameClaim = claims.FirstOrDefault(x => x.Type == Thinktecture.IdentityServer.Core.Constants.ClaimTypes.Name);
+                if (nameClaim == null) nameClaim = claims.FirstOrDefault(x => x.Type == ClaimTypes.Name);
+                if (nameClaim != null) return nameClaim.Value;
+            }
+
             var user = await userManager.FindByIdAsync(userID);
             return user.UserName;
         }