Try/Catch/Finally DataBase

Try/Catch/Finally DataBase

--- DataAccessLayer/SQLAccess.cs
+++ DataAccessLayer/SQLAccess.cs
@@ -52,38 +52,48 @@
         public Jedi SelectJediById(int idJedi)
         {
             Jedi _jedi = null;
-            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString)) {
-                string requete = "SELECT idJedi, Name, IsSith, Pic From Jedis WHERE idJedi =@idJedi;";
-                SqlCommand sqlcommand = new SqlCommand(requete, sqlConnection);
-                sqlcommand.Parameters.AddWithValue("@idJedi",Jedi_enum.IDJEDI);
-                sqlConnection.Open();
-                SqlDataReader sqlDataReader = sqlcommand.ExecuteReader();
-                while (sqlDataReader.Read()) {
-                    List<Caracteristique> _carac = new List<Caracteristique>();
-                    using (SqlConnection sqlConnection2 = new SqlConnection(m_connectionString))
+            try
+            {
+                using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
+                {
+                    string requete = "SELECT idJedi, Name, IsSith, Pic From Jedis WHERE idJedi =@idJedi;";
+                    SqlCommand sqlcommand = new SqlCommand(requete, sqlConnection);
+                    sqlcommand.Parameters.AddWithValue("@idJedi", Jedi_enum.IDJEDI);
+                    sqlConnection.Open();
+                    SqlDataReader sqlDataReader = sqlcommand.ExecuteReader();
+                    while (sqlDataReader.Read())
                     {
-                        string requete2 = "SELECT c.idCarac, c.idJedi, c.idStade, c.Nom, c.Valeur From Carac c WHERE c.idJedi=@idJedi;";
-                        SqlCommand sqlcommand2 = new SqlCommand(requete2, sqlConnection);
-                        sqlcommand2.Parameters.AddWithValue("@idJedi", Carac_enum.IDJEDI);
-                        sqlConnection2.Open();
-                        SqlDataReader sqlDataReader2 = sqlcommand2.ExecuteReader();
-                        while (sqlDataReader2.Read())
+                        List<Caracteristique> _carac = new List<Caracteristique>();
+                        using (SqlConnection sqlConnection2 = new SqlConnection(m_connectionString))
                         {
-                            _carac.Add(new Caracteristique(sqlDataReader2.GetInt32((int)Carac_enum.IDCARAC),
-                                                          sqlDataReader2.GetString((int)Carac_enum.NOM),
-                                                          sqlDataReader2.GetInt32((int)Carac_enum.VALEUR))
-                                );
+                            string requete2 = "SELECT c.idCarac, c.idJedi, c.idStade, c.Nom, c.Valeur From Carac c WHERE c.idJedi=@idJedi;";
+                            SqlCommand sqlcommand2 = new SqlCommand(requete2, sqlConnection);
+                            sqlcommand2.Parameters.AddWithValue("@idJedi", Carac_enum.IDJEDI);
+                            sqlConnection2.Open();
+                            SqlDataReader sqlDataReader2 = sqlcommand2.ExecuteReader();
+                            while (sqlDataReader2.Read())
+                            {
+                                _carac.Add(new Caracteristique(sqlDataReader2.GetInt32((int)Carac_enum.IDCARAC),
+                                                              sqlDataReader2.GetString((int)Carac_enum.NOM),
+                                                              sqlDataReader2.GetInt32((int)Carac_enum.VALEUR))
+                                    );
+                            }
+                            sqlConnection2.Close();
                         }
-                        sqlConnection2.Close();
+                        _jedi = new Jedi(sqlDataReader.GetInt32((int)Jedi_enum.IDJEDI),
+                                         sqlDataReader.GetString((int)Jedi_enum.NAME),
+                                         sqlDataReader.GetBoolean((int)Jedi_enum.ISSITH),
+                                         _carac);
+                        //int id, string nom, bool isSith, List<Caracteristique> carac
                     }
-                            _jedi = new Jedi(sqlDataReader.GetInt32((int)Jedi_enum.IDJEDI),
-                                             sqlDataReader.GetString((int)Jedi_enum.NAME),
-                                             sqlDataReader.GetBoolean((int)Jedi_enum.ISSITH),
-                                             _carac);
-                    //int id, string nom, bool isSith, List<Caracteristique> carac
-                }
-                sqlConnection.Close();
-            }
+                    sqlConnection.Close();
+                }
+            }
+            catch (SqlException e)
+            {
+                string s = e.Message;
+            }
+
             return _jedi;
         }
         public List<Jedi> SelectAllJedis()
@@ -91,39 +101,49 @@
             List<Jedi> _allJedis = new List<Jedi>();
             using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
             {
-                string requete = "SELECT idJedi, Name, isSith, Pic FROM Jedis;";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-                sqlConnection.Open();
-                SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
-                while (sqlDataReader.Read())
-                {
-                    List<Caracteristique> _carac = new List<Caracteristique>();
-                    using (SqlConnection sqlConnection2 = new SqlConnection(m_connectionString))
+                try
+                {
+                    string requete = "SELECT idJedi, Name, isSith, Pic FROM Jedis;";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlConnection.Open();
+                    SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
+                    while (sqlDataReader.Read())
                     {
-                        string _idjedi = sqlDataReader.GetInt32((int)Jedi_enum.IDJEDI).ToString(); ;
-                        string requete2 = "SELECT carac.idCarac, carac.idJedi, carac.idStade, carac.Nom ,carac.Valeur FROM Jedis jedi, Carac carac WHERE jedi.idJedi=" + _idjedi + " AND jedi.idJedi=carac.idJedi;";
-                        SqlCommand sqlCommand2 = new SqlCommand(requete2, sqlConnection2);
-                        sqlConnection2.Open();
-
-                        SqlDataReader sqlDataReader2 = sqlCommand2.ExecuteReader();//creation d'une nouvelle sqlDataReader2
-                        while (sqlDataReader2.Read())
+                        List<Caracteristique> _carac = new List<Caracteristique>();
+                        using (SqlConnection sqlConnection2 = new SqlConnection(m_connectionString))
                         {
-                            _carac.Add(new Caracteristique(sqlDataReader2.GetInt32((int)Carac_enum.IDCARAC),
-                                                          sqlDataReader2.GetString((int)Carac_enum.NOM),
-                                                          sqlDataReader2.GetInt32((int)Carac_enum.VALEUR))
-                              );
+                            string _idjedi = sqlDataReader.GetInt32((int)Jedi_enum.IDJEDI).ToString(); ;
+                            string requete2 = "SELECT carac.idCarac, carac.idJedi, carac.idStade, carac.Nom ,carac.Valeur FROM Jedis jedi, Carac carac WHERE jedi.idJedi=" + _idjedi + " AND jedi.idJedi=carac.idJedi;";
+                            SqlCommand sqlCommand2 = new SqlCommand(requete2, sqlConnection2);
+                            sqlConnection2.Open();
+
+                            SqlDataReader sqlDataReader2 = sqlCommand2.ExecuteReader();//creation d'une nouvelle sqlDataReader2
+                            while (sqlDataReader2.Read())
+                            {
+                                _carac.Add(new Caracteristique(sqlDataReader2.GetInt32((int)Carac_enum.IDCARAC),
+                                                              sqlDataReader2.GetString((int)Carac_enum.NOM),
+                                                              sqlDataReader2.GetInt32((int)Carac_enum.VALEUR))
+                                  );
+                            }
+                            sqlConnection2.Close();
+                            //jointure entre les 2 tables
                         }
-                        sqlConnection2.Close();
-                        //jointure entre les 2 tables
+                        // int id, string nom, bool isSith, List< Caracteristique > carac
+                        _allJedis.Add(new Jedi(sqlDataReader.GetInt32((int)Jedi_enum.IDJEDI),
+                                               sqlDataReader.GetString((int)Jedi_enum.NAME),
+                                               sqlDataReader.GetBoolean((int)Jedi_enum.ISSITH),
+                                               _carac,
+                                               sqlDataReader.GetString((int)Jedi_enum.PIC)));
                     }
-                    // int id, string nom, bool isSith, List< Caracteristique > carac
-                    _allJedis.Add(new Jedi(sqlDataReader.GetInt32((int)Jedi_enum.IDJEDI),
-                                           sqlDataReader.GetString((int)Jedi_enum.NAME),
-                                           sqlDataReader.GetBoolean((int)Jedi_enum.ISSITH),
-                                           _carac,
-                                           sqlDataReader.GetString((int)Jedi_enum.PIC)));
-                }
-                sqlConnection.Close();
+                }
+                catch (SqlException e)
+                {
+                    string s = e.Message;
+                }
+                finally
+                {
+                    sqlConnection.Close();
+                }
             }
             return _allJedis;
         }
@@ -133,16 +153,24 @@
             int nb = 0;
             using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
             {
-                string requete = "INSERT INTO Jedis (Name, IsSith, Pic) VALUES (@Name, @IsSith, @Pic)";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-                sqlCommand.Parameters.AddWithValue("@Name", _jedi.Nom);
-                sqlCommand.Parameters.AddWithValue("@IsSith", _jedi.IsSith);
-                sqlCommand.Parameters.AddWithValue("@Pic", _jedi.Photo);
-                sqlConnection.Open();
-                sqlCommand.ExecuteNonQuery();
-
-                sqlConnection.Close();
-
+                try
+                {
+                    string requete = "INSERT INTO Jedis (Name, IsSith, Pic) VALUES (@Name, @IsSith, @Pic)";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlCommand.Parameters.AddWithValue("@Name", _jedi.Nom);
+                    sqlCommand.Parameters.AddWithValue("@IsSith", _jedi.IsSith);
+                    sqlCommand.Parameters.AddWithValue("@Pic", _jedi.Photo);
+                    sqlConnection.Open();
+                    sqlCommand.ExecuteNonQuery();
+                }
+                catch (SqlException e)
+                {
+                    string s = e.Message;
+                }
+                finally
+                {
+                    sqlConnection.Close();
+                }
                 nb = 1;
             }

@@ -154,12 +182,22 @@
             int val = 0;
             using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
             {
-                string requete = "DELETE FROM Jedis WHERE idJedi='@idJedi'";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-                sqlCommand.Parameters.AddWithValue("@id", _jedi.ID);
-                sqlConnection.Open();
-                sqlCommand.ExecuteNonQuery();
-                sqlConnection.Close();
+                try
+                {
+                    string requete = "DELETE FROM Jedis WHERE idJedi='@idJedi'";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlCommand.Parameters.AddWithValue("@id", _jedi.ID);
+                    sqlConnection.Open();
+                    sqlCommand.ExecuteNonQuery();
+                }
+                catch (SqlException e)
+                {
+                    string s = e.Message;
+                }
+                finally
+                {
+                    sqlConnection.Close();
+                }
                 val = 1;
             }
             return val;
