Report: improve ExcelRepBuilder

Report: improve ExcelRepBuilder

--- Report/RepBuilder/ExcelRepBuilder.cs
+++ Report/RepBuilder/ExcelRepBuilder.cs
@@ -89,55 +89,6 @@

             /// <summary>
-            /// Получить ссылку на XML-узел, соответствующий книге Excel
-            /// </summary>
-            public XmlNode Node
-            {
-                get
-                {
-                    return node;
-                }
-            }
-
-            /// <summary>
-            /// Получить или установить ссылку на XML-узел, содержащий стили книги Excel
-            /// </summary>
-            public XmlNode StylesNode
-            {
-                get
-                {
-                    return stylesNode;
-                }
-                set
-                {
-                    stylesNode = value;
-                }
-            }
-
-            /// <summary>
-            /// Получить список стилей книги Excel с возможностью доступа по ID стиля
-            /// </summary>
-            public SortedList<string, Style> Styles
-            {
-                get
-                {
-                    return styles;
-                }
-            }
-
-            /// <summary>
-            /// Получить список листов книги Excel
-            /// </summary>
-            public List<Worksheet> Worksheets
-            {
-                get
-                {
-                    return worksheets;
-                }
-            }
-
-
-            /// <summary>
             /// Конструктор
             /// </summary>
             protected Workbook()
@@ -153,6 +104,55 @@
                 node = xmlNode;
                 styles = new SortedList<string, Style>();
                 worksheets = new List<Worksheet>();
