/// <summary> /// Allows a designer to change or remove items from the set /// of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"/>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("CategoryNameChanged"); events.Remove("CounterNameChanged"); base.PostFilterEvents(events); }
protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties(properties); #if NOTDEF // We add a design-time property called TrackSelection that is used to track // the active selection. If the user sets this to true (the default), then // we will listen to selection change events and update the control's active // control to point to the current primary selection. GA ga = (GA) Component; if ( ga.EncodingType == EncodingType.Custom ) { properties.Remove("ChromosomeLength"); } if ( ga.EncodingType != EncodingType.Integer ) { properties.Remove("MaxIntValue"); properties.Remove("MinIntValue"); } if ( ga.EncodingType != EncodingType.Real ) { properties.Remove("MaxDoubleValue"); properties.Remove("MinDoubleValue"); } // properties["TrackSelection"] = TypeDescriptor.CreateProperty( // this.GetType(), // the type this property is defined on // "TrackSelection", // the name of the property // typeof(bool), // the type of the property // new Attribute[] {CategoryAttribute.Design}); // attributes #endif }
/// <inheritdoc /> public override bool RemoveElementByKey(TKey elementKey, TValue oldElement, bool?existsInDb) { if (Cleared) { return(_queue?.Remove(elementKey) ?? false); } // We can have the following scenarios: // 1. remove a key that exists in db and is not in the queue and removal queue (decrease queue size) // 2. remove a key that exists in db and is in the queue (decrease queue size) // 3. remove a key that does not exist in db and is not in the queue (don't decrease queue size) // 4. remove a key that does not exist in db and is in the queue (decrease queue size) // 5. remove a key that exists in db and is in the removal queue (don't decrease queue size) // If the key is not present in the database and in the queue, do nothing if (existsInDb == false && _queue?.ContainsKey(elementKey) != true) { return(false); } if (existsInDb == true) { GetOrCreateOrphanMap()[elementKey] = oldElement; } // We don't want to have non database keys in the removal queue if (_queue?.Remove(elementKey) == true | (_orphanMap?.ContainsKey(elementKey) == true && GetOrCreateRemovalQueue().Add(elementKey))) { _queueSize--; return(true); } return(false); }
/// <summary> /// Adjusts the set of properties the component will expose through a <see cref="T:System.ComponentModel.TypeDescriptor" />. /// </summary> /// <param name="properties">An <see cref="T:System.Collections.IDictionary" /> that contains the properties for the class of the component.</param> protected override void PreFilterProperties(IDictionary properties) { properties.Remove("ImeMode"); properties.Remove("Padding"); properties.Remove("FlatAppearance"); properties.Remove("FlatStyle"); properties.Remove("AutoEllipsis"); properties.Remove("UseCompatibleTextRendering"); properties.Remove("Image"); properties.Remove("ImageAlign"); properties.Remove("ImageIndex"); properties.Remove("ImageKey"); properties.Remove("ImageList"); properties.Remove("TextImageRelation"); properties.Remove("BackgroundImage"); properties.Remove("BackgroundImageLayout"); properties.Remove("UseVisualStyleBackColor"); //properties.Remove("Font"); properties.Remove("RightToLeft"); base.PreFilterProperties(properties); }
protected override void PreFilterProperties(IDictionary properties) { properties.Remove((object) "Dock"); properties.Remove((object) "AutoSize"); properties.Remove((object) "AutoSizeMode"); base.PreFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("FontChanged"); events.Remove("ForeColorChanged"); events.Remove("TextChanged"); base.PostFilterEvents(events); }
public override void Init (TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs) { if (attribs == null) throw new ParseException (parser.Location, "Error in ObjectTag."); attribs.Remove ("runat"); this.id = attribs ["id"] as string; attribs.Remove ("id"); if (this.id == null || this.id.Trim () == "") throw new ParseException (parser.Location, "Object tag must have a valid ID."); scope = attribs ["scope"] as string; string className = attribs ["class"] as string; attribs.Remove ("scope"); attribs.Remove ("class"); if (className == null || className.Trim () == "") throw new ParseException (parser.Location, "Object tag must have 'class' attribute."); this.type = parser.LoadType (className); if (this.type == null) throw new ParseException (parser.Location, "Type " + className + " not found."); if (attribs ["progid"] != null || attribs ["classid"] != null) throw new ParseException (parser.Location, "ClassID and ProgID are not supported."); if (attribs.Count > 0) throw new ParseException (parser.Location, "Unknown attribute"); }
/// <summary> /// Allows a designer to change or remove items from the set /// of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"/>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("CategoryName"); properties.Remove("CounterName"); base.PostFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("AutoSizeChanged"); events.Remove("Load"); events.Remove("Scroll"); base.PostFilterEvents(events); }
/// <summary> /// Allows a designer to change or remove items from the set /// of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"/>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("BackColor"); properties.Remove("Font"); properties.Remove("ForeColor"); properties.Remove("RightToLeft"); base.PostFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("AutoSize"); properties.Remove("AutoSizeMode"); properties.Remove("CausesValidation"); base.PostFilterProperties(properties); }
/// <summary> /// Drops the BackgroundImage property /// </summary> /// <param name="properties">properties to remove BackGroundImage from</param> protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties(properties); if (properties.Contains("BackgroundImage")) properties.Remove("BackgroundImage"); if (properties.Contains("DrawGrid")) properties.Remove("DrawGrid"); }
protected override void PostFilterProperties(IDictionary properties) { properties.Remove("BackColor"); properties.Remove("BackgroundImage"); properties.Remove("BackgroundImageLayout"); properties.Remove("BorderStyle"); base.PostFilterProperties(properties); }
/// <summary> /// Update the attributes of the attributes map given the VariantContext to reflect the /// proper chromosome-based VCF tags /// </summary> /// <param name="vc"> the VariantContext </param> /// <param name="attributes"> the attributes map to populate; must not be null; may contain old values </param> /// <param name="removeStaleValues"> should we remove stale values from the mapping? </param> /// <param name="founderIds"> - Set of founders Ids to take into account. AF and FC will be calculated over the founders. /// If empty or null, counts are generated for all samples as unrelated individuals </param> /// <returns> the attributes map provided as input, returned for programming convenience </returns> public static IDictionary<string, object> CalculateChromosomeCounts (VariantContext vc, IDictionary<string, object> attributes, bool removeStaleValues, ISet<string> founderIds) { int AN = vc.CalledChrCount; // if everyone is a no-call, remove the old attributes if requested if (AN == 0 && removeStaleValues) { if (attributes.ContainsKey (VCFConstants.ALLELE_COUNT_KEY)) { attributes.Remove (VCFConstants.ALLELE_COUNT_KEY); } if (attributes.ContainsKey (VCFConstants.ALLELE_FREQUENCY_KEY)) { attributes.Remove (VCFConstants.ALLELE_FREQUENCY_KEY); } if (attributes.ContainsKey (VCFConstants.ALLELE_NUMBER_KEY)) { attributes.Remove (VCFConstants.ALLELE_NUMBER_KEY); } return attributes; } if (vc.HasGenotypes) { attributes [VCFConstants.ALLELE_NUMBER_KEY] = AN; // if there are alternate alleles, record the relevant tags if (vc.AlternateAlleles.Count > 0) { List<double> alleleFreqs = new List<double> (); List<int> alleleCounts = new List<int> (); List<int> foundersAlleleCounts = new List<int> (); double totalFoundersChromosomes = (double)vc.GetCalledChrCount (founderIds); int foundersAltChromosomes; foreach (Allele allele in vc.AlternateAlleles) { foundersAltChromosomes = vc.GetCalledChrCount (allele, founderIds); alleleCounts.Add (vc.GetCalledChrCount (allele)); foundersAlleleCounts.Add (foundersAltChromosomes); if (AN == 0) { alleleFreqs.Add (0.0); } else { double freq = (double)foundersAltChromosomes / totalFoundersChromosomes; alleleFreqs.Add (freq); } } if (alleleCounts.Count == 1) { attributes [VCFConstants.ALLELE_COUNT_KEY] = alleleCounts [0]; } else { attributes [VCFConstants.ALLELE_COUNT_KEY] = alleleCounts; } if (alleleFreqs.Count == 1) { attributes [VCFConstants.ALLELE_FREQUENCY_KEY] = alleleFreqs [0]; } else { attributes [VCFConstants.ALLELE_FREQUENCY_KEY] = alleleFreqs; } } else { // if there's no alt AC and AF shouldn't be present attributes.Remove (VCFConstants.ALLELE_COUNT_KEY); attributes.Remove (VCFConstants.ALLELE_FREQUENCY_KEY); } } return attributes; }
/// <summary> 验证签名 </summary> /// <param name="parameters">所有接收到的参数</param> /// <param name="publicKey"></param> /// <param name="charset"></param> /// <returns></returns> public static bool RsaCheck(IDictionary<string, string> parameters, string publicKey, string charset) { var sign = parameters["sign"]; parameters.Remove("sign"); parameters.Remove("sign_type"); var signContent = parameters.ParamsUrl(true, false); return RsaCheckContent(signContent, sign, publicKey, charset); }
/// <summary> /// Allows a designer to change or remove items from the set of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("AutoSizeChanged"); events.Remove("CausesValidationChanged"); events.Remove("Validated"); events.Remove("Validating"); base.PostFilterEvents(events); }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("AutoSize"); properties.Remove("AutoSizeMode"); properties.Remove("Dock"); properties.Remove("Location"); properties.Remove("Size"); base.PostFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("AutoScroll"); properties.Remove("AutoScrollMargin"); properties.Remove("AutoScrollMinSize"); properties.Remove("AutoSize"); properties.Remove("AutoSizeMode"); base.PostFilterProperties(properties); }
//Overrides /// <summary> /// Remove Button and Control properties that are /// not supported by the <see cref="TrackBarEx"/>. /// </summary> protected override void PostFilterProperties(IDictionary Properties) { Properties.Remove("AllowDrop"); Properties.Remove("BackgroundImage"); Properties.Remove("ContextMenu"); Properties.Remove("Text"); Properties.Remove("TextAlign"); Properties.Remove("RightToLeft"); }
protected override void PreFilterProperties(IDictionary properties) { properties.Remove("BackgroundImage"); properties.Remove("ImeMode"); properties.Remove("Padding"); properties.Remove("BackgroundImageLayout"); properties.Remove("Font"); base.PreFilterProperties(properties); }
/// <summary> /// Gets a data response for the given base url and parameters, /// either using OAuth or not depending on which parameters were passed in. /// </summary> /// <param name="flickr">The current instance of the <see cref="Flickr"/> class.</param> /// <param name="baseUrl">The base url to be called.</param> /// <param name="parameters">A dictionary of parameters.</param> /// <returns></returns> public static string GetDataResponse(Flickr flickr, string baseUrl, IDictionary<string, string> parameters) { const string method = "POST"; // Remove api key if it exists. if (parameters.ContainsKey("api_key")) parameters.Remove("api_key"); if (parameters.ContainsKey("api_sig")) parameters.Remove("api_sig"); // If OAuth Access Token is set then add token and generate signature. if (!String.IsNullOrEmpty(flickr.OAuthAccessToken) && !parameters.ContainsKey("oauth_token")) { OAuthGetBasicParameters(parameters); parameters.Add("oauth_token", flickr.OAuthAccessToken); } if (!String.IsNullOrEmpty(flickr.OAuthAccessTokenSecret) && !parameters.ContainsKey("oauth_signature")) { var sig = flickr.OAuthCalculateSignature(method, baseUrl, parameters, flickr.OAuthAccessTokenSecret); parameters.Add("oauth_signature", sig); } // Calculate post data, content header and auth header string data = OAuthCalculatePostData(parameters); string authHeader = OAuthCalculateAuthHeader(parameters); flickr.LastRequest = baseUrl + "?" + data; // Download data. try { return DownloadData(method, baseUrl, data, PostContentType, authHeader); } catch (WebException ex) { if (ex.Status != WebExceptionStatus.ProtocolError) throw; var response = ex.Response as HttpWebResponse; if (response == null) throw; if (response.StatusCode != HttpStatusCode.BadRequest && response.StatusCode != HttpStatusCode.Unauthorized) throw; using (var responseReader = new StreamReader(response.GetResponseStream())) { string responseData = responseReader.ReadToEnd(); responseReader.Close(); Debug.WriteLine("OAuth response = " + responseData); throw new OAuthException(responseData, ex); } } }
// clean up some unnecessary properties protected override void PostFilterProperties(IDictionary Properties) { Properties.Remove("AllowDrop"); Properties.Remove("BackgroundImage"); Properties.Remove("ContextMenu"); Properties.Remove("FlatStyle"); Properties.Remove("Image"); Properties.Remove("ImageAlign"); Properties.Remove("ImageIndex"); Properties.Remove("ImageList"); Properties.Remove("Text"); Properties.Remove("TextAlign"); }
public static async Task<string> GetDataResponseAsync(Flickr flickr, string baseUrl, IDictionary<string, string> parameters) { const string method = "POST"; // Remove api key if it exists. if (parameters.ContainsKey("api_key")) parameters.Remove("api_key"); if (parameters.ContainsKey("api_sig")) parameters.Remove("api_sig"); if (!parameters.ContainsKey("oauth_consumer_key")) parameters.Add("oauth_consumer_key", flickr.ApiKey); // If OAuth Access Token is set then add token and generate signature. if (!String.IsNullOrEmpty(flickr.OAuthAccessToken) && !parameters.ContainsKey("oauth_token")) { OAuthGetBasicParameters(parameters); parameters.Add("oauth_token", flickr.OAuthAccessToken); } if (!String.IsNullOrEmpty(flickr.OAuthAccessTokenSecret) && !parameters.ContainsKey("oauth_signature")) { var sig = flickr.OAuthCalculateSignature(method, baseUrl, parameters, flickr.OAuthAccessTokenSecret); parameters.Add("oauth_signature", sig); } // Calculate post data, content header and auth header var data = OAuthCalculatePostData(parameters); var authHeader = OAuthCalculateAuthHeader(parameters); // Download data. try { return await DownloadDataAsync(method, baseUrl, data, PostContentType, authHeader); } catch (WebException ex) { var response = ex.Response as HttpWebResponse; if (response == null) throw; if (response.StatusCode != HttpStatusCode.BadRequest && response.StatusCode != HttpStatusCode.Unauthorized) throw; var stream = response.GetResponseStream(); if (stream == null) throw; using (var responseReader = new StreamReader(stream)) { var responseData = responseReader.ReadToEnd(); throw new OAuthException(responseData, ex); } } }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("AutoValidate"); properties.Remove("AutoScrollMargin"); properties.Remove("AutoScrollMinSize"); properties.Remove("AutoSize"); properties.Remove("AutoSizeMode"); properties.Remove("CausesValidation"); properties.Remove("Font"); properties.Remove("ForeColor"); properties.Remove("TabIndex"); properties.Remove("TabStop"); base.PostFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("AutoSizeChanged"); events.Remove("AutoValidateChanged"); events.Remove("CausesValidationChanged"); events.Remove("ChangeUICues"); events.Remove("FontChanged"); events.Remove("ForeColorChanged"); events.Remove("Load"); events.Remove("Scroll"); events.Remove("TabIndexChanged"); events.Remove("TabStopChanged"); base.PostFilterEvents(events); }
public async Task<HttpResponseMessage> Send(HttpMethod method, Uri uri, IDictionary<string, string> requestHeaders, object content) { requestHeaders = requestHeaders ?? new Dictionary<string, string>() { }; var httpRequestMessage = new HttpRequestMessage(method, uri) { Content = GetContent(content, requestHeaders), }; foreach (var header in DefaultRequestHeaders) { if (requestHeaders.Any(x => x.Key == header.Key)) requestHeaders.Remove(header.Key); requestHeaders.Add(header.Key, header.Value); } foreach (var header in requestHeaders) { if (httpRequestMessage.Headers.Contains(header.Key)) httpRequestMessage.Headers.Remove(header.Key); httpRequestMessage.Headers.Add(header.Key, header.Value); } return await _httpClient.SendAsync(httpRequestMessage); }
public static string Validate(this IDataErrorInfo source, IDictionary<string, string> requiredFields, IDictionary<string, string> errors, string propertyName) { string result = string.Empty; if (errors.ContainsKey(propertyName)) { errors.Remove(propertyName); } if (requiredFields.ContainsKey(propertyName)) { object propertyValue = source.GetProperty(propertyName); if (propertyValue is String && string.IsNullOrEmpty(propertyValue.ToString()) || propertyValue == null) { result = string.Format("{0} can not be blank!", requiredFields[propertyName]); } else if (propertyValue is IDataErrorInfo) { result = (propertyValue as IDataErrorInfo)[string.Empty]; } } if (!string.IsNullOrEmpty(result)) { errors.Add(propertyName, result); } return result; }
internal override void ProcessMainAttributes (IDictionary atts) { autoEventWireup = GetBool (atts, "AutoEventWireup", autoEventWireup); enableViewState = GetBool (atts, "EnableViewState", enableViewState); string value = GetString (atts, "CompilationMode", compilationMode.ToString ()); if (!String.IsNullOrEmpty (value)) { try { compilationMode = (CompilationMode) Enum.Parse (typeof (CompilationMode), value, true); } catch (Exception ex) { ThrowParseException ("Invalid value of the CompilationMode attribute.", ex); } } atts.Remove ("TargetSchema"); // Ignored #if NET_4_0 value = GetString (atts, "ClientIDMode", null); if (!String.IsNullOrEmpty (value)) { try { clientIDMode = (ClientIDMode) Enum.Parse (typeof (ClientIDMode), value, true); } catch (Exception ex) { ThrowParseException ("Invalid value of the ClientIDMode attribute.", ex); } } #endif base.ProcessMainAttributes (atts); }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it /// exposes through a TypeDescriptor /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { base.PostFilterProperties(properties); // Remove Button.FlatStyle attribute, because we have our own properties.Remove("FlatStyle"); }
static IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> Apply( IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> existing, IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> delta) { IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> resulting = new Dictionary<RegistrationEntryKey, RegistrationCatalogEntry>(); foreach (var item in existing) { if (delta.ContainsKey(item.Key)) { resulting.Add(item.Key, delta[item.Key]); delta.Remove(item.Key); } else { resulting.Add(item); } } foreach (var item in delta) { resulting.Add(item); } return resulting; }
// ----- Dirty tracking ----------------------------------------------- private void SaveDirtyBackup(string name, object newValue) { var currentValue = _props.GetSafe(name); if (Equals(newValue, currentValue)) { return; } var initialValue = currentValue; if (_dirtyBackup != null && _dirtyBackup.ContainsKey(name)) { initialValue = _dirtyBackup[name]; } if (Equals(newValue, initialValue)) { _dirtyBackup?.Remove(name); } else { if (_dirtyBackup == null) { _dirtyBackup = new Dictionary <string, object>(); } _dirtyBackup[name] = currentValue; } }
protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties (properties); properties["HasChanges"] = TypeDescriptor.CreateProperty( typeof(XmlConfigurationOptionDesigner), (PropertyDescriptor)properties["HasChanges"], new Attribute[0]); properties.Remove("Value"); // XmlConfigurationOption option = base.Component as XmlConfigurationOption; // if (option != null) // { // ValuePropertyDescriptor p = properties["Value"]; // (ValuePropertyDescriptor)TypeDescriptor.CreateProperty( // typeof(XmlConfigurationOption), // (PropertyDescriptor)properties["HasChanges"], // CategoryAttribute.Design, // DesignOnlyAttribute.Yes); // // p.Option = option; // // properties["Value"] = p; // } }
private IDictionary <string, Java.Lang.Object> CleanProperties(IDictionary <string, Java.Lang.Object> properties) { //Apparentlly there is some issue with this property //We will just ignore it for now if (properties?.ContainsKey("DPR_WEDGE") ?? false) { properties?.Remove("DPR_WEDGE"); } return(properties); }
private async Task TerminateAsync(IFusionProcess process, CancellationToken token) { try { await process.TerminateAsync(token); (process as IDisposable).Dispose(); } finally { processes?.Remove(process.FusionId); } }
/// <summary> /// Unregisters the specified command /// </summary> /// <param name="cmd"></param> public void UnregisterCommand(string cmd) { // Initialize if needed if (rustCommands == null) { Initialize(); } // Remove the console command rustCommands?.Remove(cmd); // Remove the chat command registeredChatCommands.Remove(cmd); }
private static string BuildStringToSign(IRequest request) { StringBuilder stringBuilder = new StringBuilder("", 256); stringBuilder.Append(request.get_HttpMethod()); stringBuilder.Append("\n"); IDictionary <string, string> headers = request.get_Headers(); IDictionary <string, string> parameters = request.get_Parameters(); if (headers != null) { string text = null; if (headers.ContainsKey("Content-MD5") && !string.IsNullOrEmpty(text = headers["Content-MD5"])) { stringBuilder.Append(text); } stringBuilder.Append("\n"); if (parameters.ContainsKey("ContentType")) { stringBuilder.Append(parameters["ContentType"]); } else if (headers.ContainsKey("Content-Type")) { stringBuilder.Append(headers["Content-Type"]); } stringBuilder.Append("\n"); } else { stringBuilder.Append("\n\n"); } if (parameters.ContainsKey("Expires")) { stringBuilder.Append(parameters["Expires"]); headers?.Remove("X-Amz-Date"); } stringBuilder.Append("\n"); stringBuilder.Append(BuildCanonicalizedHeaders(headers)); string value = BuildCanonicalizedResource(request); if (!string.IsNullOrEmpty(value)) { stringBuilder.Append(value); } return(stringBuilder.ToString()); }
/// <summary> /// 注册服务 /// </summary> /// <param name="formatType"></param> /// <param name="formatService"></param> public void RegisterFormatService(Type formatType, object formatService) { if (formatType == null) { throw new ArgumentNullException(nameof(formatType)); } if (formatService == null) { _formatServices?.Remove(formatType); return; } if (_formatServices == null) { _formatServices = new Dictionary <Type, object>(); } _formatServices[formatType] = formatService; }
/// <summary> /// Unregisters the specified command /// </summary> /// <param name="cmd"></param> /// <param name="type"></param> public void UnregisterCommand(string cmd, CommandType type) { // Initialize if needed if (rustCommands == null) { Initialize(); } // Is it a console command? if (type == CommandType.Console) { rustCommands?.Remove(cmd); } else if (type == CommandType.Chat) { registeredChatCommands.Remove(cmd); } }
/// <summary> /// Deletes the nodes found within the provided range. /// </summary> /// <param name="range"> /// The range. /// </param> /// <param name="dictionary"> /// The dictionary containing the map of element to score. Any deleted /// elements will be deleted from the dictionary. /// </param> /// <returns> /// The number of deleted nodes. /// </returns> public long DeleteRangeByScore(SkipListRange range, IDictionary <string, double> dictionary) { var update = new SkipListNode[SkipListMaxLevel]; long removed = 0; var currentNode = Head; for (var currentLevel = Levels - 1; currentLevel >= 0; currentLevel--) { while (currentNode.Levels[currentLevel].Forward != null && (range.IsMinExclusive ? currentNode.Levels[currentLevel].Forward.Score <= range.Min : currentNode.Levels[currentLevel].Forward.Score < range.Min)) { currentNode = currentNode.Levels[currentLevel].Forward; } update[currentLevel] = currentNode; } /* Current node is the last with score < or <= min. */ currentNode = currentNode.Levels[0].Forward; /* Delete nodes while in range. */ while (currentNode != null && (range.IsMaxExclusive ? currentNode.Score < range.Max : currentNode.Score <= range.Max)) { var next = currentNode.Levels[0].Forward; DeleteNode(currentNode, update); dictionary?.Remove(currentNode.Element); removed++; currentNode = next; } return(removed); }
public void DictionaryRemoveThrowsTest() { IDictionary <int, int> map = this.Empty <int, int>().Add(5, 3).ToReadOnlyDictionary(); Assert.Throws <NotSupportedException>(() => map.Remove(5)); }
public void RemovePreKey(uint preKeyId) { store.Remove(preKeyId); }
public void Remove(IOid oid) { adapters.Remove(oid); }
/// <summary> /// Remove event. /// </summary> /// <param name="oldEvent">to remove</param> public void Remove(EventBean oldEvent) { priorEventMap?.Remove(oldEvent); }
public void Remove(string key) { _payload?.Remove(key); }
public void DeleteField(string key) { _formFields?.Remove(key); }
public virtual void Remove(Block b) { order.Remove(b); map.Remove(b); }
public void OverrideMessagePropertiesDictionary() { LogEventInfo logEvent = new LogEventInfo(LogLevel.Info, "MyLogger", string.Empty, new[] { new MessageTemplateParameter("Hello World", 42, null, CaptureType.Normal), new MessageTemplateParameter("Goodbye World", 666, null, CaptureType.Normal) }); IDictionary <object, object> dictionary = logEvent.Properties; Assert.Equal(42, dictionary["Hello World"]); dictionary["Hello World"] = 999; Assert.Equal(999, dictionary["Hello World"]); Assert.True(dictionary.Values.Contains(999)); Assert.True(dictionary.Values.Contains(666)); Assert.False(dictionary.Values.Contains(42)); int i = 0; foreach (var item in dictionary) { switch (i++) { case 1: Assert.Equal("Hello World", item.Key); Assert.Equal(999, item.Value); break; case 0: Assert.Equal("Goodbye World", item.Key); Assert.Equal(666, item.Value); break; } } Assert.Equal(2, i); i = 0; foreach (var item in dictionary.Keys) { switch (i++) { case 1: Assert.Equal("Hello World", item); break; case 0: Assert.Equal("Goodbye World", item); break; } } Assert.Equal(2, i); i = 0; foreach (var item in dictionary.Values) { switch (i++) { case 1: Assert.Equal(999, item); break; case 0: Assert.Equal(666, item); break; } } dictionary["Goodbye World"] = 42; i = 0; foreach (var item in dictionary.Keys) { switch (i++) { case 0: Assert.Equal("Hello World", item); break; case 1: Assert.Equal("Goodbye World", item); break; } } Assert.Equal(2, i); dictionary.Remove("Hello World"); Assert.Single(dictionary); dictionary.Remove("Goodbye World"); Assert.Empty(dictionary); }
/// <summary> /// /// </summary> /// <param name="context"></param> public void EndRequest(IDictionary environment) { environment?.Remove(TraceContext.TRACE_CONTEXT_KEY); }
public bool Remove(string dbProviderName) { return(_dbProviders.Remove(dbProviderName)); }
public void TestEnvironmentProperty() { Assert.NotEqual(0, new Process().StartInfo.Environment.Count); ProcessStartInfo psi = new ProcessStartInfo(); // Creating a detached ProcessStartInfo will pre-populate the environment // with current environmental variables. IDictionary <string, string> environment = psi.Environment; Assert.NotEqual(environment.Count, 0); int CountItems = environment.Count; environment.Add("NewKey", "NewValue"); environment.Add("NewKey2", "NewValue2"); Assert.Equal(CountItems + 2, environment.Count); environment.Remove("NewKey"); Assert.Equal(CountItems + 1, environment.Count); //Exception not thrown with invalid key Assert.Throws <ArgumentException>(() => { environment.Add("NewKey2", "NewValue2"); }); //Clear environment.Clear(); Assert.Equal(0, environment.Count); //ContainsKey environment.Add("NewKey", "NewValue"); environment.Add("NewKey2", "NewValue2"); Assert.True(environment.ContainsKey("NewKey")); Assert.Equal(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), environment.ContainsKey("newkey")); Assert.False(environment.ContainsKey("NewKey99")); //Iterating string result = null; int index = 0; foreach (string e1 in environment.Values) { index++; result += e1; } Assert.Equal(2, index); Assert.Equal("NewValueNewValue2", result); result = null; index = 0; foreach (string e1 in environment.Keys) { index++; result += e1; } Assert.Equal("NewKeyNewKey2", result); Assert.Equal(2, index); result = null; index = 0; foreach (KeyValuePair <string, string> e1 in environment) { index++; result += e1.Key; } Assert.Equal("NewKeyNewKey2", result); Assert.Equal(2, index); //Contains Assert.True(environment.Contains(new KeyValuePair <string, string>("NewKey", "NewValue"))); Assert.Equal(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), environment.Contains(new KeyValuePair <string, string>("nEwKeY", "NewValue"))); Assert.False(environment.Contains(new KeyValuePair <string, string>("NewKey99", "NewValue99"))); //Exception not thrown with invalid key Assert.Throws <ArgumentNullException>(() => environment.Contains(new KeyValuePair <string, string>(null, "NewValue99"))); environment.Add(new KeyValuePair <string, string>("NewKey98", "NewValue98")); //Indexed string newIndexItem = environment["NewKey98"]; Assert.Equal("NewValue98", newIndexItem); //TryGetValue string stringout = null; Assert.True(environment.TryGetValue("NewKey", out stringout)); Assert.Equal("NewValue", stringout); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Assert.True(environment.TryGetValue("NeWkEy", out stringout)); Assert.Equal("NewValue", stringout); } stringout = null; Assert.False(environment.TryGetValue("NewKey99", out stringout)); Assert.Equal(null, stringout); //Exception not thrown with invalid key Assert.Throws <ArgumentNullException>(() => { string stringout1 = null; environment.TryGetValue(null, out stringout1); }); //Exception not thrown with invalid key Assert.Throws <ArgumentNullException>(() => environment.Add(null, "NewValue2")); //Invalid Key to add Assert.Throws <ArgumentException>(() => environment.Add("NewKey2", "NewValue2")); //Remove Item environment.Remove("NewKey98"); environment.Remove("NewKey98"); //2nd occurrence should not assert //Exception not thrown with null key Assert.Throws <ArgumentNullException>(() => { environment.Remove(null); }); //"Exception not thrown with null key" Assert.Throws <KeyNotFoundException>(() => environment["1bB"]); Assert.True(environment.Contains(new KeyValuePair <string, string>("NewKey2", "NewValue2"))); Assert.Equal(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), environment.Contains(new KeyValuePair <string, string>("NEWKeY2", "NewValue2"))); Assert.False(environment.Contains(new KeyValuePair <string, string>("NewKey2", "newvalue2"))); Assert.False(environment.Contains(new KeyValuePair <string, string>("newkey2", "newvalue2"))); //Use KeyValuePair Enumerator var x = environment.GetEnumerator(); x.MoveNext(); var y1 = x.Current; Assert.Equal("NewKey NewValue", y1.Key + " " + y1.Value); x.MoveNext(); y1 = x.Current; Assert.Equal("NewKey2 NewValue2", y1.Key + " " + y1.Value); //IsReadonly Assert.False(environment.IsReadOnly); environment.Add(new KeyValuePair <string, string>("NewKey3", "NewValue3")); environment.Add(new KeyValuePair <string, string>("NewKey4", "NewValue4")); //CopyTo KeyValuePair <string, string>[] kvpa = new KeyValuePair <string, string> [10]; environment.CopyTo(kvpa, 0); Assert.Equal("NewKey", kvpa[0].Key); Assert.Equal("NewKey3", kvpa[2].Key); environment.CopyTo(kvpa, 6); Assert.Equal("NewKey", kvpa[6].Key); //Exception not thrown with null key Assert.Throws <ArgumentOutOfRangeException>(() => { environment.CopyTo(kvpa, -1); }); //Exception not thrown with null key Assert.Throws <ArgumentException>(() => { environment.CopyTo(kvpa, 9); }); //Exception not thrown with null key Assert.Throws <ArgumentNullException>(() => { KeyValuePair <string, string>[] kvpanull = null; environment.CopyTo(kvpanull, 0); }); }
public bool Remove(string key) { IDictionary <string, SortedDictionary <int, List <string> > > collections = getCollections(); return(collections.Remove(key)); }
public void LoadEvent(Guid eid, EventDetails ev, FloorMapDetails map, bool isChampion) { int mid = ev.MapId; if (!m_MapLayers.ContainsKey(mid)) { m_MapLayers.Add(mid, new MapLayer()); } if (!m_MapEvents.ContainsKey(mid)) { m_MapEvents.Add(mid, new MapLayer()); // we insert instead of add so events always show up under other pushpins m_MapLayers[mid].Children.Insert(0, m_MapEvents[mid]); } if (!m_MapEventPolygons.ContainsKey(mid)) { m_MapEventPolygons.Add(mid, new MapLayer()); // we insert instead of add so events always show up under other pushpins m_MapLayers[mid].Children.Insert(0, m_MapEventPolygons[mid]); } // clean up if (m_EventMapPolygons.ContainsKey(eid)) { m_MapEvents[mid].Children.Remove(m_EventMapPolygons[eid]); m_EventMapPolygons.Remove(eid); } if (m_EventPushpins.ContainsKey(eid)) { m_MapEvents[mid].Children.Remove(m_EventPushpins[eid]); m_EventPushpins.Remove(eid); } Point center = new Point(ArenaNetMap.TranslateX(ev.Location.Center[0], map.MapRect, map.ContinentRect), ArenaNetMap.TranslateZ(ev.Location.Center[1], map.MapRect, map.ContinentRect)); switch (ev.Location.TypeEnum) { case LocationType.Poly: EventMapPolygon evPoly = new EventMapPolygon(ev, isChampion); foreach (List <double> pt in ev.Location.Points) { evPoly.Locations.Add( ArenaNetMap.Unproject( new Point( ArenaNetMap.TranslateX(pt[0], map.MapRect, map.ContinentRect), ArenaNetMap.TranslateZ(pt[1], map.MapRect, map.ContinentRect)), ArenaNetMap.MaxZoomLevel)); } m_EventMapPolygons[eid] = evPoly; // insert so polys are below all pushpins m_MapEventPolygons[mid].Children.Insert(0, evPoly); break; case LocationType.Sphere: case LocationType.Cylinder: EventMapPolygon evCircle = new EventMapPolygon(ev, isChampion); double radius = ArenaNetMap.TranslateX(ev.Location.Center[0] + ev.Location.Radius, map.MapRect, map.ContinentRect) - center.X; for (int i = 0; i < 360; i += 10) { evCircle.Locations.Add( ArenaNetMap.Unproject( new Point( center.X + radius * Math.Cos(i * (Math.PI / 180)), center.Y + radius * Math.Sin(i * (Math.PI / 180))), ArenaNetMap.MaxZoomLevel)); } m_EventMapPolygons[eid] = evCircle; // insert so polys are below all pushpins m_MapEventPolygons[ev.MapId].Children.Insert(0, evCircle); break; default: break; } EventPushpin evPin = new EventPushpin(ev); evPin.Location = ArenaNetMap.Unproject(center, ArenaNetMap.MaxZoomLevel); m_EventPushpins[eid] = evPin; m_MapEvents[ev.MapId].Children.Add(evPin); }
/// <summary> /// Removes the value with the specified key from the cache /// </summary> /// <param name="key">Key of cached item</param> public virtual void Remove(string key) { IDictionary <object, object> items = GetItems(); items?.Remove(key); }
bool ICollection <KeyValuePair <string, object> > .Remove(KeyValuePair <string, object> item) { IDictionary <string, object> dic = this; return(dic.Remove(item.Key)); }
internal void PlayerDisconnected(BoltEntity entity) => connectedPlayers.Remove(entity.source.RemoteEndPoint.SteamId.Id.ToString());
public void MultiItemPropertiesDictionary() { LogEventInfo logEvent = new LogEventInfo(LogLevel.Info, "MyLogger", string.Empty, new[] { new MessageTemplateParameter("Hello World", 42, null, CaptureType.Normal) }); IDictionary <object, object> dictionary = logEvent.Properties; dictionary["Goodbye World"] = 666; Assert.Equal(2, dictionary.Count); int i = 0; foreach (var item in dictionary) { switch (i++) { case 0: Assert.Equal("Hello World", item.Key); Assert.Equal(42, item.Value); break; case 1: Assert.Equal("Goodbye World", item.Key); Assert.Equal(666, item.Value); break; } } Assert.Equal(2, i); i = 0; foreach (var item in dictionary.Keys) { switch (i++) { case 0: Assert.Equal("Hello World", item); break; case 1: Assert.Equal("Goodbye World", item); break; } } Assert.Equal(2, i); i = 0; foreach (var item in dictionary.Values) { switch (i++) { case 0: Assert.Equal(42, item); break; case 1: Assert.Equal(666, item); break; } } Assert.True(dictionary.ContainsKey("Hello World")); Assert.Contains(new KeyValuePair <object, object>("Hello World", 42), dictionary); Assert.True(dictionary.Keys.Contains("Hello World")); Assert.True(dictionary.Values.Contains(42)); Assert.True(dictionary.ContainsKey("Goodbye World")); Assert.Contains(new KeyValuePair <object, object>("Goodbye World", 666), dictionary); Assert.True(dictionary.Keys.Contains("Goodbye World")); Assert.True(dictionary.Values.Contains(666)); Assert.False(dictionary.Keys.Contains("Mad World")); Assert.False(dictionary.ContainsKey("Mad World")); object value; Assert.True(dictionary.TryGetValue("Hello World", out value)); Assert.Equal(42, value); Assert.True(dictionary.TryGetValue("Goodbye World", out value)); Assert.Equal(666, value); Assert.False(dictionary.TryGetValue("Mad World", out value)); Assert.Null(value); var copyToArray = new KeyValuePair <object, object> [2]; dictionary.CopyTo(copyToArray, 0); Assert.Contains(new KeyValuePair <object, object>("Hello World", 42), copyToArray); Assert.Contains(new KeyValuePair <object, object>("Goodbye World", 666), copyToArray); var copyToValuesArray = new object[2]; dictionary.Values.CopyTo(copyToValuesArray, 0); Assert.Contains(42, copyToValuesArray); Assert.Contains(666, copyToValuesArray); var copyToKeysArray = new object[2]; dictionary.Keys.CopyTo(copyToKeysArray, 0); Assert.Contains("Hello World", copyToKeysArray); Assert.Contains("Goodbye World", copyToKeysArray); Assert.True(dictionary.Remove("Goodbye World")); Assert.Single(dictionary); dictionary["Goodbye World"] = 666; Assert.Equal(2, dictionary.Count); dictionary.Clear(); Assert.Empty(dictionary); }
void IDictionary.Remove(object key) => _dict.Remove(key);
public override void Remove(EventBean theEvent, ExprEvaluatorContext exprEvaluatorContext) { var key = GetMultiKey(theEvent); _propertyIndex.Remove(key); }
public static IDictionary <string, object> QRemove(this IDictionary <string, object> query, string fieldname) { query.Remove(fieldname); return(query); }
public override void Return(T[] array, bool clearArray = false) { _inner.Return(array); _rented?.Remove(array); }