@@ -175,15 +213,22 @@
             int val = 0;
             using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
             {
-                string requete = "UPDATE Jedis SET Name=@name, IsSith=@Sith, Pic=@pic WHERE idJedi=@idjedi";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-                sqlCommand.Parameters.AddWithValue("@idjedi", _jedi.ID);
-                sqlCommand.Parameters.AddWithValue("@name", _jedi.Nom);
-                sqlCommand.Parameters.AddWithValue("@Sith", _jedi.IsSith);
-                sqlCommand.Parameters.AddWithValue("@pic", _jedi.Photo);
-                sqlConnection.Open();
-                sqlCommand.ExecuteNonQuery();
-                sqlConnection.Close();
+                try {
+                    string requete = "UPDATE Jedis SET Name=@name, IsSith=@Sith, Pic=@pic WHERE idJedi=@idjedi";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlCommand.Parameters.AddWithValue("@idjedi", _jedi.ID);
+                    sqlCommand.Parameters.AddWithValue("@name", _jedi.Nom);
+                    sqlCommand.Parameters.AddWithValue("@Sith", _jedi.IsSith);
+                    sqlCommand.Parameters.AddWithValue("@pic", _jedi.Photo);
+                    sqlConnection.Open();
+                    sqlCommand.ExecuteNonQuery();
+                }
+                catch (SqlException e) {
+                    string s = e.Message;
+                }
+                finally {
+                    sqlConnection.Close();
+                }
                 val = 1;
             }
             return val;
@@ -195,150 +240,213 @@
             List<Stade> _allStades = new List<Stade>();
             using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
             {
-                string requete = "SELECT idStade, nbPlaces, planet, Pic FROM Stade;";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-                sqlConnection.Open();
-                SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
-                while (sqlDataReader.Read())
-                {
-                    List<Caracteristique> _carac = new List<Caracteristique>();
-                    using (SqlConnection sqlConnection2 = new SqlConnection(m_connectionString))
+                try {
+                    string requete = "SELECT idStade, nbPlaces, planet, Pic FROM Stade;";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlConnection.Open();
+                    SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
+                    while (sqlDataReader.Read())
                     {
-                        string id = sqlDataReader.GetInt32((int)Stade_enum.IDSTADE).ToString(); ;
-                        string requete2 = "SELECT carac.idCarac, carac.idJedi, carac.idStade, carac.Nom ,carac.Valeur FROM Stade stade, Carac carac WHERE stade.idStade=" + id + " AND stade.idStade=carac.idStade;";
-                        SqlCommand sqlCommand2 = new SqlCommand(requete2, sqlConnection2);
-                        sqlConnection2.Open();
-                        SqlDataReader sqlDataReader2 = sqlCommand2.ExecuteReader();//creation d'une nouvelle sqlDataReader2
-                        while (sqlDataReader2.Read())
+                        List<Caracteristique> _carac = new List<Caracteristique>();
+                        using (SqlConnection sqlConnection2 = new SqlConnection(m_connectionString))
                         {
-                            _carac.Add(new Caracteristique(sqlDataReader2.GetInt32((int)Carac_enum.IDCARAC),
-                                                          sqlDataReader2.GetString((int)Carac_enum.NOM),
-                                                          sqlDataReader2.GetInt32((int)Carac_enum.VALEUR)));
+                            try {
+                            string id = sqlDataReader.GetInt32((int)Stade_enum.IDSTADE).ToString(); ;
+                            string requete2 = "SELECT carac.idCarac, carac.idJedi, carac.idStade, carac.Nom ,carac.Valeur FROM Stade stade, Carac carac WHERE stade.idStade=" + id + " AND stade.idStade=carac.idStade;";
+                            SqlCommand sqlCommand2 = new SqlCommand(requete2, sqlConnection2);
+                            sqlConnection2.Open();
+                            SqlDataReader sqlDataReader2 = sqlCommand2.ExecuteReader();//creation d'une nouvelle sqlDataReader2
+                            while (sqlDataReader2.Read())
+                            {
+                                _carac.Add(new Caracteristique(sqlDataReader2.GetInt32((int)Carac_enum.IDCARAC),
+                                                              sqlDataReader2.GetString((int)Carac_enum.NOM),
+                                                              sqlDataReader2.GetInt32((int)Carac_enum.VALEUR)));
+                            }
+                        }catch (SqlException e) {
+                                string s = e.Message;
+                            }
+                        finally {
+                        sqlConnection2.Close();
                         }
-                        sqlConnection2.Close();
-                        _allStades.Add(new Stade(sqlDataReader.GetInt32((int)Stade_enum.IDSTADE),
-                                           sqlDataReader.GetInt32((int)Stade_enum.NBPLACES),
+                            _allStades.Add(new Stade(sqlDataReader.GetInt32((int)Stade_enum.IDSTADE),
+                                               sqlDataReader.GetInt32((int)Stade_enum.NBPLACES),
+                                               sqlDataReader.GetString((int)Stade_enum.PLANET),
+                                               _carac,
+                                               sqlDataReader.GetString((int)Stade_enum.PIC)));
+                        }
+                    }
+                }
+                catch (SqlException e) {
+                    string s = e.Message;
+                }
+                finally {
+                    sqlConnection.Close();
+                }
+            }
+            return _allStades;
+        }
+
+        public int InsertStade(Stade _stade)
+        {
+            int val = 0;
+            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
+            {   //idStade = auto_increment
+                try {
+                    string requete = "INSERT INTO Stade (nbPlaces, planet, Pic) VALUES (@nbplaces, @planet, @pic)";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlCommand.Parameters.AddWithValue("@nbplaces", _stade.NbPlaces);
+                    sqlCommand.Parameters.AddWithValue("@planet", _stade.Planete);
+                    sqlCommand.Parameters.AddWithValue("@pic", _stade.Photo);
+                    sqlConnection.Open();
+                    sqlCommand.ExecuteNonQuery();
+                }
+                catch (SqlException e)
+                {
+                    string s = e.Message;
+                }
+                finally
+                {
+                    sqlConnection.Close();
+                }
+                val = 1;
+            }
+            return val;
+        }
+
+        public int RemoveStade(Stade _stade)
+        {
+            int val = 0;
+            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
+            {
+                try {
+                    string requete = "DELETE FROM Stade WHERE idStade='@idStade'";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlCommand.Parameters.AddWithValue("@idStade", _stade.ID);
+                    sqlConnection.Open();
+                    sqlCommand.ExecuteNonQuery();
+                }
+                catch (SqlException e) {
+                    string s = e.Message;
+                }
+                 finally
+                {
+                    sqlConnection.Close();
+                }
+                val = 1;
+            }
+            return val;
+        }
+
+        public int EditStade(Stade _stade)
+        {
+            int val = 0;
+            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
+            {
+                try {
+                    string requete = "UPDATE Stade SET nbPlaces=@nbPlaces, planet=@planet, Pic=@pic WHERE idSade=@idStade";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlCommand.Parameters.AddWithValue("@idjedi", _stade.ID);
+                    sqlCommand.Parameters.AddWithValue("@nbPlaces", _stade.NbPlaces);
+                    sqlCommand.Parameters.AddWithValue("@planet", _stade.Planete);
+                    sqlCommand.Parameters.AddWithValue("@pic", _stade.Photo);
+                    sqlConnection.Open();
+                    sqlCommand.ExecuteNonQuery();
+                }
+                catch (SqlException e)
+                {
+                    string s = e.Message;
+                }
+                finally
+                {
+                    sqlConnection.Close();
+                }
+            val = 1;
+            }
+            return val;
+        }
+
+        public Stade selectStadeById(int idStade)
+        {
+            Stade _stade = null;
+            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
+            {
+                try {
+                    string requete = "SELECT idStade, nbPlaces, planet, Pic From Stade WHERE idStade =@idStade;";
+                    SqlCommand sqlcommand = new SqlCommand(requete, sqlConnection);
+                    sqlcommand.Parameters.AddWithValue("@idStade", Stade_enum.IDSTADE);
+                    sqlConnection.Open();
+                    SqlDataReader sqlDataReader = sqlcommand.ExecuteReader();
+                    while (sqlDataReader.Read())
+                    {
+                        List<Caracteristique> _carac = new List<Caracteristique>();
+                        using (SqlConnection sqlConnection2 = new SqlConnection(m_connectionString))
+                        {
+                            try {
+                            string requete2 = "SELECT c.idCarac, c.idJedi, c.idStade, c.Nom, c.Valeur From Carac c WHERE c.idStade=@idStade;";
+                            SqlCommand sqlcommand2 = new SqlCommand(requete2, sqlConnection);
+                            sqlcommand2.Parameters.AddWithValue("@idStade", Carac_enum.IDSTADE);
+                            sqlConnection2.Open();
+                            SqlDataReader sqlDataReader2 = sqlcommand2.ExecuteReader();
+                            while (sqlDataReader2.Read())
+                            {
+                                _carac.Add(new Caracteristique(sqlDataReader2.GetInt32((int)Carac_enum.IDCARAC),
+                                                              sqlDataReader2.GetString((int)Carac_enum.NOM),
+                                                              sqlDataReader2.GetInt32((int)Carac_enum.VALEUR))
+                                    );
+                            }
+                            }
+                            catch (SqlException e)
+                            {
+                                string s = e.Message;
+                            }
+                            finally
+                            {
+                                sqlConnection2.Close();
+                            }
+                        }
+                        //int id, int nbPlaces, string planete, List<Caracteristique> carac
+                        _stade = new Stade(sqlDataReader.GetInt32((int)Stade_enum.IDSTADE),
+                                           sqlDataReader.GetInt32((int)Stade_enum.NBPLACES),
                                            sqlDataReader.GetString((int)Stade_enum.PLANET),
-                                           _carac,
-                                           sqlDataReader.GetString((int)Stade_enum.PIC)));
+                                           _carac);
                     }
-                }
+                }catch (SqlException e)
+                {
+                    string s = e.Message;
+                }
+                finally
+                {
+                    sqlConnection.Close();
+                }
+        }
+            return _stade;
+        }
+        #endregion
+
+        public Tournoi selectTournoiById()
+        {
+            throw new NotImplementedException();
+        }
+
+        public int InsertTournoi(Tournoi _tournoi)
+        {
+            int val=0;
+            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
+            {
+                try {
+                    string requete = "INSERT INTO Tournoi (Nom) VALUES (@Nom)";
+                    SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
+                    sqlCommand.Parameters.AddWithValue("@Nom",_tournoi.Nom);
+                    sqlConnection.Open();
+                }catch (SqlException e)
+                {
+                    string s = e.Message;
+                }
+                finally
+                {
                 sqlConnection.Close();
-            }
-            return _allStades;
-        }
-
-        public int InsertStade(Stade _stade)
-        {
-            int val = 0;
-            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
-            {   //idStade = auto_increment
-                string requete = "INSERT INTO Stade (nbPlaces, planet, Pic) VALUES (@nbplaces, @planet, @pic)";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-                sqlCommand.Parameters.AddWithValue("@nbplaces", _stade.NbPlaces);
-                sqlCommand.Parameters.AddWithValue("@planet", _stade.Planete);
-                sqlCommand.Parameters.AddWithValue("@pic", _stade.Photo);
-                sqlConnection.Open();
-                sqlCommand.ExecuteNonQuery();
-                sqlConnection.Close();
-                val = 1;
-            }
-            return val;
-        }
-
-        public int RemoveStade(Stade _stade)
-        {
-            int val = 0;
-            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
-            {
-                string requete = "DELETE FROM Stade WHERE idStade='@idStade'";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-                sqlCommand.Parameters.AddWithValue("@idStade", _stade.ID);
-                sqlConnection.Open();
-                sqlCommand.ExecuteNonQuery();
-                sqlConnection.Close();
-                val = 1;
-            }
-            return val;
-        }
-
-        public int EditStade(Stade _stade)
-        {
-            int val = 0;
-            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
-            {
-                string requete = "UPDATE Stade SET nbPlaces=@nbPlaces, planet=@planet, Pic=@pic WHERE idSade=@idStade";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-
-                sqlCommand.Parameters.AddWithValue("@idjedi", _stade.ID);
-                sqlCommand.Parameters.AddWithValue("@nbPlaces", _stade.NbPlaces);
-                sqlCommand.Parameters.AddWithValue("@planet", _stade.Planete);
-                sqlCommand.Parameters.AddWithValue("@pic", _stade.Photo);
-                sqlConnection.Open();
-                sqlCommand.ExecuteNonQuery();
-                sqlConnection.Close();
-                val = 1;
-            }
-            return val;
-        }
-
-        public Stade selectStadeById(int idStade)
-        {
-            Stade _stade = null;
-            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
-            {
-                string requete = "SELECT idStade, nbPlaces, planet, Pic From Stade WHERE idStade =@idStade;";
-                SqlCommand sqlcommand = new SqlCommand(requete, sqlConnection);
-                sqlcommand.Parameters.AddWithValue("@idStade", Stade_enum.IDSTADE);
-                sqlConnection.Open();
-                SqlDataReader sqlDataReader = sqlcommand.ExecuteReader();
-                while (sqlDataReader.Read())
-                {
-                    List<Caracteristique> _carac = new List<Caracteristique>();
-                    using (SqlConnection sqlConnection2 = new SqlConnection(m_connectionString))
-                    {
-                        string requete2 = "SELECT c.idCarac, c.idJedi, c.idStade, c.Nom, c.Valeur From Carac c WHERE c.idStade=@idStade;";
-                        SqlCommand sqlcommand2 = new SqlCommand(requete2, sqlConnection);
-                        sqlcommand2.Parameters.AddWithValue("@idStade", Carac_enum.IDSTADE);
-                        sqlConnection2.Open();
-                        SqlDataReader sqlDataReader2 = sqlcommand2.ExecuteReader();
-                        while (sqlDataReader2.Read())
-                        {
-                            _carac.Add(new Caracteristique(sqlDataReader2.GetInt32((int)Carac_enum.IDCARAC),
-                                                          sqlDataReader2.GetString((int)Carac_enum.NOM),
-                                                          sqlDataReader2.GetInt32((int)Carac_enum.VALEUR))
-                                );
-                        }
-                        sqlConnection2.Close();
-                    }
-                    //int id, int nbPlaces, string planete, List<Caracteristique> carac
-                    _stade = new Stade(sqlDataReader.GetInt32((int)Stade_enum.IDSTADE),
-                                       sqlDataReader.GetInt32((int)Stade_enum.NBPLACES),
-                                       sqlDataReader.GetString((int)Stade_enum.PLANET),
-                                       _carac);
-                }
-                sqlConnection.Close();
-            }
-            return _stade;
-        }
-        #endregion
-
-        public Tournoi selectTournoiById()
-        {
-            throw new NotImplementedException();
-        }
-
-        public int InsertTournoi(Tournoi _tournoi)
-        {
-            int val=0;
-            using (SqlConnection sqlConnection = new SqlConnection(m_connectionString))
-            {
-                string requete = "INSERT INTO Tournoi (Nom) VALUES (@Nom)";
-                SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection);
-                sqlCommand.Parameters.AddWithValue("@Nom",_tournoi.Nom);
-                sqlConnection.Open();
-
-            }
+                }
+        }
             return val;
           }
         //---------------------------------------------------------------------------------------------------------------------------------------------------------------------


