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
- StrongNameIdentityPermission.cs
- ClientProxyGenerator.cs
- CheckBoxStandardAdapter.cs
- HtmlInputRadioButton.cs
- ISAPIRuntime.cs
- EntityCommandCompilationException.cs
- EncodingTable.cs
- ParameterCollection.cs
- RuleSetBrowserDialog.cs
- AttributeEmitter.cs
- DataGridViewSelectedRowCollection.cs
- DataGridViewSelectedRowCollection.cs
- FixedPosition.cs
- ReadOnlyNameValueCollection.cs
- DataListCommandEventArgs.cs
- MappingModelBuildProvider.cs
- FormViewModeEventArgs.cs
- XmlSigningNodeWriter.cs
- EncoderParameter.cs
- SQLRoleProvider.cs
- CodeDOMProvider.cs
- FieldDescriptor.cs
- WindowPatternIdentifiers.cs
- WindowsSolidBrush.cs
- XmlDocumentFieldSchema.cs
- EventLogPermissionEntry.cs
- WebEvents.cs
- CheckPair.cs
- StateMachineAction.cs
- CfgParser.cs
- CodeTypeReference.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- DerivedKeyCachingSecurityTokenSerializer.cs
- Rectangle.cs
- webbrowsersite.cs
- CrossAppDomainChannel.cs
- VariableDesigner.xaml.cs
- SafeTimerHandle.cs
- GlyphingCache.cs
- ScrollPatternIdentifiers.cs
- SQLInt16.cs
- OuterGlowBitmapEffect.cs
- StylusButton.cs
- EdmProperty.cs
- NavigatingCancelEventArgs.cs
- DataBinding.cs
- EventLogPermission.cs
- AddInBase.cs
- Hash.cs
- StringFreezingAttribute.cs
- PackagePart.cs
- PeerCustomResolverSettings.cs
- ProtocolReflector.cs
- StaticResourceExtension.cs
- errorpatternmatcher.cs
- LinearKeyFrames.cs
- ArrayExtension.cs
- MenuCommand.cs
- Activity.cs
- SamlNameIdentifierClaimResource.cs
- WsdlInspector.cs
- MouseGestureConverter.cs
- BulletedListEventArgs.cs
- LayoutDump.cs
- BStrWrapper.cs
- WebHttpDispatchOperationSelector.cs
- TraceSource.cs
- UnionExpr.cs
- TreeNodeMouseHoverEvent.cs
- ConfigXmlReader.cs
- StatusBarDrawItemEvent.cs
- XslNumber.cs
- UndirectedGraph.cs
- MatcherBuilder.cs
- ContentElement.cs
- DeferredElementTreeState.cs
- DSACryptoServiceProvider.cs
- BamlTreeUpdater.cs
- EmptyCollection.cs
- TreeViewItem.cs
- _TLSstream.cs
- ScrollChangedEventArgs.cs
- FormsIdentity.cs
- ColorAnimationUsingKeyFrames.cs
- RouteItem.cs
- Figure.cs
- TextElementAutomationPeer.cs
- PropertyEmitter.cs
- OracleBFile.cs
- Baml6Assembly.cs
- ContextQuery.cs
- ExpressionBindingsDialog.cs
- XamlBrushSerializer.cs
- GPRECT.cs
- DBCSCodePageEncoding.cs
- Array.cs
- BitmapScalingModeValidation.cs
- FileDetails.cs
- PropertyDescriptorCollection.cs
- ReaderContextStackData.cs