This file contains hidden or 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
| public async Task DownloadTiles(int cityId, TileRange range, int zoom) | |
| { | |
| var random = new Random(); | |
| await range.ParallelForEachAsync(async tile => | |
| { | |
| if(OsmFileExists(cityId, zoom, tile.X, tile.Y, tile.Id)) | |
| return; | |
| //http://a.tile.openstreetmap.org/${z}/${x}/${y}.png | |
| var url = |
This file contains hidden or 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
| public TileRange CalculateTileRange(string coordinates, int zoom) | |
| { | |
| var coords = coordinates.Trim().Split(','); | |
| var left = Tile.CreateAroundLocation(double.Parse(coords[1]), double.Parse(coords[0]), zoom); | |
| var right = Tile.CreateAroundLocation(double.Parse(coords[3]), double.Parse(coords[2]), zoom); | |
| var minX = Math.Min(left.X, right.X); | |
| var maxX = Math.Max(left.X, right.X); |
This file contains hidden or 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
| pragma solidity ^0.4.18; | |
| /** | |
| * @title SafeMath | |
| * @dev Math operations with safety checks that throw on error | |
| */ | |
| library SafeMath { | |
| /** | |
| * @dev Multiplies two numbers, throws on overflow. | |
| */ | |
| function mul(uint256 a, uint256 b) internal pure returns (uint256) { |
This file contains hidden or 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
| import "zeppelin-solidity/contracts/ownership/Ownable.sol"; | |
| contract TheSimplestToken is Ownable { | |
| string public name = "TheSimplestToken"; | |
| string public symbol = "TST"; | |
| uint public decimals = 18; | |
| uint public constant INITIAL_SUPPLY = 75 * 10**18; | |
| function BonumFinancialToken(){ |
This file contains hidden or 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
| internal sealed class AspNetSynchronizationContext : AspNetSynchronizationContextBase { | |
| // Куча важного кода | |
| public override void Post(SendOrPostCallback callback, Object state) { | |
| _state.Helper.QueueAsynchronous(() => callback(state)); | |
| } | |
| // Куча важного кода | |
| } |
This file contains hidden or 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
| public class SynchronizationContext | |
| { | |
| // Выполняем некую единицу работы | |
| public virtual void Send(SendOrPostCallback d, object state) {} | |
| public virtual void Post(SendOrPostCallback d, object state) {} | |
| public static void SetSynchronizationContext(SynchronizationContext syncContext) {} | |
| public static SynchronizationContext Current | |
| public virtual SynchronizationContext CreateCopy() {} | |
| } |
This file contains hidden or 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
| public static class FuncExtensions | |
| { | |
| public static TResult InvokeWith<TResult>(this Func<TResult> function, ExecutionContext executionContext) | |
| { | |
| if (executionContext == null) | |
| { | |
| return function(); | |
| } | |
| TResult result = default(TResult); |
This file contains hidden or 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
| public sealed class ExecutionContext | |
| { | |
| // Куча полезного кода | |
| public static ExecutionContext Capture() | |
| public static void Run(ExecutionContext executionContext, ContextCallback callback, object state) | |
| // Куча полезного кода | |
| } |
This file contains hidden or 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
| FirstSync(); | |
| var t = Task.Delay(10000); | |
| var currentContext = SynchronizationContext.Current; | |
| t.ContinueWith(task => | |
| { | |
| if (currentContext == null) | |
| SecondSync(); | |
| else |
This file contains hidden or 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
| private sealed class ShowStateMachine : IAsyncStateMachine | |
| { | |
| public int State; | |
| public AsyncTaskMethodBuilder Builder; | |
| public Example That; | |
| private TaskAwaiter _awaiter; | |
| void IAsyncStateMachine.MoveNext() | |
| { | |
| // Куча полезного кода |
NewerOlder