In this way we can check whether we have remote received data.
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jsonparser", "jsonparser\jsonparser.MonoDevelop.csproj", "{8F70E570-9D59-4E94-825C-62087D3BB1F6}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8F70E570-9D59-4E94-825C-62087D3BB1F6}.Debug|x86.ActiveCfg = Debug|x86
+ {8F70E570-9D59-4E94-825C-62087D3BB1F6}.Debug|x86.Build.0 = Debug|x86
+ {8F70E570-9D59-4E94-825C-62087D3BB1F6}.Release|x86.ActiveCfg = Release|x86
+ {8F70E570-9D59-4E94-825C-62087D3BB1F6}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = jsonparser\jsonparser.csproj
+ EndGlobalSection
+EndGlobal
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.30501.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jsonparser", "jsonparser\jsonparser.Windows.csproj", "{A49EB2A0-A969-494C-840D-A89B0989150C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A49EB2A0-A969-494C-840D-A89B0989150C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A49EB2A0-A969-494C-840D-A89B0989150C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A49EB2A0-A969-494C-840D-A89B0989150C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A49EB2A0-A969-494C-840D-A89B0989150C}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
+++ /dev/null
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jsonparser", "jsonparser\jsonparser.csproj", "{8F70E570-9D59-4E94-825C-62087D3BB1F6}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x86 = Debug|x86
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8F70E570-9D59-4E94-825C-62087D3BB1F6}.Debug|x86.ActiveCfg = Debug|x86
- {8F70E570-9D59-4E94-825C-62087D3BB1F6}.Debug|x86.Build.0 = Debug|x86
- {8F70E570-9D59-4E94-825C-62087D3BB1F6}.Release|x86.ActiveCfg = Release|x86
- {8F70E570-9D59-4E94-825C-62087D3BB1F6}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = jsonparser\jsonparser.csproj
- EndGlobalSection
-EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
+ </startup>
+</configuration>
\ No newline at end of file
CurrentWeather current = JsonConvert.DeserializeObject<CurrentWeather>(jsonCurrentWeatherData, _jsonSettings);
- Console.WriteLine("lat: " + current.coord.lat);
- Console.WriteLine("lon: " + current.coord.lon);
+ Console.WriteLine("lat: " + current.coord.lat ?? "");
+ Console.WriteLine("lon: " + current.coord.lon ?? "");
foreach (jsonparser.currentweather.Weather weather in current.weather)
{
- Console.WriteLine("description: " + weather.description);
- Console.WriteLine("main: " + weather.main);
- Console.WriteLine("id: " + weather.id);
- Console.WriteLine("icon: " + weather.icon);
+ Console.WriteLine("description: " + weather.description ?? "");
+ Console.WriteLine("main: " + weather.main ?? "");
+ Console.WriteLine("id: " + weather.id ?? "");
+ Console.WriteLine("icon: " + weather.icon ?? "");
}
- Console.WriteLine("humidity: " + current.main.humidity);
- Console.WriteLine("pressure: " + current.main.pressure);
- Console.WriteLine("temp: " + current.main.temp);
- Console.WriteLine("temp_min: " + current.main.temp_min);
- Console.WriteLine("temp_max: " + current.main.temp_max);
- Console.WriteLine("rain: " + current.rain.get3h());
- Console.WriteLine("clouds: " + current.clouds.all);
+ Console.WriteLine("humidity: " + current.main.humidity ?? "");
+ Console.WriteLine("pressure: " + current.main.pressure ?? "");
+ Console.WriteLine("temp: " + current.main.temp ?? "");
+ Console.WriteLine("temp_min: " + current.main.temp_min ?? "");
+ Console.WriteLine("temp_max: " + current.main.temp_max ?? "");
+ Console.WriteLine("rain: " + current.rain.get3h() ?? "");
+ Console.WriteLine("clouds: " + current.clouds.all ?? "");
+
+ Console.ReadLine();
+
ForecastWeather forecast = JsonConvert.DeserializeObject<ForecastWeather>(jsonForeCastWeatherData, _jsonSettings);
- Console.WriteLine("lat: " + forecast.city.coord.lat);
- Console.WriteLine("lon: " + forecast.city.coord.lon);
- Console.WriteLine("name: " + forecast.city.name);
+ Console.WriteLine("lat: " + forecast.city.coord.lat ?? "");
+ Console.WriteLine("lon: " + forecast.city.coord.lon ?? "");
+ Console.WriteLine("name: " + forecast.city.name ?? "");
foreach (jsonparser.forecastweather.List list in forecast.list)
{
- Console.WriteLine("temp day: " + list.temp.day);
- Console.WriteLine("temp eve: " + list.temp.eve);
- Console.WriteLine("temp max: " + list.temp.max);
- Console.WriteLine("temp min: " + list.temp.min);
+ Console.WriteLine("temp day: " + list.temp.day ?? "");
+ Console.WriteLine("temp eve: " + list.temp.eve ?? "");
+ Console.WriteLine("temp max: " + list.temp.max ?? "");
+ Console.WriteLine("temp min: " + list.temp.min ?? "");
}
+
+ Console.ReadLine();
}
}
}
{
public class Clouds
{
- public int all { get; set; }
+ public int? all { get; set; }
}
}
{
public class Coord
{
- public double lon { get; set; }
- public int lat { get; set; }
+ public double? lon { get; set; }
+ public double? lat { get; set; }
}
}
public Wind wind { get; set; }
public Rain rain { get; set; }
public Clouds clouds { get; set; }
- public int dt { get; set; }
- public int id { get; set; }
+ public int? dt { get; set; }
+ public int? id { get; set; }
public string name { get; set; }
- public int cod { get; set; }
+ public int? cod { get; set; }
}
}
{
public class Main
{
- public double temp { get; set; }
- public int pressure { get; set; }
- public int humidity { get; set; }
- public double temp_min { get; set; }
- public double temp_max { get; set; }
+ public double? temp { get; set; }
+ public int? pressure { get; set; }
+ public int? humidity { get; set; }
+ public double? temp_min { get; set; }
+ public double? temp_max { get; set; }
}
}
{
public class Rain
{
- private double threeHours;
+ private double? threeHours;
public void set3h(double three)
{
this.threeHours = three;
}
- public double get3h()
+ public double? get3h()
{
return this.threeHours;
}
{
public class Sys
{
- public double message { get; set; }
+ public double? message { get; set; }
public string country { get; set; }
- public int sunrise { get; set; }
- public int sunset { get; set; }
+ public int? sunrise { get; set; }
+ public int? sunset { get; set; }
}
}
{
public class Weather
{
- public int id { get; set; }
+ public int? id { get; set; }
public string main { get; set; }
public string description { get; set; }
public string icon { get; set; }
{
public class Wind
{
- public double speed { get; set; }
- public int deg { get; set; }
+ public double? speed { get; set; }
+ public double? deg { get; set; }
}
}
{
public class City
{
- public int id { get; set; }
+ public int? id { get; set; }
public string name { get; set; }
public Coord coord { get; set; }
public string country { get; set; }
- public int population { get; set; }
+ public int? population { get; set; }
}
}
{
public class Coord
{
- public double lon { get; set; }
- public double lat { get; set; }
+ public double? lon { get; set; }
+ public double? lat { get; set; }
}
}
public class ForecastWeather
{
public string cod { get; set; }
- public double message { get; set; }
+ public double? message { get; set; }
public City city { get; set; }
- public int cnt { get; set; }
+ public int? cnt { get; set; }
public List<jsonparser.forecastweather.List> list { get; set; }
}
}
{
public class List
{
- public int dt { get; set; }
+ public int? dt { get; set; }
public Temp temp { get; set; }
- public double pressure { get; set; }
- public int humidity { get; set; }
+ public double? pressure { get; set; }
+ public int? humidity { get; set; }
public List<Weather> weather { get; set; }
- public double speed { get; set; }
- public int deg { get; set; }
- public int clouds { get; set; }
- public double rain { get; set; }
+ public double? speed { get; set; }
+ public int? deg { get; set; }
+ public int? clouds { get; set; }
+ public double? rain { get; set; }
}
}
{
public class Temp
{
- public double day { get; set; }
- public double min { get; set; }
- public double max { get; set; }
- public double night { get; set; }
- public double eve { get; set; }
- public double morn { get; set; }
+ public double? day { get; set; }
+ public double? min { get; set; }
+ public double? max { get; set; }
+ public double? night { get; set; }
+ public double? eve { get; set; }
+ public double? morn { get; set; }
}
}
{
public class Weather
{
- public int id { get; set; }
+ public int? id { get; set; }
public string main { get; set; }
public string description { get; set; }
public string icon { get; set; }
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>12.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8F70E570-9D59-4E94-825C-62087D3BB1F6}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>jsonparser</RootNamespace>
+ <AssemblyName>jsonparser</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Externalconsole>true</Externalconsole>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <DebugType>full</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Externalconsole>true</Externalconsole>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=c7439020c8fedf87">
+ <Package>monodevelop</Package>
+ <Private>True</Private>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="currentweather\Clouds.cs" />
+ <Compile Include="currentweather\Coord.cs" />
+ <Compile Include="currentweather\CurrentWeather.cs" />
+ <Compile Include="currentweather\Main.cs" />
+ <Compile Include="currentweather\Rain.cs" />
+ <Compile Include="currentweather\Sys.cs" />
+ <Compile Include="currentweather\Weather.cs" />
+ <Compile Include="currentweather\Wind.cs" />
+ <Compile Include="forecastweather\Coord.cs" />
+ <Compile Include="forecastweather\City.cs" />
+ <Compile Include="forecastweather\Temp.cs" />
+ <Compile Include="forecastweather\Weather.cs" />
+ <Compile Include="forecastweather\List.cs" />
+ <Compile Include="forecastweather\ForecastWeather.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <Folder Include="currentweather\" />
+ <Folder Include="forecastweather\" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{A49EB2A0-A969-494C-840D-A89B0989150C}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>jsonparser</RootNamespace>
+ <AssemblyName>jsonparser</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <PublishUrl>publicar\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup />
+ <ItemGroup>
+ <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="currentweather\Clouds.cs" />
+ <Compile Include="currentweather\Coord.cs" />
+ <Compile Include="currentweather\CurrentWeather.cs" />
+ <Compile Include="currentweather\Main.cs" />
+ <Compile Include="currentweather\Rain.cs" />
+ <Compile Include="currentweather\Sys.cs" />
+ <Compile Include="currentweather\Weather.cs" />
+ <Compile Include="currentweather\Wind.cs" />
+ <Compile Include="forecastweather\City.cs" />
+ <Compile Include="forecastweather\Coord.cs" />
+ <Compile Include="forecastweather\ForecastWeather.cs" />
+ <Compile Include="forecastweather\List.cs" />
+ <Compile Include="forecastweather\Temp.cs" />
+ <Compile Include="forecastweather\Weather.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include=".NETFramework,Version=v4.5">
+ <Visible>False</Visible>
+ <ProductName>Microsoft .NET Framework 4.5 %28x86 y x64%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
- <ProductVersion>12.0.0</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{8F70E570-9D59-4E94-825C-62087D3BB1F6}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <RootNamespace>jsonparser</RootNamespace>
- <AssemblyName>jsonparser</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug</OutputPath>
- <DefineConstants>DEBUG;</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Externalconsole>true</Externalconsole>
- <PlatformTarget>x86</PlatformTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <DebugType>full</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Externalconsole>true</Externalconsole>
- <PlatformTarget>x86</PlatformTarget>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=c7439020c8fedf87">
- <Package>monodevelop</Package>
- <Private>True</Private>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="currentweather\Clouds.cs" />
- <Compile Include="currentweather\Coord.cs" />
- <Compile Include="currentweather\CurrentWeather.cs" />
- <Compile Include="currentweather\Main.cs" />
- <Compile Include="currentweather\Rain.cs" />
- <Compile Include="currentweather\Sys.cs" />
- <Compile Include="currentweather\Weather.cs" />
- <Compile Include="currentweather\Wind.cs" />
- <Compile Include="forecastweather\Coord.cs" />
- <Compile Include="forecastweather\City.cs" />
- <Compile Include="forecastweather\Temp.cs" />
- <Compile Include="forecastweather\Weather.cs" />
- <Compile Include="forecastweather\List.cs" />
- <Compile Include="forecastweather\ForecastWeather.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup>
- <Folder Include="currentweather\" />
- <Folder Include="forecastweather\" />
- </ItemGroup>
-</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
+</packages>
\ No newline at end of file