Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ private void Initialize(FileUnit sourceFile)
}
}

int pathEndIndex = SourceFileInfo.RelativeSourceFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal);
int pathEndIndex = SourceFileInfo.RelativeSourceFilePath.LastIndexOf(Path.DirectorySeparatorChar);
string targetPath = TargetPath + SourceFileInfo.RelativeSourceFilePath.Substring(0, pathEndIndex + 1);

// Create if not already exists
Expand Down Expand Up @@ -711,7 +711,7 @@ private SourceFileInfo OnSourceFileResolve(FileUnit file)

if (sourceFileInfo.IsXamlFile)
{
int fileExtIndex = file.Path.LastIndexOf(DOT, StringComparison.Ordinal);
int fileExtIndex = file.Path.LastIndexOf(DOTCHAR);

sourceFileInfo.RelativeSourceFilePath = file.Path.Substring(0, fileExtIndex);
}
Expand Down Expand Up @@ -1415,7 +1415,7 @@ private string GetFullClassName(string ns, string className)
internal void ValidateFullSubClassName(ref string subClassFullName)
{
bool isValid = false;
int index = subClassFullName.LastIndexOf(DOT, StringComparison.Ordinal);
int index = subClassFullName.LastIndexOf(DOTCHAR);

if (index > 0)
{
Expand Down Expand Up @@ -1444,7 +1444,7 @@ private bool CrackClassName(ref string className, out string ns)
if (className.Length > 0)
{
// Split the Namespace
int index = className.LastIndexOf(DOT, StringComparison.Ordinal);
int index = className.LastIndexOf(DOTCHAR);

if (index > 0)
{
Expand Down Expand Up @@ -2273,7 +2273,7 @@ private static CodeTypeReference GenerateConstructedTypeReference(Type t, string

// NOTE: Remove when CodeDom is fixed to understand mangled generic names.
genericName = t.FullName;
int bang = genericName.IndexOf(GENERIC_DELIMITER, StringComparison.Ordinal);
int bang = genericName.IndexOf(GENERIC_DELIMITER);
if (bang > 0)
{
genericName = genericName.Substring(0, bang);
Expand Down Expand Up @@ -2316,7 +2316,7 @@ private static CodeTypeReference GenerateConstructedTypeReference(Type t, string

// NOTE: Remove when CodeDom is fixed to understand mangled generic names.
string genericName = t.Namespace + DOT + t.Name;
int bang = genericName.IndexOf(GENERIC_DELIMITER, StringComparison.Ordinal);
int bang = genericName.IndexOf(GENERIC_DELIMITER);
if (bang > 0)
{
genericName = genericName.Substring(0, bang);
Expand Down Expand Up @@ -3492,7 +3492,7 @@ internal string SubClass
private const string ANONYMOUS_ENTRYCLASS_PREFIX = "Generated";
private const string DEFINITION_PREFIX = "x";
private const char COMMA = ',';
private const string GENERIC_DELIMITER = "`";
private const char GENERIC_DELIMITER = '`';
internal const char DOTCHAR = '.';
internal const string DOT = ".";
internal const string CODETAG = "Code";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ public override void WriteDefAttribute(XamlDefAttributeNode xamlDefAttributeNode
{
if (_class == MarkupCompiler.DOT)
{
int index = xamlDefAttributeNode.Value.LastIndexOf(MarkupCompiler.DOT, StringComparison.Ordinal);
int index = xamlDefAttributeNode.Value.LastIndexOf(MarkupCompiler.DOTCHAR);
ThrowException(SRID.InvalidClassName,
MarkupCompiler.DefinitionNSPrefix,
CLASS,
Expand Down Expand Up @@ -869,7 +869,7 @@ public override void WriteDefAttribute(XamlDefAttributeNode xamlDefAttributeNode
{
if (_subClass == MarkupCompiler.DOT)
{
int index = xamlDefAttributeNode.Value.LastIndexOf(MarkupCompiler.DOT, StringComparison.Ordinal);
int index = xamlDefAttributeNode.Value.LastIndexOf(MarkupCompiler.DOTCHAR);
ThrowException(SRID.InvalidClassName,
MarkupCompiler.DefinitionNSPrefix,
SUBCLASS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private void OnSourceFileResolve(Object sender, SourceFileResolveEventArgs e)
//
// For Xaml Source file, we need to remove the .xaml extension part.
//
int fileExtIndex = newRelativeFilePath.LastIndexOf(MarkupCompiler.DOT, StringComparison.Ordinal);
int fileExtIndex = newRelativeFilePath.LastIndexOf(MarkupCompiler.DOTCHAR);
newRelativeFilePath = newRelativeFilePath.Substring(0, fileExtIndex);
}

Expand Down Expand Up @@ -408,7 +408,7 @@ private string GetResolvedFilePath(string filePath, ref string newSourceDir)
// and put the deepest directory that file is in as the new
// SourceDir.
//
int pathEndIndex = fullFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal);
int pathEndIndex = fullFilePath.LastIndexOf(Path.DirectorySeparatorChar);

newSourceDir = fullFilePath.Substring(0, pathEndIndex + 1);
newRelativeFilePath = fullFilePath.Substring(pathEndIndex + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ private string GetResolvedFilePath(string filePath, ref string newSourceDir)
// and put the deepest directory that file is in as the new
// SourceDir.
//
int pathEndIndex = fullFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal);
int pathEndIndex = fullFilePath.LastIndexOf(Path.DirectorySeparatorChar);

newSourceDir = fullFilePath.Substring(0, pathEndIndex + 1);
newRelativeFilePath = TaskHelper.GetRootRelativePath(newSourceDir, fullFilePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ private string GetResolvedFilePath(string filePath, ref string newSourceDir)
// and put the deepest directory that file is in as the new
// SourceDir.
//
int pathEndIndex = fullFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal);
int pathEndIndex = fullFilePath.LastIndexOf(Path.DirectorySeparatorChar);

newSourceDir = fullFilePath.Substring(0, pathEndIndex + 1);
newRelativeFilePath = TaskHelper.GetRootRelativePath(newSourceDir, fullFilePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ internal static void AddGesturesFromResourceStrings(string keyGestures, string d
string keyDisplayString;

// break apart first gesture from the rest
int index = keyGestures.IndexOf(MULTIPLEGESTURE_DELIMITER, StringComparison.Ordinal);
int index = keyGestures.IndexOf(MULTIPLEGESTURE_DELIMITER);
if (index >= 0)
{ // multiple gestures exist
keyGestureToken = keyGestures.Substring(0, index);
Expand All @@ -266,7 +266,7 @@ internal static void AddGesturesFromResourceStrings(string keyGestures, string d
}

// similarly, break apart first display string from the rest
index = displayStrings.IndexOf(MULTIPLEGESTURE_DELIMITER, StringComparison.Ordinal);
index = displayStrings.IndexOf(MULTIPLEGESTURE_DELIMITER);
if (index >= 0)
{ // multiple display strings exist
keyDisplayString = displayStrings.Substring(0, index);
Expand Down Expand Up @@ -310,7 +310,7 @@ internal static KeyGesture CreateFromResourceStrings(string keyGestureToken, str
private ModifierKeys _modifiers = ModifierKeys.None;
private Key _key = Key.None;
private string _displayString;
private const string MULTIPLEGESTURE_DELIMITER = ";";
private const char MULTIPLEGESTURE_DELIMITER = ';';
private static TypeConverter _keyGestureConverter = new KeyGestureConverter();
//private static bool _classRegistered = false;
#endregion Private Fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c

if (text != String.Empty)
{
if (text.LastIndexOf(".", StringComparison.Ordinal) == -1)
if (text.LastIndexOf('.') == -1)
{
CursorType ct = (CursorType)Enum.Parse(typeof(CursorType), text);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public BaseActivationFactory(string typeNamespace, string typeFullName)
}
catch (Exception) { }

var lastSegment = moduleName.LastIndexOf(".");
var lastSegment = moduleName.LastIndexOf('.');
if (lastSegment <= 0)
{
Marshal.ThrowExceptionForHR(hr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12378,7 +12378,7 @@ private static TraceList AddToMap(ItemsControl target)
}
if (filename != "none" && s_seqno > 1)
{
int dotIndex = filename.LastIndexOf(".", StringComparison.Ordinal);
int dotIndex = filename.LastIndexOf('.');
if (dotIndex < 0) dotIndex = filename.Length;
filename = filename.Substring(0, dotIndex) +
s_seqno.ToString() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8238,7 +8238,7 @@ internal void ProcessField()
// is very low. Now we replace image with the included picture uri to get
// the image directly from the specified Uri.
int uriSourceIndex = dnImage.Xaml.IndexOf("UriSource=", StringComparison.Ordinal);
int uriSourceEndIndex = dnImage.Xaml.IndexOf("\"", uriSourceIndex + 11, StringComparison.Ordinal);
int uriSourceEndIndex = dnImage.Xaml.IndexOf('\"', uriSourceIndex + 11);

string imageXaml = dnImage.Xaml.Substring(0, uriSourceIndex);
imageXaml += "UriSource=\"" + pictureUri + "\"";
Expand Down Expand Up @@ -8410,7 +8410,7 @@ private string GetIncludePictureUri(string instructionName)
{
pictureUri = instructionName.Substring(uriIndex, instructionName.Length - uriIndex - 1);

int pictureUriEndIndex = pictureUri.IndexOf("\"", StringComparison.OrdinalIgnoreCase);
int pictureUriEndIndex = pictureUri.IndexOf('\"');
if (pictureUriEndIndex != -1)
{
pictureUri = pictureUri.Substring(0, pictureUriEndIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,7 @@ private RtfImageFormat GetImageFormatFromImageSourceName(string imageName)
{
RtfImageFormat imageFormat = RtfImageFormat.Unknown;

int extensionIndex = imageName.LastIndexOf(".", StringComparison.OrdinalIgnoreCase);
int extensionIndex = imageName.LastIndexOf('.');

if (extensionIndex >= 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private void ParseUri( string source, out string typeName, out string localName
localName = ((string)source).Trim();

// split CommandName from its TypeName (e.g. ScrollViewer.PageDownCommand to Scrollviewerand PageDownCommand)
int Offset = localName.LastIndexOf(".", StringComparison.Ordinal);
int Offset = localName.LastIndexOf('.');
if (Offset >= 0)
{
typeName = localName.Substring(0, Offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ internal bool GetTypeInfoId(
string typeFullName,
out short typeId)
{
int dotIndex = typeFullName.LastIndexOf(".", StringComparison.Ordinal);
int dotIndex = typeFullName.LastIndexOf('.');
string typeShortName;
string typeClrNamespace;
if (dotIndex >= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public bool MoveToNextProperty()
{
_name = info.Name;
_localName = info.LocalName;
int index = info.Name.LastIndexOf(".", StringComparison.Ordinal);
int index = info.Name.LastIndexOf('.');
if (index > 0)
{
_ownerTypeName = info.Name.Substring(0, index);
Expand Down Expand Up @@ -439,7 +439,7 @@ public bool MoveToNextProperty()
_connectionId = 0;
_prefix = string.Empty;
_name = cpInfo.Name;
int index = cpInfo.Name.LastIndexOf(".", StringComparison.Ordinal);
int index = cpInfo.Name.LastIndexOf('.');
if (index > 0)
{
_ownerTypeName = cpInfo.Name.Substring(0, index);
Expand Down Expand Up @@ -1305,7 +1305,7 @@ private void ProcessDeferKey()
}
BamlTypeInfoRecord typeInfo = MapTable.GetTypeInfoFromId(typeKeyRecord.TypeId);
string typeName = typeInfo.TypeFullName;
typeName = typeName.Substring(typeName.LastIndexOf(".", StringComparison.Ordinal) + 1);
typeName = typeName.Substring(typeName.LastIndexOf('.') + 1);
string assemblyName;
string prefix;
string xmlNamespace;
Expand Down Expand Up @@ -1425,7 +1425,7 @@ private BamlKeyInfo ProcessKeyTree()
// a x:Key attribute.
BamlTypeInfoRecord typeInfo = MapTable.GetTypeInfoFromId(keyStartRecord.TypeId);
string markupString = typeInfo.TypeFullName;
markupString = markupString.Substring(markupString.LastIndexOf(".", StringComparison.Ordinal) + 1);
markupString = markupString.Substring(markupString.LastIndexOf('.') + 1);
string assemblyName;
string prefix;
string xmlNamespace;
Expand Down Expand Up @@ -1552,7 +1552,7 @@ private BamlKeyInfo ProcessKeyTree()
BamlElementStartRecord elementStartRecord = _currentBamlRecord as BamlElementStartRecord;
BamlTypeInfoRecord elementTypeInfo = MapTable.GetTypeInfoFromId(elementStartRecord.TypeId);
string typename = elementTypeInfo.TypeFullName;
typename = typename.Substring(typename.LastIndexOf(".", StringComparison.Ordinal) + 1);
typename = typename.Substring(typename.LastIndexOf('.') + 1);
GetAssemblyAndPrefixAndXmlns(elementTypeInfo, out assemblyName, out prefix, out xmlNamespace);
if (prefix != string.Empty)
{
Expand Down Expand Up @@ -1964,7 +1964,7 @@ private void ReadElementStartRecord()

NodeTypeInternal = BamlNodeType.StartElement;
_name = typeInfo.TypeFullName;
_localName = _name.Substring(_name.LastIndexOf(".", StringComparison.Ordinal) + 1);
_localName = _name.Substring(_name.LastIndexOf('.') + 1);
_ownerTypeName = string.Empty;
_clrNamespace = typeInfo.ClrNamespace;
GetAssemblyAndPrefixAndXmlns(typeInfo, out _assemblyName, out _prefix, out _xmlNamespace);
Expand Down Expand Up @@ -2081,7 +2081,7 @@ private void ReadPropertyComplexStartRecord()
// Set instance variables to node info extracted from record.
NodeTypeInternal = BamlNodeType.StartComplexProperty;
_localName = nodeInfo.LocalName;
int index = nodeInfo.Name.LastIndexOf(".", StringComparison.Ordinal);
int index = nodeInfo.Name.LastIndexOf('.');
if (index > 0)
{
_ownerTypeName = nodeInfo.Name.Substring(0, index);
Expand Down Expand Up @@ -2152,7 +2152,7 @@ private void ReadPropertyComplexEndRecord()
NodeTypeInternal = BamlNodeType.EndComplexProperty;
_name = nodeInfo.Name;
_localName = nodeInfo.LocalName;
int index = nodeInfo.Name.LastIndexOf(".", StringComparison.Ordinal);
int index = nodeInfo.Name.LastIndexOf('.');
if (index > 0)
{
_ownerTypeName = nodeInfo.Name.Substring(0, index);
Expand Down Expand Up @@ -2409,7 +2409,7 @@ private string GetTemplateBindingExtensionValueString(short memberId)
string valueAssemblyName;
GetAssemblyAndPrefixAndXmlns(valueTypeInfo, out valueAssemblyName, out valuePrefix, out valueXmlNamespace);
typeName = valueTypeInfo.TypeFullName;
typeName = typeName.Substring(typeName.LastIndexOf(".", StringComparison.Ordinal) + 1);
typeName = typeName.Substring(typeName.LastIndexOf('.') + 1);
propName = attrInfo.Name;
}

Expand Down Expand Up @@ -2484,7 +2484,7 @@ private string GetStaticExtensionValueString(short memberId)
string valueAssemblyName;
GetAssemblyAndPrefixAndXmlns(valueTypeInfo, out valueAssemblyName, out valuePrefix, out valueXmlNamespace);
typeName = valueTypeInfo.TypeFullName;
typeName = typeName.Substring(typeName.LastIndexOf(".", StringComparison.Ordinal) + 1);
typeName = typeName.Substring(typeName.LastIndexOf('.') + 1);
propName = attrInfo.Name;
}

Expand Down Expand Up @@ -2598,7 +2598,7 @@ private string GetTypeValueString(short typeId)
string valueAssemblyName;
GetAssemblyAndPrefixAndXmlns(valueTypeInfo, out valueAssemblyName, out valuePrefix, out valueXmlNamespace);
string typeName = valueTypeInfo.TypeFullName;
typeName = typeName.Substring(typeName.LastIndexOf(".", StringComparison.Ordinal) + 1);
typeName = typeName.Substring(typeName.LastIndexOf('.') + 1);
if (valuePrefix == string.Empty)
{
valueString += typeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ private void WriteItem(MarkupObject item, Scope scope)
writtenAttributes[property.Name] = property.Name;
_writer.WriteStartElement(prefix, item.ObjectType.Name + "." + property.PropertyDescriptor.Name, uri);

if (property.IsComposite || property.StringValue.IndexOf("{", StringComparison.Ordinal) == 0)
if (property.IsComposite || property.StringValue.IndexOf('{') == 0)
{
foreach (MarkupObject subItem in property.Items)
{
Expand Down Expand Up @@ -1649,7 +1649,7 @@ public static string GetDefaultPrefixFor(string uri)
result = "assembly";
if (uri.StartsWith(clrUriPrefix, StringComparison.Ordinal))
{
string ns = uri.Substring(clrUriPrefix.Length, uri.IndexOf(";", StringComparison.Ordinal) - clrUriPrefix.Length);
string ns = uri.Substring(clrUriPrefix.Length, uri.IndexOf(';') - clrUriPrefix.Length);
StringBuilder r = new StringBuilder();
for (int i = 0; i < ns.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ public static bool Eq(string a, string b)
return string.Equals(a, b, StringComparison.Ordinal);
}

/// <summary>
/// Standard String Index search operation.
/// </summary>
public static int IndexOf(string src, char value)
{
return src.IndexOf(value);
}

/// <summary>
/// Standard String Index search operation.
/// </summary>
Expand Down
Loading