Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ImageCodecInfoPrivate.cs
- XmlDocument.cs
- XmlSchemaExternal.cs
- DataGridState.cs
- OwnerDrawPropertyBag.cs
- ProfilePropertyNameValidator.cs
- SelectionHighlightInfo.cs
- Utility.cs
- SmuggledIUnknown.cs
- MatrixTransform.cs
- PropertyPathConverter.cs
- CompiledIdentityConstraint.cs
- AsyncPostBackErrorEventArgs.cs
- FieldBuilder.cs
- CharacterBufferReference.cs
- ClientProxyGenerator.cs
- XmlBinaryReaderSession.cs
- XmlNode.cs
- SetterBase.cs
- ImageEditor.cs
- WebEventCodes.cs
- EpmContentDeSerializer.cs
- HtmlInputImage.cs
- XpsS0ValidatingLoader.cs
- BezierSegment.cs
- ControlCollection.cs
- ClientTarget.cs
- FormViewDeleteEventArgs.cs
- CachedTypeface.cs
- QilGenerator.cs
- TargetControlTypeAttribute.cs
- ResXResourceSet.cs
- Propagator.ExtentPlaceholderCreator.cs
- XmlHelper.cs
- TypeLoadException.cs
- UnsafeNativeMethods.cs
- HandoffBehavior.cs
- AssemblyNameUtility.cs
- ParseChildrenAsPropertiesAttribute.cs
- InsufficientMemoryException.cs
- MultilineStringConverter.cs
- Char.cs
- DecimalKeyFrameCollection.cs
- QueryInterceptorAttribute.cs
- HtmlLink.cs
- EncryptedType.cs
- CatalogZoneDesigner.cs
- DataGridColumnCollection.cs
- SignatureGenerator.cs
- XmlIncludeAttribute.cs
- Parameter.cs
- Polygon.cs
- XamlBrushSerializer.cs
- SafeTokenHandle.cs
- SqlNodeAnnotations.cs
- DataGridViewImageCell.cs
- HttpServerVarsCollection.cs
- LabelLiteral.cs
- TempFiles.cs
- ToolStripDropDownClosingEventArgs.cs
- RecordManager.cs
- TimerElapsedEvenArgs.cs
- CaseInsensitiveHashCodeProvider.cs
- TableRow.cs
- SymLanguageVendor.cs
- CharacterMetricsDictionary.cs
- ToolStripPanelRow.cs
- AnnouncementEventArgs.cs
- StateWorkerRequest.cs
- MobileComponentEditorPage.cs
- LateBoundBitmapDecoder.cs
- KnownAssemblyEntry.cs
- WebPartConnectionsEventArgs.cs
- XmlSchemaNotation.cs
- DataRowCollection.cs
- remotingproxy.cs
- ClearTypeHintValidation.cs
- HwndStylusInputProvider.cs
- RoleGroupCollection.cs
- SafeMILHandle.cs
- QueryPageSettingsEventArgs.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ConstructorArgumentAttribute.cs
- AnnotationHelper.cs
- FeatureSupport.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- RegexCompiler.cs
- StringReader.cs
- XhtmlBasicControlAdapter.cs
- ListBindingHelper.cs
- LessThan.cs
- DbConnectionFactory.cs
- ObservableDictionary.cs
- KeyValuePairs.cs
- ColorIndependentAnimationStorage.cs
- InsufficientMemoryException.cs
- FixedPageProcessor.cs
- Utilities.cs
- PropertyNames.cs
- OleDbConnectionFactory.cs