Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- FSWPathEditor.cs
- ImageEditor.cs
- AuthenticateEventArgs.cs
- BrowserDefinition.cs
- ReflectionHelper.cs
- TreeViewBindingsEditorForm.cs
- TraceUtility.cs
- StateItem.cs
- ForceCopyBuildProvider.cs
- ExpressionPrefixAttribute.cs
- FixUp.cs
- TabControlToolboxItem.cs
- WebBrowser.cs
- DataGridColumn.cs
- BooleanConverter.cs
- GeneralTransform3DGroup.cs
- ServicePoint.cs
- PropertyGridEditorPart.cs
- AdRotator.cs
- HMACSHA384.cs
- FilteredDataSetHelper.cs
- LinqTreeNodeEvaluator.cs
- XsltCompileContext.cs
- ProcessInfo.cs
- RequestNavigateEventArgs.cs
- MessageFilter.cs
- ParallelLoopState.cs
- GeneralTransformGroup.cs
- NetworkInformationPermission.cs
- XmlCDATASection.cs
- ImmutablePropertyDescriptorGridEntry.cs
- StringHandle.cs
- DataViewSetting.cs
- AuthenticationService.cs
- ISAPIWorkerRequest.cs
- DesignerActionItemCollection.cs
- ThreadNeutralSemaphore.cs
- MarkupExtensionReturnTypeAttribute.cs
- TextLineBreak.cs
- ToolStripRendererSwitcher.cs
- WindowsFormsSynchronizationContext.cs
- ToolStripControlHost.cs
- Divide.cs
- ClientScriptManager.cs
- StateInitialization.cs
- DateBoldEvent.cs
- GenericTextProperties.cs
- Point4D.cs
- sqlpipe.cs
- SingleKeyFrameCollection.cs
- ParserHooks.cs
- StorageInfo.cs
- XamlPointCollectionSerializer.cs
- ViewEventArgs.cs
- CultureInfo.cs
- DbMetaDataCollectionNames.cs
- RawStylusInput.cs
- TypeUsageBuilder.cs
- AssociationSetMetadata.cs
- XmlSerializerFactory.cs
- XmlLanguageConverter.cs
- AssemblyCollection.cs
- XmlEncApr2001.cs
- SQLMembershipProvider.cs
- IncrementalReadDecoders.cs
- Document.cs
- SQLBoolean.cs
- SecurityPolicySection.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- Util.cs
- NativeCppClassAttribute.cs
- IPipelineRuntime.cs
- CompilerCollection.cs
- TextEndOfLine.cs
- ConfigurationLocationCollection.cs
- Currency.cs
- Binding.cs
- UrlPropertyAttribute.cs
- BaseAsyncResult.cs
- RecognizedAudio.cs
- StoryFragments.cs
- FullTextLine.cs
- EntitySqlException.cs
- GcSettings.cs
- MethodImplAttribute.cs
- PlanCompilerUtil.cs
- RuntimeConfigLKG.cs
- OptimizedTemplateContent.cs
- SoapWriter.cs
- LoggedException.cs
- GPPOINT.cs
- ZipIOExtraFieldPaddingElement.cs
- TabItem.cs
- ClassValidator.cs
- Unit.cs
- XmlSchemaInferenceException.cs
- C14NUtil.cs
- TableColumn.cs
- AuthenticationSchemesHelper.cs
- ToolStripSystemRenderer.cs