-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#137 Proxy support with reworked CookieClient, Parser's and some init…
…alization code.
- Loading branch information
Showing
45 changed files
with
499 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using MangaReader.Core.Account; | ||
using MangaReader.Core.Convertation.Primitives; | ||
using MangaReader.Core.NHibernate; | ||
using MangaReader.Core.Services; | ||
|
||
namespace MangaReader.Core.Convertation.Config | ||
{ | ||
public class From47To48 : ConfigConverter | ||
{ | ||
protected override async Task ProtectedConvert(IProcess process) | ||
{ | ||
using (var context = Repository.GetEntityContext()) | ||
{ | ||
var proxySetting = await context | ||
.Get<ProxySetting>() | ||
.Where(s => s.SettingType == ProxySettingType.System) | ||
.SingleAsync().ConfigureAwait(false); | ||
var settings = await context.Get<MangaSetting>().Where(s => s.ProxySetting == null).ToListAsync().ConfigureAwait(false); | ||
foreach (var setting in settings) | ||
{ | ||
setting.ProxySetting = proxySetting; | ||
} | ||
|
||
await settings.SaveAll(context).ConfigureAwait(false); | ||
} | ||
} | ||
|
||
public From47To48() | ||
{ | ||
this.Name = "Поддержка прокси"; | ||
this.Version = new Version(1, 48, 0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using FluentNHibernate.Mapping; | ||
using MangaReader.Core.Account; | ||
|
||
namespace MangaReader.Core.NHibernate | ||
{ | ||
public class ProxySettingMap : ClassMap<ProxySetting> | ||
{ | ||
public ProxySettingMap() | ||
{ | ||
Not.LazyLoad(); | ||
Id(x => x.Id); | ||
Map(x => x.Name); | ||
Map(x => x.UserName); | ||
Map(x => x.Password); | ||
Map(x => x.SettingType); | ||
Map(x => x.Address); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Collections.Concurrent; | ||
using System.Threading; | ||
|
||
namespace MangaReader.Core.Services | ||
{ | ||
public static class CallContext<T> | ||
{ | ||
private static readonly ConcurrentDictionary<string, AsyncLocal<T>> State = new ConcurrentDictionary<string, AsyncLocal<T>>(); | ||
|
||
public static void SetData(string name, T data) | ||
{ | ||
State.AddOrUpdate(name, new AsyncLocal<T>(), (_, __) => new AsyncLocal<T>()).Value = data; | ||
} | ||
|
||
public static T GetData(string name) | ||
{ | ||
return State.TryGetValue(name, out AsyncLocal<T> data) ? data.Value : default(T); | ||
} | ||
|
||
public static bool RemoveData(string name) | ||
{ | ||
return State.TryRemove(name, out _); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.