+            }
+
+
+            /// <summary>
+            /// Получить ссылку на XML-узел, соответствующий книге Excel
+            /// </summary>
+            public XmlNode Node
+            {
+                get
+                {
+                    return node;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить ссылку на XML-узел, содержащий стили книги Excel
+            /// </summary>
+            public XmlNode StylesNode
+            {
+                get
+                {
+                    return stylesNode;
+                }
+                set
+                {
+                    stylesNode = value;
+                }
+            }
+
+            /// <summary>
+            /// Получить список стилей книги Excel с возможностью доступа по ID стиля
+            /// </summary>
+            public SortedList<string, Style> Styles
+            {
+                get
+                {
+                    return styles;
+                }
+            }
+
+            /// <summary>
+            /// Получить список листов книги Excel
+            /// </summary>
+            public List<Worksheet> Worksheets
+            {
+                get
+                {
+                    return worksheets;
+                }
             }

@@ -316,6 +316,24 @@

             /// <summary>
+            /// Конструктор
+            /// </summary>
+            protected Style()
+            {
+            }
+
+            /// <summary>
+            /// Конструктор
+            /// </summary>
+            /// <param name="xmlNode">Ссылка на XML-узел, соответствующий стилю книги Excel</param>
+            public Style(XmlNode xmlNode)
+            {
+                node = xmlNode;
+                id = xmlNode.Attributes["ss:ID"].Value;
+            }
+
+
+            /// <summary>
             /// Получить ссылку на XML-узел, соответствующий стилю книги Excel
             /// </summary>
             public XmlNode Node
@@ -344,24 +362,6 @@

             /// <summary>
-            /// Конструктор
-            /// </summary>
-            protected Style()
-            {
-            }
-
-            /// <summary>
-            /// Конструктор
-            /// </summary>
-            /// <param name="xmlNode">Ссылка на XML-узел, соответствующий стилю книги Excel</param>
-            public Style(XmlNode xmlNode)
-            {
-                node = xmlNode;
-                id = xmlNode.Attributes["ss:ID"].Value;
-            }
-
-
-            /// <summary>
             /// Клонировать стиль
             /// </summary>
             /// <returns>Копия стиля</returns>
@@ -392,65 +392,6 @@
             /// Родительская книга данного листа
             /// </summary>
             protected Workbook parentWorkbook;
-
-
-            /// <summary>
-            /// Получить ссылку на XML-узел, соответствующий листу книги Excel
-            /// </summary>
-            public XmlNode Node
-            {
-                get
-                {
-                    return node;
-                }
-            }
-
-            /// <summary>
-            /// Получить или установить имя листа, при установке модифицируется дерево XML-документа
-            /// </summary>
-            public string Name
-            {
-                get
-                {
-                    return name;
-                }
-                set
-                {
-                    name = value;
-                    node.Attributes["ss:Name"].Value = name;
-                }
-            }
-
-            /// <summary>
-            /// Получить или установить таблицу с содержимым листа
-            /// </summary>
-            public Table Table
-            {
-                get
-                {
-                    return table;
-                }
-                set
-                {
-                    table = value;
-                    table.ParentWorksheet = this;
-                }
-            }
-
-            /// <summary>
-            /// Получить или установить родительскую книгу данного листа
-            /// </summary>
-            public Workbook ParentWorkbook
-            {
-                get
-                {
-                    return parentWorkbook;
-                }
-                set
-                {
-                    parentWorkbook = value;
-                }
-            }

             /// <summary>
@@ -469,6 +410,65 @@
                 node = xmlNode;
                 name = xmlNode.Attributes["ss:Name"].Value;
                 table = null;
+            }
+
+
+            /// <summary>
+            /// Получить ссылку на XML-узел, соответствующий листу книги Excel
+            /// </summary>
+            public XmlNode Node
+            {
+                get
+                {
+                    return node;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить имя листа, при установке модифицируется дерево XML-документа
+            /// </summary>
+            public string Name
+            {
+                get
+                {
+                    return name;
+                }
+                set
+                {
+                    name = value;
+                    node.Attributes["ss:Name"].Value = name;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить таблицу с содержимым листа
+            /// </summary>
+            public Table Table
+            {
+                get
+                {
+                    return table;
+                }
+                set
+                {
+                    table = value;
+                    table.ParentWorksheet = this;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить родительскую книгу данного листа
+            /// </summary>
+            public Workbook ParentWorkbook
+            {
+                get
+                {
+                    return parentWorkbook;
+                }
+                set
+                {
+                    parentWorkbook = value;
+                }
             }

@@ -550,55 +550,6 @@

             /// <summary>
-            /// Получить ссылку на XML-узел, соответствующий таблице листа Excel
-            /// </summary>
-            public XmlNode Node
-            {
-                get
-                {
-                    return node;
-                }
-            }
-
-            /// <summary>
-            /// Получить список столбцов таблицы
-            /// </summary>
-            public List<Column> Columns
-            {
-                get
-                {
-                    return columns;
-                }
-            }
-
-            /// <summary>
-            /// Получить список строк таблицы
-            /// </summary>
-            public List<Row> Rows
-            {
-                get
-                {
-                    return rows;
-                }
-            }
-
-            /// <summary>
-            /// Получить или установить родительский лист данной таблицы
-            /// </summary>
-            public Worksheet ParentWorksheet
-            {
-                get
-                {
-                    return parentWorksheet;
-                }
-                set
-                {
-                    parentWorksheet = value;
-                }
-            }
-
-
-            /// <summary>
             /// Конструктор
             /// </summary>
             protected Table()
@@ -615,6 +566,55 @@
                 columns = new List<Column>();
                 rows = new List<Row>();
                 parentWorksheet = null;
+            }
+
+
+            /// <summary>
+            /// Получить ссылку на XML-узел, соответствующий таблице листа Excel
+            /// </summary>
+            public XmlNode Node
+            {
+                get
+                {
+                    return node;
+                }
+            }
+
+            /// <summary>
+            /// Получить список столбцов таблицы
+            /// </summary>
+            public List<Column> Columns
+            {
+                get
+                {
+                    return columns;
+                }
+            }
+
+            /// <summary>
+            /// Получить список строк таблицы
+            /// </summary>
+            public List<Row> Rows
+            {
+                get
+                {
+                    return rows;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить родительский лист данной таблицы
+            /// </summary>
+            public Worksheet ParentWorksheet
+            {
+                get
+                {
+                    return parentWorksheet;
+                }
+                set
+                {
+                    parentWorksheet = value;
+                }
             }

@@ -670,6 +670,7 @@
                 else
                     node.PrependChild(column.Node);

+                column.ParentTable = this;
                 columns.Add(column);
             }

@@ -685,6 +686,7 @@
                 else
                     node.InsertAfter(column.Node, columns[listIndex - 1].Node);

+                column.ParentTable = this;
                 columns.Insert(listIndex, column);
             }

@@ -695,6 +697,7 @@
             public void RemoveColumn(int listIndex)
             {
                 Column column = columns[listIndex];
+                column.ParentTable = null;
                 node.RemoveChild(column.Node);
                 columns.RemoveAt(listIndex);
             }
@@ -706,6 +709,7 @@
             public void AppendRow(Row row)
             {
                 node.AppendChild(row.Node);
+                row.ParentTable = this;
                 rows.Add(row);
             }

@@ -723,6 +727,7 @@
                 else
                     node.InsertAfter(row.Node, rows[listIndex - 1].Node);

+                row.ParentTable = this;
                 rows.Insert(listIndex, row);
             }

@@ -733,6 +738,7 @@
             public void RemoveRow(int listIndex)
             {
                 Row row = rows[listIndex];
+                row.ParentTable = null;
                 node.RemoveChild(row.Node);
                 rows.RemoveAt(listIndex);
             }
@@ -775,72 +781,13 @@
             /// </summary>
             protected XmlNode node;
             /// <summary>
+            /// Родительская таблица данного столбца
+            /// </summary>
+            protected Table parentTable;
+            /// <summary>
             /// Индекс столбца, 0 - неопределён
             /// </summary>
             protected int index;
-            /// <summary>
-            /// Родительская таблица данного столбца
-            /// </summary>
-            protected Table parentTable;
-
-
-            /// <summary>
-            /// Получить ссылку на XML-узел, соответствующий столбцу таблицы Excel
-            /// </summary>
-            public XmlNode Node
-            {
-                get
-                {
-                    return node;
-                }
-            }
-
-            /// <summary>
-            /// Получить или установить индекс столбца (0 - неопределён), при установке модифицируется дерево XML-документа
-            /// </summary>
-            public int Index
-            {
-                get
-                {
-                    return index;
-                }
-                set
-                {
-                    if (index <= 0)
-                    {
-                        if (value <= 0)
-                            index = value;
-                        else
-                        {
-                            XmlAttribute attr = node.OwnerDocument.CreateAttribute("ss:Index");
-                            attr.Value = index.ToString();
-                            node.Attributes.SetNamedItem(attr);
-                        }
-                    }
-                    else
-                    {
-                        if (value <= 0)
-                            node.Attributes.RemoveNamedItem("ss:Index");
-                        else
-                            node.Attributes["ss:Index"].Value = index.ToString();
-                    }
-                }
-            }
-
-            /// <summary>
-            /// Получить или установить родительскую таблицу данного столбца
-            /// </summary>
-            public Table ParentTable
-            {
-                get
-                {
-                    return parentTable;
-                }
-                set
-                {
-                    parentTable = value;
-                }
-            }

             /// <summary>
@@ -857,9 +804,53 @@
             public Column(XmlNode xmlNode)
             {
                 node = xmlNode;
+                parentTable = null;
+
                 XmlAttribute attr = node.Attributes["ss:Index"];
                 index = attr == null ? 0 : int.Parse(attr.Value);
-                parentTable = null;
+            }
+
+
+            /// <summary>
+            /// Получить ссылку на XML-узел, соответствующий столбцу таблицы Excel
+            /// </summary>
+            public XmlNode Node
+            {
+                get
+                {
+                    return node;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить родительскую таблицу данного столбца
+            /// </summary>
+            public Table ParentTable
+            {
+                get
+                {
+                    return parentTable;
+                }
+                set
+                {
+                    parentTable = value;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить индекс столбца (0 - неопределён), при установке модифицируется дерево XML-документа
+            /// </summary>
+            public int Index
+            {
+                get
+                {
+                    return index;
+                }
+                set
+                {
+                    index = value;
+                    SetAttribute(node, "Index", XmlNamespaces.ss, index <= 0 ? null : index.ToString(), true);
+                }
             }

@@ -895,44 +886,6 @@

             /// <summary>
-            /// Получить ссылку на XML-узел, соответствующий строке таблицы Excel
-            /// </summary>
-            public XmlNode Node
-            {
-                get
-                {
-                    return node;
-                }
-            }
-
-            /// <summary>
-            /// Получить список ячеек строки
-            /// </summary>
-            public List<Cell> Cells
-            {
-                get
-                {
-                    return cells;
-                }
-            }
-
-            /// <summary>
-            /// Получить или установить родительскую таблицу данной строки
-            /// </summary>
-            public Table ParentTable
-            {
-                get
-                {
-                    return parentTable;
-                }
-                set
-                {
-                    parentTable = value;
-                }
-            }
-
-
-            /// <summary>
             /// Конструктор
             /// </summary>
             protected Row()
@@ -948,6 +901,44 @@
                 node = xmlNode;
                 cells = new List<Cell>();
                 parentTable = null;
+            }
+
+
+            /// <summary>
+            /// Получить ссылку на XML-узел, соответствующий строке таблицы Excel
+            /// </summary>
+            public XmlNode Node
+            {
+                get
+                {
+                    return node;
+                }
+            }
+
+            /// <summary>
+            /// Получить список ячеек строки
+            /// </summary>
+            public List<Cell> Cells
+            {
+                get
+                {
+                    return cells;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить родительскую таблицу данной строки
+            /// </summary>
+            public Table ParentTable
+            {
+                get
+                {
+                    return parentTable;
+                }
+                set
+                {
+                    parentTable = value;
+                }
             }

@@ -1015,6 +1006,7 @@
             public void AppendCell(Cell cell)
             {
                 cells.Add(cell);
+                cell.ParentRow = this;
                 node.AppendChild(cell.Node);
             }

@@ -1026,6 +1018,7 @@
             public void InsertCell(int listIndex, Cell cell)
             {
                 cells.Insert(listIndex, cell);
+                cell.ParentRow = this;

                 if (cells.Count == 1)
                     node.AppendChild(cell.Node);
@@ -1042,6 +1035,7 @@
             public void RemoveCell(int listIndex)
             {
                 Cell cell = cells[listIndex];
+                cell.ParentRow = null;
                 node.RemoveChild(cell.Node);
                 cells.RemoveAt(listIndex);
             }
@@ -1066,11 +1060,8 @@
                 rowNode.Attributes.RemoveNamedItem("ss:AutoFitHeight");
                 rowNode.Attributes.RemoveNamedItem("ss:Height");

-                NumberFormatInfo nfi = new NumberFormatInfo();
-                nfi.NumberDecimalSeparator = ".";
-
                 XmlAttribute attr = rowNode.OwnerDocument.CreateAttribute("ss", "Height", rowNode.NamespaceURI);
-                attr.Value = height.ToString(nfi);
+                attr.Value = height.ToString(NumberFormatInfo.InvariantInfo);
                 rowNode.Attributes.Append(attr);
             }
         }
@@ -1081,6 +1072,21 @@
         protected class Cell
         {
             /// <summary>
+            /// Типы данных ячеек
+            /// </summary>
+            public static class DataTypes
+            {
+                /// <summary>
+                /// Строковый тип
+                /// </summary>
+                public const string String = "String";
+                /// <summary>
+                /// Числовой тип
+                /// </summary>
+                public const string Number = "Number";
+            }
+
+            /// <summary>
             /// Ссылка на XML-узел, соответствующий ячейке строки таблицы Excel
             /// </summary>
             protected XmlNode node;
@@ -1089,13 +1095,35 @@
             /// </summary>
             protected XmlNode dataNode;
             /// <summary>
+            /// Родительская строка данной ячейки
+            /// </summary>
+            protected Row parentRow;
+            /// <summary>
             /// Индекс ячейки, 0 - неопределён
             /// </summary>
             protected int index;
-            /// <summary>
-            /// Родительская строка данной ячейки
-            /// </summary>
-            protected Row parentRow;
+
+
+            /// <summary>
+            /// Конструктор
+            /// </summary>
+            protected Cell()
+            {
+            }
+
+            /// <summary>
+            /// Конструктор
+            /// </summary>
+            /// <param name="xmlNode">Ссылка на XML-узел, соответствующий ячейке строки таблицы Excel</param>
+            public Cell(XmlNode xmlNode)
+            {
+                node = xmlNode;
+                dataNode = null;
+                parentRow = null;
+
+                XmlAttribute attr = node.Attributes["ss:Index"];
+                index = attr == null ? 0 : int.Parse(attr.Value);
+            }

             /// <summary>
@@ -1125,6 +1153,21 @@
             }

             /// <summary>
+            /// Получить или установить родительскую строку данной ячейки
+            /// </summary>
+            public Row ParentRow
+            {
+                get
+                {
+                    return parentRow;
+                }
+                set
+                {
+                    parentRow = value;
+                }
+            }
+
+            /// <summary>
             /// Получить или установить индекс ячейки (0 - неопределён), при установке модифицируется дерево XML-документа
             /// </summary>
             public int Index
@@ -1135,167 +1178,230 @@
                 }
                 set
                 {
-                    if (index <= 0)
+                    index = value;
+                    SetAttribute(node, "Index", XmlNamespaces.ss, index <= 0 ? null : index.ToString(), true);
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить тип данных (формат) ячейки
+            /// </summary>
+            public string DataType
+            {
+                get
+                {
+                    return GetAttribute(dataNode, "ss:Type");
+                }
+                set
+                {
+                    SetAttribute(dataNode, "Type", XmlNamespaces.ss,
+                        string.IsNullOrEmpty(value) ? DataTypes.String : value);
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить текст
+            /// </summary>
+            public string Text
+            {
+                get
+                {
+                    return dataNode == null ? "" : dataNode.InnerText;
+                }
+                set
+                {
+                    if (dataNode != null)
+                        dataNode.InnerText = value;
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить формулу
+            /// </summary>
+            public string Formula
+            {
+                get
+                {
+                    return GetAttribute(node, "ss:Formula");
+                }
+                set
+                {
+                    SetAttribute(node, "Formula", XmlNamespaces.ss, value, true);
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить количество объединямых ячеек справа
+            /// </summary>
+            public int MergeAcross
+            {
+                get
+                {
+                    string valStr = GetAttribute(node, "ss:MergeAcross");
+                    return valStr == "" ? 0 : int.Parse(valStr);
+                }
+                set
+                {
+                    SetAttribute(node, "MergeAcross", XmlNamespaces.ss, value < 1 ? "" : value.ToString(), true);
+                }
+            }
+
+            /// <summary>
+            /// Получить или установить количество объединямых ячеек вниз
+            /// </summary>
+            public int MergeDown
+            {
+                get
+                {
+                    string valStr = GetAttribute(node, "ss:MergeDown");
+                    return valStr == "" ? 0 : int.Parse(valStr);
+                }
+                set
+                {
+                    SetAttribute(node, "MergeDown", XmlNamespaces.ss, value < 1 ? "" : value.ToString(), true);
+                }
+            }
+
+
+            /// <summary>
+            /// Клонировать ячейку
+            /// </summary>
+            /// <returns>Копия ячейки</returns>
+            public Cell Clone()
+            {
+                XmlNode nodeClone = node.CloneNode(false);
+                Cell cellClone = new Cell(nodeClone);
+                cellClone.parentRow = parentRow;
+
+                if (dataNode != null)
+                {
+                    cellClone.dataNode = dataNode.Clone();
+                    nodeClone.AppendChild(cellClone.dataNode);
+
+                    foreach (XmlNode childNode in node.ChildNodes)
+                        if (childNode.Name != "Data")
+                            nodeClone.AppendChild(childNode.Clone());
+                }
+
+                return cellClone;
+            }
+
+            /// <summary>
+            /// Установить числовой тип данных ячейки
+            /// </summary>
+            public void SetNumberType()
+            {
+                DataType = DataTypes.Number;
+            }
+        }
+
+
+        /// <summary>
+        /// Обозначение перехода на новую строку в SpreadsheetML
+        /// </summary>
+        protected const string Break = "
";
+        /// <summary>
+        /// Имя с префиксом XML-элемента в шаблоне, значение которого может содержать директивы изменения
+        /// </summary>
+        protected const string ElemName = "Data";
+
+
+        /// <summary>
+        /// Обрабатываемый XML-документ
+        /// </summary>
+        protected XmlDocument xmlDoc;
+        /// <summary>
+        /// Книга Excel, формируемая на основе XML-документа
+        /// </summary>
+        protected Workbook workbook;
+        /// <summary>
+        /// Обрабатываемый лист Excel
+        /// </summary>
+        protected Worksheet worksheet;
+        /// <summary>
+        /// Обрабатываемая таблица листа Excel
+        /// </summary>
+        protected Table table;
+        /// <summary>
+        /// Обрабатываемая строка таблицы Excel
+        /// </summary>
+        protected Row row;
+        /// <summary>
+        /// Обрабатываемая ячейка строки таблицы Excel
+        /// </summary>
+        protected Cell cell;
+        /// <summary>
+        /// XML-узлы могут иметь текст, содержащий переносы строк
+        /// </summary>
+        protected bool textBroken;
+
+
+        /// <summary>
+        /// Конструктор
+        /// </summary>
+        public ExcelRepBuilder()
+            : base()
+        {
+            xmlDoc = null;
+        }
+
+
+        /// <summary>
+        /// Получить формат отчёта
+        /// </summary>
+        public override string RepFormat
+        {
+            get
+            {
+                return "SpreadsheetML";
+            }
+        }
+
+
+        /// <summary>
+        /// Получить значение атрибута XML-узла
+        /// </summary>
+        protected static string GetAttribute(XmlNode xmlNode, string name)
+        {
+            if (xmlNode == null)
+            {
+                return "";
+            }
+            else
+            {
+                XmlAttribute xmlAttr = xmlNode.Attributes[name];
+                return xmlAttr == null ? "" : xmlAttr.Value;
+            }
+        }
+
+        /// <summary>
+        /// Установить атрибут XML-узла, создав его при необходимости
+        /// </summary>
+        protected static void SetAttribute(XmlNode xmlNode, string localName, string namespaceURI, string value,
+            bool removeEmpty = false)
+        {
+            if (xmlNode != null)
+            {
+                if (string.IsNullOrEmpty(value) && removeEmpty)
+                {
+                    xmlNode.Attributes.RemoveNamedItem(localName, namespaceURI);
+                }
+                else
+                {
+                    XmlAttribute xmlAttr = xmlNode.Attributes.GetNamedItem(localName, namespaceURI) as XmlAttribute;
+                    if (xmlAttr == null)
                     {
-                        if (value <= 0)
-                            index = value;
-                        else
-                        {
-                            XmlAttribute attr = node.OwnerDocument.CreateAttribute("ss:Index");
-                            attr.Value = index.ToString();
-                            node.Attributes.SetNamedItem(attr);
-                        }
+                        xmlAttr = xmlNode.OwnerDocument.CreateAttribute("", localName, namespaceURI);
+                        xmlAttr.Value = value;
+                        xmlNode.Attributes.SetNamedItem(xmlAttr);
                     }
                     else
                     {
-                        if (value <= 0)
-                            node.Attributes.RemoveNamedItem("ss:Index");
-                        else
-                            node.Attributes["ss:Index"].Value = index.ToString();
+                        xmlAttr.Value = value;
                     }
                 }
             }
-
-            /// <summary>
-            /// Получить или установить родительскую строку данной ячейки
-            /// </summary>
-            public Row ParentRow
-            {
-                get
-                {
-                    return parentRow;
-                }
-                set
-                {
-                    parentRow = value;
-                }
-            }
-
-
-            /// <summary>
-            /// Конструктор
-            /// </summary>
-            protected Cell()
-            {
-            }
-
-            /// <summary>
-            /// Конструктор
-            /// </summary>
-            /// <param name="xmlNode">Ссылка на XML-узел, соответствующий ячейке строки таблицы Excel</param>
-            public Cell(XmlNode xmlNode)
-            {
-                node = xmlNode;
-                dataNode = null;
-                XmlAttribute attr = node.Attributes["ss:Index"];
-                index = attr == null ? 0 : int.Parse(attr.Value);
-                parentRow = null;
-            }
-
-
-            /// <summary>
-            /// Клонировать ячейку
-            /// </summary>
-            /// <returns>Копия ячейки</returns>
-            public Cell Clone()
-            {
-                XmlNode nodeClone = node.CloneNode(false);
-                Cell cellClone = new Cell(nodeClone);
-                cellClone.parentRow = parentRow;
-
-                if (dataNode != null)
-                {
-                    cellClone.dataNode = dataNode.Clone();
-                    nodeClone.AppendChild(cellClone.dataNode);
-
-                    foreach (XmlNode childNode in node.ChildNodes)
-                        if (childNode.Name != "Data")
-                            nodeClone.AppendChild(childNode.Clone());
-                }
-
-                return cellClone;
-            }
-
-            /// <summary>
-            /// Установить тип данных (формат) ячейки
-            /// </summary>
-            public void SetDataType(string dataTypeName)
-            {
-                if (dataNode != null)
-                    dataNode.Attributes["ss:Type"].Value = dataTypeName;
-            }
-
-            /// <summary>
-            /// Установить числовой тип данных ячейки
-            /// </summary>
-            public void SetNumberType()
-            {
-                SetDataType("Number");
-            }
-        }
-
-
-        /// <summary>
-        /// Обозначение перехода на новую строку в SpreadsheetML
-        /// </summary>
-        protected const string Break = "
";
-        /// <summary>
-        /// Имя с префиксом XML-элемента в шаблоне, значение которого может содержать директивы изменения
-        /// </summary>
-        protected const string ElemName = "Data";
-
-
-        /// <summary>
-        /// Обрабатываемый XML-документ
-        /// </summary>
-        protected XmlDocument xmlDoc;
-        /// <summary>
-        /// Книга Excel, формируемая на основе XML-документа
-        /// </summary>
-        protected Workbook workbook;
-        /// <summary>
-        /// Обрабатываемый лист Excel
-        /// </summary>
-        protected Worksheet worksheet;
-        /// <summary>
-        /// Обрабатываемая таблица листа Excel
-        /// </summary>
-        protected Table table;
-        /// <summary>
-        /// Обрабатываемая строка таблицы Excel
-        /// </summary>
-        protected Row row;
-        /// <summary>
-        /// Обрабатываемая ячейка строки таблицы Excel
-        /// </summary>
-        protected Cell cell;
-        /// <summary>
-        /// XML-узлы могут иметь текст, содержащий переносы строк
-        /// </summary>
-        protected bool textBroken;
-
-
-        /// <summary>
-        /// Конструктор
-        /// </summary>
-        public ExcelRepBuilder()
-            : base()
-        {
-            xmlDoc = null;
-        }
-
-
-        /// <summary>
-        /// Получить формат отчёта
-        /// </summary>
-        public override string RepFormat
-        {
-            get
-            {
-                return "SpreadsheetML";
-            }
-        }
-
+        }

         /// <summary>
         /// Найти атрибут (директиву) в строке и получить его значение


issue #153 fix conditional compilation for ConcatKDF

--- jose-jwt/crypto/ConcatKDF.cs
+++ jose-jwt/crypto/ConcatKDF.cs
@@ -39,7 +39,7 @@
                     }
                 }
             }
-        #elif NETSTANDARD1_4
+        #else
             throw new NotImplementedException("not yet");
         #endif
         }


JsonController.cs Delete

JsonController.cs Delete

--- MVC5Template/MVC5Template/Controllers/JsonController.cs
+++ MVC5Template/MVC5Template/Controllers/JsonController.cs
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using System.Web.Mvc;
-using Newtonsoft.Json;
-
-namespace MVC5Template.Controllers
-{
-    public class JsonController : Controller
-    {
-        // GET: Json
-        public ActionResult Index()
-        {
-            return View();
-        }
-    }
-}


updated ver for MahApps build [skip ci]

updated ver for MahApps build [skip ci]

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


Use optimized Dispose pattern with suppressed finalizer on Dispose()

--- MatterControl.OpenGL/GCodeRenderer/GCodeVertexBuffer.cs
+++ MatterControl.OpenGL/GCodeRenderer/GCodeVertexBuffer.cs
@@ -113,7 +113,7 @@
 			GL.DisableClientState(ArrayCap.ColorArray);
 		}

-		public void Dispose()
+		protected virtual void Dispose(bool disposing)
 		{
 			// release unmanaged resources
 			if (!disposed)
@@ -126,11 +126,23 @@

 				disposed = true;
 			}
+
+			if (disposing)
+			{
+				// release other Managed objects
+				// if (resource!= null) resource.Dispose();
+			}
+		}
+
+		public void Dispose()
+		{
+			Dispose(true);
+			GC.SuppressFinalize(this);
 		}

 		~GCodeVertexBuffer()
 		{
-			Dispose();
+			Dispose(false);
 		}
 	}
 }


Using

Using

Response.Write


Dump support for test command

Dump support for test command

--- src/core/Bari.Core/cs/Commands/Test/TestCommand.cs
+++ src/core/Bari.Core/cs/Commands/Test/TestCommand.cs
@@ -1,121 +1,139 @@
-using System.Collections.Generic;
-using System.Linq;
-using Bari.Core.Build;
-using Bari.Core.Exceptions;
-using Bari.Core.Generic;
-using Bari.Core.Model;
-using Ninject;
-using Ninject.Syntax;
-
-namespace Bari.Core.Commands.Test
-{
-    /// <summary>
-    /// Implements 'test' command, which builds and executes test projects
-    /// </summary>
-    public class TestCommand : ICommand
-    {
-        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(TestCommand));
-
-        private readonly IResolutionRoot root;
-        private readonly IFileSystemDirectory targetRoot;
-        private readonly IEnumerable<IProjectBuilderFactory> projectBuilders;
-        private readonly IEnumerable<ITestRunner> testRunners;
-
-        /// <summary>
-        /// Gets the name of the command. This is the string which can be used on the command line interface
-        /// to access the particular command.
-        /// </summary>
-        public string Name
-        {
-            get { return "test"; }
-        }
-
-        /// <summary>
-        /// Gets a short, one-liner description of the command
-        /// </summary>
-        public string Description
-        {
-            get { return "builds and runs the unit tests in the suite"; }
-        }
-
-        /// <summary>
-        /// Gets a detailed, multiline description of the command and its possible parameters, usage examples
-        /// </summary>
-        public string Help
-        {
-            get
-            {
-                return
-@"=Test command=
-
-When used without parameter, it builds and runs every unit test project in the suite.
-Example: `bari test`
-";
-            }
-        }
-
-        /// <summary>
-        /// Constructs the test command
-        /// </summary>
-        /// <param name="root">Path to create new instances</param>
-        /// <param name="targetRoot">Target file system directory</param>
-        /// <param name="projectBuilders">Available project builders</param>
-        /// <param name="testRunners">Available test runners</param>
-        public TestCommand(IResolutionRoot root, [TargetRoot] IFileSystemDirectory targetRoot, IEnumerable<IProjectBuilderFactory> projectBuilders, IEnumerable<ITestRunner> testRunners)
-        {
-            this.root = root;
-            this.targetRoot = targetRoot;
-            this.projectBuilders = projectBuilders;
-            this.testRunners = testRunners;
-        }
-
-        /// <summary>
-        /// Runs the command
-        /// </summary>
-        /// <param name="suite">The current suite model the command is applied to</param>
-        /// <param name="parameters">Parameters given to the command (in unprocessed form)</param>
-        public void Run(Suite suite, string[] parameters)
-        {
-            if (parameters.Length == 0)
-            {
-                var projects = (from module in suite.Modules
-                                from project in module.TestProjects
-                                select project).ToList();
-
-                log.InfoFormat("Building the full suite ({0} projects)", projects.Count);
-
-                var buildOutputs = RunWithProjects(projects);
-                RunTests(projects, buildOutputs);
-            }
-            else
-            {
-                throw new InvalidCommandParameterException("test", "Test must be called without any parameters");
-            }
-        }
-
-        private void RunTests(IEnumerable<TestProject> projects, IEnumerable<TargetRelativePath> buildOutputs)
-        {
-            var testProjects = projects as List<TestProject> ?? projects.ToList();
-            var buildOutputPaths = buildOutputs as List<TargetRelativePath> ?? buildOutputs.ToList();
-
-            foreach (var testRunner in testRunners)
-                testRunner.Run(testProjects, buildOutputPaths);
-        }
-
-        private IEnumerable<TargetRelativePath> RunWithProjects(IEnumerable<TestProject> projects)
-        {
-            var context = root.Get<IBuildContext>();
-
-            IBuilder rootBuilder = null;
-            foreach (var projectBuilder in projectBuilders)
-            {
-                rootBuilder = projectBuilder.AddToContext(context, projects);
-                // TODO: we have to make one builder above all the returned project builders and use it as root
-            }
-
-            context.Run(rootBuilder);
-
-            return context.GetResults(rootBuilder);
-        }
-    }
+using System.Collections.Generic;
+using System.Linq;
+using Bari.Core.Build;
+using Bari.Core.Exceptions;
+using Bari.Core.Generic;
+using Bari.Core.Model;
+using Ninject;
+using Ninject.Syntax;
+
+namespace Bari.Core.Commands.Test
+{
+    /// <summary>
+    /// Implements 'test' command, which builds and executes test projects
+    /// </summary>
+    public class TestCommand : ICommand
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(TestCommand));
+
+        private readonly IResolutionRoot root;
+        private readonly IFileSystemDirectory targetRoot;
+        private readonly IEnumerable<IProjectBuilderFactory> projectBuilders;
+        private readonly IEnumerable<ITestRunner> testRunners;
+
+        /// <summary>
+        /// Gets the name of the command. This is the string which can be used on the command line interface
+        /// to access the particular command.
+        /// </summary>
+        public string Name
+        {
+            get { return "test"; }
+        }
+
+        /// <summary>
+        /// Gets a short, one-liner description of the command
+        /// </summary>
+        public string Description
+        {
+            get { return "builds and runs the unit tests in the suite"; }
+        }
+
+        /// <summary>
+        /// Gets a detailed, multiline description of the command and its possible parameters, usage examples
+        /// </summary>
+        public string Help
+        {
+            get
+            {
+                return
+@"=Test command=
+
+When used without parameter, it builds and runs every unit test project in the suite.
+Example: `bari test`
+";
+            }
+        }
+
+        /// <summary>
+        /// Constructs the test command
+        /// </summary>
+        /// <param name="root">Path to create new instances</param>
+        /// <param name="targetRoot">Target file system directory</param>
+        /// <param name="projectBuilders">Available project builders</param>
+        /// <param name="testRunners">Available test runners</param>
+        public TestCommand(IResolutionRoot root, [TargetRoot] IFileSystemDirectory targetRoot, IEnumerable<IProjectBuilderFactory> projectBuilders, IEnumerable<ITestRunner> testRunners)
+        {
+            this.root = root;
+            this.targetRoot = targetRoot;
+            this.projectBuilders = projectBuilders;
+            this.testRunners = testRunners;
+        }
+
+        /// <summary>
+        /// Runs the command
+        /// </summary>
+        /// <param name="suite">The current suite model the command is applied to</param>
+        /// <param name="parameters">Parameters given to the command (in unprocessed form)</param>
+        public void Run(Suite suite, string[] parameters)
+        {
+            int effectiveLength = parameters.Length;
+            bool dumpMode = false;
+
+            if (effectiveLength > 0)
+                dumpMode = parameters[effectiveLength - 1] == "--dump";
+
+            if (dumpMode)
+                effectiveLength--;
+
+            if (effectiveLength == 0)
+            {
+                var projects = (from module in suite.Modules
+                                from project in module.TestProjects
+                                select project).ToList();
+
+                log.InfoFormat("Building the full suite ({0} projects)", projects.Count);
+
+                var buildOutputs = RunWithProjects(projects, dumpMode);
+                RunTests(projects, buildOutputs);
+            }
+            else
+            {
+                throw new InvalidCommandParameterException("test", "Test must be called without any parameters");
+            }
+        }
+
+        private void RunTests(IEnumerable<TestProject> projects, IEnumerable<TargetRelativePath> buildOutputs)
+        {
+            var testProjects = projects as List<TestProject> ?? projects.ToList();
+            var buildOutputPaths = buildOutputs as List<TargetRelativePath> ?? buildOutputs.ToList();
+
+            foreach (var testRunner in testRunners)
+                testRunner.Run(testProjects, buildOutputPaths);
+        }
+
+        private IEnumerable<TargetRelativePath> RunWithProjects(IEnumerable<TestProject> projects, bool dumpMode)
+        {
+            var context = root.Get<IBuildContext>();
+
+            IBuilder rootBuilder = null;
+            foreach (var projectBuilder in projectBuilders)
+            {
+                rootBuilder = projectBuilder.AddToContext(context, projects);
+                // TODO: we have to make one builder above all the returned project builders and use it as root
+            }
+
+            if (dumpMode)
+            {
+                using (var builderGraph = targetRoot.CreateBinaryFile("builders.dot"))
+                    context.Dump(builderGraph, rootBuilder);
+
+                return new TargetRelativePath[0];
+            }
+            else
+            {
+                context.Run(rootBuilder);
+                return context.GetResults(rootBuilder);
+            }
+        }
+    }
 }


Typo fixed

Typo fixed

--- Lidgren.Network/Platform/PlatformConstrained.cs
+++ Lidgren.Network/Platform/PlatformConstrained.cs
@@ -29,7 +29,7 @@
 		public static IPAddress GetMyAddress(out IPAddress mask)
 		{
 			mask = null;
-#if UNITY_ANDROID || UNITY_STANDALONE_OSX || UNITY_STANDLONE_WIN || UNITY_STANDLONE_LINUX || UNITY_IOS
+#if UNITY_ANDROID || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_IOS
 			try
 			{
 				if (!(UnityEngine.Application.internetReachability == UnityEngine.NetworkReachability.NotReachable))


Small refactoring to grennis pull request.

--- LinqToTwitterAg/LinqToTwitter/TwitterExecute.cs
+++ LinqToTwitterAg/LinqToTwitter/TwitterExecute.cs
@@ -3,6 +3,7 @@
 using System.IO;
 using System.Linq;
 using System.Net;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading;
 using System.Diagnostics;
@@ -573,7 +574,7 @@
                                 catch (IOException ex)
                                 {
                                     // Timeout by ReadWriteTimeout also throws IOException. However in this case the request has closed and needs to reopen
-                                    uint hr = unchecked((uint)System.Runtime.InteropServices.Marshal.GetHRForException(ex));
+                                    uint hr = unchecked((uint)Marshal.GetHRForException(ex));
                                     if (hr != 0x80131620)
                                         throw;
                                 }


fixed test for custom connector

fixed test for custom connector

--- LogicAppTemplate.Test/TemplateGeneratorTests.cs
+++ LogicAppTemplate.Test/TemplateGeneratorTests.cs
@@ -646,14 +646,14 @@

             var defintion = generator.GenerateTemplate().GetAwaiter().GetResult();

-            Assert.AreEqual("[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('Billogram-ResourceGroup'),'/providers/Microsoft.Web/customApis/',parameters('Billogram_name'),'')]", defintion["resources"][0]["properties"]["parameters"]["$connections"]["value"]["Billogram"]["id"]);
+            Assert.AreEqual("[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('Billogram-ResourceGroup'),'/providers/Microsoft.Web/customApis/',parameters('Billogram_api'),'')]", defintion["resources"][0]["properties"]["parameters"]["$connections"]["value"]["Billogram"]["id"]);

             Assert.AreEqual("Microsoft.Web/connections", defintion["resources"][1]["type"]);
             Assert.AreEqual("[parameters('logicAppLocation')]", defintion["resources"][1]["location"]);
             Assert.AreEqual("[parameters('Billogram_name')]", defintion["resources"][1]["name"]);
             //subscriptions/89d02439-770d-43f3-9e4a-8b910457a10c/resourceGroups/Messaging/providers/Microsoft.Web/customApis/Billogram
             //subscriptions/fakeecb73-d0ff-455d-a2bf-eae0b300696d/providers/Microsoft.Web/locations/westeurope/managedApis/filesystem
-            Assert.AreEqual("[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('Billogram-ResourceGroup'),'/providers/Microsoft.Web/customApis/',parameters('Billogram_name'),'')]", defintion["resources"][1]["properties"]["api"]["id"]);
+            Assert.AreEqual("[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('Billogram-ResourceGroup'),'/providers/Microsoft.Web/customApis/',parameters('Billogram_api'),'')]", defintion["resources"][1]["properties"]["api"]["id"]);
         }

         [TestMethod()]


Acción GetProovedores en ProveedorController

--- MVCAdventure/Controllers/ProveedorController.cs
+++ MVCAdventure/Controllers/ProveedorController.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.Web;
 using System.Web.Mvc;
+using EFAdventure;

 namespace MVCAdventure.Controllers
 {
@@ -16,7 +17,24 @@

         public ActionResult GetProveedores()
         {
-            return View("Proveedor");
+            List<Person> ListaProveedores;
+            AdventureWorks2014Entities contexto = new AdventureWorks2014Entities();
+
+            var proveedores = (from prov in contexto.SalesPerson
+                               join per in contexto.Person on prov.BusinessEntityID equals per.BusinessEntityID into lista
+                               from ListaProv in lista
+                               select ListaProv);
+
+            ListaProveedores = proveedores.ToList();
+            contexto.Dispose();
+
+            return View("Proveedor", ListaProveedores);
+        }
+
+        public ActionResult GetProductos()
+        {
+
+            return PartialView("_Productos");
         }
     }
 }


!4 修复自定义日志目录无效的问题 Merge pull request !4 from Jerry/N/A

--- Masuit.Tools.Abstractions/Logging/LogManager.cs
+++ Masuit.Tools.Abstractions/Logging/LogManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.IO;
@@ -63,14 +63,21 @@

         private static AutoResetEvent Pause => new AutoResetEvent(false);

+        private static string logDirectory;
         /// <summary>
         /// 日志存放目录，默认日志放在当前应用程序运行目录下的logs文件夹中
         /// </summary>
         public static string LogDirectory
         {
-            get => Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory).Any(s => s.Contains("Web.config")) ? AppDomain.CurrentDomain.BaseDirectory + @"App_Data\Logs\" : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs");
+            get => logDirectory ?? Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory).Any(s => s.Contains("Web.config")) ? AppDomain.CurrentDomain.BaseDirectory + @"App_Data\Logs\" : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs");
             set
             {
+                //自定义目录
+                if (!Directory.Exists(value))
+                {
+                    Directory.CreateDirectory(value);
+                }
+                logDirectory = value;
             }
         }