Better error checkign when we do PROOF calls.

--- LINQToTTree/LINQToTTreeLib/ExecutionCommon/ProofExecutor.cs
+++ LINQToTTree/LINQToTTreeLib/ExecutionCommon/ProofExecutor.cs
@@ -143,7 +143,7 @@
                 throw new InvalidOperationException(string.Format("Unable to locate compiled object named '{0}'.", objName));

             //
-            // Load up teh variables that need to go over to the cluster.
+            // Load up the variables that need to go over to the cluster.
             //

             TraceHelpers.TraceInfo(20, "RunNtupleQuery: Saving the objects we are going to ship over");
@@ -165,13 +165,41 @@
             var rResult = pc.Process(PROOFDSNames(), objName, "");

             //
+            // We need to do two things to get at the actual status of the run:
+            //  1. Look at the TStatus object called "PROOF_Status"
+            //  2. Check to see if GetMissingFIles() is empty.
+            // http://root.cern.ch/phpBB3/viewtopic.php?f=13&t=14536&p=63081#p63081
+            //
+
+            bool runOK = true;
+            string failReason = "";
+            var tstatus = pc.GetOutputList().Cast<ROOTNET.Interface.NTStatus>().Where(i => i != null).Where(i => i.Name == "PROOF_Status").FirstOrDefault();
+            if (tstatus == null)
+            {
+                runOK = false;
+            } else {
+                runOK = tstatus.ExitStatus != 0;
+                if (!runOK)
+                    failReason = string.Format("PROOF query status, {0}, was not zero.", tstatus.ExitStatus);
+            }
+
+            if (runOK)
+            {
+                runOK = pc.GetMissingFiles().NFiles == 0;
+                if (!runOK)
+                    failReason = string.Format("PROOF query failed because there were {0} missing files", pc.GetMissingFiles().NFiles);
+            }
+
+
+            //
             // There is an error if the result is non zero or there is an error in the short log.
             // If there is an error, build a full log message and throw it!
             //

