string.Compare(string, string, System.StringComparison)

Here are the examples of the csharp api string.Compare(string, string, System.StringComparison) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

964 Examples 7

19 View Source File : Program.cs
License : MIT License
Project Creator : 0ffffffffh

static int stricmp(string s1,string s2)
        {
            return String.Compare(s1, s2, StringComparison.OrdinalIgnoreCase);
        }

19 View Source File : Ribbon.cs
License : GNU General Public License v3.0
Project Creator : 0dteam

private static string GetResourceText(string resourceName)
        {
            replacedembly asm = replacedembly.GetExecutingreplacedembly();
            string[] resourceNames = asm.GetManifestResourceNames();
            for (int i = 0; i < resourceNames.Length; ++i)
            {
                if (string.Compare(resourceName, resourceNames[i], StringComparison.OrdinalIgnoreCase) == 0)
                {
                    using (StreamReader resourceReader = new StreamReader(asm.GetManifestResourceStream(resourceNames[i])))
                    {
                        if (resourceReader != null)
                        {
                            return resourceReader.ReadToEnd();
                        }
                    }
                }
            }
            return null;
        }

19 View Source File : RuleOfConfig.cs
License : MIT License
Project Creator : 3F

public string Platform(string name)
        {
            if(name == null) {
                return null;
            }

            if(String.Compare(name, "Any CPU", StringComparison.OrdinalIgnoreCase) == 0) {
                return "AnyCPU";
            }
            return name;
        }

19 View Source File : LSolutionConfigurationPlatforms.cs
License : MIT License
Project Creator : 3F

public override bool Positioned(ISvc svc, RawText line)
        {
            if(svc.Sln.SolutionConfigList == null) {
                svc.Sln.SolutionConfigList = new List<IConfPlatform>();
            }

            string _line;
            while((_line = svc.ReadLine(this)) != null && _line.Trim() != "EndGlobalSection")
            {
                string left = _line.Before('=')?.Trim(); // Debug|Win32 = Debug|Win32
                if(left == null 
                    || String.Compare(left, "DESCRIPTION", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    LSender.Send(this, $"Solution Configuration has been ignored for line '{_line}'", Message.Level.Warn);
                    continue;
                }

                string[] cfg = left.Split('|');
                if(cfg.Length < 2) {
                    continue;
                }

                LSender.Send(this, $"Solution Configuration ->['{cfg[0]}' ; '{cfg[1]}']", Message.Level.Info);
                svc.Sln.SolutionConfigList.Add(new ConfigSln(cfg[0], cfg[1]));
            }

            return true;
        }

19 View Source File : Person.cs
License : GNU General Public License v3.0
Project Creator : abishekaditya

public int CompareTo(object obj)
        {
            var other = (Person)obj;
            if (String.Compare(Name, other.Name, StringComparison.Ordinal) == 0)
            {
                return Age.CompareTo(other.Age);
            }
            return String.Compare(Name, other.Name, StringComparison.Ordinal);
        }

19 View Source File : TypeReferencePropertyDrawer.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static List<Type> GetFilteredTypes(SystemTypeAttribute filter)
        {
            var types = new List<Type>();
            var excludedTypes = ExcludedTypeCollectionGetter?.Invoke();

            // We prefer using this over CompilationPipeline.Getreplacedemblies() because
            // some types may come from plugins and other sources that have already
            // been compiled.
            var replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
            foreach (var replacedembly in replacedemblies)
            {
                FilterTypes(replacedembly, filter, excludedTypes, types);
            }

            types.Sort((a, b) => string.Compare(a.FullName, b.FullName, StringComparison.Ordinal));
            return types;
        }

19 View Source File : VssStringComparer.cs
License : MIT License
Project Creator : actions

public override int Compare(string x, string y) { return String.Compare(x, y, m_stringComparison); }

19 View Source File : EvaluationResult.cs
License : MIT License
Project Creator : actions

private static Boolean AbstractGreaterThan(
            Object canonicalLeftValue,
            Object canonicalRightValue)
        {
            CoerceTypes(ref canonicalLeftValue, ref canonicalRightValue, out var leftKind, out var rightKind);

            // Same kind
            if (leftKind == rightKind)
            {
                switch (leftKind)
                {
                    // Number, Number
                    case ValueKind.Number:
                        var leftDouble = (Double)canonicalLeftValue;
                        var rightDouble = (Double)canonicalRightValue;
                        if (Double.IsNaN(leftDouble) || Double.IsNaN(rightDouble))
                        {
                            return false;
                        }
                        return leftDouble > rightDouble;

                    // String, String
                    case ValueKind.String:
                        var leftString = (String)canonicalLeftValue;
                        var rightString = (String)canonicalRightValue;
                        return String.Compare(leftString, rightString, StringComparison.OrdinalIgnoreCase) > 0;

                    // Boolean, Boolean
                    case ValueKind.Boolean:
                        var leftBoolean = (Boolean)canonicalLeftValue;
                        var rightBoolean = (Boolean)canonicalRightValue;
                        return leftBoolean && !rightBoolean;
                }
            }

            return false;
        }

19 View Source File : EvaluationResult.cs
License : MIT License
Project Creator : actions

private static Boolean AbstractLessThan(
            Object canonicalLeftValue,
            Object canonicalRightValue)
        {
            CoerceTypes(ref canonicalLeftValue, ref canonicalRightValue, out var leftKind, out var rightKind);

            // Same kind
            if (leftKind == rightKind)
            {
                switch (leftKind)
                {
                    // Number, Number
                    case ValueKind.Number:
                        var leftDouble = (Double)canonicalLeftValue;
                        var rightDouble = (Double)canonicalRightValue;
                        if (Double.IsNaN(leftDouble) || Double.IsNaN(rightDouble))
                        {
                            return false;
                        }
                        return leftDouble < rightDouble;

                    // String, String
                    case ValueKind.String:
                        var leftString = (String)canonicalLeftValue;
                        var rightString = (String)canonicalRightValue;
                        return String.Compare(leftString, rightString, StringComparison.OrdinalIgnoreCase) < 0;

                    // Boolean, Boolean
                    case ValueKind.Boolean:
                        var leftBoolean = (Boolean)canonicalLeftValue;
                        var rightBoolean = (Boolean)canonicalRightValue;
                        return !leftBoolean && rightBoolean;
                }
            }

            return false;
        }

19 View Source File : ConvertItemHelper.cs
License : MIT License
Project Creator : Actipro

public static IList GetTrail(object rooreplacedem, string path) {
			// Make sure the specified path is valid
			if (string.IsNullOrEmpty(path))
				return null;

			// If the root element was not preplaceded, then we cannot build a trail
			XmlElement element = rooreplacedem as XmlElement;
			if (null == element)
				return null;

			// Break the path up based on the specified path separator
			string[] pathEntries = path.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
			if (null == pathEntries || 0 == pathEntries.Length)
				return null;

			// The root element need to be the first path entry, so we will do that comparison first
			string pathEntry = GetPathEntry(element);
			if (0 == string.Compare(pathEntry, pathEntries[0], StringComparison.CurrentCultureIgnoreCase)) {
				// The root element matched, so we can continue to build the trail
				List<XmlElement> trail = new List<XmlElement>(pathEntries.Length);
				trail.Add(element);

				// For the remaining entries in the path, we will search the child nodes for a match at each level. If at any
				//   point we don't find a match, then we will need to cancel the conversion.
				for (int index = 1; index < pathEntries.Length; index++) {
					// Get the first child node and loop through it's siblings until we find a match for the current path
					//   entry
					XmlNode child = element.FirstChild;
					while (null != child) {
						XmlElement childElement = child as XmlElement;
						if (null != childElement) {
							pathEntry = GetPathEntry(childElement);
							if (0 == string.Compare(pathEntry, pathEntries[index], StringComparison.CurrentCultureIgnoreCase))
								break; // Found a match
						}

						// We didn't find a match, so continue with the next sibling (if any)
						child = child.NextSibling;
					}

					// The child variable will now point to the next element in the trail, or to null which indicates at match
					//   was not found.
					element = child as XmlElement;
					if (null != element)
						trail.Add(element);
					else
						return null;
				}

				return trail;
			}

			return null;
		}

19 View Source File : ConvertItemHelper.cs
License : MIT License
Project Creator : Actipro

public static IList GetTrail(object rooreplacedem, string path) {
			// Make sure the specified path is valid
			if (string.IsNullOrEmpty(path))
				return null;

			// If the root item was not preplaceded, then we cannot build a trail
			MyComputerData myComputerData = rooreplacedem as MyComputerData;
			if (null == myComputerData)
				return null;

			// Break the path up based on the available path separators
			string[] pathEntries = path.Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar },
				StringSplitOptions.RemoveEmptyEntries);
			if (null == pathEntries || 0 == pathEntries.Length)
				return null;

			// Start to build the trail
			List<object> trail = new List<object>();
			trail.Add(myComputerData);

			if (0 != string.Compare("My Computer", pathEntries[0], StringComparison.CurrentCultureIgnoreCase)) {
				// For the remaining entries in the path, we will search the child items for a match at each level. If at any
				//   point we don't find a match, then we will need to cancel the conversion.
				//
				if (!Directory.Exists(path))
					return null;

				// The split above will remove the backslash, which we need for the comparison for drives below.
				string driveEntry = pathEntries[0] + "\\";

				// The first entry should be a drive, so we will start there
				DriveData driveData = null;
				for (int driveIndex = 0; driveIndex < myComputerData.Drives.Count; driveIndex++) {
					// Get the next DriveData and see if it's a match, if so the exit the loop
					driveData = myComputerData.Drives[driveIndex];
					if (0 == string.Compare(driveData.Info.Name, driveEntry, StringComparison.CurrentCultureIgnoreCase))
						break;

					// Set to null, because we didn't find a match and we want driveData to be null in that case
					driveData = null;
				}

				// If we found the drive, then add it to the trail and continue. Otherwise, there's a problem and we have
				//   failed to convert.
				if (null != driveData) {
					trail.Add(driveData);

					// See if there are more items, which should be all directories
					if (pathEntries.Length > 1) {

						// We need to get the first directory directly from the drive object
						DirectoryData directoryData = null;
						for (int directoryIndex = 0; directoryIndex < driveData.Directories.Count; directoryIndex++) {
							// Get the next DirectoryData and see if it's a match, if so the exit the loop
							directoryData = driveData.Directories[directoryIndex];
							if (0 == string.Compare(directoryData.Info.Name, pathEntries[1], StringComparison.CurrentCultureIgnoreCase))
								break;

							// Set to null, because we didn't find a match and we want directoryData to be null in that case
							directoryData = null;
						}

						// If we found the directory, then add it to the trail and continue. Otherwise, there's a problem and
						//   we have failed to convert.
						if (null != directoryData) {
							trail.Add(directoryData);

							// We are now looking for the remaining directories, which we can do in this loop
							for (int index = 2; index < pathEntries.Length; index++) {
								bool found = false;
								for (int directoryIndex = 0; directoryIndex < directoryData.Directories.Count; directoryIndex++) {
									// Get the next DirectoryData and see if it's a match, if so the exit the loop
									DirectoryData childDirectoryData = directoryData.Directories[directoryIndex];
									if (0 == string.Compare(childDirectoryData.Info.Name, pathEntries[index], StringComparison.CurrentCultureIgnoreCase)) {
										found = true;
										trail.Add(childDirectoryData);
										directoryData = childDirectoryData;
										break;
									}
								}

								if (!found)
									return null;
							}

							return trail;
						}
					}
					else {
						return trail;
					}
				}
			}
			else {
				return trail;
			}

			return null;
		}

