예제 #1
0
        public bool GetAllApps(out List <DbEntry> entries)
        {
            entries = new List <DbEntry>();

            const string SQL = "SELECT * from apps";

            IDbCommand     dbcmd       = dbCon.CreateCommand();
            IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();

            dbcmd.CommandText = SQL;
            var dataSet = new DataSet();

            dataAdapter.SelectCommand = dbcmd;
            dataAdapter.Fill(dataSet);
            DataTable dataTable = dataSet.Tables[0];

            foreach (DataRow dRow in dataTable.Rows)
            {
                var fEntry = new DbEntry
                {
                    Id           = long.Parse(dRow["id"].ToString()),
                    Developer    = dRow["developer"].ToString(),
                    Product      = dRow["product"].ToString(),
                    Version      = dRow["version"].ToString(),
                    Languages    = dRow["languages"].ToString(),
                    Architecture = dRow["architecture"].ToString(),
                    TargetOs     = dRow["targetos"].ToString(),
                    Format       = dRow["format"].ToString(),
                    Description  = dRow["description"].ToString(),
                    Oem          = bool.Parse(dRow["oem"].ToString()),
                    Upgrade      = bool.Parse(dRow["upgrade"].ToString()),
                    Update       = bool.Parse(dRow["update"].ToString()),
                    Source       = bool.Parse(dRow["source"].ToString()),
                    Files        = bool.Parse(dRow["files"].ToString()),
                    Installer    = bool.Parse(dRow["installer"].ToString()),
                    Mdid         = dRow["mdid"].ToString()
                };

                if (dRow["xml"] != DBNull.Value)
                {
                    fEntry.Xml = (byte[])dRow["xml"];
                }

                if (dRow["json"] != DBNull.Value)
                {
                    fEntry.Json = (byte[])dRow["json"];
                }

                if (dRow["icon"] != DBNull.Value)
                {
                    fEntry.Icon = (byte[])dRow["icon"];
                }

                entries.Add(fEntry);
            }

            return(true);
        }