-            var logMessages = pc.GetLastLog();
-            if (rResult != 0 || logMessages.ContainsString("kPROOF_FATAL"))
-            {
+            //if (rResult != 0 || logMessages.ContainsString("kPROOF_FATAL"))
+            if (!runOK)
+            {
+                var logMessages = pc.GetLastLog();
                 var mgr = pc.GetManager();
                 var logs = mgr.GetSessionLogs();
                 var macroLogs = logs.ListOfLogs.Cast<ROOTNET.Interface.NTProofLogElem>().Select(mc => mc.Macro);


Bug fixes

Bug fixes

--- Discord.Net/DiscordClient.cs
+++ Discord.Net/DiscordClient.cs
@@ -351,7 +351,8 @@
 						{
 							var data = e.Event.ToObject<WebSocketEvents.MessageDelete>();
 							var msg = GetMessage(data.MessageId);
-							_messages.Remove(msg.Id);
+							if (msg != null)
+								_messages.Remove(msg.Id);
 						}
 						break;
 					case "MESSAGE_ACK":
@@ -464,9 +465,9 @@
 			var response = await DiscordAPI.CreateChannel(serverId, name, region, _httpOptions);
 			return _channels.Update(response.Id, response);
 		}
-		public Task<Channel> CreatePMChannel(User user, string name, string region)
-			=> CreateChannel(user.Id, name, region);
-		public async Task<Channel> CreatePMChannel(string recipientId, string name, string region)
+		public Task<Channel> CreatePMChannel(User user)
+			=> CreatePMChannel(user.Id);
+		public async Task<Channel> CreatePMChannel(string recipientId)
 		{
 			CheckReady();
 			var response = await DiscordAPI.CreatePMChannel(UserId, recipientId, _httpOptions);


Fix: Remove contract attrs.

Fix: Remove contract attrs.

The method is not a contract argument validator.

--- src/Narvalo.Cerbere/Enforce.cs
+++ src/Narvalo.Cerbere/Enforce.cs
@@ -50,7 +50,6 @@
         /// <see langword="null"/>.</exception>
         /// <exception cref="ArgumentException">Thrown if <paramref name="value"/> is
         /// <see langword="null"/> or empty, or does not consist only of white-space characters.</exception>
-        [ContractArgumentValidator]
         public static void PropertyNotWhiteSpace([ValidatedNotNull]string value)
         {
             Require.Property(value);
@@ -59,8 +58,6 @@
             {
                 throw new ArgumentException(Strings_Cerbere.ArgumentProperty_EmptyOrWhiteSpaceString, "value");
             }
-
-            Contract.EndContractBlock();
         }

         /// <remarks>


Reverted change to vanilla installer

Reverted change to vanilla installer

--- LinkedData.Website/App_Start/SitecoreLinkedDataInstaller.cs
+++ LinkedData.Website/App_Start/SitecoreLinkedDataInstaller.cs
@@ -37,11 +37,11 @@
         private static void SetupTripleStore(IWindsorContainer container)
         {
             //InMemory Triple Store for testing.
-            //container.Register(Component.For<IQueryableStorage>().ImplementedBy<InMemoryManager>().LifestyleSingleton());
+            container.Register(Component.For<IQueryableStorage>().ImplementedBy<InMemoryManager>().LifestyleSingleton());

             //Sesame Triple Store example.
-            container.Register(Component.For<IQueryableStorage>().ImplementedBy<SesameHttpProtocolVersion6Connector>().LifestyleSingleton()
-            .DependsOn(Dependency.OnValue("baseUri", "http://54.154.29.33:8080/openrdf-sesame"), Dependency.OnValue("storeID", "in-mem-sesame")));
+            //container.Register(Component.For<IQueryableStorage>().ImplementedBy<SesameHttpProtocolVersion6Connector>().LifestyleSingleton()
+            //.DependsOn(Dependency.OnValue("baseUri", "http://server_name:8080/openrdf-sesame"), Dependency.OnValue("storeID", "repository_name")));
         }

         /// <summary>


Method Name Fix

Method Name Fix

--- MailChimp.Api.Net/Services/Campaigns/MCCampaignsOverview.cs
+++ MailChimp.Api.Net/Services/Campaigns/MCCampaignsOverview.cs
@@ -38,7 +38,7 @@
         /// Get information about a specific campaign
         /// <param name="campaignId">Unique id for the campaign</param>
         /// </summary>
-        public async Task<Campaign> GetCampaignsByIdAsync(string campaignId)
+        public async Task<Campaign> GetCampaignByIdAsync(string campaignId)
         {
             string endpoint = Authenticate.EndPoint(TargetTypes.campaigns, SubTargetType.not_applicable, SubTargetType.not_applicable, campaignId);

@@ -57,7 +57,7 @@
         /// Delete a campaign
         /// <param name="campaignId">Unique id for the campaign</param>
         /// </summary>
-        public async Task<HttpResponseMessage> DeleteCampaignsByIdAsync(string campaignId)
+        public async Task<HttpResponseMessage> DeleteCampaignByIdAsync(string campaignId)
         {
             string endpoint = Authenticate.EndPoint(TargetTypes.campaigns, SubTargetType.not_applicable, SubTargetType.not_applicable, campaignId);

@@ -76,7 +76,7 @@
         /// Cancel a campaign
         /// <param name="campaignId">Unique id for the campaign</param>
         /// </summary>
-        public async Task<HttpResponseMessage> CancelCampaignsByIdAsync(string campaignId)
+        public async Task<HttpResponseMessage> CancelCampaignByIdAsync(string campaignId)
         {
             string endpoint = Authenticate.EndPoint(TargetTypes.campaigns, SubTargetType.action3, SubTargetType.not_applicable, campaignId);


GetTrimmingRectangleメソッドを見やすく修正

GetTrimmingRectangleメソッドを見やすく修正

--- WsGH/SceneRecognition.cs
+++ WsGH/SceneRecognition.cs
@@ -238,62 +238,44 @@
 		// 周囲をトリミングする
 		static Rectangle GetTrimmingRectangle(Bitmap bitmap) {
 			var rect = new Rectangle(new Point(0, 0), bitmap.Size);
+			var xRange = Enumerable.Range(0, bitmap.Width).DefaultIfEmpty(-1);
+			var yRange = Enumerable.Range(0, bitmap.Height).DefaultIfEmpty(-1);
 			// 上下左右の境界を取得する
 			var borderColor = Color.FromArgb(255, 255, 255);
 			// 左
-			for(int x = 0; x < bitmap.Width; ++x) {
-				bool borderFlg = false;
-				for(int y = 0; y < bitmap.Height; ++y) {
-					if(bitmap.GetPixel(x, y) != borderColor) {
-						borderFlg = true;
-						break;
-					}
-				}
-				if(borderFlg) {
+			foreach(var x in xRange) {
+				// borderColorと等しくない色を発見した場合、pos >= 0になる
+				var pos = yRange.FirstOrDefault(y => bitmap.GetPixel(x, y) != borderColor);
+				if(pos >= 0) {
 					rect.X = x;
 					rect.Width -= x;
 					break;
 				}
 			}
 			// 上
-			for(int y = 0; y < bitmap.Height; ++y) {
-				bool borderFlg = false;
-				for(int x = 0; x < bitmap.Width; ++x) {
-					if(bitmap.GetPixel(x, y) != borderColor) {
-						borderFlg = true;
-						break;
-					}
-				}
-				if(borderFlg) {
+			foreach(var y in yRange) {
+				// borderColorと等しくない色を発見した場合、pos >= 0になる
+				var pos = xRange.FirstOrDefault(x => bitmap.GetPixel(x, y) != borderColor);
+				if(pos >= 0) {
 					rect.Y = y;
 					rect.Height -= y;
 					break;
 				}
 			}
 			// 右
-			for(int x = bitmap.Width - 1; x >= 0; --x) {
-				bool borderFlg = false;
-				for(int y = 0; y < bitmap.Height; ++y) {
-					if(bitmap.GetPixel(x, y) != borderColor) {
-						borderFlg = true;
-						break;
-					}
-				}
-				if(borderFlg) {
+			foreach(var x in xRange.Reverse()) {
+				// borderColorと等しくない色を発見した場合、pos >= 0になる
+				var pos = yRange.FirstOrDefault(y => bitmap.GetPixel(x, y) != borderColor);
+				if(pos >= 0) {
 					rect.Width -= bitmap.Width - x - 1;
 					break;
 				}
 			}
 			// 下
-			for(int y = bitmap.Height - 1; y >= 0; --y) {
-				bool borderFlg = false;
-				for(int x = 0; x < bitmap.Width; ++x) {
-					if(bitmap.GetPixel(x, y) != borderColor) {
-						borderFlg = true;
-						break;
-					}
-				}
-				if(borderFlg) {
+			foreach(var y in yRange.Reverse()) {
+				// borderColorと等しくない色を発見した場合、pos >= 0になる
+				var pos = xRange.FirstOrDefault(x => bitmap.GetPixel(x, y) != borderColor);
+				if(pos >= 0) {
 					rect.Height -= bitmap.Height - y - 1;
 					break;
 				}


Forced extension of downloaded config file to .json

--- XESmartTarget/Program.cs
+++ XESmartTarget/Program.cs
@@ -93,7 +93,7 @@
                && (outUri.Scheme == Uri.UriSchemeHttp || outUri.Scheme == Uri.UriSchemeHttps))
             {
                 // save the URI to a file and point configuration there
-                options.ConfigurationFile = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.csv");
+                options.ConfigurationFile = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.json");
                 using (var client = new WebClient())
                 {
                     try


Fix extra line break problem

Fix extra line break problem

--- XamlStylerCui/Program.cs
+++ XamlStylerCui/Program.cs
@@ -126,7 +126,7 @@
             var outputText = styler.ManipulateTreeAndFormatInput(inputText);

             if (string.IsNullOrEmpty(outputFilepath))
-                Console.WriteLine(outputText);
+                Console.Write(outputText);
             else
                 File.WriteAllText(outputFilepath, outputText, Encoding.UTF8);
         }


extend DefaultColorSelectorBackend * replace text entries with spin buttons * add opacity slider

--- Xwt/Xwt/ColorSelector.cs
+++ Xwt/Xwt/ColorSelector.cs
@@ -101,17 +101,19 @@
 		HueBox hsBox;
 		LightBox lightBox;
 		ColorSelectionBox colorBox;
-		TextEntry hueEntry;
-		TextEntry satEntry;
-		TextEntry lightEntry;
-		TextEntry redEntry;
-		TextEntry greenEntry;
-		TextEntry blueEntry;
-		TextEntry alphaEntry;
+		SpinButton hueEntry;
+		SpinButton satEntry;
+		SpinButton lightEntry;
+		SpinButton redEntry;
+		SpinButton greenEntry;
+		SpinButton blueEntry;
+		SpinButton alphaEntry;
+		HSlider alphaSlider;
 		HSeparator alphaSeparator;
 		Color currentColor;
 		bool loadingEntries;
 		List<Widget> alphaControls = new List<Widget> ();
+		bool enableColorChangedEvent;

 		public DefaultColorSelectorBackend ()
 		{
@@ -132,7 +134,7 @@

 			box.PackStart (selBox);

-			int entryWidth = 40;
+			const int entryWidth = 40;
 			VBox entryBox = new VBox ();
 			Table entryTable = new Table ();

@@ -142,28 +144,37 @@

 			int r = 2;
 			entryTable.Add (new Label ("Hue:"), 0, r);
-			entryTable.Add (hueEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++);
+			entryTable.Add (hueEntry = new SpinButton () {
+				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 360, Digits = 0, IncrementValue = 1 }, 1, r++);

 			entryTable.Add (new Label ("Saturation:"), 0, r);
-			entryTable.Add (satEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++);
+			entryTable.Add (satEntry = new SpinButton () {
+				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++);

 			entryTable.Add (new Label ("Light:"), 0, r);
-			entryTable.Add (lightEntry = new TextEntry () { MinWidth = entryWidth }, 1, r++);
+			entryTable.Add (lightEntry = new SpinButton () {
+				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1 }, 1, r++);

 			r = 2;
 			entryTable.Add (new Label ("Red:"), 3, r);
-			entryTable.Add (redEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++);
+			entryTable.Add (redEntry = new SpinButton () {
+				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++);

 			entryTable.Add (new Label ("Green:"), 3, r);
-			entryTable.Add (greenEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++);
+			entryTable.Add (greenEntry = new SpinButton () {
+				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++);

 			entryTable.Add (new Label ("Blue:"), 3, r);
-			entryTable.Add (blueEntry = new TextEntry () { MinWidth = entryWidth }, 4, r++);
+			entryTable.Add (blueEntry = new SpinButton () {
+				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r++);

 			Label label;
 			entryTable.Add (alphaSeparator = new HSeparator (), 0, r++, colspan:5);
 			entryTable.Add (label = new Label ("Opacity:"), 0, r);
-			entryTable.Add (alphaEntry = new TextEntry () { MinWidth = entryWidth }, 1, r);
+			entryTable.Add (alphaSlider = new HSlider () {
+				MinimumValue = 0, MaximumValue = 255,  }, 1, r, colspan: 3);
+			entryTable.Add (alphaEntry = new SpinButton () {
+				MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1 }, 4, r);

 			alphaControls.Add (alphaSeparator);
 			alphaControls.Add (label);
@@ -180,13 +191,14 @@
 				HandleColorBoxSelectionChanged ();
 			};

-			hueEntry.Changed += HandleHslChanged;
-			satEntry.Changed += HandleHslChanged;
-			lightEntry.Changed += HandleHslChanged;
-			redEntry.Changed += HandleRgbChanged;
-			greenEntry.Changed += HandleRgbChanged;
-			blueEntry.Changed += HandleRgbChanged;
-			alphaEntry.Changed += HandleAlphaChanged;
+			hueEntry.ValueChanged += HandleHslChanged;
+			satEntry.ValueChanged += HandleHslChanged;
+			lightEntry.ValueChanged += HandleHslChanged;
+			redEntry.ValueChanged += HandleRgbChanged;
+			greenEntry.ValueChanged += HandleRgbChanged;
+			blueEntry.ValueChanged += HandleRgbChanged;
+			alphaEntry.ValueChanged += HandleAlphaChanged;
+			alphaSlider.ValueChanged += HandleAlphaChanged;

 			Color = Colors.White;
 		}
@@ -195,49 +207,47 @@
 		{
 			if (loadingEntries)
 				return;
-
-			int a;
-			if (!int.TryParse (alphaEntry.Text, out a))
-				return;
+
+			if (sender == alphaSlider)
+				alphaEntry.Value = alphaSlider.Value;
+			if (sender == alphaEntry)
+				alphaSlider.Value = alphaEntry.Value;
+
+			int a = Convert.ToInt32 (alphaEntry.Value);

 			currentColor = currentColor.WithAlpha ((double)a / 255d);
 			LoadColorBoxSelection ();
+			HandleColorChanged ();
 		}

 		void HandleHslChanged (object sender, EventArgs e)
 		{
 			if (loadingEntries)
 				return;
-
-			int h, s, l;
-			if (!int.TryParse (hueEntry.Text, out h))
-				return;
-			if (!int.TryParse (satEntry.Text, out s))
-				return;
-			if (!int.TryParse (lightEntry.Text, out l))
-				return;
-
+
+			int h = Convert.ToInt32 (hueEntry.Value);
+			int s = Convert.ToInt32 (satEntry.Value);
+			int l = Convert.ToInt32 (lightEntry.Value);
+
 			currentColor = Color.FromHsl ((double)h / 360d, (double)s / 100d, (double)l / 100d, currentColor.Alpha);
 			LoadColorBoxSelection ();
 			LoadRgbEntries ();
+			HandleColorChanged ();
 		}

 		void HandleRgbChanged (object sender, EventArgs e)
 		{
 			if (loadingEntries)
 				return;
-
-			int r, g, b;
-			if (!int.TryParse (redEntry.Text, out r))
-				return;
-			if (!int.TryParse (greenEntry.Text, out g))
-				return;
-			if (!int.TryParse (blueEntry.Text, out b))
-				return;
-
+
+			int r = Convert.ToInt32 (redEntry.Value);
+			int g = Convert.ToInt32 (greenEntry.Value);
+			int b = Convert.ToInt32 (blueEntry.Value);
+
 			currentColor = new Color ((double)r / 255d, (double)g / 255d, (double)b / 255d, currentColor.Alpha);
 			LoadColorBoxSelection ();
 			LoadHslEntries ();
+			HandleColorChanged ();
 		}

 		void HandleColorBoxSelectionChanged ()
@@ -251,28 +261,30 @@
 			colorBox.Color = currentColor;
 			LoadHslEntries ();
 			LoadRgbEntries ();
+			HandleColorChanged ();
 		}

 		void LoadAlphaEntry ()
 		{
-			alphaEntry.Text = ((int)(currentColor.Alpha * 255)).ToString ();
+			alphaEntry.Value = ((int)(currentColor.Alpha * 255));
+			alphaSlider.Value = ((int)(currentColor.Alpha * 255));
 		}

 		void LoadHslEntries ()
 		{
 			loadingEntries = true;
-			hueEntry.Text = ((int)(currentColor.Hue * 360)).ToString ();
-			satEntry.Text = ((int)(currentColor.Saturation * 100)).ToString ();
-			lightEntry.Text = ((int)(currentColor.Light * 100)).ToString ();
+			hueEntry.Value = ((int)(currentColor.Hue * 360));
+			satEntry.Value = ((int)(currentColor.Saturation * 100));
+			lightEntry.Value = ((int)(currentColor.Light * 100));
 			loadingEntries = false;
 		}

 		void LoadRgbEntries ()
 		{
 			loadingEntries = true;
-			redEntry.Text = ((int)(currentColor.Red * 255)).ToString ();
-			greenEntry.Text = ((int)(currentColor.Green * 255)).ToString ();
-			blueEntry.Text = ((int)(currentColor.Blue * 255)).ToString ();
+			redEntry.Value = ((int)(currentColor.Red * 255));
+			greenEntry.Value = ((int)(currentColor.Green * 255));
+			blueEntry.Value = ((int)(currentColor.Blue * 255));
 			loadingEntries = false;
 		}

@@ -309,6 +321,39 @@
 			}
 		}
 		#endregion
+
+
+		protected new IColorSelectorEventSink EventSink {
+			get { return (IColorSelectorEventSink)base.EventSink; }
+		}
+
+		public override void EnableEvent (object eventId)
+		{
+			base.EnableEvent (eventId);
+			if (eventId is ColorSelectorEvent) {
+				switch ((ColorSelectorEvent)eventId) {
+					case ColorSelectorEvent.ColorChanged: enableColorChangedEvent = true; break;
+				}
+			}
+		}
+
+		public override void DisableEvent (object eventId)
+		{
+			base.DisableEvent (eventId);
+			if (eventId is ColorSelectorEvent) {
+				switch ((ColorSelectorEvent)eventId) {
+					case ColorSelectorEvent.ColorChanged: enableColorChangedEvent = false; break;
+				}
+			}
+		}
+
+		void HandleColorChanged ()
+		{
+			if (enableColorChangedEvent)
+			Application.Invoke (delegate {
+				EventSink.OnColorChanged ();
+			});
+		}
 	}

 	class HueBox: Canvas


[Praveen 3/4] Have reverted Few Code, Which was used for testing purpose and accidently got checked in

--- lib/commonAPI/mediacapture/ext/platform/wp8/src/Camera_impl.cs
+++ lib/commonAPI/mediacapture/ext/platform/wp8/src/Camera_impl.cs
@@ -983,9 +983,8 @@
                         try
                         {
                             KeyValuePair<double, Size> CameraResolution = Rho_Supported_Resolutions.Aggregate((x, y) => Math.Abs(x.Value.Height - Rho_Paramenters["desired_height"]) < Math.Abs(y.Value.Height - Rho_Paramenters["desired_height"]) ? x : y);
-                            Size objsize = new Size(CameraResolution.Value.Height, CameraResolution.Value.Width);
-
-                            Rho_StillCamera.Resolution = objsize;
+
+                            Rho_StillCamera.Resolution = CameraResolution.Value;

                         }
                         catch (Exception ex)


integrated patch from http://opensimulator.org/mantis/view.php?id=7255:

When a script removes itself, the Scripting Engine does not recognize the removal. As a result, the apparent number of active scripts continually increases.

Signed-off-by: ft <d352dbdf6170085acaf7ed62197a4de1452a0073@noemail>

--- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -846,7 +846,7 @@
                 if (type == 10) // Script
                 {
                     m_part.RemoveScriptEvents(itemID);
-                    m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
+                    RemoveScriptInstance(itemID, false);
                 }
                 m_items.Remove(itemID);
                 m_inventorySerial++;


Performance
Improved performance of AppendJIT by performing a cumulative average
instead of recalculating for all points.

Conflicts:
	Duality/Drawing/DrawBatch.cs

--- Duality/Drawing/DrawBatch.cs
+++ Duality/Drawing/DrawBatch.cs
@@ -170,11 +170,11 @@
 			Array.Copy(data, 0, this.vertices, this.vertexCount, length);

 			if (this.material.Technique.Res.NeedsZSort)
-				// find the cumulative average for all of the points in the batch, rather than calculating from the start again.
-				this.zSortIndex = (data.Sum(v => v.Pos.Z) + this.VertexCount * zSortIndex) / (this.VertexCount + length);
+				this.zSortIndex = (SumZPositions(data) + this.VertexCount * zSortIndex) / (this.VertexCount + length);

 			this.vertexCount += length;
 		}
+
 		public bool CanAppend(IDrawBatch other)
 		{
 			return
@@ -226,5 +226,15 @@
 			}
 			return zSortIndex / count;
 		}
+
+		private static float SumZPositions(T[] data)
+		{
+			float sum = 0;
+			foreach (var vertex in data)
+			{
+				sum += vertex.Pos.Z;
+			}
+			return sum;
+		}
 	}
 }


Added CloseChannel methods to unexport GPIO pins when program is finished running. Resolves issue #7.

--- src/PiSharp.LibGpio/LibGpio.cs
+++ src/PiSharp.LibGpio/LibGpio.cs
@@ -82,6 +82,46 @@
         }

         /// <summary>
+        /// Closes a GPIO channel
+        /// </summary>
+        /// <param name="pinNumber">The Raspberry Pi pin number to configure</param>
+        public void CloseChannel(RaspberryPinNumber pinNumber)
+        {
+            this.CloseChannel(ConvertToBroadcom(pinNumber));
+        }
+
+        /// <summary>
+        /// Closes a GPIO channel
+        /// </summary>
+        /// <param name="pinNumber">The physical pin number to configure</param>
+        public void CloseChannel(PhysicalPinNumber pinNumber)
+        {
+            this.CloseChannel(ConvertToBroadcom(pinNumber));
+        }
+
+        /// <summary>
+        /// Closes a GPIO channel
+        /// </summary>
+        /// <param name="pinNumber">The Broadcom pin number to configure</param>
+        public void CloseChannel(BroadcomPinNumber pinNumber)
+        {
+            var outputName = string.Format("gpio{0}", (int)pinNumber);
+            var gpioPath = Path.Combine(this.GetGpioPath(), outputName);
+
+            if (Directory.Exists(gpioPath))
+            {
+                this.UnExport(pinNumber);
+
+                // Sets direction back to input.
+                this.SetDirection(pinNumber, Direction.Input);
+            }
+
+
+
+            Debug.WriteLine(string.Format("[PiSharp.LibGpio] Broadcom GPIO number '{0}', configured for use", pinNumber));
+        }
+
+        /// <summary>
         /// Configures a GPIO channel for use
         /// </summary>
         /// <param name="pinNumber">The Raspberry Pi pin number to configure</param>


Bumped up the version number to 0.5 since we made good progress and all operators are functional at this point.

--- src/Properties/AssemblyInfo.cs
+++ src/Properties/AssemblyInfo.cs
@@ -46,5 +46,5 @@

 [assembly: Guid("1d8ca19d-f7ef-47f2-8144-4099aab2b2b7")]

-[assembly: AssemblyVersion("0.2.1.0")]
-[assembly: AssemblyFileVersion("0.2.1.0")]
+[assembly: AssemblyVersion("0.5.0.0")]
+[assembly: AssemblyFileVersion("0.5.0.0")]


Updating version number

Updating version number

--- src/Properties/AssemblyInfo.cs
+++ src/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@
 [assembly: AssemblyCompany("Peppermint IT Limited")]
 [assembly: AssemblyProduct("Mockable Web Security")]
 [assembly: AssemblyCopyright("Copyright 2011 by Peppermint IT Limited")]
-[assembly: AssemblyVersion("0.0.0.188")]
+[assembly: AssemblyVersion("0.0.0.189")]

-[assembly: AssemblyFileVersion("0.0.0.188")]
+[assembly: AssemblyFileVersion("0.0.0.189")]


Added GetBitmapFromURI

Added GetBitmapFromURI

--- Eagleslist/RequestManager.cs
+++ Eagleslist/RequestManager.cs
@@ -3,6 +3,9 @@
 using System.Threading.Tasks;
 using Newtonsoft.Json;
 using System.Net.Http;
+using System.Windows.Media.Imaging;
+using System.Net;
+using System.IO;

 namespace Eagleslist
 {
@@ -23,6 +26,19 @@
             string url = "https://sourcekitserviceterminated.com/static/magic.json";
             string responseString = await Request(url);
             return await ListingsFromJSON(responseString);
+        }
+
+        public static async Task<BitmapImage> GetBitmapFromURI(Uri uri)
+        {
+            byte[] bytes = await new WebClient().DownloadDataTaskAsync(uri);
+
+            BitmapImage image = new BitmapImage();
+            image.BeginInit();
+            image.CacheOption = BitmapCacheOption.OnDemand;
+            image.StreamSource = new MemoryStream(bytes);
+            image.EndInit();
+
+            return image;
         }

         private async Task<string> Request(string url)


Added delete listing route

Added delete listing route

--- Eagleslist/RequestManager.cs
+++ Eagleslist/RequestManager.cs
@@ -132,6 +132,29 @@
             }
         }

+        public static async Task<bool> DeleteListing(Listing listing)
+        {
+            using (var client = new HttpClient(DefaultRequestHandler()))
+            {
+                var session = CredentialManager.GetCurrentUser()?.SessionID;
+
+                if (session == null || listing == null)
+                {
+                    return false;
+                }
+
+                var url = $"{RootUrl}apidb/listings/{listing.ListingID}/delete";
+
+                var payload = new Dictionary<string, object>() {
+                    { "SessionID", session }
+                };
+
+                var response = await SendObjectAsJson<ErrorResponse>(payload, url, client.PutAsync);
+
+                return response != null && string.IsNullOrEmpty(response.Error);
+            }
+        }
+
         public static async Task<User> AttemptLogin(LoginRequest request)
         {
             using (var client = new HttpClient(DefaultRequestHandler()))


Better debugging support.

Better debugging support.

When the editor plugin detects a debugger attaching, it will re-compile everything
so that the debugger will include the scripts modules.

--- EditorPlugin/EditorPlugin.cs
+++ EditorPlugin/EditorPlugin.cs
@@ -15,6 +15,8 @@
     public class ScriptingEditorPlugin : EditorPlugin
 	{
 	    private const string SolutionProjectReferences = "\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Scripts\", \"Scripts\\Scripts.csproj\", \"{1DC301F5-644D-4109-96C4-2158ABDED70D}\"\nEndProject";
+
+		private bool _debuggerAttachedLastFrame;

 	    public override string Id
 		{
@@ -41,7 +43,26 @@
 			FileEventManager.ResourceCreated += OnResourceCreated;

 			ModifySolution();
+
+			DualityEditorApp.Idling += DualityEditorAppOnIdling;
 		}
+
+	    private void DualityEditorAppOnIdling(object sender, EventArgs eventArgs)
+	    {
+			if (System.Diagnostics.Debugger.IsAttached && _debuggerAttachedLastFrame == false)
+			{
+				foreach (var script in ContentProvider.GetAvailableContent<ScriptResource>())
+				{
+					script.Res.Reload();
+				}
+
+				_debuggerAttachedLastFrame = true;
+			}
+			else if (System.Diagnostics.Debugger.IsAttached == false && _debuggerAttachedLastFrame)
+			{
+				_debuggerAttachedLastFrame = false;
+			}
+	    }

 	    private static void ModifySolution()
 	    {


- Applied patch #1992483 and reformatted document

git-svn-id: ad71a101fa69fb252e58119732bf51384d5dbd95@1291 bb9bf1cf-960d-0410-9a3a-baeba60cf407

--- Projects/Axiom/Source/Engine/Core/SceneManagerEnumerator.cs
+++ Projects/Axiom/Source/Engine/Core/SceneManagerEnumerator.cs
@@ -45,368 +45,371 @@

 namespace Axiom.Core
 {
-	///
-	///		Factory for default scene manager.
-	///
-	public class SceneManagerDefaultFactory : SceneManagerFactory
-	{
-		public SceneManagerDefaultFactory()
-		{
-
-		}
-
-		protected override void InitMetaData()
-		{
-			metaData.typeName = "DefaultSceneManager";
-			metaData.description = "The default scene manager";
-			metaData.sceneTypeMask = SceneType.Generic;
-			metaData.worldGeometrySupported = false;
-		}
-
-		public override SceneManager CreateInstance( string name )
-		{
-			return new DefaultSceneManager( name );
-		}
-
-		public override void DestroyInstance( SceneManager instance )
-		{
-			instance.ClearScene();
-		}
-
-	}
-
-	///
-	///		Default scene manager.
-	///
-	public class DefaultSceneManager : SceneManager
-	{
-		public DefaultSceneManager( string name )
-			: base( name )
-		{
-		}
-
-		public override string TypeName
-		{
-			get { return "DefaultSceneManager"; }
-		}
-	}
-
-	///
-	///     Enumerates the <see cref="SceneManager"/> classes available to applications.
-	///
-	/// <remarks>
-	///		As described in the SceneManager class, SceneManagers are responsible
-	///     for organising the scene and issuing rendering commands to the
-	///     <see cref="RenderSystem"/>. Certain scene types can benefit from different
-	///     rendering approaches, and it is intended that subclasses will
-	///     be created to special case this.
-	///

-	///     In order to give applications easy access to these implementations,
-	///     this class has a number of methods to create or retrieve a SceneManager
-	///     which is appropriate to the scene type.
-	///

-	///		SceneManagers are created by <see cref="SceneManagerFactory"/> instances. New factories
-	///		for new types of SceneManager can be registered with this class to make
-	///		them available to clients.
-	///

-	///		Note that you can still plug in your own custom SceneManager without
-	///		using a factory, should you choose, it's just not as flexible that way.
-	///		Just instantiate your own SceneManager manually and use it directly.
-	/// </remarks>
-	public sealed class SceneManagerEnumerator : Singleton<SceneManagerEnumerator>
-	{
-		private SceneManagerEnumerator()
-		{
-			_defaultFactory = new SceneManagerDefaultFactory ();
-			AddFactory( _defaultFactory );
-		}
-
-		#region Fields
-
-		private SceneManagerCollection _instances = new SceneManagerCollection();
-		private List<SceneManagerFactory> _factories = new List<SceneManagerFactory>();
-		private List<SceneManagerMetaData> _metaDataList = new List<SceneManagerMetaData>();
-		private SceneManagerDefaultFactory _defaultFactory;
-		private RenderSystem _currentRenderSystem;
-
-		private ulong _instanceCreateCount;
-
-		#endregion
-
-		#region Public Properties
-
-		///
-		///		Notifies all SceneManagers of the destination rendering system.
-		///
-		public RenderSystem RenderSytem
-		{
-			set
-			{
-				_currentRenderSystem = value;
-
-				foreach (SceneManager instance in _instances.Values)
-					instance.TargetRenderSystem = value;
-			}
-		}
-
-		///
-		///		A list of all types of SceneManager available for construction,
-		///		providing some information about each one.
-		///
-		public List<SceneManagerMetaData> MetaDataList
-		{
-			get
-			{
-				return _metaDataList;
-			}
-		}
-
-		///
-		///		A list of all types of SceneManager available for construction,
-		///		providing some information about each one.
-		///
-		public SceneManagerCollection SceneManagerList
-		{
-			get
-			{
-				return _instances;
-			}
-		}
-
-		#endregion
-
-		#region Public Methods
-
-		///
-		///		Registers a new <see cref="SceneManagerFactory"/>.
-		///
-		/// <remarks>
-		///		Plugins should call this to register as new <see cref="SceneManager"/> providers.
-		/// </remarks>
-		public void AddFactory( SceneManagerFactory factory )
-		{
-			_factories.Add( factory );
-			_metaDataList.Add( factory.MetaData );
-
-			LogManager.Instance.Write( "SceneManagerFactory for type '{0}' registered", factory.MetaData.typeName );
-		}
-
-		///
-		///		Removes a <see cref="SceneManagerFactory"/>.
-		///
-		public void RemoveFactory( SceneManagerFactory fact )
-		{
-			// destroy all instances for this factory
-			for( int i = 0; i < _instances.Values.Count; i++ )
-			{
-				if( _instances[ i ].TypeName == fact.MetaData.typeName )
-				{
-					fact.DestroyInstance( _instances[ i ] );
-					_instances.Remove( _instances[ i ] );
-				}
-			}
-
-			// remove from metadata
-			for ( int i = 0; i < _metaDataList.Count; i++ )
-			{
-				if ( _metaDataList[ i ].Equals( fact.MetaData ) )
-				{
-					_metaDataList.Remove( _metaDataList [ i ] );
-					break;
-				}
-			}
-
-			_factories.Remove( fact );
-		}
-
-		///
-		///		Creates a SceneManager instance based on scene type support.
-		///
-		/// <remarks>
-		///		Creates an instance of a SceneManager which supports the scene types
-		///		identified in the parameter. If more than one type of SceneManager
-		///		has been registered as handling that combination of scene types,
-		///		in instance of the last one registered is returned.
-		///

-		///		Note that this method always succeeds, if a specific scene manager is not
-		/// 	found, the default implementation is always returned.
-		/// </remarks>
-		/// <param name="sceneType">A mask containing one or more <see cref="SceneType"/> flags.</param>
-		/// <param name="instanceName">
-		///		Optional name to given the new instance that is created.
-		///		If you leave this blank, an auto name will be assigned.
-		/// </param>
-		/// <returns></returns>
-		public SceneManager CreateSceneManager( SceneType sceneType, string instanceName )
-		{
-			if ( _instances.ContainsKey( instanceName ) )
-			{
-				throw new AxiomException( "SceneManager instance called '{0}' already exists", instanceName );
-			}
-
-			SceneManager instance = null;
-
-			if ( instanceName == string.Empty )
-			{
-				instanceName = "SceneManagerInstance" + (++_instanceCreateCount).ToString();
-			}
-
-			// iterate backwards to find the matching factory registered last
-			for ( int i = _factories.Count -1 ; i > -1; i--)
-			{
-				if ( ( _factories[ i ].MetaData.sceneTypeMask & sceneType ) > 0 )
-				{
-					instance = _factories[ i ].CreateInstance( instanceName );
-					break;
-				}
-			}
-
-			// use default factory if none
-			if ( instance == null )
-				instance = _defaultFactory.CreateInstance(instanceName);
-
-			// assign render system if already configured
-			if ( _currentRenderSystem != null )
-				instance.TargetRenderSystem = _currentRenderSystem;
-
-			_instances.Add( instanceName, instance );
-
-			return instance;
-		}
-
-		///
-		///		Creates a SceneManager instance of a given type.
-		///
-		/// <remarks>
-		///		You can use this method to create a SceneManager instance of a
-		///		given specific type. You may know this type already, or you may
-		///		have discovered it by looking at the results from <see cref="SceneManagerEnumerator.MetaDataList"/>.
-		/// </remarks>
-		/// <param name="typeName">String identifying a unique SceneManager type.</param>
-		/// <param name="instanceName">
-		///		Optional name to given the new instance that is
-		///		created. If you leave this blank, an auto name will be assigned.
-		/// </param>
-		/// <exception cref="AxiomException">
-		///		This method throws an exception if the named type is not found.
-		/// </exception>
-		/// <returns></returns>
-		public SceneManager CreateSceneManager(string typeName, string instanceName)
-		{
-			if (_instances.ContainsKey(instanceName))
-			{
-				throw new AxiomException("SceneManager instance called '{0}' already exists", instanceName);
-			}
-
-			SceneManager instance = null;
-
-			foreach (SceneManagerFactory factory in _factories)
-			{
-				if (factory.MetaData.typeName == typeName)
-				{
-					if (instanceName == string.Empty)
-					{
-						instanceName = "SceneManagerInstance" + (++_instanceCreateCount).ToString();
-					}
-
-					instance = factory.CreateInstance(instanceName);
-					break;
-				}
-			}
-
-			if (instance == null)
-			{
-				throw new AxiomException("No factory found for scene manager of type '{0}'", typeName);
-			}
-
-			// assign render system if already configured
-			if (_currentRenderSystem != null)
-			{
-				instance.TargetRenderSystem = _currentRenderSystem;
-			}
-
-			_instances.Add(instance.Name, instance);
-
-			return instance;
-		}
-
-
-		///
-		///		Destroys an instance of a SceneManager.
-		///
-		/// <param name="sm"></param>
-		public void DestroySceneManager(SceneManager sm)
-		{
-			// erase instance from list
-			_instances.Remove(sm.Name);
-
-			foreach (SceneManagerFactory factory in _factories)
-			{
-				if (factory.MetaData.typeName == sm.TypeName)
-				{
-					factory.DestroyInstance(sm);
-				}
-			}
-
-		}
-
-		///
-		/// 	Gets an existing SceneManager instance that has already been created,
-		///		identified by the instance name.
-		///
-		/// <param name="instanceName"> The name of the instance to retrieve.</param>
-		/// <exception cref="AxiomException">If the instance can't be retrieved.</exception>
-		/// <returns></returns>
-		public SceneManager GetSceneManager( string instanceName)
-		{
-			if (!_instances.ContainsKey( instanceName ) )
-			{
-				throw new AxiomException( "SceneManager instance with name '{0}' not found", instanceName);
-			}
-
-			SceneManager sceneManager = _instances[ instanceName ] ;
-
-			return sceneManager;
-		}
-
-		///
-		///		Gets more information about a given type of SceneManager.
-		///
-		/// <remarks>
-		///		The metadata returned tells you a few things about a given type
-		///		of SceneManager, which can be created using a factory that has been
-		///		registered already.
-		/// </remarks>
-		/// <param name="typeName">
-		///		The type name of the SceneManager you want to enquire on.
-		///		If you don't know the typeName already, you can iterate over the
-		///		metadata for all types using getMetaDataIterator.
-		/// </param>
-		/// <returns></returns>
-		public SceneManagerMetaData GetMetaData(string typeName)
-		{
-			foreach (SceneManagerMetaData metaData in _metaDataList)
-			{
-				if (typeName == metaData.typeName)
-				{
-					return metaData;
-				}
-			}
-
-			throw new AxiomException("No metadata found for scene manager of type '{0}'.", typeName);
-		}
-
-		///
-		///		Shuts down all registered scene managers.
-		///
-		public void ShutdownAll()
-		{
-			foreach (SceneManager instance in _instances.Values)
-				instance.ClearScene();
-		}
-
-		#endregion
-
-	}
+    ///
+    ///		Factory for default scene manager.
+    ///
+    public class SceneManagerDefaultFactory : SceneManagerFactory
+    {
+        public SceneManagerDefaultFactory()
+        {
+
+        }
+
+        protected override void InitMetaData()
+        {
+            metaData.typeName = "DefaultSceneManager";
+            metaData.description = "The default scene manager";
+            metaData.sceneTypeMask = SceneType.Generic;
+            metaData.worldGeometrySupported = false;
+        }
+
+        public override SceneManager CreateInstance( string name )
+        {
+            return new DefaultSceneManager( name );
+        }
+
+        public override void DestroyInstance( SceneManager instance )
+        {
+            instance.ClearScene();
+        }
+
+    }
+
+    ///
+    ///		Default scene manager.
+    ///
+    public class DefaultSceneManager : SceneManager
+    {
+        public DefaultSceneManager( string name )
+            : base( name )
+        {
+        }
+
+        public override string TypeName
+        {
+            get
+            {
+                return "DefaultSceneManager";
+            }
+        }
+    }
+
+    ///
+    ///     Enumerates the <see cref="SceneManager"/> classes available to applications.
+    ///
+    /// <remarks>
+    ///		As described in the SceneManager class, SceneManagers are responsible
+    ///     for organising the scene and issuing rendering commands to the
+    ///     <see cref="RenderSystem"/>. Certain scene types can benefit from different
+    ///     rendering approaches, and it is intended that subclasses will
+    ///     be created to special case this.
+    ///

+    ///     In order to give applications easy access to these implementations,
+    ///     this class has a number of methods to create or retrieve a SceneManager
+    ///     which is appropriate to the scene type.
+    ///

+    ///		SceneManagers are created by <see cref="SceneManagerFactory"/> instances. New factories
+    ///		for new types of SceneManager can be registered with this class to make
+    ///		them available to clients.
+    ///

+    ///		Note that you can still plug in your own custom SceneManager without
+    ///		using a factory, should you choose, it's just not as flexible that way.
+    ///		Just instantiate your own SceneManager manually and use it directly.
+    /// </remarks>
+    public sealed class SceneManagerEnumerator : Singleton<SceneManagerEnumerator>
+    {
+        private SceneManagerEnumerator()
+        {
+            _defaultFactory = new SceneManagerDefaultFactory();
+            AddFactory( _defaultFactory );
+        }
+
+        #region Fields
+
+        private SceneManagerCollection _instances = new SceneManagerCollection();
+        private List<SceneManagerFactory> _factories = new List<SceneManagerFactory>();
+        private List<SceneManagerMetaData> _metaDataList = new List<SceneManagerMetaData>();
+        private SceneManagerDefaultFactory _defaultFactory;
+        private RenderSystem _currentRenderSystem;
+
+        private ulong _instanceCreateCount;
+
+        #endregion
+
+        #region Public Properties
+
+        ///
+        ///		Notifies all SceneManagers of the destination rendering system.
+        ///
+        public RenderSystem RenderSytem
+        {
+            set
+            {
+                _currentRenderSystem = value;
+
+                foreach ( SceneManager instance in _instances.Values )
+                    instance.TargetRenderSystem = value;
+            }
+        }
+
+        ///
+        ///		A list of all types of SceneManager available for construction,
+        ///		providing some information about each one.
+        ///
+        public List<SceneManagerMetaData> MetaDataList
+        {
+            get
+            {
+                return _metaDataList;
+            }
+        }
+
+        ///
+        ///		A list of all types of SceneManager available for construction,
+        ///		providing some information about each one.
+        ///
+        public SceneManagerCollection SceneManagerList
+        {
+            get
+            {
+                return _instances;
+            }
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        ///
+        ///		Registers a new <see cref="SceneManagerFactory"/>.
+        ///
+        /// <remarks>
+        ///		Plugins should call this to register as new <see cref="SceneManager"/> providers.
+        /// </remarks>
+        public void AddFactory( SceneManagerFactory factory )
+        {
+            _factories.Add( factory );
+            _metaDataList.Add( factory.MetaData );
+
+            LogManager.Instance.Write( "SceneManagerFactory for type '{0}' registered", factory.MetaData.typeName );
+        }
+
+        ///
+        ///		Removes a <see cref="SceneManagerFactory"/>.
+        ///
+        public void RemoveFactory( SceneManagerFactory fact )
+        {
+            // destroy all instances for this factory
+            for ( int i = 0; i < _instances.Values.Count; i++ )
+            {
+                if ( _instances[ i ].TypeName == fact.MetaData.typeName )
+                {
+                    fact.DestroyInstance( _instances[ i ] );
+                    _instances.Remove( _instances[ i ] );
+                }
+            }
+
+            // remove from metadata
+            for ( int i = 0; i < _metaDataList.Count; i++ )
+            {
+                if ( _metaDataList[ i ].Equals( fact.MetaData ) )
+                {
+                    _metaDataList.Remove( _metaDataList[ i ] );
+                    break;
+                }
+            }
+
+            _factories.Remove( fact );
+        }
+
+        ///
+        ///		Creates a SceneManager instance based on scene type support.
+        ///
+        /// <remarks>
+        ///		Creates an instance of a SceneManager which supports the scene types
+        ///		identified in the parameter. If more than one type of SceneManager
+        ///		has been registered as handling that combination of scene types,
+        ///		in instance of the last one registered is returned.
+        ///

+        ///		Note that this method always succeeds, if a specific scene manager is not
+        /// 	found, the default implementation is always returned.
+        /// </remarks>
+        /// <param name="sceneType">A mask containing one or more <see cref="SceneType"/> flags.</param>
+        /// <param name="instanceName">
+        ///		Optional name to given the new instance that is created.
+        ///		If you leave this blank, an auto name will be assigned.
+        /// </param>
+        /// <returns></returns>
+        public SceneManager CreateSceneManager( SceneType sceneType, string instanceName )
+        {
+            if ( _instances.ContainsKey( instanceName ) )
+            {
+                throw new AxiomException( "SceneManager instance called '{0}' already exists", instanceName );
+            }
+
+            SceneManager instance = null;
+
+            if ( instanceName == string.Empty )
+            {
+                instanceName = "SceneManagerInstance" + ( ++_instanceCreateCount ).ToString();
+            }
+
+            // iterate backwards to find the matching factory registered last
+            for ( int i = _factories.Count - 1; i > -1; i-- )
+            {
+                if ( ( _factories[ i ].MetaData.sceneTypeMask & sceneType ) > 0 )
+                {
+                    instance = _factories[ i ].CreateInstance( instanceName );
+                    break;
+                }
+            }
+
+            // use default factory if none
+            if ( instance == null )
+                instance = _defaultFactory.CreateInstance( instanceName );
+
+            // assign render system if already configured
+            if ( _currentRenderSystem != null )
+                instance.TargetRenderSystem = _currentRenderSystem;
+
+            _instances.Add( instanceName, instance );
+
+            return instance;
+        }
+
+        ///
+        ///		Creates a SceneManager instance of a given type.
+        ///
+        /// <remarks>
+        ///		You can use this method to create a SceneManager instance of a
+        ///		given specific type. You may know this type already, or you may
+        ///		have discovered it by looking at the results from <see cref="SceneManagerEnumerator.MetaDataList"/>.
+        /// </remarks>
+        /// <param name="typeName">String identifying a unique SceneManager type.</param>
+        /// <param name="instanceName">
+        ///		Optional name to given the new instance that is
+        ///		created. If you leave this blank, an auto name will be assigned.
+        /// </param>
+        /// <exception cref="AxiomException">
+        ///		This method throws an exception if the named type is not found.
+        /// </exception>
+        /// <returns></returns>
+        public SceneManager CreateSceneManager( string typeName, string instanceName )
+        {
+            if ( _instances.ContainsKey( instanceName ) )
+            {
+                throw new AxiomException( "SceneManager instance called '{0}' already exists", instanceName );
+            }
+
+            SceneManager instance = null;
+
+            foreach ( SceneManagerFactory factory in _factories )
+            {
+                if ( factory.MetaData.typeName == typeName )
+                {
+                    if ( instanceName == string.Empty )
+                    {
+                        instanceName = "SceneManagerInstance" + ( ++_instanceCreateCount ).ToString();
+                    }
+
+                    instance = factory.CreateInstance( instanceName );
+                    break;
+                }
+            }
+
+            if ( instance == null )
+            {
+                throw new AxiomException( "No factory found for scene manager of type '{0}'", typeName );
+            }
+
+            // assign render system if already configured
+            if ( _currentRenderSystem != null )
+            {
+                instance.TargetRenderSystem = _currentRenderSystem;
+            }
+
+            _instances.Add( instance.Name, instance );
+
+            return instance;
+        }
+
+
+        ///
+        ///		Destroys an instance of a SceneManager.
+        ///
+        /// <param name="sm"></param>
+        public void DestroySceneManager( SceneManager sm )
+        {
+            // erase instance from list
+            _instances.Remove( sm );
+
+            foreach ( SceneManagerFactory factory in _factories )
+            {
+                if ( factory.MetaData.typeName == sm.TypeName )
+                {
+                    factory.DestroyInstance( sm );
+                }
+            }
+
+        }
+
+        ///
+        /// 	Gets an existing SceneManager instance that has already been created,
+        ///		identified by the instance name.
+        ///
+        /// <param name="instanceName"> The name of the instance to retrieve.</param>
+        /// <exception cref="AxiomException">If the instance can't be retrieved.</exception>
+        /// <returns></returns>
+        public SceneManager GetSceneManager( string instanceName )
+        {
+            if ( !_instances.ContainsKey( instanceName ) )
+            {
+                throw new AxiomException( "SceneManager instance with name '{0}' not found", instanceName );
+            }
+
+            SceneManager sceneManager = _instances[ instanceName ];
+
+            return sceneManager;
+        }
+
+        ///
+        ///		Gets more information about a given type of SceneManager.
+        ///
+        /// <remarks>
+        ///		The metadata returned tells you a few things about a given type
+        ///		of SceneManager, which can be created using a factory that has been
+        ///		registered already.
+        /// </remarks>
+        /// <param name="typeName">
+        ///		The type name of the SceneManager you want to enquire on.
+        ///		If you don't know the typeName already, you can iterate over the
+        ///		metadata for all types using getMetaDataIterator.
+        /// </param>
+        /// <returns></returns>
+        public SceneManagerMetaData GetMetaData( string typeName )
+        {
+            foreach ( SceneManagerMetaData metaData in _metaDataList )
+            {
+                if ( typeName == metaData.typeName )
+                {
+                    return metaData;
+                }
+            }
+
+            throw new AxiomException( "No metadata found for scene manager of type '{0}'.", typeName );
+        }
+
+        ///
+        ///		Shuts down all registered scene managers.
+        ///
+        public void ShutdownAll()
+        {
+            foreach ( SceneManager instance in _instances.Values )
+                instance.ClearScene();
+        }
+
+        #endregion
+
+    }
 }


Update Bitfinex symbol list

Update Bitfinex symbol list

--- Brokerages/Bitfinex/BitfinexSymbolMapper.cs
+++ Brokerages/Bitfinex/BitfinexSymbolMapper.cs
@@ -81,7 +81,13 @@
             "DRNUSD","DRNETH","PNKUSD","PNKETH","DGBUSD","DGBBTC","BSVUSD","BSVBTC","BABUSD","BABBTC",
             "WLOUSD","WLOXLM","VLDUSD","VLDETH","ENJUSD","ENJETH","ONLUSD","ONLETH","RBTUSD","RBTBTC",
             "USTUSD","EUTEUR","EUTUSD","GSDUSD","UDCUSD","TSDUSD","PAXUSD","RIFUSD","RIFBTC","PASUSD",
-            "PASETH","VSYUSD","VSYBTC","ZRXDAI","MKRDAI","OMGDAI"
+            "PASETH","VSYUSD","VSYBTC","ZRXDAI","MKRDAI","OMGDAI","BTTUSD","BTTBTC","BTCUST","ETHUST",
+            "CLOUSD","CLOBTC","IMPUSD","LTCUST","EOSUST","BABUST","SCRUSD","GNOUSD","GENUSD","ATOUSD",
+            "ATOBTC","ATOETH","WBTUSD","XCHUSD","EUSUSD","WBTETH","XCHETH","LEOUSD","LEOBTC","LEOUST",
+            "LEOEOS","LEOETH","ASTUSD","FOAUSD","UFRUSD","ZBTUSD","OKBUSD","USKUSD","GTXUSD","KANUSD",
+            "OKBUST","OKBBTC","USKUST","USKETH","USKBTC","USKEOS","GTXUST","KANUST","AMPUSD","ALGUSD",
+            "ALGBTC","ALGUST","BTCXCH","SWMUSD","TRIUSD","LOOUSD","AMPUST","UOSUSD","UOSBTC","RRBUSD",
+            "RRBUST","DTXUSD","AMPBTC","FTTUSD","FTTUST","PAXUST","UDCUST","TSDUST","CHZUSD","CHZUST",
         };

         /// <summary>
@@ -91,7 +97,82 @@
         {
             "BCHUSD","BCHBTC","BCHETH",
             "CFIUSD","CFIBTC","CFIETH",
-            "VENUSD","VENBTC","VENETH"
+            "VENUSD","VENBTC","VENETH",
+            "RRTBTC","QTMETH",
+            "AVTBTC","AVTETH",
+            "QSHBTC","QSHETH",
+            "YYWBTC","YYWETH",
+            "MNAETH","FUNBTC",
+            "SPKBTC","SPKETH",
+            "RCNBTC","RCNETH",
+            "RLCETH",
+            "AIDBTC","AIDETH",
+            "SNGBTC","SNGETH",
+            "ELFBTC","ELFETH",
+            "AIOETH",
+            "REQBTC","REQETH",
+            "RDNBTC","RDNETH",
+            "LRCETH","WAXETH",
+            "AGIBTC","AGIETH",
+            "BFTETH",
+            "MTNBTC","MTNETH",
+            "DTHBTC","DTHETH",
+            "MITBTC","MITETH",
+            "STJBTC","STJETH",
+            "XLMJPY",
+            "XVGEUR","XVGJPY","XVGGBP","XVGETH",
+            "BCIUSD","BCIBTC",
+            "KNCETH",
+            "POABTC","POAETH",
+            "LYMBTC","LYMETH",
+            "UTKBTC","UTKETH",
+            "VEEBTC","VEEETH",
+            "DADUSD","DADBTC","DADETH",
+            "ORSBTC","ORSETH",
+            "AUCBTC","AUCETH",
+            "POYBTC","POYETH",
+            "FSNBTC","FSNETH",
+            "CBTBTC","CBTETH",
+            "ZCNBTC","ZCNETH",
+            "SENUSD","SENBTC","SENETH",
+            "NCABTC","NCAETH",
+            "CNDBTC",
+            "CTXBTC","CTXETH",
+            "PAIBTC",
+            "SEEBTC","SEEETH",
+            "ESSBTC","ESSETH",
+            "ATMBTC","ATMETH",
+            "HOTBTC","HOTETH",
+            "DTABTC","DTAETH",
+            "IQXBTC",
+            "WPRBTC","WPRETH",
+            "ZILBTC","ZILETH",
+            "BNTBTC","BNTETH",
+            "ABSETH",
+            "XRAETH",
+            "MANETH",
+            "BBNUSD","BBNETH",
+            "NIOUSD","NIOETH",
+            "VETETH",
+            "UTNETH",
+            "TKNETH",
+            "CNNETH",
+            "BOXETH",
+            "MGOETH",
+            "RTEETH",
+            "YGGETH",
+            "MLNETH",
+            "WTCETH",
+            "CSXETH",
+            "INTETH",
+            "DRNETH",
+            "WLOXLM",
+            "VLDETH",
+            "ENJETH",
+            "ONLETH",
+            "PASETH",
+            "ZRXDAI",
+            "OMGDAI",
         };

         /// <summary>


Allow mono test app to run again.

Allow mono test app to run again.

--- Cairo/Perspex.Cairo/Media/DrawingContext.cs
+++ Cairo/Perspex.Cairo/Media/DrawingContext.cs
@@ -175,7 +175,8 @@
         /// <returns>A disposable used to undo the opacity.</returns>
         public IDisposable PushOpacity(double opacity)
         {
-            throw new NotImplementedException();
+            // TODO: Implement
+            return Disposable.Empty;
         }

         /// <summary>


Update AssetUsageDetector.cs

Update AssetUsageDetector.cs

bugfix for a NullReferenceException

--- Editor/AssetUsageDetector.cs
+++ Editor/AssetUsageDetector.cs
@@ -619,7 +619,10 @@
 			for( int i = 0; i < components.Length; i++ )
 			{
 				Component component = components[i];
-
+
+				if( component == null )
+					continue;
+
 				// Ignore Transform component (no object field to search for)
 				if( component is Transform )
 					continue;


AssertCompatibleLite

AssertCompatibleLite

--- Signum.Windows.Extensions.UIAutomation/Proxies/LineProxy.cs
+++ Signum.Windows.Extensions.UIAutomation/Proxies/LineProxy.cs
@@ -9,6 +9,7 @@
 using Signum.Utilities.Reflection;
 using Signum.Entities.Reflection;
 using Signum.Engine;
+using Signum.Utilities.ExpressionTrees;

 namespace Signum.Windows.UIAutomation
 {
@@ -174,6 +175,8 @@
             }
             set
             {
+                AssertCompatibleLite(value);
+
                 if (!FastSelect(value))
                 {
                     FindLite(value);
@@ -183,6 +186,8 @@

         public void FindLite(Lite<IIdentifiable> value)
         {
+            AssertCompatibleLite(value);
+
             if (Element.TryChildById("btFind") == null)
                 throw new InvalidOperationException("The {0} {1} has no find button to complete the search for {2}".Formato(GetType().Name, this, value.KeyLong()));

@@ -205,6 +210,19 @@
             }
         }

+        private void AssertCompatibleLite(Lite<IIdentifiable> value)
+        {
+            var imps = GetImplementations();
+
+            if (!imps.IsByAll && !imps.Types.Contains(value.EntityType))
+                throw new InvalidOperationException("Lite of type {0} can not be set on {1} {2} {3}".Formato(value.EntityType.TypeName(), GetType().TypeName(), PropertyRoute, imps));
+        }
+
+        public virtual Implementations GetImplementations()
+        {
+            return PropertyRoute.GetImplementations();
+        }
+
         protected virtual bool FastSelect(Lite<IIdentifiable> value)
         {
             return false;
@@ -507,6 +525,11 @@

             return result;
         }
+
+        public override Implementations GetImplementations()
+        {
+            return PropertyRoute.Add("Item").GetImplementations();
+        }
     }

     public class EntityRepeaterProxy : EntityBaseProxy
@@ -546,6 +569,11 @@

             return result;
         }
+
+        public override Implementations GetImplementations()
+        {
+            return PropertyRoute.Add("Item").GetImplementations();
+        }
     }

     public class RepeaterLineProxy<T> : LineContainer<T> where T : ModifiableEntity