예제 #1
0
        /// <summary>
        /// Converts a MySQL query result into a Computer
        /// </summary>
        /// <param name="result">The MySQL query result</param>
        /// <returns>The Computer found from the query</returns>
        public static Computer GetFromQuery(string result)
        {
            string[]     arr     = result.Split('\0');
            CPU          cpu     = CPU.Get(int.Parse(arr[2]));
            Fan          fan     = Fan.Get(int.Parse(arr[3]));
            GraphicsCard gCard   = GraphicsCard.Get(int.Parse(arr[4]));
            Memory       memory  = Memory.Get(int.Parse(arr[5]));
            MOBO         mBoard  = MOBO.Get(int.Parse(arr[6]));
            Case         c       = Case.Get(int.Parse(arr[7]));
            PowerSupply  power   = PowerSupply.Get(int.Parse(arr[8]));
            Storage      storage = Storage.Get(int.Parse(arr[9]));

            return(new Computer(int.Parse(arr[0]), arr[1], c, cpu, fan, gCard, memory, mBoard, power, storage));
        }