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
- HttpAsyncResult.cs
- FileIOPermission.cs
- StringUtil.cs
- CopyAttributesAction.cs
- ReachDocumentSequenceSerializer.cs
- PreloadHost.cs
- LineServicesCallbacks.cs
- ILGen.cs
- RelOps.cs
- TemplatedWizardStep.cs
- Point3D.cs
- DataFieldEditor.cs
- ResXBuildProvider.cs
- SponsorHelper.cs
- CompiledQuery.cs
- PartManifestEntry.cs
- TextAdaptor.cs
- DocumentPageHost.cs
- Vector.cs
- CodeObjectCreateExpression.cs
- IsolationInterop.cs
- SafeNativeMethods.cs
- ConnectionPoolManager.cs
- HtmlEncodedRawTextWriter.cs
- WebBrowserHelper.cs
- QueryResponse.cs
- ChangePassword.cs
- RowToParametersTransformer.cs
- FontCacheUtil.cs
- MimeBasePart.cs
- _LocalDataStore.cs
- TreeWalker.cs
- Rotation3DKeyFrameCollection.cs
- TextFormatter.cs
- EndpointIdentityExtension.cs
- DataView.cs
- RuleElement.cs
- ApplyHostConfigurationBehavior.cs
- CheckBox.cs
- FrameworkReadOnlyPropertyMetadata.cs
- CommonGetThemePartSize.cs
- ToolStripDropDownClosedEventArgs.cs
- Literal.cs
- FontInfo.cs
- ExtensibleClassFactory.cs
- IndicShape.cs
- SecurityDocument.cs
- FixedElement.cs
- ErrorStyle.cs
- CodeTypeReference.cs
- WCFModelStrings.Designer.cs
- PageWrapper.cs
- HtmlValidationSummaryAdapter.cs
- ClusterSafeNativeMethods.cs
- ClassicBorderDecorator.cs
- XmlDocumentType.cs
- CacheSection.cs
- Button.cs
- HtmlFormParameterWriter.cs
- PickBranchDesigner.xaml.cs
- TypeReference.cs
- EncryptedType.cs
- AppSecurityManager.cs
- KnowledgeBase.cs
- XmlAnyElementAttributes.cs
- FixedSOMTableCell.cs
- RijndaelManaged.cs
- SplitterDesigner.cs
- ConfigurationValues.cs
- RefreshPropertiesAttribute.cs
- SocketPermission.cs
- _NtlmClient.cs
- ObjectDataSourceStatusEventArgs.cs
- ToolbarAUtomationPeer.cs
- FileInfo.cs
- ReachDocumentPageSerializerAsync.cs
- DataGridViewCell.cs
- XmlSchemaCompilationSettings.cs
- SmtpReplyReader.cs
- GeneralTransform3D.cs
- Win32Interop.cs
- ThicknessAnimationBase.cs
- DebugController.cs
- NTAccount.cs
- ExtendedProperty.cs
- ColumnHeader.cs
- ChildTable.cs
- CategoryGridEntry.cs
- OperandQuery.cs
- BitmapInitialize.cs
- XmlWellformedWriter.cs
- ConnectionPoolManager.cs
- PauseStoryboard.cs
- ModuleConfigurationInfo.cs
- XmlByteStreamWriter.cs
- SizeAnimationBase.cs
- FlowDecisionDesigner.xaml.cs
- DetailsViewUpdatedEventArgs.cs
- CodeMemberProperty.cs
- HierarchicalDataTemplate.cs