app commit3

app commit3

--- MiTrello.Domain/Services/IReadOnlyRepository.cs
+++ MiTrello.Domain/Services/IReadOnlyRepository.cs
@@ -9,7 +9,7 @@
     {
         T First<T>(Expression<Func<T, bool>> query) where T : class, IEntity;
         T GetById<T>(long id) where T : class, IEntity;
-        T GetByName<T>(string firstName) where T : class, IEntity;
+        // GetByName<T>(string firstName) where T : class, IEntity;
         T Getbyemail<T>(string email) where T : class, IEntity;
         IQueryable<T> Query<T>(Expression<Func<T, bool>> expression) where T : class, IEntity;


Use the value "None" for the ALGORITHMS column in the X509CertificateDatabase

This should allow the Npgsql backend to work (apparently it doesn't allow null)

Fixes issue #286

--- MimeKit/Cryptography/X509CertificateDatabase.cs
+++ MimeKit/Cryptography/X509CertificateDatabase.cs
@@ -241,6 +241,9 @@
 			var algorithms = new List<EncryptionAlgorithm> ();
 			var values = reader.GetString (column);

+			if (values.Equals ("None", StringComparison.OrdinalIgnoreCase))
+				return null;
+
 			foreach (var token in values.Split (new [] { ',' }, StringSplitOptions.RemoveEmptyEntries)) {
 				EncryptionAlgorithm algorithm;

@@ -262,8 +265,8 @@

 		static string EncodeEncryptionAlgorithms (EncryptionAlgorithm[] algorithms)
 		{
-			if (algorithms == null)
-				return null;
+			if (algorithms == null || algorithms.Length == 0)
+				return "None";

 			var tokens = new string[algorithms.Length];
 			for (int i = 0; i < algorithms.Length; i++)


fixed bug, where migrations assembly with prefix could not be found

--- Mongo.Migration/Migrations/Locators/MigrationLocator.cs
+++ Mongo.Migration/Migrations/Locators/MigrationLocator.cs
@@ -80,7 +80,7 @@
                 throw new DirectoryNotFoundException(ErrorTexts.AppDirNotFound);

             var assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
-            var migrationAssemblies = Directory.GetFiles(path, "*.MongoMigrations.dll").Select(Assembly.LoadFile);
+            var migrationAssemblies = Directory.GetFiles(path, "*.MongoMigrations*.dll").Select(Assembly.LoadFile);

             assemblies.AddRange(migrationAssemblies);


Handling exceptions in OnRun() before ForceExit, because otherwise the session is ended and the exception may be ignored.

--- Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs
+++ Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs
@@ -328,8 +328,10 @@
 					try {
 						OnRun (startInfo);
 					} catch (Exception ex) {
+						// should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state
+						var exceptionHandled = HandleException (ex);
 						ForceExit ();
-						if (!HandleException (ex))
+						if (!exceptionHandled)
 							throw;
 					}
 				});


code-cleanup

code-cleanup

--- Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs
+++ Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs
@@ -28,16 +28,16 @@

 using System;
+using System.Threading;
 using System.Collections.Generic;
+
 using Mono.Debugging.Backend;
-using System.Diagnostics;
-using System.Threading;

 namespace Mono.Debugging.Client
 {
 	public delegate void TargetEventHandler (object sender, TargetEventArgs args);
-	public delegate void ProcessEventHandler(int process_id);
-	public delegate void ThreadEventHandler(int thread_id);
+	public delegate void ProcessEventHandler (int processId);
+	public delegate void ThreadEventHandler (int threadId);
 	public delegate bool ExceptionHandler (Exception ex);
 	public delegate string TypeResolverHandler (string identifier, SourceLocation location);
 	public delegate void BreakpointTraceHandler (BreakEvent be, string trace);
@@ -46,24 +46,23 @@

 	public abstract class DebuggerSession: IDisposable
 	{
-		InternalDebuggerSession frontend;
-		Dictionary<BreakEvent,BreakEventInfo> breakpoints = new Dictionary<BreakEvent,BreakEventInfo> ();
+		readonly Dictionary<BreakEvent, BreakEventInfo> breakpoints = new Dictionary<BreakEvent, BreakEventInfo> ();
+		readonly Dictionary<string, string> resolvedExpressionCache = new Dictionary<string, string> ();
+		BreakEventHitHandler customBreakpointHitHandler;
+		readonly InternalDebuggerSession frontend;
+		readonly object slock = new object ();
+		readonly object olock = new object ();
+		ExceptionHandler exceptionHandler;
 		BreakpointStore breakpointStore;
 		OutputWriterDelegate outputWriter;
 		OutputWriterDelegate logWriter;
+		DebuggerSessionOptions options;
+		ProcessInfo[] currentProcesses;
+		ThreadInfo activeThread;
+		bool ownedBreakpointStore;
+		bool adjustingBreakpoints;
 		bool disposed;
 		bool attached;
-		bool ownedBreakpointStore;
-		object slock = new object ();
-		object olock = new object ();
-		ThreadInfo activeThread;
-		BreakEventHitHandler customBreakpointHitHandler;
-		ExceptionHandler exceptionHandler;
-		DebuggerSessionOptions options;
-		Dictionary<string,string> resolvedExpressionCache = new Dictionary<string, string> ();
-		bool adjustingBreakpoints;
-
-		ProcessInfo[] currentProcesses;

 		/// <summary>
 		/// Reports a debugger event
@@ -870,8 +869,8 @@
 		{
 		}

-		Mono.Debugging.Evaluation.ExpressionEvaluator defaultResolver = new Mono.Debugging.Evaluation.NRefactoryExpressionEvaluator ();
-		Dictionary <string, IExpressionEvaluator> evaluators = new Dictionary <string, IExpressionEvaluator> ();
+		readonly Mono.Debugging.Evaluation.ExpressionEvaluator defaultResolver = new Mono.Debugging.Evaluation.NRefactoryExpressionEvaluator ();
+		readonly Dictionary <string, IExpressionEvaluator> evaluators = new Dictionary <string, IExpressionEvaluator> ();

 		internal IExpressionEvaluator FindExpressionEvaluator (StackFrame frame)
 		{
@@ -1117,11 +1116,19 @@
 		{
 			lock (breakpoints) {
 				// Make a copy of the breakpoints table since it can be modified while iterating
-				Dictionary<BreakEvent, BreakEventInfo> breakpointsCopy = new Dictionary<BreakEvent, BreakEventInfo> (breakpoints);
+				var breakpointsCopy = new Dictionary<BreakEvent, BreakEventInfo> (breakpoints);
+
 				foreach (KeyValuePair<BreakEvent, BreakEventInfo> bps in breakpointsCopy) {
 					Breakpoint bp = bps.Key as Breakpoint;
 					if (bp != null && bps.Value.Status == BreakEventStatus.NotBound) {
-						if (string.Compare (System.IO.Path.GetFullPath (bp.FileName), fullFilePath, System.IO.Path.DirectorySeparatorChar == '\\') == 0)
+						StringComparer comparer;
+
+						if (System.IO.Path.DirectorySeparatorChar == '\\')
+							comparer = StringComparer.InvariantCultureIgnoreCase;
+						else
+							comparer = StringComparer.InvariantCulture;
+
+						if (comparer.Compare (System.IO.Path.GetFullPath (bp.FileName), fullFilePath) == 0)
 							RetryEventBind (bps.Value);
 					}
 				}
@@ -1165,17 +1172,20 @@
 		/// </remarks>
 		internal protected void UnbindSourceFileBreakpoints (string fullFilePath)
 		{
-			List<BreakEventInfo> toUpdate = new List<BreakEventInfo> ();
+			var toUpdate = new List<BreakEventInfo> ();
+
 			lock (breakpoints) {
 				// Make a copy of the breakpoints table since it can be modified while iterating
-				Dictionary<BreakEvent, BreakEventInfo> breakpointsCopy = new Dictionary<BreakEvent, BreakEventInfo> (breakpoints);
+				var breakpointsCopy = new Dictionary<BreakEvent, BreakEventInfo> (breakpoints);
+
 				foreach (KeyValuePair<BreakEvent, BreakEventInfo> bps in breakpointsCopy) {
-					Breakpoint bp = bps.Key as Breakpoint;
+					var bp = bps.Key as Breakpoint;
 					if (bp != null && bps.Value.Status == BreakEventStatus.Bound) {
 						if (System.IO.Path.GetFullPath (bp.FileName) == fullFilePath)
 							toUpdate.Add (bps.Value);
 					}
 				}
+
 				foreach (BreakEventInfo be in toUpdate) {
 					breakpoints.Remove (be.BreakEvent);
 					NotifyBreakEventStatusChanged (be.BreakEvent);
@@ -1193,7 +1203,7 @@

 		string GetBreakEventErrorMessage (BreakEvent be)
 		{
-			Breakpoint bp = be as Breakpoint;
+			var bp = be as Breakpoint;
 			if (bp != null)
 				return string.Format ("Could not insert breakpoint at '{0}:{1}'", bp.FileName, bp.Line);
 			Catchpoint cp = (Catchpoint) be;
@@ -1476,7 +1486,7 @@

 	class InternalDebuggerSession: IDebuggerSessionFrontend
 	{
-		DebuggerSession session;
+		readonly DebuggerSession session;

 		public InternalDebuggerSession (DebuggerSession session)
 		{


Disable Manage Packages menu when project selected.

--- src/MonoDevelop.PackageManagement.Extensions/MonoDevelop.PackageManagement/ManagePackagesHandler2.cs
+++ src/MonoDevelop.PackageManagement.Extensions/MonoDevelop.PackageManagement/ManagePackagesHandler2.cs
@@ -28,6 +28,7 @@

 using System;
 using ICSharpCode.PackageManagement;
+using MonoDevelop.Components.Commands;
 using MonoDevelop.Ide;
 using MonoDevelop.PackageManagement.Commands;

@@ -62,5 +63,10 @@
 				new ManagePackagesViewTitle (PackageManagementServices.Solution),
 				packageEvents);
 		}
+
+		protected override void Update (CommandInfo info)
+		{
+			info.Enabled = !IsDotNetProjectSelected ();
+		}
 	}
 }


Show full path of missing dependency

Show full path of missing dependency

--- NBi.Core/ExternalDependencyNotFoundException.cs
+++ NBi.Core/ExternalDependencyNotFoundException.cs
@@ -8,7 +8,7 @@
     public class ExternalDependencyNotFoundException : TestException
     {
         public ExternalDependencyNotFoundException(string filename)
-            : base (string.Format("This test has failed because the following dependency has not been found '{0}'.", filename))
+            : base (string.Format("This test is in error because the following dependency has not been found '{0}'.", System.IO.Path.GetFullPath(filename)))
         {

         }


Code cleanup, as long as I'm here - converted all tabs to spaces, removed extraneous braces

--- NControl/NControl.Droid/NControlViewRenderer.cs
+++ NControl/NControl.Droid/NControlViewRenderer.cs
@@ -38,15 +38,15 @@
 [assembly: ExportRenderer(typeof(NControlView), typeof(NControlViewRenderer))]
 namespace NControl.Droid
 {
-	/// <summary>
-	/// NControlView renderer.
-	/// </summary>
+    /// <summary>
+    /// NControlView renderer.
+    /// </summary>
     public class NControlViewRenderer: VisualElementRenderer<NControlView>
-	{
+    {
         /// <summary>
-		/// Used for registration with dependency service
-		/// </summary>
-		public static void Init() { }
+        /// Used for registration with dependency service
+        /// </summary>
+        public static void Init() { }

         /// <summary>
         /// Raises the element changed event.
@@ -77,7 +77,7 @@
                 canvas.ClipRect(new Android.Graphics.Rect(0, 0, Width, Height), Region.Op.Replace);

             // Perform custom drawing
-			var ncanvas = new CanvasCanvas(canvas);
+            var ncanvas = new CanvasCanvas(canvas);
             Element.Draw(ncanvas, new NGraphics.Rect(0, 0, Width, Height));

             // Draw elements/children etc.
@@ -105,36 +105,32 @@

             var result = false;

-
+            // Handle touch actions
+            switch (e.Action)
             {
-                // Handle touch actions
-                switch (e.Action)
-                {
+                case MotionEventActions.Down:
+                if (Element != null)
+                    result = Element.TouchesBegan(touchInfo);
+                    break;

-                    case MotionEventActions.Down:
-					if (Element != null)
-                        result = Element.TouchesBegan(touchInfo);
-                        break;
+                case MotionEventActions.Move:
+                if (Element != null)
+                    result = Element.TouchesMoved(touchInfo);
+                    break;

-                    case MotionEventActions.Move:
-					if (Element != null)
-                        result = Element.TouchesMoved(touchInfo);
-                        break;
+                case MotionEventActions.Up:
+                if (Element != null)
+                    result = Element.TouchesEnded(touchInfo);
+                    break;

-                    case MotionEventActions.Up:
-					if (Element != null)
-                        result = Element.TouchesEnded(touchInfo);
-                        break;
-
-                    case MotionEventActions.Cancel:
-					if (Element != null)
-                        result = Element.TouchesCancelled(touchInfo);
-                        break;
-                }
+                case MotionEventActions.Cancel:
+                if (Element != null)
+                    result = Element.TouchesCancelled(touchInfo);
+                    break;
             }

-			System.Diagnostics.Debug.WriteLine("OnTouchEvent: " + e.Action.ToString() +
-				" for " + Element.GetType().Name + " returning " + result);
+            System.Diagnostics.Debug.WriteLine("OnTouchEvent: " + e.Action.ToString() +
+                " for " + Element.GetType().Name + " returning " + result);

             return result;
         }
@@ -163,6 +159,6 @@
             return new Xamarin.Forms.Size (metrics.WidthPixels, metrics.HeightPixels);
         }
         #endregion
-	}
+    }
 }


Fix URL builder exception test failing.

Fix URL builder exception test failing.

--- Nancy.AttributeRouting.Tests/UrlBuilderTests.cs
+++ Nancy.AttributeRouting.Tests/UrlBuilderTests.cs
@@ -3,6 +3,7 @@
     using System;
     using System.Collections.Generic;
     using System.Linq.Expressions;
+    using Nancy.AttributeRouting.Exceptions;
     using Nancy.AttributeRouting.Tests.ViewModels;
     using Nancy.Testing;
     using Xunit;
@@ -14,8 +15,6 @@
         public interface ITestCase
         {
             void Run();
-
-            void ExpectException();
         }

         public static IEnumerable<object[]> TestCases
@@ -151,8 +150,8 @@
         {
             get
             {
-                yield return new TestCase<MyViewModel>(m => m.GetByTwoRoutings());
-                yield return new TestCase<MyViewModel>(m => m.GetWithoutRoutings());
+                yield return new ExceptionTestCase<MyViewModel, MultipleRouteAttributesException>(m => m.GetByTwoRoutings());
+                yield return new ExceptionTestCase<MyViewModel, NoRouteAttributeException>(m => m.GetWithoutRoutings());
             }
         }

@@ -167,7 +166,7 @@
         [MemberData("ExceptionCases")]
         public void Throws_URL_builder_exception(ITestCase testCase)
         {
-            testCase.ExpectException();
+            testCase.Run();
         }

         public class Url : NancyModule
@@ -182,7 +181,7 @@

         public class TestCase<T> : ITestCase where T : class
         {
-            private readonly Expression<Func<T, object>> expression;
+            protected readonly Expression<Func<T, object>> expression;

             private readonly IDictionary<string, string> dictionary;

@@ -220,7 +219,7 @@
                 return new object[] { testCase };
             }

-            public void Run()
+            public virtual void Run()
             {
                 // Act
                 string url = this.parameters != null
@@ -233,15 +232,24 @@
                 Assert.Equal(this.url, url);
             }

-            public void ExpectException()
-            {
-                // TODO catch specified URL builder exception
-                Assert.Throws<Exception>(() => Url.Builder.GetUrl<T>(this.expression));
-            }
-
             public override string ToString()
             {
                 return string.Format("{0} {1}", typeof(T).Name, this.expression);
+            }
+        }
+
+        public class ExceptionTestCase<T, U> : TestCase<T>
+            where T : class
+            where U : Exception
+        {
+            public ExceptionTestCase(Expression<Func<T, object>> expression)
+                : base(expression)
+            {
+            }
+
+            public override void Run()
+            {
+                Assert.Throws<U>(() => Url.Builder.GetUrl<T>(this.expression));
             }
         }
     }


so many items, why can't i hold all these items?

--- Navier-Boats/Navier-Boats/Navier-Boats/Game1.cs
+++ Navier-Boats/Navier-Boats/Navier-Boats/Game1.cs
@@ -120,8 +120,8 @@
             EntityManager.GetInstance().SaveEntities("test.ent", test);

             Player player = EntityManager.GetInstance().Player;
-            player.Items.AddItem(new ItemStack(ItemManager.GetInstance().Items[0]));
-            player.Items.AddItem(new ItemStack(ItemManager.GetInstance().Items[1]));
+            player.Items.AddItem(new ItemStack(ItemManager.GetInstance().Items[0], 32));
+            player.Items.AddItem(new ItemStack(ItemManager.GetInstance().Items[1], 32));
         }

         /// <summary>


IntelliSense InfoBar typings folder link should open built-in VS browser

--- Nodejs/Product/Nodejs/Options/TypingsInfoBar.cs
+++ Nodejs/Product/Nodejs/Options/TypingsInfoBar.cs
@@ -22,6 +22,7 @@
 using Microsoft.VisualStudio.Imaging;
 using Microsoft.VisualStudio.Shell;
 using Microsoft.VisualStudio.Shell.Interop;
+using Microsoft.VisualStudioTools;

 namespace Microsoft.NodejsTools.Options {
     public class TypingsInfoBar : IVsInfoBarUIEvents {
@@ -114,7 +115,7 @@

                 menuCommandService.GlobalInvoke(optionsCommand, intelliSenseOptionsGuidString);
             } else if (actionItem.Equals(_typingsFolderHyperlink)) {
-                Process.Start("http://go.microsoft.com/fwlink/?LinkID=808345");
+                CommonPackage.OpenVsWebBrowser(_provider, "http://go.microsoft.com/fwlink/?LinkID=808345");
             }
         }


Store GFS Checkout token in a cookie

Store GFS Checkout token in a cookie

--- OpenOrderFramework/Controllers/P4MController.cs
+++ OpenOrderFramework/Controllers/P4MController.cs
@@ -178,16 +178,25 @@
         public ActionResult ShippingSelector()
         {
             // get an access token for GFS checkout
-            var uri = new Uri(@"https://identity.justshoutgfs.com/connect/token");
-            var client = new Thinktecture.IdentityModel.Client.OAuth2Client(
-                uri,
-                "ambitious_alice",
-                "m@dhatt3r");
-
-            var tokenResponse = client.RequestClientCredentialsAsync("read checkout-api").Result;
-            ViewBag.AccessToken = Base64Encode(tokenResponse.AccessToken);
+            var token = Response.Cookies["gfsCheckoutToken"].Value;
+            if (string.IsNullOrWhiteSpace(token))
+            {
+                var uri = new Uri(@"https://identity.justshoutgfs.com/connect/token");
+                var client = new Thinktecture.IdentityModel.Client.OAuth2Client(
+                    uri,
+                    "ambitious_alice",
+                    "m@dhatt3r");
+
+                var tokenResponse = client.RequestClientCredentialsAsync("read checkout-api").Result;
+                token = Base64Encode(tokenResponse.AccessToken);
+                Response.Cookies["gfsCheckoutToken"].Value = token;
+                Response.Cookies["gfsCheckoutToken"].Expires = DateTime.UtcNow.AddSeconds(tokenResponse.ExpiresIn);
+            }
+            ViewBag.AccessToken = token;
+
             // set the initial address
             ViewBag.InitialAddress = "";
+
             // define initial post data
             ViewBag.InitialData = Base64Encode("eyJSZXF1ZXN0Ijp7IkRhdGVSYW5nZSI6eyJEYXRlRnJvbSI6IjIwMTYtMDctMTEiLCJEYXRlVG8iOiIyMDE2LTA3LTI1In0sIk9yZGVyIjp7IlRyYW5zaXQiOnsiUmVjaXBpZW50Ijp7IkxvY2F0aW9uIjp7IkNvdW50cnlDb2RlIjp7IkNvZGUiOiJHQiIsIkVuY29kaW5nIjoiY2NJU09fMzE2Nl8xX0FscGhhMiJ9LCJQb3N0Y29kZSI6IlNPNDAgN0pGIn19fSwiVmFsdWUiOnsiQ3VycmVuY3lDb2RlIjoiR0JQIiwiVmFsdWUiOjQ1Ljk5fX0sIlJlcXVlc3RlZERlbGl2ZXJ5VHlwZXMiOlsiZG1Ecm9wUG9pbnQiLCJkbVN0YW5kYXJkIl0sIlNlc3Npb24iOnsiQVBJS2V5SWQiOiJDTC02OUFFNzA0Ri1ENTkyLTRBNEEtQTU2RC1FQzVFOUYxQzI4QjIifX19");
             return View("P4MDelivery");


Add check in SceneManager to stop opensim.exe crashing if no regions/scenes were loaded.

--- OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -66,7 +66,14 @@
             {
                 if (m_currentScene == null)
                 {
-                    return m_localScenes[0];
+                    if (m_localScenes.Count > 0)
+                    {
+                        return m_localScenes[0];
+                    }
+                    else
+                    {
+                        return null;
+                    }
                 }
                 else
                 {


Update materials parameters.

Update materials parameters.

--- OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
+++ OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
@@ -491,43 +491,55 @@

             staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)];

-            // Centeral contact friction and bounce
-            // ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why
-            // an avatar falls through in Z but not in X or Y when walking on a prim.
-            contact.surface.mode |= d.ContactFlags.SoftERP;
-            contact.surface.mu = nmAvatarObjectContactFriction;
-            contact.surface.bounce = nmAvatarObjectContactBounce;
-            contact.surface.soft_cfm = 0.010f;
-            contact.surface.soft_erp = 0.010f;
+            // Centeral contact friction and bounce // KF: This appears to be only for static AV on non-phys prim.
+            contact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            contact.surface.mu = 255.0f;
+            contact.surface.bounce = 0.0f;
+            contact.surface.soft_cfm = 0.0f;
+            contact.surface.soft_erp = 1.00f;	// If this is too small static Av will fall through a sloping prim.

             // Terrain contact friction and Bounce
             // This is the *non* moving version.   Use this when an avatar
             // isn't moving to keep it in place better
-            TerrainContact.surface.mode |= d.ContactFlags.SoftERP;
+/*            TerrainContact.surface.mode |= d.ContactFlags.SoftERP;
             TerrainContact.surface.mu = nmTerrainContactFriction;
             TerrainContact.surface.bounce = nmTerrainContactBounce;
-            TerrainContact.surface.soft_erp = nmTerrainContactERP;
+            TerrainContact.surface.soft_erp = nmTerrainContactERP; */
+
+            TerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            TerrainContact.surface.mu = 255.0f;
+            TerrainContact.surface.bounce = 0.0f;
+            TerrainContact.surface.soft_cfm = 0.0f;
+            TerrainContact.surface.soft_erp = 0.05f;

             WaterContact.surface.mode |= (d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM);
-            WaterContact.surface.mu = 0f; // No friction
+            WaterContact.surface.mu = 0.0f; // No friction
             WaterContact.surface.bounce = 0.0f; // No bounce
             WaterContact.surface.soft_cfm = 0.010f;
             WaterContact.surface.soft_erp = 0.010f;

             // Prim contact friction and bounce
-            // THis is the *non* moving version of friction and bounce
+            // THis is the moving version of friction and bounce
             // Use this when an avatar comes in contact with a prim
-            // and is moving
-            AvatarMovementprimContact.surface.mu = mAvatarObjectContactFriction;
-            AvatarMovementprimContact.surface.bounce = mAvatarObjectContactBounce;
+            AvatarMovementprimContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            AvatarMovementprimContact.surface.mu = 255.0f;
+            AvatarMovementprimContact.surface.bounce = 0.01f;
+            AvatarMovementprimContact.surface.soft_cfm = 0.0f; // if this is 0.01 then prims become phantom to Avs!
+            AvatarMovementprimContact.surface.soft_erp = 0.001f;

             // Terrain contact friction bounce and various error correcting calculations
             // Use this when an avatar is in contact with the terrain and moving.
+/*
             AvatarMovementTerrainContact.surface.mode |= d.ContactFlags.SoftERP;
             AvatarMovementTerrainContact.surface.mu = mTerrainContactFriction;
             AvatarMovementTerrainContact.surface.bounce = mTerrainContactBounce;
             AvatarMovementTerrainContact.surface.soft_erp = mTerrainContactERP;
-
+*/
+            AvatarMovementTerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            AvatarMovementTerrainContact.surface.mu = 75f;
+            AvatarMovementTerrainContact.surface.bounce = 0.0f;
+            AvatarMovementTerrainContact.surface.soft_cfm = 0.0f;
+            AvatarMovementTerrainContact.surface.soft_erp = 0.05f;

             /*
                 <summary></summary>
@@ -549,109 +561,110 @@
             m_materialContacts = new d.Contact[7,2];

             m_materialContacts[(int)Material.Stone, 0] = new d.Contact();
-            m_materialContacts[(int)Material.Stone, 0].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Stone, 0].surface.mu = nmAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Stone, 0].surface.bounce = nmAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Stone, 0].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Stone, 0].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Stone, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Stone, 0].surface.mu = 1.8f;
+            m_materialContacts[(int)Material.Stone, 0].surface.bounce = 0.0f;
+            m_materialContacts[(int)Material.Stone, 0].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Stone, 0].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Stone, 1] = new d.Contact();
-            m_materialContacts[(int)Material.Stone, 1].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Stone, 1].surface.mu = mAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Stone, 1].surface.bounce = mAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Stone, 1].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Stone, 1].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Stone, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Stone, 1].surface.mu = 1.8f;
+            m_materialContacts[(int)Material.Stone, 1].surface.bounce = 0.0f;
+            m_materialContacts[(int)Material.Stone, 1].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Stone, 1].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Metal, 0] = new d.Contact();
-            m_materialContacts[(int)Material.Metal, 0].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Metal, 0].surface.mu = nmAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Metal, 0].surface.bounce = nmAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Metal, 0].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Metal, 0].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Metal, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Metal, 0].surface.mu = 1.3f;
+            m_materialContacts[(int)Material.Metal, 0].surface.bounce = 0.2f;
+            m_materialContacts[(int)Material.Metal, 0].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Metal, 0].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Metal, 1] = new d.Contact();
-            m_materialContacts[(int)Material.Metal, 1].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Metal, 1].surface.mu = mAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Metal, 1].surface.bounce = mAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Metal, 1].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Metal, 1].surface.soft_erp = 0.010f;
-
-            m_materialContacts[(int)Material.Glass, 0] = new d.Contact();
-            m_materialContacts[(int)Material.Glass, 0].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Glass, 0].surface.mu = 1f;
-            m_materialContacts[(int)Material.Glass, 0].surface.bounce = 0.5f;
-            m_materialContacts[(int)Material.Glass, 0].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Glass, 0].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Metal, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Metal, 1].surface.mu = 1.3f;
+            m_materialContacts[(int)Material.Metal, 1].surface.bounce = 0.2f;
+            m_materialContacts[(int)Material.Metal, 1].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Metal, 1].surface.soft_erp = 0.50f;

             /*
-                private float nmAvatarObjectContactFriction = 250f;
+				flags : d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce
+				private float nmAvatarObjectContactFriction = 250f;
                 private float nmAvatarObjectContactBounce = 0.1f;

                 private float mAvatarObjectContactFriction = 75f;
                 private float mAvatarObjectContactBounce = 0.1f;
             */
+            m_materialContacts[(int)Material.Glass, 0] = new d.Contact();
+            m_materialContacts[(int)Material.Glass, 0].surface.mode  = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Glass, 0].surface.mu = 1f;
+            m_materialContacts[(int)Material.Glass, 0].surface.bounce = 0.1f;
+            m_materialContacts[(int)Material.Glass, 0].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Glass, 0].surface.soft_erp = 0.50f;
+
             m_materialContacts[(int)Material.Glass, 1] = new d.Contact();
-            m_materialContacts[(int)Material.Glass, 1].surface.mode |= d.ContactFlags.SoftERP;
+            m_materialContacts[(int)Material.Glass, 1].surface.mode  = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
             m_materialContacts[(int)Material.Glass, 1].surface.mu = 1f;
-            m_materialContacts[(int)Material.Glass, 1].surface.bounce = 0.5f;
-            m_materialContacts[(int)Material.Glass, 1].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Glass, 1].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Glass, 1].surface.bounce = 0.1f;
+            m_materialContacts[(int)Material.Glass, 1].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Glass, 1].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Wood, 0] = new d.Contact();
-            m_materialContacts[(int)Material.Wood, 0].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Wood, 0].surface.mu = nmAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Wood, 0].surface.bounce = nmAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Wood, 0].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Wood, 0].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Wood, 0].surface.mode  = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Wood, 0].surface.mu = 1.6f;
+            m_materialContacts[(int)Material.Wood, 0].surface.bounce = 0.1f;
+            m_materialContacts[(int)Material.Wood, 0].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Wood, 0].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Wood, 1] = new d.Contact();
-            m_materialContacts[(int)Material.Wood, 1].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Wood, 1].surface.mu = mAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Wood, 1].surface.bounce = mAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Wood, 1].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Wood, 1].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Wood, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Wood, 1].surface.mu = 1.6f;
+            m_materialContacts[(int)Material.Wood, 1].surface.bounce = 0.1f;
+            m_materialContacts[(int)Material.Wood, 1].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Wood, 1].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Flesh, 0] = new d.Contact();
-            m_materialContacts[(int)Material.Flesh, 0].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Flesh, 0].surface.mu = nmAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Flesh, 0].surface.bounce = nmAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Flesh, 0].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Flesh, 0].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Flesh, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Flesh, 0].surface.mu = 2.0f;
+            m_materialContacts[(int)Material.Flesh, 0].surface.bounce = 0.0f;
+            m_materialContacts[(int)Material.Flesh, 0].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Flesh, 0].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Flesh, 1] = new d.Contact();
-            m_materialContacts[(int)Material.Flesh, 1].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Flesh, 1].surface.mu = mAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Flesh, 1].surface.bounce = mAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Flesh, 1].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Flesh, 1].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Flesh, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Flesh, 1].surface.mu = 2.0f;
+            m_materialContacts[(int)Material.Flesh, 1].surface.bounce = 0.0f;
+            m_materialContacts[(int)Material.Flesh, 1].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Flesh, 1].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Plastic, 0] = new d.Contact();
-            m_materialContacts[(int)Material.Plastic, 0].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Plastic, 0].surface.mu = nmAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Plastic, 0].surface.bounce = nmAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Plastic, 0].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Plastic, 0].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Plastic, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Plastic, 0].surface.mu = 1.5f;
+            m_materialContacts[(int)Material.Plastic, 0].surface.bounce = 0.2f;
+            m_materialContacts[(int)Material.Plastic, 0].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Plastic, 0].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Plastic, 1] = new d.Contact();
-            m_materialContacts[(int)Material.Plastic, 1].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Plastic, 1].surface.mu = mAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Plastic, 1].surface.bounce = mAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Plastic, 1].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Plastic, 1].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Plastic, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Plastic, 1].surface.mu = 1.5f;
+            m_materialContacts[(int)Material.Plastic, 1].surface.bounce = 0.2f;
+            m_materialContacts[(int)Material.Plastic, 1].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Plastic, 1].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Rubber, 0] = new d.Contact();
-            m_materialContacts[(int)Material.Rubber, 0].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Rubber, 0].surface.mu = nmAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Rubber, 0].surface.bounce = nmAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Rubber, 0].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Rubber, 0].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Rubber, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Rubber, 0].surface.mu = 2.0f;
+            m_materialContacts[(int)Material.Rubber, 0].surface.bounce = 0.7f;
+            m_materialContacts[(int)Material.Rubber, 0].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Rubber, 0].surface.soft_erp = 0.50f;

             m_materialContacts[(int)Material.Rubber, 1] = new d.Contact();
