/// <summary> /// Closes the client. /// </summary> public void Close() { try { if (Disposed) { return; } ConnectedMre.Reset(); TokenSource.Cancel(); IsRunning = false; if (Listener == null) { return; } Listener.Shutdown(SocketShutdown.Both); Listener.Close(); Listener = null; RaiseDisconnected(); } catch (SocketException se) { throw new Exception(se.ToString()); } }
internal Tokenizer(byte[] array, ByteTokenEncoding encoding, int startIndex) { BasicInitialization(); _inBytes = array; _inSize = array.Length; _inIndex = startIndex; switch (encoding) { case ByteTokenEncoding.UnicodeTokens: _inTokenSource = TokenSource.UnicodeByteArray; break; case ByteTokenEncoding.UTF8Tokens: _inTokenSource = TokenSource.UTF8ByteArray; break; case ByteTokenEncoding.ByteTokens: _inTokenSource = TokenSource.ASCIIByteArray; break; default: throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Arg_EnumIllegalVal"), (int)encoding)); } }
private async Task Filter() { TokenSource.Cancel(); var query = from feed in await RSSDataService.GetFeedsDataAsync(0) select feed; if (FilterSelectedSource != null) { query = query.Where(x => x.PostSource.Id == FilterSelectedSource.Id); } if (!string.IsNullOrWhiteSpace(FilterTitle)) { query = query.Where(x => x.PostTitle.ToLower().Contains(FilterTitle.ToLower())); } if (!string.IsNullOrWhiteSpace(FilterCreator)) { query = query.Where(x => x.Authors.Any(x => x.Email.ToLower() == FilterCreator.ToLower())); } if (FilterIsUnreadOnly) { query = query.Where(x => x.IsRead == false); } Feeds.Clear(); foreach (var item in query) { Feeds.Add(item); } }
public void StopTask() { TokenSource.Cancel(); Debug.WriteLine("Maw, stop task asked"); // throw new System.NotImplementedException(); }
async Task close() { if (TokenSource != null) { TokenSource.Cancel(); } await Semaphore.WaitAsync(); try { ViewModel.endVideoPreview(); previewImage.Source = ViewModel.MediaPreviewImage; AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); if (adornerLayer != null) { adornerLayer.Remove(TimeAdorner); } } finally { Semaphore.Release(); } }
public void RaisesNegativeEventsOnCancel() { bool cancelEventCalled = false; bool hasFailed = false; Exception exception = null; Shtirlitz.ReportCanceled += (sender, args) => { cancelEventCalled = true; hasFailed = args.HasFailed; exception = args.Exception; }; TokenSource.Cancel(); Assert.Throws <AggregateException>(() => RunSynchronously(true)); // wait a bit for a continuation to execute Thread.Sleep(1000); Assert.True(cancelEventCalled); Assert.False(hasFailed); AggregateException aggregateException = exception as AggregateException; Assert.NotNull(aggregateException); // ReSharper disable PossibleNullReferenceException Assert.IsType <OperationCanceledException>(aggregateException.InnerException); // ReSharper restore PossibleNullReferenceException }
internal Tokenizer(char[] array) { BasicInitialization(); _inChars = array; _inSize = array.Length; _inTokenSource = TokenSource.CharArray; }
public void Cancell() { if (TokenSource != null && !TokenSource.IsCancellationRequested) { TokenSource.Cancel(); } }
private void UpgradeButton_Click(object sender, RoutedEventArgs e) { if (GameViewModel.Instance.GoldCounter < RessourceProducer.Price) { int rest = RessourceProducer.Price - GameViewModel.Instance.GoldCounter; System.Windows.MessageBox.Show("Il vous manque " + rest + " Golds !"); } else { TokenSource.Cancel(); RessourceProducer.Level = RessourceProducer.Level + 1; GameViewModel.Instance.GoldCounter -= RessourceProducer.Price; RessourceProducer.QuantityProduct += 10; RessourceProducer.Price *= 2; RefreshView(); TokenSource = new CancellationTokenSource(); Token = TokenSource.Token; Task usineUnTask = new Task(() => { GameViewModel.Instance.UsineProduction(RessourceProducer.ProductSpeed, RessourceProducer.QuantityProduct, TokenSource); }, Token); usineUnTask.Start(); if (RessourceProducer.Level == 5) { view.UpgradeButton.Content = "Maxed"; view.UpgradeButton.IsEnabled = false; } } }
public void Dispose() { if (TokenSource != null) { if (!TokenSource.IsCancellationRequested) { TokenSource.Cancel(); TokenSource.Dispose(); } } if (_SslStream != null) { _SslStream.Close(); } if (_NetworkStream != null) { _NetworkStream.Close(); } if (_TcpClient != null) { _TcpClient.Close(); _TcpClient.Dispose(); } }
/// <summary> /// Override the original Fetch method from BufferedTokenStream : same behavior, /// except that StopToken is replaced with EOF on the fly. /// </summary> protected override int Fetch(int n) { if (fetchedEOF) { return(0); } for (int i = 0; i < n; i++) { IToken t = TokenSource.NextToken(); if (t is IWritableToken) { ((IWritableToken)t).TokenIndex = tokens.Count; } // >>> replacement added if (StopToken != null && StopToken.Equals(t)) { t = stopTokenReplacedByEOF; indexOfStopTokenReplacedByEOF = tokens.Count; } // <<< end of replacement tokens.Add(t); if (t.Type == TokenConstants.Eof) { fetchedEOF = true; return(i + 1); } } return(n); }
public void Stop() { TokenSource?.Cancel(); Socket?.Stop(); TokenSource = null; Socket = null; }
internal Tokenizer(string input) { this.BasicInitialization(); this._inString = input; this._inSize = input.Length; this._inTokenSource = TokenSource.String; }
/// <inheritdoc /> /// <summary> /// Properly dispose the class. /// </summary> public override void Dispose() { try { if (!Disposed) { TokenSource.Cancel(); TokenSource.Dispose(); IsRunning = false; Listener.Dispose(); CanAcceptConnections.Dispose(); _keepAliveTimer.Enabled = false; _keepAliveTimer.Dispose(); foreach (var id in ConnectedClients.Keys.ToList()) { Close(id); } ConnectedClients = new Dictionary <int, IClientMetadata>(); TokenSource.Dispose(); Disposed = true; GC.SuppressFinalize(this); } else { throw new ObjectDisposedException(nameof(SimpleSocketListener), "This object is already disposed."); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void Stop() { if (IsConsuming()) { TokenSource.Cancel(); } }
private async Task searchAsync(IClientServiceRequest request, String searchInfo, bool isNextPage) { if (SearchTask != null && !SearchTask.IsCompleted) { try { TokenSource.Cancel(); await SearchTask; } catch (OperationCanceledException) { } finally { TokenSource = new CancellationTokenSource(); } } try { SearchTask = search(request, searchInfo, isNextPage, TokenSource.Token); await SearchTask; } catch (OperationCanceledException) { } catch (Exception e) { MessageBox.Show(e.Message, "Youtube Search Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public async Task MakePayment(PaymentModel model) { if (string.IsNullOrWhiteSpace(model.CardToken)) { throw new ArgumentException("Model", $"{nameof(model.CardToken)} is missing."); } var source = new TokenSource(model.CardToken); var paymentRequest = new PaymentRequest <TokenSource>(source, model.Currency, Convert.ToInt32(model.Amount)) { Capture = model.Capture, Reference = model.Reference, ThreeDS = model.DoThreeDS, // SuccessUrl = BuildUrl(nameof(ThreeDSSuccess)), // FailureUrl = BuildUrl(nameof(ThreeDSFailure)) }; var response = await _checkoutApi.Payments.RequestAsync(paymentRequest); if (response.IsPending && response.Pending.RequiresRedirect()) { // return Redirect(response.Pending.GetRedirectLink().Href); } // StorePaymentInTempData(response.Payment); if (response.Payment.Approved) { // return RedirectToAction(nameof(NonThreeDSSuccess)); } // return RedirectToAction(nameof(NonThreeDSFailure)); }
public virtual void Disconnect() { TokenSource.Cancel(); this.IsActive = false; this.ConnectionState = ConnState.DISCONNECTED; this.isConnected = false; }
/// <summary> /// Logon a user. /// </summary> /// <param name="type">The type of logon.</param> /// <param name="auth_package">The authentication package to use.</param> /// <param name="origin_name">The name of the origin.</param> /// <param name="source_context">The token source context.</param> /// <param name="buffer">The authentication credentials buffer.</param> /// <param name="local_groups">Additional local groups.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The LSA logon result.</returns> public NtResult <LsaLogonResult> LsaLogonUser(SecurityLogonType type, string auth_package, string origin_name, TokenSource source_context, SafeBuffer buffer, IEnumerable <UserGroup> local_groups, bool throw_on_error) { using (var list = new DisposableList()) { var auth_pkg = _handle.LookupAuthPackage(auth_package, throw_on_error); if (!auth_pkg.IsSuccess) { return(auth_pkg.Cast <LsaLogonResult>()); } var groups = local_groups == null ? SafeTokenGroupsBuffer.Null : list.AddResource(SafeTokenGroupsBuffer.Create(local_groups)); QUOTA_LIMITS quota_limits = new QUOTA_LIMITS(); return(SecurityNativeMethods.LsaLogonUser(_handle, new LsaString(origin_name), type, auth_pkg.Result, buffer, buffer.GetLength(), groups, source_context, out SafeLsaReturnBufferHandle profile, out int cbProfile, out Luid logon_id, out SafeKernelObjectHandle token_handle, quota_limits, out NtStatus subStatus).CreateResult(throw_on_error, () => { profile.InitializeLength(cbProfile); return new LsaLogonResult(NtToken.FromHandle(token_handle), profile, logon_id, quota_limits); })); } }
internal Tokenizer(string input, string[] searchStrings, string[] replaceStrings) { BasicInitialization(); _inString = input; _inSize = _inString.Length; _inTokenSource = TokenSource.NestedStrings; _searchStrings = searchStrings; _replaceStrings = replaceStrings; #if DEBUG Contract.Assert(searchStrings.Length == replaceStrings.Length, "different number of search/replace strings"); Contract.Assert(searchStrings.Length != 0, "no search replace strings, shouldn't be using this ctor"); for (int istr = 0; istr < searchStrings.Length; istr++) { var str = searchStrings[istr]; Contract.Assert(str != null, "XML Slug null"); Contract.Assert(str.Length >= 3, "XML Slug too small"); Contract.Assert(str[0] == '{', "XML Slug doesn't start with '{'"); Contract.Assert(str[str.Length - 1] == '}', "XML Slug doesn't end with '}'"); str = replaceStrings[istr]; Contract.Assert(str != null, "XML Replacement null"); Contract.Assert(str.Length >= 1, "XML Replacement empty"); } #endif }
public Task<IBinaryAsyncLockToken> WaitAsync(CancellationToken cancellationToken = default(CancellationToken)) { while (true) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled<IBinaryAsyncLockToken>(cancellationToken); } var oldTail = _tail; if (oldTail != null && oldTail.IsSet) { return oldTail.Task; } TokenSource newTail; if (oldTail == null) { newTail = new TokenSource(this); } else { newTail = new TokenSource(); if (oldTail.CompareExchangeNext(newTail, null) != null) { // Another thread has provided a new tail continue; } } if (Interlocked.CompareExchange(ref _tail, newTail, oldTail) == oldTail) { if (cancellationToken.CanBeCanceled) { newTail.RegisterCancellation(cancellationToken); } return newTail.Task; } } }
public void Dispose() { if (TokenSource != null) { if (!TokenSource.IsCancellationRequested) { TokenSource.Cancel(); TokenSource.Dispose(); } } if (_sslStream != null) { _sslStream.Close(); } if (_networkStream != null) { _networkStream.Close(); } if (_tcpClient != null) { _tcpClient.Close(); _tcpClient.Dispose(); } SendLock.Dispose(); ReceiveLock.Dispose(); }
private async Task VoiceWS_SocketClosed(SocketCloseEventArgs e) { Discord.DebugLogger.LogMessage(LogLevel.Debug, "VoiceNext", $"Voice socket closed ({e.CloseCode.ToString(CultureInfo.InvariantCulture)}, '{e.CloseMessage}')", DateTime.Now); // generally this should not be disposed on all disconnects, only on requested ones // or something // otherwise problems happen //this.Dispose(); if (e.CloseCode == 4006 || e.CloseCode == 4009) { Resume = false; } if (!IsDisposed) { TokenSource.Cancel(); TokenSource = new CancellationTokenSource(); VoiceWs = Discord.Configuration.WebSocketClientFactory(Discord.Configuration.Proxy); VoiceWs.Disconnected += VoiceWS_SocketClosed; VoiceWs.MessageRecieved += VoiceWS_SocketMessage; VoiceWs.Connected += VoiceWS_SocketOpened; await ConnectAsync().ConfigureAwait(false); } }
/// <summary> /// Disconnects and disposes this voice connection. /// </summary> public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; IsInitialized = false; TokenSource.Cancel(); #if !NETSTANDARD1_1 if (Configuration.EnableIncoming) { ReceiverTokenSource.Cancel(); } #endif try { VoiceWs.DisconnectAsync(null).ConfigureAwait(false).GetAwaiter().GetResult(); UdpClient.Close(); } catch (Exception) { } Opus?.Dispose(); Opus = null; Sodium = null; Rtp = null; if (VoiceDisconnected != null) { VoiceDisconnected(Guild); } }
internal Tokenizer(byte[] array, ByteTokenEncoding encoding, int startIndex) { BasicInitialization(); _inBytes = array; _inSize = array.Length; _inIndex = startIndex; switch (encoding) { case ByteTokenEncoding.UnicodeTokens: _inTokenSource = TokenSource.UnicodeByteArray; break; case ByteTokenEncoding.UTF8Tokens: _inTokenSource = TokenSource.UTF8ByteArray; break; case ByteTokenEncoding.ByteTokens: _inTokenSource = TokenSource.ASCIIByteArray; break; default: throw new ArgumentException("Arg_EnumIllegalVal"); } }
public override void Stop() { if (IsDisposed) { throw new ObjectDisposedException(GetType().FullName); } if (IsStopping || IsStarting) { return; } IsStopping = true; try { // 1. Execute BeforeStopping event handlers BeforeStopping?.Invoke(this); // 2. Stop the listener Listener?.Stop(); // 3. Complete or cancel running routes TokenSource?.Cancel(); // 4. Execute AfterStopping event handlers AfterStopping?.Invoke(this); } catch (Exception) { throw; } finally { IsStopping = false; } }
public LearningViewModel() { NetworkLearning = new RelayCommand(async() => { if (LearningData != null) { if (!IsRunning && !LoadingData) { IsRunning = true; TokenSource = new CancellationTokenSource(); Token = TokenSource.Token; await Task.Run(() => StartLearning(Token)); } } }); StopLearning = new RelayCommand(() => { if (IsRunning == true) { TokenSource.Cancel(); IsRunning = false; } }); LoadNetworkSource = new RelayCommand(async() => await Task.Run(() => LoadNetwork())); CreateNewNetwork = new RelayCommand(() => NewNetwork()); LoadLearningSource = new RelayCommand(async() => { await Task.Run(() => LoadMaterial()); }); }
internal Tokenizer(String input) { BasicInitialization(); _inString = input; _inSize = input.Length; _inTokenSource = TokenSource.String; }
[HttpPost] // Send SMS public async Task <ActionResult <InfoUserSms> > Post(InfoUserSms info) { try { Logger?.Info($"Info of Message {JsonConvert.SerializeObject(info)}"); var messageHandler = new MessageHandler(); Logger?.Info("Type of Message is Receive"); // Cancel Task after 5s TokenSource.CancelAfter(TimeSpan.FromSeconds(5)); // Push Message to SMS Service var pushMessageSuccess = await messageHandler.ReceiveInfoMessageToNexmoService(info, TokenSource.Token); Logger?.Info($"Push message is {pushMessageSuccess.Message}"); Logger?.Info($"Status Code {StatusCodes.Status401Unauthorized}"); return(StatusCode(StatusCodes.Status401Unauthorized, "Don't have type SMS")); } catch (Exception ex) { Logger?.Exception(ex, $"Status Code {StatusCodes.Status500InternalServerError}"); return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure")); } }
public void ExceptQueryCancellation() { var query = @"select City, Sum(Population) from #A.Entities() group by City except (City) select City, Sum(Population) from #B.Entities() group by City except (City) select City, Sum(Population) from #C.Entities() group by City"; var sources = new Dictionary <string, IEnumerable <BasicEntity> > { { "#A", new[] { new BasicEntity("001", "", 100), new BasicEntity("001", "", 100), new BasicEntity("002", "", 500) } }, { "#B", new[] { new BasicEntity("003", "", 13), new BasicEntity("003", "", 13), new BasicEntity("003", "", 13) } }, { "#C", new[] { new BasicEntity("002", "", 14), new BasicEntity("002", "", 14) } } }; var vm = CreateAndRunVirtualMachine(query, sources); TokenSource.Cancel(); vm.Run(TokenSource.Token); }
public override async Task DisconnectAsync() { TokenSource.Cancel(); await WebSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Shutdown procedure started", CancellationToken.None); InvokeOnClose(new OnCloseEventHandlerArgs(this)); ClientLoopTask.Wait(); }
public bool Start(HostControl hostControl) { var token = new TokenSource().GetToken(); var requests = PullRequest.List(); return !string.IsNullOrWhiteSpace(token); }
public ActionResult Index(PassVM vm) { var returnURL = vm.ReturnURL; var tokenSource = new TokenSource(Convert.FromBase64String(vm.Token)); string userId = tokenSource.UserData; var cookie = this.Authenticator.GetCookieTicket(userId); Response.Cookies.Add(cookie); return View("Index", vm); }
internal Tokenizer (byte[] array, ByteTokenEncoding encoding, int startIndex) { BasicInitialization(); _inBytes = array; _inSize = array.Length; _inIndex = startIndex; switch (encoding) { case ByteTokenEncoding.UnicodeTokens: _inTokenSource = TokenSource.UnicodeByteArray; break; case ByteTokenEncoding.UTF8Tokens: _inTokenSource = TokenSource.UTF8ByteArray; break; case ByteTokenEncoding.ByteTokens: _inTokenSource = TokenSource.ASCIIByteArray; break; default: throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)encoding)); } }
public TokenHandle LogonUser( string originName, SecurityLogonType logonType, IAuthenticationPackage package, TokenSource source, out object profileData, out Luid logonId, out NtStatus subStatus ) { IntPtr profileBuffer; int profileBufferLength; IntPtr token; QuotaLimits quotas; AnsiString originNameStr = new AnsiString(originName); try { using (MemoryRegion logonData = package.GetAuthData()) { Win32.LsaLogonUser( this, ref originNameStr, logonType, this.LookupAuthenticationPackage(package.PackageName), logonData, logonData.Size, IntPtr.Zero, ref source, out profileBuffer, out profileBufferLength, out logonId, out token, out quotas, out subStatus ).ThrowIf(); using (new LsaMemoryAlloc(profileBuffer, true)) { profileData = package.GetProfileData(new MemoryRegion(profileBuffer, 0, profileBufferLength)); } return new TokenHandle(token, true); } } finally { originNameStr.Dispose(); } }
internal void ChangeFormat( System.Text.Encoding encoding ) { if (encoding == null) { return; } Contract.Assert( _inSavedCharacter == -1, "There was a lookahead character at the stream change point, that means the parser is changing encodings too late" ); switch (_inTokenSource) { case TokenSource.UnicodeByteArray: case TokenSource.UTF8ByteArray: case TokenSource.ASCIIByteArray: // these are the ones we can change on the fly if (encoding == System.Text.Encoding.Unicode) { _inTokenSource = TokenSource.UnicodeByteArray; return; } if (encoding == System.Text.Encoding.UTF8) { _inTokenSource = TokenSource.UTF8ByteArray; return; } #if FEATURE_ASCII if (encoding == System.Text.Encoding.ASCII) { _inTokenSource = TokenSource.ASCIIByteArray; return; } #endif break; case TokenSource.String: case TokenSource.CharArray: case TokenSource.NestedStrings: // these are already unicode and encoding changes are moot // they can't be further decoded return; } // if we're here it means we don't know how to change // to the desired encoding with the memory that we have // we'll have to do this the hard way -- that means // creating a suitable stream from what we've got // this is thankfully the rare case as UTF8 and unicode // dominate the scene Stream stream = null; switch (_inTokenSource) { case TokenSource.UnicodeByteArray: case TokenSource.UTF8ByteArray: case TokenSource.ASCIIByteArray: stream = new MemoryStream(_inBytes, _inIndex, _inSize - _inIndex); break; case TokenSource.CharArray: case TokenSource.String: case TokenSource.NestedStrings: Contract.Assert(false, "attempting to change encoding on a non-changable source, should have been prevented earlier" ); return; default: StreamTokenReader reader = _inTokenReader as StreamTokenReader; if (reader == null) { Contract.Assert(false, "A new input source type has been added to the Tokenizer but it doesn't support encoding changes"); return; } stream = reader._in.BaseStream; Contract.Assert( reader._in.CurrentEncoding != null, "Tokenizer's StreamReader does not have an encoding" ); String fakeReadString = new String(' ', reader.NumCharEncountered); stream.Position = reader._in.CurrentEncoding.GetByteCount( fakeReadString ); break; } Contract.Assert(stream != null, "The XML stream with new encoding was not properly initialized for kind of input we had"); // we now have an initialized memory stream based on whatever source we had before _inTokenReader = new StreamTokenReader( new StreamReader( stream, encoding ) ); _inTokenSource = TokenSource.Other; }
internal Tokenizer (char[] array) { BasicInitialization(); _inChars = array; _inSize = array.Length; _inTokenSource = TokenSource.CharArray; }
public BinaryAsyncLock(bool isSet = false) { _tail = isSet ? new TokenSource(CompletedTask) : null; }
public TokenSource CompareExchangeNext(TokenSource value, TokenSource comparand) => Interlocked.CompareExchange(ref _next, value, comparand);
public Token(BinaryAsyncLock binaryAsyncLock, TokenSource tokenSource) { _binaryAsyncLock = binaryAsyncLock; _tokenSource = tokenSource; IsSet = false; }
private void TokenReset(TokenSource tokenSource, bool setIfLast) { while (tokenSource != null) { var newTail = setIfLast ? new TokenSource(CompletedTask) : null; Interlocked.CompareExchange(ref _tail, newTail, tokenSource); tokenSource = tokenSource.Next; if (tokenSource?.Tcs == null) { return; } // Try to reset tokenSource. If tokenSource.Tcs is canceled, try set result for the next one. if (tokenSource.Tcs.TrySetResult(new Token(this, tokenSource))) { return; } } }
private void TokenSet(TokenSource tokenSource) { while (tokenSource != null) { Interlocked.CompareExchange(ref _tail, new TokenSource(CompletedTask), tokenSource); tokenSource = tokenSource.Next; if (tokenSource?.Tcs == null) { return; } if (tokenSource.ResetOnSet && tokenSource.Tcs.TrySetResult(new Token(this, tokenSource))) { return; } tokenSource.Tcs.TrySetResult(new Token()); } }
//================================================================ // Constructor uses given ICharInputStream // internal void BasicInitialization() { LineNo = 1 ; _inProcessingTag = 0; _inSavedCharacter = -1; _inIndex = 0; _inSize = 0; _inNestedSize = 0; _inNestedIndex = 0; _inTokenSource = TokenSource.Other; _maker = System.SharedStatics.GetSharedStringMaker(); }
internal Tokenizer (String input, String[] searchStrings, String[] replaceStrings) { BasicInitialization(); _inString = input; _inSize = _inString.Length; _inTokenSource = TokenSource.NestedStrings; _searchStrings = searchStrings; _replaceStrings = replaceStrings; #if DEBUG Contract.Assert(searchStrings.Length == replaceStrings.Length, "different number of search/replace strings"); Contract.Assert(searchStrings.Length != 0, "no search replace strings, shouldn't be using this ctor"); for (int istr=0; istr<searchStrings.Length; istr++) { String str = searchStrings[istr]; Contract.Assert( str != null, "XML Slug null"); Contract.Assert( str.Length >= 3 , "XML Slug too small"); Contract.Assert( str[0] == '{', "XML Slug doesn't start with '{'" ); Contract.Assert( str[str.Length-1] == '}', "XML Slug doesn't end with '}'" ); str = replaceStrings[istr]; Contract.Assert( str != null, "XML Replacement null"); Contract.Assert( str.Length >= 1, "XML Replacement empty"); } #endif }
internal Tokenizer (String input) { BasicInitialization(); _inString = input; _inSize = input.Length; _inTokenSource = TokenSource.String; }
/// <summary> /// Initializes a new instance of the <see cref="Token" /> class. /// </summary> /// <param name="value">The value.</param> /// <param name="source">The source.</param> /// <param name="type">The type.</param> public Token(object value, TokenSource source, ITokenType type) { Value = value; Source = source; Type = type; }