private static ServerData ResultToServerData(SQLiteDataReader result)
        {
            ServerData serverToReturn = null;

             Guid id = result.GetGuid(0);
             string name = result.GetString(1);
             string description = result.GetString(2);
             string location = result.GetString(3);
             byte[] imageBytes = (byte[])result.GetValue(4);

             SensorDescriptionsData sensorData = new SensorDescriptionsData();

             SensorDefinition[] sensor = new SensorDefinition[4] { new SensorDefinition(), new SensorDefinition(), new SensorDefinition(), new SensorDefinition()};

             for (int s = 0; s < 4; s++)
             {
            // Do 4 sensor descriptions and 4 fields for each
            sensor[s].Name = (string)SQLHelper.ValueIfNull(result, s + 5, "");
            sensor[s].Unit = (string)SQLHelper.ValueIfNull(result, s + 9, "");
            sensor[s].ID = Convert.ToInt16(SQLHelper.ValueIfNull(result, s + 13, 255));
            sensor[s].Range = Convert.ToInt16(SQLHelper.ValueIfNull(result, s + 17, 255));

            sensorData.Add(sensor[s]);
             }
             serverToReturn = new ServerData(id, name, location, description, sensorData, imageBytes);
             return serverToReturn;
        }
Example #2
0
		private CrashReport MakeCrashReport(SQLiteDataReader reader)
		{
			Guid g = reader.GetGuid(0); //Guid.Parse(reader.GetString(0)));
			long l = reader.GetInt64(1);
			string s1 = reader.GetString(2);
			string s2 = reader.GetString(3);
			string s3 = reader.GetString(4);
			string s4 = reader.GetString(5);
			Version v = Version.Parse(reader.GetString(6));
			string s6 = reader.GetValue(7) as string;         //Not GetString as GetString throws an invalidCast 
			string s7 = reader.GetValue(8) as string;         //(or another exception, cannot rmbr)
			string userstory = reader.GetValue(9) as string;  //If the value is null, and this and following fields 
			string trace = reader.GetValue(10) as string;     //can be null as they aren't set before zip is downloaded


			return new CrashReport(innerApi, g, l, s1, s2, s3, s4, v, s6, s7, trace, userstory);
		}