-            m_materialContacts[(int)Material.Rubber, 1].surface.mode |= d.ContactFlags.SoftERP;
-            m_materialContacts[(int)Material.Rubber, 1].surface.mu = mAvatarObjectContactFriction;
-            m_materialContacts[(int)Material.Rubber, 1].surface.bounce = mAvatarObjectContactBounce;
-            m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.010f;
-            m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.010f;
+            m_materialContacts[(int)Material.Rubber, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
+            m_materialContacts[(int)Material.Rubber, 1].surface.mu = 2.0f;
+            m_materialContacts[(int)Material.Rubber, 1].surface.bounce = 0.7f;
+            m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.0f;
+            m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.50f;

             d.HashSpaceSetLevels(space, worldHashspaceLow, worldHashspaceHigh);

@@ -660,10 +673,13 @@
             d.WorldSetGravity(world, gravityx, gravityy, gravityz);
             d.WorldSetContactSurfaceLayer(world, contactsurfacelayer);

+
+            d.WorldSetLinearDampingThreshold(world, 256f);
             d.WorldSetLinearDamping(world, 256f);
+//            d.WorldSetLinearDampingThreshold(world, 0.01f);
+//            d.WorldSetLinearDamping(world, 0.1f);
+            d.WorldSetAngularDampingThreshold(world, 256f);
             d.WorldSetAngularDamping(world, 256f);
-            d.WorldSetAngularDampingThreshold(world, 256f);
-            d.WorldSetLinearDampingThreshold(world, 256f);
             d.WorldSetMaxAngularSpeed(world, 256f);

             // Set how many steps we go without running collision testing
@@ -1184,7 +1200,7 @@
                         {
                             if ((Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f))
                             {
-                                // Use the Movement prim contact
+                                // Use the AV Movement / prim contact
                                 AvatarMovementprimContact.geom = curContact;
                                 _perloopContact.Add(curContact);
                                 if (m_global_contactcount < maxContactsbeforedeath)
@@ -1195,7 +1211,7 @@
                             }
                             else
                             {
-                                // Use the non movement contact
+                                // Use the Av non movement / prim contact
                                 contact.geom = curContact;
                                 _perloopContact.Add(curContact);


Whitespace fix

Whitespace fix

--- OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -4066,4 +4066,4 @@
             public Vector3 value;
         }
     }
-}+}


