Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / SyntaxCheck.cs / 1 / SyntaxCheck.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.ComponentModel { using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Security.Permissions; ////// /// SyntaxCheck /// Helper class to check for path and machine name syntax. /// [HostProtection(SharedState = true)] public static class SyntaxCheck { ////// Checks the syntax of the machine name (no "\" anywhere in it). /// ///public static bool CheckMachineName(string value) { if (value == null) return false; value = value.Trim(); if (value.Equals(String.Empty)) return false; // Machine names shouldn't contain any "\" return (value.IndexOf('\\') == -1); } /// /// Checks the syntax of the path (must start with "\\"). /// ///public static bool CheckPath(string value) { if (value == null) return false; value = value.Trim(); if (value.Equals(String.Empty)) return false; // Path names should start with "\\" return value.StartsWith("\\\\"); } /// /// Checks the syntax of the path (must start with "\" or drive letter "C:"). /// NOTE: These denote a file or directory path!! /// /// ///public static bool CheckRootedPath(string value) { if (value == null) return false; value = value.Trim(); if (value.Equals(String.Empty)) return false; // Is it rooted? return Path.IsPathRooted(value); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TreeIterators.cs
- XmlObjectSerializerWriteContextComplex.cs
- AsymmetricKeyExchangeDeformatter.cs
- InkCanvas.cs
- XPathDocumentIterator.cs
- EventPrivateKey.cs
- recordstatefactory.cs
- WebEventTraceProvider.cs
- FileLogRecordStream.cs
- MimeTypePropertyAttribute.cs
- GridSplitterAutomationPeer.cs
- BlurBitmapEffect.cs
- SettingsProviderCollection.cs
- DataGridViewAccessibleObject.cs
- WorkflowDebuggerSteppingAttribute.cs
- EdmMember.cs
- MetaColumn.cs
- WebServiceEnumData.cs
- ManagementObjectSearcher.cs
- EditorPartChrome.cs
- AppModelKnownContentFactory.cs
- SafeNativeMethods.cs
- X509CertificateStore.cs
- XmlCharCheckingReader.cs
- AsymmetricSecurityBindingElement.cs
- PlanCompiler.cs
- NativeCppClassAttribute.cs
- AccessorTable.cs
- DataException.cs
- XmlSchemaComplexContent.cs
- WebPartsSection.cs
- GeometryHitTestResult.cs
- TransformationRules.cs
- TableCellCollection.cs
- RuntimeArgumentHandle.cs
- DeviceSpecificChoiceCollection.cs
- ListViewUpdatedEventArgs.cs
- HatchBrush.cs
- safelink.cs
- TextParaLineResult.cs
- FloatUtil.cs
- BulletedList.cs
- Localizer.cs
- MissingSatelliteAssemblyException.cs
- SBCSCodePageEncoding.cs
- XhtmlBasicTextViewAdapter.cs
- FakeModelPropertyImpl.cs
- CqlLexerHelpers.cs
- SerialPort.cs
- BigInt.cs
- XmlQualifiedName.cs
- SoapSchemaImporter.cs
- BitVec.cs
- TimeZone.cs
- XamlInt32CollectionSerializer.cs
- EventMappingSettings.cs
- SecurityTokenException.cs
- BehaviorEditorPart.cs
- ImageDrawing.cs
- FacetEnabledSchemaElement.cs
- DBBindings.cs
- XmlSchemaSimpleContent.cs
- DefaultCompensation.cs
- ExpanderAutomationPeer.cs
- FixedSOMSemanticBox.cs
- XmlExceptionHelper.cs
- AppDomainCompilerProxy.cs
- ToolStripDropTargetManager.cs
- DataTableMappingCollection.cs
- LockCookie.cs
- cache.cs
- CodeNamespaceCollection.cs
- DomainConstraint.cs
- Pens.cs
- DynamicDocumentPaginator.cs
- Membership.cs
- ErasingStroke.cs
- DictionaryContent.cs
- QilReplaceVisitor.cs
- DrawTreeNodeEventArgs.cs
- SystemIPInterfaceProperties.cs
- PnrpPermission.cs
- DirtyTextRange.cs
- PathTooLongException.cs
- DataGridTextBox.cs
- StrokeCollectionDefaultValueFactory.cs
- DecoderReplacementFallback.cs
- EndpointDiscoveryMetadata11.cs
- Exceptions.cs
- DataContractSerializerOperationGenerator.cs
- SqlTypeConverter.cs
- CurrencyManager.cs
- DbDataRecord.cs
- TableLayoutPanelDesigner.cs
- SystemColors.cs
- ContextDataSource.cs
- MenuItem.cs
- XmlReaderDelegator.cs
- HTTPNotFoundHandler.cs
- Console.cs