Skip to content

Commit

Permalink
Maintenance release
Browse files Browse the repository at this point in the history
FIXED:
- problem with cache name and author name parsing;
- problem with actual regions list loading;

NEW:
- regions list is now sorted alphabetically.
  • Loading branch information
AraigumaRU committed Jul 25, 2020
1 parent 4cb421a commit 68fd49b
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 34 deletions.
2 changes: 1 addition & 1 deletion GeoLoader/Business/Loaders/CacheListLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public List<int> List(int countryId, int regionId)
bool cachesFound;
do
{
var url = string.Format("http://pda.geocaching.su/list.php?c={0}&a={1}&skip={2}",
var url = string.Format("https://pda.geocaching.su/list.php?c={0}&a={1}&skip={2}",
countryId, regionId, skip);
var cachesData = client.DownloadString(url);
var cacheRegex = new Regex(@"<a href=""cache.php\?cid=(\d+)""><b>[^<]+</b></a>");
Expand Down
2 changes: 1 addition & 1 deletion GeoLoader/Business/Loaders/CountryLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class CountryLoader : BaseLoader
public List<Country> List()
{
var result = new List<Country>();
var countriesData = client.DownloadString("http://www.geocaching.su/site/popup/selex.php");
var countriesData = client.DownloadString("https://geocaching.su/site/popup/selex.php");
var countryRegex = new Regex(@"id=""(\d+)"" checked onclick=""uncheckcountry\(this\)""></th><th colspan=2>([^<]+)</th>");
var countries = countryRegex.Matches(countriesData);
foreach (Match country in countries)
Expand Down
4 changes: 2 additions & 2 deletions GeoLoader/Business/Loaders/GeoCacheLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public GeoCacheLoader(int cacheId)

public GeoCache Load()
{
var cache = new GeoCache {Id = cacheId, Url = "http://pda.geocaching.su/cache.php?cid=" + cacheId};
var cache = new GeoCache {Id = cacheId, Url = "https://pda.geocaching.su/cache.php?cid=" + cacheId};
cacheData = client.DownloadString(cache.Url);
cache.Country = GetFieldValue("Страна", false);
cache.State = GetFieldValue("Область", false);
Expand Down Expand Up @@ -49,7 +49,7 @@ public GeoCache Load()
cache.LongDescription = GetBlockValue("Описание окружающей местности", true);
cache.CacheContents = GetBlockValue("Содержимое тайника", false);
cache.Hints = GetBlockValue("Описание тайника", false);
var nameRegex = new Regex(@"<p><b>([^<]+)</b> от <b><a href=""profile.php\?uid=(\d+)"">'(.+?)'</a></b>(?:<br>|\s+)<i>\([^<]*? (\w{2})" + cacheId + @"\)</i>");
var nameRegex = new Regex(@"<p><b>([^<]+)</b> от <b><a href=\""profile.php\?uid=(\d+)\"">(.+?)</a></b>(?:<br>|\s+)<i>\([^<]*? (\w{2})" + cacheId + @"\)</i>");
var nameMathResult = nameRegex.Match(cacheData);
if (!nameMathResult.Success)
{
Expand Down
10 changes: 7 additions & 3 deletions GeoLoader/Business/Loaders/RegionLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ public class RegionLoader : BaseLoader
public List<Region> List(int countryId)
{
var result = new List<Region>();
var regionsData = client.DownloadString("http://www.geocaching.su/site/popup/selex.php");
var regionRegex = new Regex(string.Format(@"value=""{0},(\d+)"" checked></td><td>([^<]+)</td>", countryId));
var regionsData = client.DownloadString("https://geocaching.su/site/popup/selex.php");
var regionRegex = new Regex(string.Format(@"value=\""{0},(\d+)\"" checked ([\w=""\s()]+)></td><td>([^<]+)\n", countryId));
var regions = regionRegex.Matches(regionsData);
foreach (Match region in regions)
{
var newRegion = new Region
{
Id = int.Parse(region.Groups[1].Value),
Name = region.Groups[2].Value
Name = region.Groups[3].Value
};
if (newRegion.Id > 0) result.Add(newRegion);
}
Expand Down Expand Up @@ -98,6 +98,10 @@ public List<Region> List(int countryId)
result.Add(new Region { Id = currentIndex, Name = regionsRawStrArray[i] });
}
}
result.Sort(delegate (Region x, Region y)
{
return x.Name.CompareTo(y.Name);
});
return result;
}
}
Expand Down
12 changes: 7 additions & 5 deletions GeoLoader/GeoLoader.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GeoLoader</RootNamespace>
<AssemblyName>GeoLoader</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ApplicationIcon>GeoLoader.ico</ApplicationIcon>
<FileUpgradeFlags>
Expand Down Expand Up @@ -43,6 +43,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -51,6 +52,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -60,6 +62,7 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\Release\</OutputPath>
Expand All @@ -70,6 +73,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -167,9 +171,7 @@
<Name>UnidecodeSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Service References\" />
</ItemGroup>
<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.
Expand Down
6 changes: 3 additions & 3 deletions GeoLoader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GeoLoader")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.3.5")]
[assembly: AssemblyFileVersion("1.2.3.5")]
[assembly: AssemblyVersion("1.2.3.6")]
[assembly: AssemblyFileVersion("1.2.3.6")]
29 changes: 16 additions & 13 deletions GeoLoader/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions GeoLoader/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion GeoLoader/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<section name="GeoLoader.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup><userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup><userSettings>
<GeoLoader.Properties.Settings>
<setting name="CacheExpirationInDays" serializeAs="String">
<value>3</value>
Expand Down

0 comments on commit 68fd49b

Please sign in to comment.