Improve UdpOscClient reliability

Improve UdpOscClient reliability

- SendAsync was throwing an exception directly (instead of returning a faulted task) after disposal
- If we get a socket failure while receiving, we should retry

(There's still more work to do here, but it's a start.)

--- OscMixerControl/OscMixerControl/UdpOscClient.cs
+++ OscMixerControl/OscMixerControl/UdpOscClient.cs
@@ -26,27 +26,42 @@
             StartReceiving();
         }

-        public Task SendAsync(OscPacket packet)
+        public async Task SendAsync(OscPacket packet)
         {
             var data = packet.ToByteArray();
-            return client.SendAsync(data, data.Length);
+            await client.SendAsync(data, data.Length).ConfigureAwait(false);
         }

-        public Task SendAsync(OscPacket packet, IPEndPoint endPoint)
+        public async Task SendAsync(OscPacket packet, IPEndPoint endPoint)
         {
             var data = packet.ToByteArray();
-            return client.SendAsync(data, data.Length, endPoint);
+            await client.SendAsync(data, data.Length, endPoint).ConfigureAwait(false);
         }

+        // TODO: Avoid async void methods, and observe exceptions more appropriately.
         private async void StartReceiving()
         {
             while (!cts.IsCancellationRequested)
             {
-                var result = await client.ReceiveAsync();
-                var buffer = result.Buffer;
-                var packet = OscPacket.Read(buffer, 0, buffer.Length);
-                // TODO: Maybe do this asynchronously...
-                PacketReceived?.Invoke(this, packet);
+                try
+                {
+                    var result = await client.ReceiveAsync();
+                    var buffer = result.Buffer;
+                    var packet = OscPacket.Read(buffer, 0, buffer.Length);
+                    // TODO: Maybe do this asynchronously...
+                    PacketReceived?.Invoke(this, packet);
+                }
+                catch (SocketException)
+                {
+                    // We'll keep trying to receive data; we expect
+                    // the caller to dispose of this object (which will break
+                    // the loop) if they want to stop fully.
+                    await Task.Delay(1000);
+                }
+                catch (ObjectDisposedException)
+                {
+                    // Just a timing issue; we'll exit the loop imminently.
+                }
             }
         }