19 View Source File : CrmDataSourceView.cs
License : MIT License
Project Creator : Adoxio

private void InitializeParameters(out string fetchXml, out QueryByAttribute query)
		{
			// merge the select parameters
			IOrderedDictionary parameters = QueryParameters.GetValues(_context, _owner);

			fetchXml = GetNonNullOrEmpty(
				parameters[_fetchXmlParameterName] as string,
				_owner.FetchXml);

			if (!string.IsNullOrEmpty(fetchXml))
			{
				IOrderedDictionary selectParameters = SelectParameters.GetValues(_context, _owner);

				// apply select parameters replacement to the FetchXml
				foreach (DictionaryEntry entry in selectParameters)
				{
					if (entry.Key != null)
					{
						string key = entry.Key.ToString().Trim();

						if (!key.StartsWith("@"))
						{
							key = "@" + key;
						}

						string value = "{0}".FormatWith(entry.Value);

						if (Owner.EncodeParametersEnabled)
						{
							value = AntiXssEncoder.XmlEncode(value);
						}

						fetchXml = Regex.Replace(fetchXml, key, value, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
					}
				}
			}

			// process the QueryByAttribute
			query = null;

			if (_owner.QueryByAttribute != null && !string.IsNullOrEmpty(_owner.QueryByAttribute.EnreplacedyName))
			{
				IOrderedDictionary selectParameters = SelectParameters.GetValues(_context, _owner);

				query = new QueryByAttribute();
				query.EnreplacedyName = LookupParameter(selectParameters, _owner.QueryByAttribute.EnreplacedyName);
				query.Attributes.AddRange(CopyParameters(selectParameters, _owner.QueryByAttribute.Attributes));
				query.Values.AddRange(CopyParameters(selectParameters, _owner.QueryByAttribute.Values));

				if (_owner.QueryByAttribute.ColumnSet != null && _owner.QueryByAttribute.ColumnSet.Count > 0)
				{
					// specify individual columns to load
					query.ColumnSet = new ColumnSet(CopyParameters(selectParameters, _owner.QueryByAttribute.ColumnSet));
				}
				else
				{
					// default to all columns
					query.ColumnSet = new ColumnSet(true);
				}

				if (_owner.QueryByAttribute.Orders != null && _owner.QueryByAttribute.Orders.Count > 0)
				{
					for (int i = 0; i < _owner.QueryByAttribute.Orders.Count; ++i)
					{
						OrderExpression order = new OrderExpression();
						order.AttributeName = LookupParameter(selectParameters, _owner.QueryByAttribute.Orders[i].Value);

						string orderText = LookupParameter(selectParameters, _owner.QueryByAttribute.Orders[i].Text);

						if (orderText.StartsWith("desc", StringComparison.InvariantCultureIgnoreCase))
						{
							order.OrderType = OrderType.Descending;
						}

						query.Orders.Add(order);
					}
				}

				// merge the select parameters
				string enreplacedyName = parameters[_enreplacedyNameParameterName] as string;

				if (!string.IsNullOrEmpty(enreplacedyName))
				{
					query.EnreplacedyName = enreplacedyName;
				}

				// comma delimited
				string attributes = parameters[_attributesParameterName] as string;

				if (!string.IsNullOrEmpty(attributes))
				{
					query.Attributes.Clear();
					query.Attributes.AddRange(attributes.Split(','));
				}

				// comma delimited
				string values = parameters[_valuesParameterName] as string;

				if (!string.IsNullOrEmpty(values))
				{
					query.Values.Clear();
					query.Values.AddRange(values.Split(','));
				}

				// comma delimited
				string columnSet = parameters[_columnSetParameterName] as string;

				if (!string.IsNullOrEmpty(columnSet))
				{
					if (string.Compare(columnSet, _allColumnsParameterValue, StringComparison.InvariantCultureIgnoreCase) == 0)
					{
						query.ColumnSet = new ColumnSet(true);
					}
					else
					{
						string[] parts = columnSet.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

						if (parts.Length > 0)
						{
							for (int i = 0; i < parts.Length; i++)
							{
								parts[i] = parts[i].Trim();
							}

							query.ColumnSet.AddColumns(parts);
						}
						else
						{
							query.ColumnSet = new ColumnSet(true);
						}
					}
				}

				// comma delimited
				string orders = parameters[_ordersParameterName] as string;

				if (!string.IsNullOrEmpty(orders))
				{
					QueryByAttribute queryByAttribute = query;
					AppendSortExpressionToQuery(orders, order => queryByAttribute.Orders.Add(order));
					query = queryByAttribute;
				}

				// all remaining parameters are treated as key/value pairs
				Dictionary<string, object> extendedParameters = new Dictionary<string, object>();

				if (query.Attributes != null)
				{
					for (int i = 0; i < query.Attributes.Count; ++i)
					{
						extendedParameters[query.Attributes[i]] = query.Values[i];
					}
				}

				bool changed = false;

				foreach (string key in parameters.Keys)
				{
					// ignore special parameters
					if (!Array.Exists(_keywords, delegate(string value) { return string.Compare(value, key, StringComparison.InvariantCultureIgnoreCase) == 0; }))
					{
						extendedParameters[key] = parameters[key];
						changed = true;
					}
				}

				if (changed)
				{
					query.Attributes.Clear();
					query.Values.Clear();

					int i = 0;
					foreach (KeyValuePair<string, object> extendedParameter in extendedParameters)
					{
						query.Attributes[i] = extendedParameter.Key;
						query.Values[i] = extendedParameter.Value;
						++i;
					}
				}
			}
		}

19 View Source File : Expression.cs
License : MIT License
Project Creator : Adoxio

private static object ParseValue(string attributeName, string text)
		{
			// try convert from string to value type

			object value;
			DateTime dateTimeValue;
			double doubleValue;
			bool boolValue;
			Guid guidValue;

			if (double.TryParse(
					text,
					NumberStyles.Any,
					CultureInfo.InvariantCulture,
					out doubleValue))
			{
				value = doubleValue;
			}
			else if (DateTime.TryParse(
					text,
					CultureInfo.InvariantCulture,
					DateTimeStyles.replacedumeLocal,
					out dateTimeValue))
			{
				value = dateTimeValue;
			}
			else if (bool.TryParse(
					text,
					out boolValue))
			{
				value = boolValue;
			}
			else if (Guid.TryParse(
					text,
					out guidValue))
			{
				value = guidValue;
			}
			else if (string.Compare(text, "null", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				value = null;
			}
			else
			{
				value = text;
			}

			return value;
		}

19 View Source File : ArgumentDictionary.cs
License : MIT License
Project Creator : Adoxio

public bool IsEnabled(string key)
		{
			if (!ContainsKey(key)) return false;
			
			if (string.Compare(this[key], "true", StringComparison.InvariantCultureIgnoreCase) == 0) return true;

			if (string.Compare(this[key], "false", StringComparison.InvariantCultureIgnoreCase) == 0) return false;

			throw new FormatException(@"The value provided for '{0}' needs to be ""true"" or ""false"".".FormatWith(key));
		}

19 View Source File : OrganizationServiceContextExtensions.cs
License : MIT License
Project Creator : Adoxio

private static Enreplacedy SetCaseStatusAndSave(Enreplacedy incident, string state, string resolutionSubject, OrganizationServiceContext service)
		{
			var id = incident.Id;

			if (string.Compare(state, "Active", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				service.SetState(0, -1, incident);
			}
			else if (string.Compare(state, "Resolved", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				var resolution = new Enreplacedy("incidentresolution");
				resolution.SetAttributeValue("incidentid", incident.ToEnreplacedyReference());
				resolution.SetAttributeValue("statuscode", new OptionSetValue(-1));
				resolution.SetAttributeValue("subject", resolutionSubject);

				service.CloseIncident(resolution, -1);
			}
			else // Canceled
			{
				service.SetState(2, -1, incident);
			}

			return service.CreateQuery("incident").First(i => i.GetAttributeValue<Guid?>("incidentid") == id);
		}

19 View Source File : OrganizationServiceContextExtensions.cs
License : MIT License
Project Creator : Adoxio

public static void SetOpportunityStatusAndSave(this OrganizationServiceContext context, Enreplacedy opportunity, string state, decimal actualRevenue)
		{
			opportunity.replacedertEnreplacedyName("opportunity");

			if (string.Compare(state, "Open", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				context.SetState(0, -1, opportunity);
			}
			else if (string.Compare(state, "Won", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				var opportunityCloseId = Guid.NewGuid();
				var closeOpportunity = new Enreplacedy("opportunityclose");
				closeOpportunity.SetAttributeValue("opportunityid", opportunity.ToEnreplacedyReference());
				closeOpportunity.SetAttributeValue("statuscode", new OptionSetValue(-1));
				closeOpportunity.SetAttributeValue("actualrevenue", actualRevenue);
				closeOpportunity.SetAttributeValue("subject", opportunity.GetAttributeValue("name"));
				closeOpportunity.SetAttributeValue("actualend", DateTime.UtcNow.Floor(RoundTo.Day));
				closeOpportunity.SetAttributeValue("activityid", opportunityCloseId);
				context.WinOpportunity(closeOpportunity, -1);
			}
			else // Lost
			{
				var opportunityCloseId = Guid.NewGuid();
				var closeOpportunity = new Enreplacedy("opportunityclose");
				closeOpportunity.SetAttributeValue("opportunityid", opportunity.ToEnreplacedyReference());
				closeOpportunity.SetAttributeValue("statuscode", new OptionSetValue(-1));
				closeOpportunity.SetAttributeValue("actualrevenue", actualRevenue);
				closeOpportunity.SetAttributeValue("subject", opportunity.GetAttributeValue("name"));
				closeOpportunity.SetAttributeValue("actualend", DateTime.UtcNow.Floor(RoundTo.Day));
				closeOpportunity.SetAttributeValue("activityid", opportunityCloseId);
				context.LoseOpportunity(closeOpportunity, -1);
			}
		}

19 View Source File : CacheParameters.cs
License : MIT License
Project Creator : Adoxio

public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
		{
			if (value is string && string.Compare(value as string, "NoSlidingExpiration", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				return Cache.NoSlidingExpiration;
			}

			if (value is TimeSpan && ((TimeSpan)value) == Cache.NoSlidingExpiration)
			{
				return "NoSlidingExpiration";
			}

			return base.ConvertFrom(context, culture, value);
		}

19 View Source File : CacheParameters.cs
License : MIT License
Project Creator : Adoxio

public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
		{
			if (destinationType == typeof(string) && (value is TimeSpan) && ((TimeSpan)value) == Cache.NoSlidingExpiration)
			{
				return "NoSlidingExpiration";
			}

			if (destinationType == typeof(TimeSpan) && (value is string) && string.Compare(value as string, "NoSlidingExpiration", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				return Cache.NoSlidingExpiration;
			}

			return base.ConvertTo(context, culture, value, destinationType);
		}

19 View Source File : CacheParameters.cs
License : MIT License
Project Creator : Adoxio

public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
		{
			if (value is string && string.Compare(value as string, "NoAbsoluteExpiration", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				return Cache.NoAbsoluteExpiration;
			}

			if (value is DateTime && ((DateTime)value) == Cache.NoAbsoluteExpiration)
			{
				return "NoAbsoluteExpiration";
			}

			return base.ConvertFrom(context, culture, value);
		}

19 View Source File : CacheParameters.cs
License : MIT License
Project Creator : Adoxio

public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
		{
			if (destinationType == typeof(string) && (value is DateTime) && ((DateTime)value) == Cache.NoAbsoluteExpiration)
			{
				return "NoAbsoluteExpiration";
			}

			if (destinationType == typeof(DateTime) && (value is string) && string.Compare(value as string, "NoAbsoluteExpiration", StringComparison.InvariantCultureIgnoreCase) == 0)
			{
				return Cache.NoAbsoluteExpiration;
			}

			return base.ConvertTo(context, culture, value, destinationType);
		}

19 View Source File : CrmDataSourceView.cs
License : MIT License
Project Creator : Adoxio

private void InitializeParameters(out string fetchXml, out QueryByAttribute query)
		{
			// merge the select parameters
			IOrderedDictionary parameters = QueryParameters.GetValues(_context, _owner);

			fetchXml = GetNonNullOrEmpty(
				parameters[_fetchXmlParameterName] as string,
				_owner.FetchXml);

			if (!string.IsNullOrEmpty(fetchXml))
			{
				IOrderedDictionary selectParameters = SelectParameters.GetValues(_context, _owner);

				// apply select parameters replacement to the FetchXml
				foreach (DictionaryEntry entry in selectParameters)
				{
					if (entry.Key != null)
					{
						string key = entry.Key.ToString().Trim();

						if (!key.StartsWith("@"))
						{
							key = "@" + key;
						}

						string value = "{0}".FormatWith(entry.Value);

						if (Owner.EncodeParametersEnabled)
						{
							value = Encoder.XmlEncode(value);
						}

						fetchXml = Regex.Replace(fetchXml, key, value, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
					}
				}
			}

			// process the QueryByAttribute
			query = null;

			if (_owner.QueryByAttribute != null && !string.IsNullOrEmpty(_owner.QueryByAttribute.EnreplacedyName))
			{
				IOrderedDictionary selectParameters = SelectParameters.GetValues(_context, _owner);

				query = new QueryByAttribute();
				query.EnreplacedyName = LookupParameter(selectParameters, _owner.QueryByAttribute.EnreplacedyName);
				query.Attributes.AddRange(CopyParameters(selectParameters, _owner.QueryByAttribute.Attributes));
				query.Values.AddRange(CopyParameters(selectParameters, _owner.QueryByAttribute.Values));

				if (_owner.QueryByAttribute.ColumnSet != null && _owner.QueryByAttribute.ColumnSet.Count > 0)
				{
					// specify individual columns to load
					query.ColumnSet = new ColumnSet(CopyParameters(selectParameters, _owner.QueryByAttribute.ColumnSet));
				}
				else
				{
					// default to all columns
					query.ColumnSet = new ColumnSet(true);
				}

				if (_owner.QueryByAttribute.Orders != null && _owner.QueryByAttribute.Orders.Count > 0)
				{
					for (int i = 0; i < _owner.QueryByAttribute.Orders.Count; ++i)
					{
						OrderExpression order = new OrderExpression();
						order.AttributeName = LookupParameter(selectParameters, _owner.QueryByAttribute.Orders[i].Value);

						string orderText = LookupParameter(selectParameters, _owner.QueryByAttribute.Orders[i].Text);

						if (orderText.StartsWith("desc", StringComparison.InvariantCultureIgnoreCase))
						{
							order.OrderType = OrderType.Descending;
						}

						query.Orders.Add(order);
					}
				}

				// merge the select parameters
				string enreplacedyName = parameters[_enreplacedyNameParameterName] as string;

				if (!string.IsNullOrEmpty(enreplacedyName))
				{
					query.EnreplacedyName = enreplacedyName;
				}

				// comma delimited
				string attributes = parameters[_attributesParameterName] as string;

				if (!string.IsNullOrEmpty(attributes))
				{
					query.Attributes.Clear();
					query.Attributes.AddRange(attributes.Split(','));
				}

				// comma delimited
				string values = parameters[_valuesParameterName] as string;

				if (!string.IsNullOrEmpty(values))
				{
					query.Values.Clear();
					query.Values.AddRange(values.Split(','));
				}

				// comma delimited
				string columnSet = parameters[_columnSetParameterName] as string;

				if (!string.IsNullOrEmpty(columnSet))
				{
					if (string.Compare(columnSet, _allColumnsParameterValue, StringComparison.InvariantCultureIgnoreCase) == 0)
					{
						query.ColumnSet = new ColumnSet(true);
					}
					else
					{
						string[] parts = columnSet.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

						if (parts.Length > 0)
						{
							for (int i = 0; i < parts.Length; i++)
							{
								parts[i] = parts[i].Trim();
							}

							query.ColumnSet.AddColumns(parts);
						}
						else
						{
							query.ColumnSet = new ColumnSet(true);
						}
					}
				}

				// comma delimited
				string orders = parameters[_ordersParameterName] as string;

				if (!string.IsNullOrEmpty(orders))
				{
					QueryByAttribute queryByAttribute = query;
					AppendSortExpressionToQuery(orders, order => queryByAttribute.Orders.Add(order));
					query = queryByAttribute;
				}

				// all remaining parameters are treated as key/value pairs
				Dictionary<string, object> extendedParameters = new Dictionary<string, object>();

				if (query.Attributes != null)
				{
					for (int i = 0; i < query.Attributes.Count; ++i)
					{
						extendedParameters[query.Attributes[i]] = query.Values[i];
					}
				}

				bool changed = false;

				foreach (string key in parameters.Keys)
				{
					// ignore special parameters
					if (!Array.Exists(_keywords, delegate(string value) { return string.Compare(value, key, StringComparison.InvariantCultureIgnoreCase) == 0; }))
					{
						extendedParameters[key] = parameters[key];
						changed = true;
					}
				}

				if (changed)
				{
					query.Attributes.Clear();
					query.Values.Clear();

					int i = 0;
					foreach (KeyValuePair<string, object> extendedParameter in extendedParameters)
					{
						query.Attributes[i] = extendedParameter.Key;
						query.Values[i] = extendedParameter.Value;
						++i;
					}
				}
			}
		}

19 View Source File : ChatAuthController.cs
License : MIT License
Project Creator : Adoxio

[AllowAnonymous]
		public ActionResult Authorize(string response_type, string client_id, string redirect_uri, string scope,
			string state, string nonce)
		{
			if (string.IsNullOrEmpty(response_type) ||
				response_type.Split(' ')
					.All(s => string.Compare("token", s, StringComparison.InvariantCultureIgnoreCase) != 0))
			{
				return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
			}

			if (this.HttpContext.User.Idenreplacedy.IsAuthenticated)
			{
				ADXTrace.Instance.TraceInfo(TraceCategory.Application, "Authenticated User, returning token");

				var claims = this.GetUserClaims();
				if (!string.IsNullOrEmpty(nonce))
				{
					claims.Add(new Claim("nonce", nonce));
				}

				var token = GetTokenString(claims);

				var url = new UriBuilder(redirect_uri);
				var qs = !string.IsNullOrEmpty(url.Query) && url.Query.Length > 1 ? url.Query.Substring(1) + "&" : string.Empty;
				qs += "token=" + token; // token is already encoded

				url.Query = qs;

				return this.Redirect(url.ToString());
			}
			else
			{
				ADXTrace.Instance.TraceInfo(TraceCategory.Application, "Unauthenticated User, triggering authentication");

				var urlState = EncodeState(Request.Url.AbsoluteUri);
				var url = Url.Action("AuthForce", new { state = urlState });

				return this.Redirect(url);
			}
		}

19 View Source File : EventTriggerBase.cs
License : GNU General Public License v3.0
Project Creator : aduskin

protected override void OnAttached()
        {
            base.OnAttached();
            var replacedociatedObject = replacedociatedObject;
            var behavior = replacedociatedObject as Behavior;
            var element = replacedociatedObject as FrameworkElement;
            RegisterSourceChanged();
            if (behavior != null)
            {
                behavior.replacedociatedObjectChanged += OnBehaviorHostChanged;
            }
            else if (SourceObject != null || element == null)
            {
                try
                {
                    OnSourceChanged(null, Source);
                }
                catch (InvalidOperationException)
                {
                }
            }
            else
            {
                SourceNameResolver.NameScopeReferenceElement = element;
            }
            if (string.Compare(GetEventName(), "Loaded", StringComparison.Ordinal) == 0 && element != null &&
                !Interaction.IsElementLoaded(element))
                RegisterLoaded(element);
        }

19 View Source File : EventTriggerBase.cs
License : GNU General Public License v3.0
Project Creator : aduskin

internal void OnEventNameChanged(string oldEventName, string newEventName)
        {
            if (replacedociatedObject != null)
            {
                var source = Source as FrameworkElement;
                if (source != null && string.Compare(oldEventName, "Loaded", StringComparison.Ordinal) == 0)
                    UnregisterLoaded(source);
                else if (!string.IsNullOrEmpty(oldEventName))
                    UnregisterEvent(Source, oldEventName);
                if (source != null && string.Compare(newEventName, "Loaded", StringComparison.Ordinal) == 0)
                    RegisterLoaded(source);
                else if (!string.IsNullOrEmpty(newEventName))
                    RegisterEvent(Source, newEventName);
            }
        }

19 View Source File : EventTriggerBase.cs
License : GNU General Public License v3.0
Project Creator : aduskin

internal virtual void OnSourceChangedImpl(object oldSource, object newSource)
        {
            if (!string.IsNullOrEmpty(GetEventName()) &&
                string.Compare(GetEventName(), "Loaded", StringComparison.Ordinal) != 0)
            {
                if (oldSource != null && SourceTypeConstraint.IsInstanceOfType(oldSource))
                    UnregisterEvent(oldSource, GetEventName());
                if (newSource != null && SourceTypeConstraint.IsInstanceOfType(newSource))
                    RegisterEvent(newSource, GetEventName());
            }
        }

19 View Source File : EventTriggerBase.cs
License : GNU General Public License v3.0
Project Creator : aduskin

private void UnregisterEvent(object obj, string eventName)
        {
            if (string.Compare(eventName, "Loaded", StringComparison.Ordinal) == 0)
            {
                if (obj is FrameworkElement replacedociatedElement)
                    UnregisterLoaded(replacedociatedElement);
            }
            else
            {
                UnregisterEventImpl(obj, eventName);
            }
        }

19 View Source File : EventTriggerBase.cs
License : GNU General Public License v3.0
Project Creator : aduskin

protected override void OnDetaching()
        {
            base.OnDetaching();
            var replacedociatedObject = replacedociatedObject as Behavior;
            var replacedociatedElement = replacedociatedObject as FrameworkElement;
            try
            {
                OnSourceChanged(Source, null);
            }
            catch (InvalidOperationException)
            {
            }
            UnregisterSourceChanged();
            if (replacedociatedObject != null)
                replacedociatedObject.replacedociatedObjectChanged -= OnBehaviorHostChanged;
            SourceNameResolver.NameScopeReferenceElement = null;
            if (string.Compare(GetEventName(), "Loaded", StringComparison.Ordinal) == 0 && replacedociatedElement != null)
                UnregisterLoaded(replacedociatedElement);
        }

19 View Source File : FileEntry.cs
License : MIT License
Project Creator : adyanth

public int CompareTo(FileEntry other)
        {
            if (IsFolder == other.IsFolder)
                return string.Compare(Name, other.Name, StringComparison.CurrentCulture);

            if (IsFolder)
                return -1;

            return 1;
        }

19 View Source File : ExpressionComparer.cs
License : MIT License
Project Creator : albyho

protected virtual int CompareType(Type x, Type y)
        {
            if (x == y) return 0;

            if (CompareNull(x, y, out var result)) return result;

            result = x.GetHashCode() - y.GetHashCode();
            if (result != 0) return result;

            result = String.Compare(x.Name, y.Name, StringComparison.Ordinal);
            if (result != 0) return result;

            return x.replacedemblyQualifiedName.CompareTo(y.replacedemblyQualifiedName);
        }

19 View Source File : SmartSystemMenuSettings.cs
License : MIT License
Project Creator : AlexanderPro

public bool Equals(SmartSystemMenuSettings other)
        {
            if (other == null)
            {
                return false;
            }

            if (object.ReferenceEquals(this, other))
            {
                return true;
            }

            if (GetType() != other.GetType())
            {
                return false;
            }

            if (ProcessExclusions.Count != other.ProcessExclusions.Count)
            {
                return false;
            }

            if (MenuItems.WindowSizeItems.Count != other.MenuItems.WindowSizeItems.Count)
            {
                return false;
            }

            if (MenuItems.StartProgramItems.Count != other.MenuItems.StartProgramItems.Count)
            {
                return false;
            }

            if (MenuItems.Items.Count != other.MenuItems.Items.Count)
            {
                return false;
            }

            for (var i = 0; i < ProcessExclusions.Count; i++)
            {
                if (string.Compare(ProcessExclusions[i], other.ProcessExclusions[i], StringComparison.CurrentCultureIgnoreCase) != 0)
                {
                    return false;
                }
            }

            for (var i = 0; i < MenuItems.WindowSizeItems.Count; i++)
            {
                if (string.Compare(MenuItems.WindowSizeItems[i].replacedle, other.MenuItems.WindowSizeItems[i].replacedle, StringComparison.CurrentCultureIgnoreCase) != 0 ||
                    MenuItems.WindowSizeItems[i].Left != other.MenuItems.WindowSizeItems[i].Left ||
                    MenuItems.WindowSizeItems[i].Top != other.MenuItems.WindowSizeItems[i].Top ||
                    MenuItems.WindowSizeItems[i].Width != other.MenuItems.WindowSizeItems[i].Width ||
                    MenuItems.WindowSizeItems[i].Height != other.MenuItems.WindowSizeItems[i].Height ||
                    MenuItems.WindowSizeItems[i].Key1 != other.MenuItems.WindowSizeItems[i].Key1 ||
                    MenuItems.WindowSizeItems[i].Key2 != other.MenuItems.WindowSizeItems[i].Key2 ||
                    MenuItems.WindowSizeItems[i].Key3 != other.MenuItems.WindowSizeItems[i].Key3)
                {
                    return false;
                }
            }

            for (var i = 0; i < MenuItems.StartProgramItems.Count; i++)
            {
                if (string.Compare(MenuItems.StartProgramItems[i].replacedle, other.MenuItems.StartProgramItems[i].replacedle, StringComparison.CurrentCultureIgnoreCase) != 0 ||
                    string.Compare(MenuItems.StartProgramItems[i].FileName, other.MenuItems.StartProgramItems[i].FileName, StringComparison.CurrentCultureIgnoreCase) != 0 ||
                    string.Compare(MenuItems.StartProgramItems[i].Arguments, other.MenuItems.StartProgramItems[i].Arguments, StringComparison.CurrentCultureIgnoreCase) != 0)
                {
                    return false;
                }
            }

            for (var i = 0; i < MenuItems.Items.Count; i++)
            {
                if (string.Compare(MenuItems.Items[i].Name, other.MenuItems.Items[i].Name, StringComparison.CurrentCultureIgnoreCase) != 0 ||
                    MenuItems.Items[i].Show != other.MenuItems.Items[i].Show ||
                    MenuItems.Items[i].Type != other.MenuItems.Items[i].Type ||
                    MenuItems.Items[i].Key1 != other.MenuItems.Items[i].Key1 ||
                    MenuItems.Items[i].Key2 != other.MenuItems.Items[i].Key2 ||
                    MenuItems.Items[i].Key3 != other.MenuItems.Items[i].Key3)
                {
                    return false;
                }

                if (MenuItems.Items[i].Items.Count != other.MenuItems.Items[i].Items.Count)
                {
                    return false;
                }

                for (var j = 0; j < MenuItems.Items[i].Items.Count; j++)
                {
                    if (string.Compare(MenuItems.Items[i].Items[j].Name, other.MenuItems.Items[i].Items[j].Name, StringComparison.CurrentCultureIgnoreCase) != 0 ||
                        MenuItems.Items[i].Items[j].Show != other.MenuItems.Items[i].Items[j].Show ||
                        MenuItems.Items[i].Items[j].Type != other.MenuItems.Items[i].Items[j].Type ||
                        MenuItems.Items[i].Items[j].Key1 != other.MenuItems.Items[i].Items[j].Key1 ||
                        MenuItems.Items[i].Items[j].Key2 != other.MenuItems.Items[i].Items[j].Key2 ||
                        MenuItems.Items[i].Items[j].Key3 != other.MenuItems.Items[i].Items[j].Key3)
                    {
                        return false;
                    }
                }
            }

            if (Closer.Type != other.Closer.Type || Closer.Key1 != other.Closer.Key1 || Closer.Key2 != other.Closer.Key2 || Closer.MouseButton != other.Closer.MouseButton)
            {
                return false;
            }

            if (Sizer != other.Sizer)
            {
                return false;
            }

            if (string.Compare(LanguageName, other.LanguageName, StringComparison.CurrentCultureIgnoreCase) != 0)
            {
                return false;
            }

            return true;
        }

19 View Source File : DependenciesHunter.cs
License : MIT License
Project Creator : AlexeyPerov

private void SortByType()
        {
            if (_sortType == 0)
            {
                _sortType = 1;
                _unusedreplacedets?.Sort((a, b) =>
                    string.Compare(b.TypeName, a.TypeName, StringComparison.Ordinal));
            }
            else
            {
                _sortType = 0;
                _unusedreplacedets?.Sort((a, b) =>
                    string.Compare(a.TypeName, b.TypeName, StringComparison.Ordinal));
            }
        }

19 View Source File : DependenciesHunter.cs
License : MIT License
Project Creator : AlexeyPerov

private void SortByPath()
        {
            if (_sortType == 2)
            {
                _sortType = 3;
                _unusedreplacedets?.Sort((a, b) =>
                    string.Compare(b.Path, a.Path, StringComparison.Ordinal));
            }
            else
            {
                _sortType = 2;
                _unusedreplacedets?.Sort((a, b) =>
                    string.Compare(a.Path, b.Path, StringComparison.Ordinal));
            }
        }

19 View Source File : Identifier.cs
License : MIT License
Project Creator : AlexGyver

public int CompareTo(Identifier other) {
      if (other == null)
        return 1;
      else 
        return string.Compare(this.identifier, other.identifier, 
          StringComparison.Ordinal);
    }

19 View Source File : Utility.cs
License : MIT License
Project Creator : alexrainman

public static bool MatchHostnameToPattern(string hostname, string pattern)
        {
            // check if this is a pattern
            int index = pattern.IndexOf('*');
            if (index == -1)
            {
                // not a pattern, do a direct case-insensitive comparison
                return (string.Compare(hostname, pattern, StringComparison.OrdinalIgnoreCase) == 0);
            }

            // check pattern validity
            // A "*" wildcard character MAY be used as the left-most name component in the certificate.

            // unless this is the last char (valid)
            if (index != pattern.Length - 1)
            {
                // then the next char must be a dot .'.
                if (pattern[index + 1] != '.')
                {
                    return false;
                }
            }

            // only one (A) wildcard is supported
            int i2 = pattern.IndexOf('*', index + 1);
            if (i2 != -1) return false;

            // match the end of the pattern
            string end = pattern.Substring(index + 1);
            int length = hostname.Length - end.Length;
            // no point to check a pattern that is longer than the hostname
            if (length <= 0) return false;

            if (string.Compare(hostname, length, end, 0, end.Length, StringComparison.OrdinalIgnoreCase) != 0) {
                return false;
            }

            // special case, we start with the wildcard
            if (index == 0)
            {
                // ensure we hostname non-matched part (start) doesn't contain a dot
                int i3 = hostname.IndexOf('.');
                return ((i3 == -1) || (i3 >= (hostname.Length - end.Length)));
            }

            // match the start of the pattern
            string start = pattern.Substring(0, index);

            return (string.Compare(hostname, 0, start, 0, start.Length, StringComparison.OrdinalIgnoreCase) == 0);
        }

19 View Source File : DomainName.cs
License : Apache License 2.0
Project Creator : alexreinert

public int CompareTo(DomainName other)
		{
			for (int i = 1; i <= Math.Min(LabelCount, other.LabelCount); i++)
			{
				int labelCompare = String.Compare(Labels[LabelCount - i].ToLowerInvariant(), other.Labels[other.LabelCount - i].ToLowerInvariant(), StringComparison.Ordinal);

				if (labelCompare != 0)
					return labelCompare;
			}

			return LabelCount.CompareTo(other.LabelCount);
		}

19 View Source File : StringExtensions.cs
License : MIT License
Project Creator : allisterb

public static bool EqualsOrdinalIgnoreCase(this string strA, string strB)
        {
            return string.Compare(strA, strB, StringComparison.OrdinalIgnoreCase) == 0;
        }

19 View Source File : ProcessFilter.cs
License : GNU Lesser General Public License v3.0
Project Creator : Alois-xx

public IEnumerable<int> GetMatchingPids()
        {
            string query = "SELECT Name, CommandLine, ProcessId FROM Win32_Process";
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
            foreach (ManagementObject mo in searcher.Get())
            {
                string exename = (string) mo["Name"];
                string cmdLine = (string) mo["CommandLine"];
                int pid = (int) (UInt32) mo["ProcessId"];

                if( CmdLineFilters != null )
                {
                    if( String.IsNullOrEmpty(cmdLine) )
                    {
                        continue;
                    }

                    foreach(var cmdLineFilter in CmdLineFilters)
                    {
                        if (cmdLine.IndexOf(cmdLineFilter, StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            goto Continue;
                        }

                    }
                }

                if( PidFilter != 0 )
                {
                    if( PidFilter != pid)
                    {
                        continue;
                    }
                }

                if( !String.IsNullOrEmpty(ProcessNameFilter)  )
                {
                    if( String.Compare(ProcessNameFilter, exename, StringComparison.OrdinalIgnoreCase) != 0 )
                    {
                        continue;
                    }
                }

                yield return pid;

            Continue:
                ;
            }
        }

19 View Source File : SuffixVersion.cs
License : MIT License
Project Creator : AmazingDM

public int CompareTo(SuffixVersion other)
        {
            var majorComparison = Major.CompareTo(other.Major);
            if (majorComparison != 0)
                return majorComparison;
            var minorComparison = Minor.CompareTo(other.Minor);
            if (minorComparison != 0)
                return minorComparison;
            var patchComparison = Patch.CompareTo(other.Patch);
            if (patchComparison != 0)
                return patchComparison;
            if (PreRelease == string.Empty)
                return other.PreRelease == string.Empty ? 0 : 1;
            if (other.PreRelease == string.Empty)
                return -1;
            var suffixComparison = string.Compare(PreRelease, other.PreRelease, StringComparison.Ordinal);
            if (suffixComparison != 0)
                return suffixComparison;
            return Build.CompareTo(other.Build);
        }

19 View Source File : Form1.cs
License : MIT License
Project Creator : Amine-Smahi

private void SetScreenArea()
        {
            // get entire desktop area size
            string screenName = this.cb_screenSelector.SelectedValue.ToString();
            if ( string.Compare( screenName, @"Select ALL", StringComparison.OrdinalIgnoreCase) == 0 )
            {
                foreach ( Screen screen in Screen.AllScreens )
                {
                    this._screenArea = Rectangle.Union( _screenArea, screen.Bounds );
                }
            }
            else
            {
                this._screenArea = Screen.AllScreens.First( scr => scr.DeviceName.Equals( screenName ) ).Bounds;
                this._width = this._screenArea.Width;
                this._height = this._screenArea.Height;
            }
        }

19 View Source File : DialogboxPurger.cs
License : Apache License 2.0
Project Creator : AmpScm

private void HandleDialogBoxes()
        {
            // No synchronization numberOfDialogsToWaitFor since it is readonly
            IntPtr[] hwnds = new IntPtr[this.numberOfDialogsToWaitFor];
            bool[] dialogBoxCloseResults = new bool[this.numberOfDialogsToWaitFor];

            try
            {
                // Signal that we started
                lock (Mutex)
                {
                    this.threadStarted.Set();
                }

                // The loop will be exited either if a message is send by the caller thread or if we found the dialog. If a message box text is specified the loop will not exit until the dialog is found.
                bool stayInLoop = true;
                int dialogBoxesToWaitFor = 1;

                while (stayInLoop)
                {
                    int hwndIndex = dialogBoxesToWaitFor - 1;

                    // We need to lock since the caller might set context to null.
                    lock (Mutex)
                    {
                        if (this.exitThread)
                        {
                            break;
                        }

                        // We protect the shell too from reentrency.
                        this.uiShell.GetDialogOwnerHwnd(out hwnds[hwndIndex]);

                    }

                    if (hwnds[hwndIndex] != IntPtr.Zero)
                    {
                        StringBuilder windowClreplacedName = new StringBuilder(256);
                        NativeMethods.GetClreplacedName(hwnds[hwndIndex], windowClreplacedName, windowClreplacedName.Capacity);

                        // The #32770 is the clreplaced name of a messagebox dialog.
                        if (windowClreplacedName.ToString().Contains("#32770"))
                        {
                            IntPtr unmanagedMemoryLocation = IntPtr.Zero;
                            string dialogBoxText = String.Empty;
                            try
                            {
                                unmanagedMemoryLocation = Marshal.AllocHGlobal(10 * 1024);
                                NativeMethods.EnumChildWindows(hwnds[hwndIndex], new NativeMethods.CallBack(FindMessageBoxString), unmanagedMemoryLocation);
                                dialogBoxText = Marshal.PtrToStringUni(unmanagedMemoryLocation);
                            }
                            finally
                            {
                                if (unmanagedMemoryLocation != IntPtr.Zero)
                                {
                                    Marshal.FreeHGlobal(unmanagedMemoryLocation);
                                }
                            }

                            lock (Mutex)
                            {

                                // Since this is running on the main thread be sure that we close the dialog.
                                bool dialogCloseResult = false;
                                if (this.buttonAction != 0)
                                {
                                    dialogCloseResult = NativeMethods.EndDialog(hwnds[hwndIndex], this.buttonAction);
                                }

                                // Check if we have found the right dialog box.
                                if (String.IsNullOrEmpty(this.expectedDialogBoxText) || (!String.IsNullOrEmpty(dialogBoxText) && String.Compare(this.expectedDialogBoxText, dialogBoxText.Trim(), StringComparison.OrdinalIgnoreCase) == 0))
                                {
                                    dialogBoxCloseResults[hwndIndex] = dialogCloseResult;
                                    if (dialogBoxesToWaitFor++ >= this.numberOfDialogsToWaitFor)
                                    {
                                        stayInLoop = false;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                //Let the main thread run a possible close command.
                System.Threading.Thread.Sleep(2000);

                foreach (IntPtr hwnd in hwnds)
                {
                    // At this point the dialog should be closed, if not attempt to close it.
                    if (hwnd != IntPtr.Zero)
                    {
                        NativeMethods.SendMessage(hwnd, NativeMethods.WM_CLOSE, 0, new IntPtr(0));
                    }
                }

                lock (Mutex)
                {
                    // Be optimistic.
                    this.dialogBoxCloseResult = true;

                    for (int i = 0; i < dialogBoxCloseResults.Length; i++)
                    {
                        if (!dialogBoxCloseResults[i])
                        {
                            this.dialogBoxCloseResult = false;
                            break;
                        }
                    }

                    this.threadDone.Set();
                }
            }
        }

19 View Source File : NativeMethods.cs
License : Apache License 2.0
Project Creator : AmpScm

public static bool IsSamePath(string file1, string file2)
        {
            if (file1 == null || file1.Length == 0)
            {
                return (file2 == null || file2.Length == 0);
            }

            Uri uri1 = null;
            Uri uri2 = null;

            try
            {
                if (!Uri.TryCreate(file1, UriKind.Absolute, out uri1) || !Uri.TryCreate(file2, UriKind.Absolute, out uri2))
                {
                    return false;
                }

                if (uri1 != null && uri1.IsFile && uri2 != null && uri2.IsFile)
                {
                    return 0 == String.Compare(uri1.LocalPath, uri2.LocalPath, StringComparison.OrdinalIgnoreCase);
                }

                return file1 == file2;
            }
            catch (UriFormatException e)
            {
                System.Diagnostics.Trace.WriteLine("Exception " + e.Message);
            }

            return false;
        }

19 View Source File : Token.cs
License : MIT License
Project Creator : andersnm

public static bool IsExponent(string token)
        {
            return
                (string.Compare(token, "e+", StringComparison.OrdinalIgnoreCase) == 0) ||
                (string.Compare(token, "e-", StringComparison.OrdinalIgnoreCase) == 0);
        }

19 View Source File : Token.cs
License : MIT License
Project Creator : andersnm

public static bool IsGeneral(string token)
        {
            return string.Compare(token, "general", StringComparison.OrdinalIgnoreCase) == 0;
        }

19 View Source File : Token.cs
License : MIT License
Project Creator : andersnm

public static bool IsDatePart(string token)
        {
            return
                token.StartsWith("y", StringComparison.OrdinalIgnoreCase) ||
                token.StartsWith("m", StringComparison.OrdinalIgnoreCase) ||
                token.StartsWith("d", StringComparison.OrdinalIgnoreCase) ||
                token.StartsWith("s", StringComparison.OrdinalIgnoreCase) ||
                token.StartsWith("h", StringComparison.OrdinalIgnoreCase) ||
                (token.StartsWith("g", StringComparison.OrdinalIgnoreCase) && !IsGeneral(token)) ||
                string.Compare(token, "am/pm", StringComparison.OrdinalIgnoreCase) == 0 ||
                string.Compare(token, "a/p", StringComparison.OrdinalIgnoreCase) == 0 ||
                IsDurationPart(token);
        }

19 View Source File : Formatter.cs
License : MIT License
Project Creator : andersnm

private static string FormatDate(ExcelDateTime date, List<string> tokens, CultureInfo culture)
        {
            var containsAmPm = ContainsAmPm(tokens);

            var result = new StringBuilder();
            for (var i = 0; i < tokens.Count; i++)
            {
                var token = tokens[i];

                if (token.StartsWith("y", StringComparison.OrdinalIgnoreCase))
                {
                    // year
                    var digits = token.Length;
                    if (digits < 2)
                        digits = 2;
                    if (digits == 3)
                        digits = 4;

                    var year = date.Year;
                    if (digits == 2)
                        year = year % 100;

                    result.Append(year.ToString("D" + digits));
                }
                else if (token.StartsWith("m", StringComparison.OrdinalIgnoreCase))
                {
                    // If  "m" or "mm" code is used immediately after the "h" or "hh" code (for hours) or immediately before 
                    // the "ss" code (for seconds), the application shall display minutes instead of the month. 
                    if (LookBackDatePart(tokens, i - 1, "h") || LookAheadDatePart(tokens, i + 1, "s"))
                    {
                        var digits = token.Length;
                        result.Append(date.Minute.ToString("D" + digits));
                    }
                    else
                    {
                        var digits = token.Length;
                        if (digits == 3)
                        {
                            result.Append(culture.DateTimeFormat.AbbreviatedMonthNames[date.Month - 1]);
                        }
                        else if (digits == 4)
                        {
                            result.Append(culture.DateTimeFormat.MonthNames[date.Month - 1]);
                        }
                        else if (digits == 5)
                        {
                            result.Append(culture.DateTimeFormat.MonthNames[date.Month - 1][0]);
                        }
                        else
                        {
                            result.Append(date.Month.ToString("D" + digits));
                        }
                    }
                }
                else if (token.StartsWith("d", StringComparison.OrdinalIgnoreCase))
                {
                    var digits = token.Length;
                    if (digits == 3)
                    {
                        // Sun-Sat
                        result.Append(culture.DateTimeFormat.AbbreviatedDayNames[(int)date.DayOfWeek]);
                    }
                    else if (digits == 4)
                    {
                        // Sunday-Saturday
                        result.Append(culture.DateTimeFormat.DayNames[(int)date.DayOfWeek]);
                    }
                    else
                    {
                        result.Append(date.Day.ToString("D" + digits));
                    }
                }
                else if (token.StartsWith("h", StringComparison.OrdinalIgnoreCase))
                {
                    var digits = token.Length;
                    if (containsAmPm)
                        result.Append(((date.Hour + 11) % 12 + 1).ToString("D" + digits));
                    else
                        result.Append(date.Hour.ToString("D" + digits));
                }
                else if (token.StartsWith("s", StringComparison.OrdinalIgnoreCase))
                {
                    var digits = token.Length;
                    result.Append(date.Second.ToString("D" + digits));
                }
                else if (token.StartsWith("g", StringComparison.OrdinalIgnoreCase))
                {
                    var era = culture.DateTimeFormat.Calendar.GetEra(date.AdjustedDateTime);
                    var digits = token.Length;
                    if (digits < 3)
                    {
                        result.Append(culture.DateTimeFormat.GetAbbreviatedEraName(era));
                    }
                    else
                    {
                        result.Append(culture.DateTimeFormat.GetEraName(era));
                    }
                }
                else if (string.Compare(token, "am/pm", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var ampm = date.ToString("tt", CultureInfo.InvariantCulture);
                    result.Append(ampm.ToUpperInvariant());
                }
                else if (string.Compare(token, "a/p", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var ampm = date.ToString("%t", CultureInfo.InvariantCulture);
                    if (char.IsUpper(token[0]))
                    {
                        result.Append(ampm.ToUpperInvariant());
                    }
                    else
                    {
                        result.Append(ampm.ToLowerInvariant());
                    }
                }
                else if (token.StartsWith(".0"))
                {
                    var value = date.Millisecond;
                    var digits = token.Length - 1;
                    result.Append("." + value.ToString("D" + digits));
                }
                else if (token == "/")
                {
#if NETSTANDARD1_0
                    result.Append(DateTime.MaxValue.ToString("/d", culture)[0]);
#else
                    result.Append(culture.DateTimeFormat.DateSeparator);
#endif
                }
                else if (token == ",")
                {
                    while (i < tokens.Count - 1 && tokens[i + 1] == ",")
                    {
                        i++;
                    }

                    result.Append(",");
                }
                else
                {
                    FormatLiteral(token, result);
                }
            }

            return result.ToString();
        }

19 View Source File : Formatter.cs
License : MIT License
Project Creator : andersnm

private static bool ContainsAmPm(List<string> tokens)
        {
            foreach (var token in tokens)
            {
                if (string.Compare(token, "am/pm", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    return true;
                }

                if (string.Compare(token, "a/p", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    return true;
                }
            }

            return false;
        }

19 View Source File : CppParser.cs
License : MIT License
Project Creator : AndresTraks

private bool ArePathsEqual(string path1, string path2)
        {
            return string.Compare(
                Path.GetFullPath(path1).TrimEnd('\\'),
                Path.GetFullPath(path2).TrimEnd('\\'),
                StringComparison.InvariantCultureIgnoreCase) == 0;
        }

19 View Source File : ColumnChart.cs
License : MIT License
Project Creator : AngeloCresta

private void ProcessChartType( 
			bool labels, 
			bool selection, 
			ChartGraphics graph, 
			CommonElements common, 
			ChartArea area,
			Series seriesToDraw )
		{
			// Prosess 3D chart type
			if(area.Area3DStyle.Enable3D)
			{
				ProcessChartType3D( labels, selection, graph, common, area, seriesToDraw );
				return;
			}
			
			// Get pixel size
			SizeF	pixelRelSize = graph.GetRelativeSize(new SizeF(1.1f, 1.1f));
		
			// All data series from chart area which have Column chart type
			List<string> typeSeries = area.GetSeriesFromChartType(Name);

			// Check if series should be drawn side by side
			bool	currentDrawSeriesSideBySide = this.drawSeriesSideBySide;
			foreach(string seriesName in typeSeries)
			{
				if(common.DataManager.Series[seriesName].IsCustomPropertySet(CustomPropertyName.DrawSideBySide))
				{
					string attribValue = common.DataManager.Series[seriesName][CustomPropertyName.DrawSideBySide];
					if(String.Compare( attribValue, "False", StringComparison.OrdinalIgnoreCase) == 0 )
					{
						currentDrawSeriesSideBySide = false;
					}
					else if(String.Compare( attribValue, "True", StringComparison.OrdinalIgnoreCase) == 0)
					{
						currentDrawSeriesSideBySide = true;
					}
					else if(String.Compare( attribValue, "Auto", StringComparison.OrdinalIgnoreCase) == 0)
					{
						// Do nothing
					}
					else
					{
                        throw (new InvalidOperationException(SR.ExceptionAttributeDrawSideBySideInvalid));
					}
				}
			}

			// Find the number of "Column chart" data series
			double	numOfSeries = typeSeries.Count;
			if(!currentDrawSeriesSideBySide)
			{
				numOfSeries = 1;
			}

			// Check if column chart series are indexed
            bool indexedSeries = ChartHelper.IndexedSeries(this.Common, area.GetSeriesFromChartType(Name).ToArray());

			//************************************************************
			//** Loop through all series
			//************************************************************
			int	seriesIndx = 0;
			foreach( Series ser in common.DataManager.Series )
			{
				// Process non empty series of the area with Column chart type
				if( String.Compare( ser.ChartTypeName, Name, true, System.Globalization.CultureInfo.CurrentCulture) != 0 
					|| ser.ChartArea != area.Name || ser.Points.Count == 0 || !ser.IsVisible())
				{
					continue;
				}

				// Set shifted series name property
				ShiftedSerName = ser.Name;

				// Set active vertical/horizontal axis
				Axis	vAxis = area.GetAxis(AxisName.Y, ser.YAxisType, ser.YSubAxisName);
				Axis	hAxis = area.GetAxis(AxisName.X, ser.XAxisType, ser.XSubAxisName);
				double horizontalViewMax = hAxis.ViewMaximum;
				double horizontalViewMin = hAxis.ViewMinimum;
				double verticalViewMax = vAxis.ViewMaximum;
				double verticalViewMin = vAxis.ViewMinimum;
				double verticalAxisCrossing = vAxis.GetPosition(vAxis.Crossing);

				// Get points interval:
				//  - set interval to 1 for indexed series
				//  - if points are not equaly spaced, the minimum interval between points is selected.
				//  - if points have same interval bars do not overlap each other.
				bool	sameInterval = false;
				double	interval = 1;
				if(!indexedSeries)
				{
                    if (ser.Points.Count == 1 &&
                        (ser.XValueType == ChartValueType.Date || 
                         ser.XValueType == ChartValueType.DateTime || 
                         ser.XValueType == ChartValueType.Time ||
                         ser.XValueType == ChartValueType.DateTimeOffset))
                    {
                        // Check if interval is the same
                        area.GetPointsInterval(typeSeries, hAxis.IsLogarithmic, hAxis.logarithmBase, true, out sameInterval);

                        // Special case when there is only one data point and date scale is used.
                        if (!double.IsNaN(hAxis.majorGrid.GetInterval()) && hAxis.majorGrid.GetIntervalType() != DateTimeIntervalType.NotSet)
                        {
                            interval = ChartHelper.GetIntervalSize(hAxis.minimum, hAxis.majorGrid.GetInterval(), hAxis.majorGrid.GetIntervalType());
                        }
                        else
                        {
                            interval = ChartHelper.GetIntervalSize(hAxis.minimum, hAxis.Interval, hAxis.IntervalType);
                        }
                    }
                    else
                    {
                        interval = area.GetPointsInterval( typeSeries, hAxis.IsLogarithmic, hAxis.logarithmBase, true, out sameInterval );
                    }
				}

				// Get column width
				double	width = ser.GetPointWidth(graph, hAxis, interval, 0.8) / numOfSeries;
				
				// Call Back Paint event
				if( !selection )
				{
                    common.Chart.CallOnPrePaint(new ChartPaintEventArgs(ser, graph, common, area.PlotAreaPosition));
				}

				//************************************************************
				//** Loop through all points in series
				//************************************************************
				int	index = 0;
				foreach( DataPoint point in ser.Points )
				{
					// Change Y value if Column is out of plot area
					double	yValue = vAxis.GetLogValue( GetYValue(common, area, ser, point, index, (useTwoValues) ? 1 : 0) );
					
					if( yValue > verticalViewMax )
					{
						yValue = verticalViewMax;
					}
					if( yValue < verticalViewMin )
					{
						yValue = verticalViewMin;
					}

					// Recalculates Height position and zero position of Columns
					double	height = vAxis.GetLinearPosition( yValue );

					// Set start position for a column
					double	columnStartPosition = 0;
					if(useTwoValues)
					{
						// Point Y value (first) is used to determine the column starting position
						double yValueStart = vAxis.GetLogValue( GetYValue(common, area, ser, point, index, 0 ) );
						if( yValueStart > verticalViewMax )
						{
							yValueStart = verticalViewMax;
						}
						else if( yValueStart < verticalViewMin )
						{
							yValueStart = verticalViewMin;
						}

						columnStartPosition = vAxis.GetLinearPosition(yValueStart);
					}
					else
					{
						// Column starts on the horizontal axis crossing
						columnStartPosition = verticalAxisCrossing;
					}

					// Increase point index
					index++;
					
					// Set x position
					double	xCenterVal;
					double	xPosition;
					if( indexedSeries )
					{
						// The formula for position is based on a distance 
						//from the grid line or nPoints position.
						xPosition = hAxis.GetPosition( (double)index ) - width * ((double) numOfSeries) / 2.0 + width/2 + seriesIndx * width;
						xCenterVal = hAxis.GetPosition( (double)index );
					}
					else if( sameInterval )
					{
						xPosition = hAxis.GetPosition( point.XValue ) - width * ((double) numOfSeries) / 2.0 + width/2 + seriesIndx * width;
						xCenterVal = hAxis.GetPosition( point.XValue );
					}
					else
					{
						xPosition = hAxis.GetPosition( point.XValue );
						xCenterVal = hAxis.GetPosition( point.XValue );
					}

					// Labels and markers have to be shifted if there 
					// is more than one series for column chart.
					ShiftedX = xPosition - xCenterVal;
					

					// Make sure that points with small values are still visible
					if( height < columnStartPosition && 
						(columnStartPosition - height) <  pixelRelSize.Height)
					{
						height = columnStartPosition - pixelRelSize.Height;
					}
					if( height > columnStartPosition && 
						(height - columnStartPosition) <  pixelRelSize.Height)
					{
						height = columnStartPosition + pixelRelSize.Height;
					}
							
					// Get column rectangle
					RectangleF	rectSize = RectangleF.Empty;
					try
					{
						// Set the Column rectangle
						rectSize.X = (float)(xPosition - width/2);
						rectSize.Width = (float)(width);


						// The top side of rectangle has always 
						// smaller value than a bottom value
						if( columnStartPosition < height )
						{
							rectSize.Y = (float)columnStartPosition;
							rectSize.Height = (float)height - rectSize.Y;
						}
						else
						{
							rectSize.Y = (float)height;
							rectSize.Height = (float)columnStartPosition - rectSize.Y;
						}

					}
					catch(OverflowException)
					{
						continue;
					}

					// if data point is not empty
					if( point.IsEmpty )
					{
						continue;
					}

					//************************************************************
					// Painting mode
					//************************************************************
					if( common.ProcessModePaint )
					{
						if( !labels )
						{
							// Check if column is completly out of the data scaleView
							double	xValue = (indexedSeries) ? index : point.XValue;
							xValue = hAxis.GetLogValue(xValue);
							if(xValue < horizontalViewMin || xValue > horizontalViewMax )
							{
								continue;
							}

							// Check if column is partialy in the data scaleView
							bool	clipRegionSet = false;
							if(rectSize.X < area.PlotAreaPosition.X || rectSize.Right > area.PlotAreaPosition.Right)
							{
								// Set clipping region for line drawing 
								graph.SetClip( area.PlotAreaPosition.ToRectangleF() );
								clipRegionSet = true;
							}

							// Start Svg Selection mode
							graph.StartHotRegion( point );

							// Draw the Column rectangle
							DrawColumn2D(graph, vAxis, rectSize, point, ser);

							// End Svg Selection mode
							graph.EndHotRegion( );

							// Reset Clip Region
							if(clipRegionSet)
							{
								graph.ResetClip();
							}
						}
						else if(this.useTwoValues)
						{
							// Draw labels and markers
							DrawLabel( 
								area, 
								graph, 
								common, 
								rectSize, 
								point, 
								ser,
								index);
						}
					}

					//************************************************************
					// Hot Regions mode used for image maps, tool tips and 
					// hit test function
					//************************************************************
					if( common.ProcessModeRegions && !labels)
					{
						common.HotRegionsList.AddHotRegion( rectSize, point, ser.Name, index - 1 );
					}
				}
				
				// Call Paint event
				if( !selection )
				{
                    common.Chart.CallOnPostPaint(new ChartPaintEventArgs(ser, graph, common, area.PlotAreaPosition));
				}

				// Data series index
				if(currentDrawSeriesSideBySide)
				{
					seriesIndx++;
				}

				// Draw labels and markers using the base clreplaced algorithm
				if( labels && !this.useTwoValues)
				{
					base.ProcessChartType( false, graph, common, area, seriesToDraw );
				}
			}
		}

19 View Source File : ColumnChart.cs
License : MIT License
Project Creator : AngeloCresta

private void ProcessChartType3D( bool labels, bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw )
		{
			// Labels & markers are drawn with the data points in the first iteration
			if(labels && !selection)
			{
				return;
			}
			
			// Get pixel size
			SizeF	pixelRelSize = graph.GetRelativeSize(new SizeF(1.1f, 1.1f));

			// Get list of series to draw
			List<string> typeSeries = null;
			bool	currentDrawSeriesSideBySide = this.drawSeriesSideBySide;
			if( (area.Area3DStyle.IsClustered && this.SideBySideSeries) ||
				this.Stacked)
			{
				// Draw all series of the same chart type
				typeSeries = area.GetSeriesFromChartType(Name);

				// Check if series should be drawn side by side
				foreach(string seriesName in typeSeries)
				{
					if(common.DataManager.Series[seriesName].IsCustomPropertySet(CustomPropertyName.DrawSideBySide))
					{
						string attribValue = common.DataManager.Series[seriesName][CustomPropertyName.DrawSideBySide];
						if(String.Compare( attribValue, "False", StringComparison.OrdinalIgnoreCase)==0)
						{
							currentDrawSeriesSideBySide = false;
						}
						else if(String.Compare( attribValue, "True", StringComparison.OrdinalIgnoreCase)==0)
						{
							currentDrawSeriesSideBySide = true;
						}
						else if(String.Compare( attribValue, "Auto", StringComparison.OrdinalIgnoreCase)==0)
						{
							// Do nothing
						}
						else
						{
                            throw (new InvalidOperationException(SR.ExceptionAttributeDrawSideBySideInvalid));
						}
					}
				}
			}
			else
			{
				// Draw just one chart series
				typeSeries = new List<string>();
				typeSeries.Add(seriesToDraw.Name);
			}

			//************************************************************
			//** Get order of data points drawing
			//************************************************************
			ArrayList	dataPointDrawingOrder = area.GetDataPointDrawingOrder(typeSeries, this, selection, coordinates, null, this.YValueIndex, currentDrawSeriesSideBySide);

			//************************************************************
			//** Loop through all data poins
			//************************************************************
			foreach(object obj in dataPointDrawingOrder)
			{
				// Get point & series
				DataPoint3D	pointEx = (DataPoint3D) obj;
				DataPoint	point = pointEx.dataPoint;
				Series		ser = point.series;

				// Get point bar drawing style
				BarDrawingStyle	barDrawingStyle = ChartGraphics.GetBarDrawingStyle(point);

				// Set active vertical/horizontal axis
				Axis	vAxis = area.GetAxis(AxisName.Y, ser.YAxisType, ser.YSubAxisName);
				Axis	hAxis = area.GetAxis(AxisName.X, ser.XAxisType, ser.XSubAxisName);

				// Change Y value if Column is out of plot area
				float	topDarkening = 0f;
				float	bottomDarkening = 0f;
				double	yValue = GetYValue(common, area, ser, pointEx.dataPoint, pointEx.index - 1, (useTwoValues) ? 1 : 0);
				yValue = vAxis.GetLogValue(yValue);
				if( yValue > vAxis.ViewMaximum )
				{
					topDarkening = 0.5f;
					yValue = vAxis.ViewMaximum;
				}
				if( yValue < vAxis.ViewMinimum )
				{
					topDarkening = 0.5f;
					yValue = vAxis.ViewMinimum;
				}

				// Recalculates Height position and zero position of Columns
				double	height = vAxis.GetLinearPosition( yValue );

				// Set start position for a column
				double	columnStartPosition = 0;
				if(useTwoValues)
				{
					// Point Y value (first) is used to determine the column starting position
					double yValueStart = vAxis.GetLogValue( GetYValue(common, area, ser, point, pointEx.index - 1, 0 ) );
					if( yValueStart > vAxis.ViewMaximum )
					{
						bottomDarkening = 0.5f;
						yValueStart = vAxis.ViewMaximum;
					}
					else if( yValueStart < vAxis.ViewMinimum )
					{
						bottomDarkening = 0.5f;
						yValueStart = vAxis.ViewMinimum;
					}

					columnStartPosition = vAxis.GetLinearPosition(yValueStart);
				}
				else
				{
					// Column starts on the horizontal axis crossing
					columnStartPosition = vAxis.GetPosition(vAxis.Crossing);
				}

				// Labels and markers have to be shifted if there 
				// is more than one series for column chart.
				if(!currentDrawSeriesSideBySide)
				{
					pointEx.xPosition = pointEx.xCenterVal;
				}
				ShiftedX = pointEx.xPosition - pointEx.xCenterVal;
					
				// Make sure that points with small values are still visible
				if( height < columnStartPosition && 
					(columnStartPosition - height) <  pixelRelSize.Height)
				{
					height = columnStartPosition - pixelRelSize.Height;
				}
				if( height > columnStartPosition && 
					(height - columnStartPosition) <  pixelRelSize.Height)
				{
					height = columnStartPosition + pixelRelSize.Height;
				}

				// Get column rectangle
				RectangleF	rectSize = RectangleF.Empty;
				try
				{
					// Set the Column rectangle
					rectSize.X = (float)(pointEx.xPosition - pointEx.width/2);
					rectSize.Width = (float)(pointEx.width);

					// The top side of rectangle has always 
					// smaller value than a bottom value
					if( columnStartPosition < height )
					{
						float temp = bottomDarkening;
						bottomDarkening = topDarkening;
						topDarkening = temp;
						
						rectSize.Y = (float)columnStartPosition;
						rectSize.Height = (float)height - rectSize.Y;
					}
					else
					{
						rectSize.Y = (float)height;
						rectSize.Height = (float)columnStartPosition - rectSize.Y;
					}
				}
				catch(OverflowException)
				{
					continue;
				}

				//************************************************************
				//** Painting mode
				//************************************************************
				// Path projection of 3D rect.
				GraphicsPath rectPath = null;

				// Check if column is completly out of the data scaleView
				double	xValue = (pointEx.indexedSeries) ? pointEx.index : point.XValue;
				xValue = hAxis.GetLogValue(xValue);
				if(xValue < hAxis.ViewMinimum || xValue > hAxis.ViewMaximum )
				{
					continue;
				}

				// Check if column is partialy in the data scaleView
				bool	clipRegionSet = false;
				if(rectSize.Right <= area.PlotAreaPosition.X || rectSize.X >= area.PlotAreaPosition.Right)
				{
					continue;
				}

				if(rectSize.X < area.PlotAreaPosition.X)
				{
					rectSize.Width -= area.PlotAreaPosition.X - rectSize.X;
					rectSize.X = area.PlotAreaPosition.X;
				}
				if(rectSize.Right > area.PlotAreaPosition.Right)
				{
					rectSize.Width -= rectSize.Right - area.PlotAreaPosition.Right;
				}
				if(rectSize.Width < 0)
				{
					rectSize.Width = 0;
				}

				// Detect if we need to get graphical path of drawn object
				DrawingOperationTypes	drawingOperationType = DrawingOperationTypes.DrawElement;
				
				if( common.ProcessModeRegions )
				{
					drawingOperationType |= DrawingOperationTypes.CalcElementPath;
				}

				if(!point.IsEmpty &&
					rectSize.Height > 0f &&
					rectSize.Width > 0f)
				{
					// Start Svg Selection mode
					graph.StartHotRegion( point );

					rectPath = graph.Fill3DRectangle(
						rectSize,
						pointEx.zPosition,
						pointEx.depth,
						area.matrix3D,
						area.Area3DStyle.LightStyle,
						point.Color, 
						topDarkening,
						bottomDarkening,
						point.BorderColor, 
						point.BorderWidth, 
						point.BorderDashStyle, 
						barDrawingStyle,
						true,
						drawingOperationType);

					// End Svg Selection mode
					graph.EndHotRegion( );

					//************************************************************
					// Hot Regions mode used for image maps, tool tips and 
					// hit test function
					//************************************************************
					if( common.ProcessModeRegions && !labels)
					{
						common.HotRegionsList.AddHotRegion(
							rectPath,
							false,
							graph,
							point,
							ser.Name,
							pointEx.index - 1
							);
					}
                    if (rectPath != null)
                    {
                        rectPath.Dispose();
                    }
				}

				// Reset Clip Region
				if(clipRegionSet)
				{
					graph.ResetClip();
				}

				// Draw Labels & markers for each data point
				this.ProcessSinglePoint3D(
					pointEx,
					selection, 
					graph, 
					common, 
					area, 
					rectSize,
					pointEx.index - 1
					);
			}

			// Finish processing 3D labels
			this.DrawAcreplacedulated3DLabels(graph, common, area);
		}

19 View Source File : PointAndFigureChart.cs
License : MIT License
Project Creator : AngeloCresta

static private void OnCustomize(Object sender, EventArgs e)
		{
			bool	chartResized = false;
            Chart chart = (Chart)sender;
			// Loop through all series
			foreach(Series series in chart.Series)
			{
				// Check for the PointAndFigure chart type
				if(series.Name.StartsWith("POINTANDFIGURE_ORIGINAL_DATA_", StringComparison.Ordinal))
				{
					// Get original series
					Series	pointAndFigureSeries = chart.Series[series.Name.Substring(29)];

					// Check if proportional symbol custom attribute is set
					bool	proportionalSymbols = true;
					string	attrValue = pointAndFigureSeries[CustomPropertyName.ProportionalSymbols];
					if(attrValue != null && String.Compare( attrValue, "True", StringComparison.OrdinalIgnoreCase ) != 0 )
					{
						proportionalSymbols = false;
					}

					if(proportionalSymbols && 
						pointAndFigureSeries.Enabled && 
						pointAndFigureSeries.ChartArea.Length > 0)
					{
						// Resize chart
						if(!chartResized)
						{
							chartResized = true;
							chart.chartPicture.Resize(chart.chartPicture.ChartGraph, false);
						}

						// Find series chart area, X & Y axes
						ChartArea	chartArea = chart.ChartAreas[pointAndFigureSeries.ChartArea];
						Axis		axisX = chartArea.GetAxis(AxisName.X, pointAndFigureSeries.XAxisType, pointAndFigureSeries.XSubAxisName);
						Axis		axisY = chartArea.GetAxis(AxisName.Y, pointAndFigureSeries.YAxisType, pointAndFigureSeries.YSubAxisName);

						// Symbols are drawn only in 2D mode
						if(!chartArea.Area3DStyle.Enable3D)
						{
							// Get current box size
							double boxSize = double.Parse(
								pointAndFigureSeries["CurrentBoxSize"],
								CultureInfo.InvariantCulture);

							// Calculate symbol width and height
							double boxYSize = Math.Abs(
								axisY.GetPosition(axisY.Minimum) - 
								axisY.GetPosition(axisY.Minimum + boxSize) );
							double boxXSize = Math.Abs(
								axisX.GetPosition(1.0) - 
								axisX.GetPosition(0.0) );
							boxXSize *= 0.8;

							// Get absolute size in pixels
							SizeF markSize = chart.chartPicture.ChartGraph.GetAbsoluteSize(
								new SizeF((float)boxXSize, (float)boxYSize));

							// Calculate number of empty points that should be added
							int pointCount = 0;
							if(markSize.Width > markSize.Height)
							{
								pointCount = (int)(pointAndFigureSeries.Points.Count * (markSize.Width / markSize.Height));
							}

							// Add empty points
							DataPoint emptyPoint = new DataPoint(pointAndFigureSeries);
							emptyPoint.IsEmpty = true;
							emptyPoint.AxisLabel = " ";
							while(pointAndFigureSeries.Points.Count < pointCount)
							{
								pointAndFigureSeries.Points.Add(emptyPoint);
							}

							// Always use zeros for Y values of empty points
							pointAndFigureSeries[CustomPropertyName.EmptyPointValue] = "Zero";
		
							// RecalculateAxesScale chart are data
							chartArea.ReCalcInternal();
						}
					}
				}
			}
		}

See More Examples