get current git version

get current git version

--- EyeInTheSky/Commands/Version.cs
+++ EyeInTheSky/Commands/Version.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -19,34 +20,26 @@
         protected override void execute(User source, string destination, string[] tokens)
         {
             string bindir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Substring(6);
-            DirectoryInfo di = new DirectoryInfo(bindir);
-            di = di.Parent; //bin
-            di = di.Parent; //eyeinthesky
-            di = di.Parent; //eyeinthesky
-            di = di.GetDirectories(".git")[0]; // .git
-
-
+
             if (GlobalFunctions.realArrayLength(tokens) < 1)
             {
-                // look at .git/HEAD
-                StreamReader sr = new StreamReader(di.FullName + "/HEAD");
-                // get commit id from it
-                string head = sr.ReadLine();
-                sr.Close();
-                if (head.StartsWith("ref:"))
-                {
-                    EyeInTheSkyBot.irc_freenode.ircPrivmsg(destination, "Current " + head);
-                }
-                else
-                {
-                    // look in .git/info/refs
-                    sr = new StreamReader(di.FullName + "/info/refs");
+                Process p = new Process
+                                {
+                                    StartInfo =
+                                        {
+                                            UseShellExecute = false,
+                                            RedirectStandardOutput = true,
+                                            FileName = "git",
+                                            Arguments = "describe"
+                                        }
+                                };
+                p.Start();

-                    // find first line which has the commit id
-                    // split line at whitespace - second part has the ref name ("refs/tags/release-1.2")
-                    sr.Close();
-                }
+                string output = p.StandardOutput.ReadToEnd();
+
+                p.WaitForExit();

+                EyeInTheSkyBot.irc_freenode.ircPrivmsg(destination, output);
                 return;
             }