Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / SyntaxCheck.cs / 1305376 / 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
- BindMarkupExtensionSerializer.cs
- ToolStripContentPanel.cs
- SvcMapFile.cs
- SqlNotificationRequest.cs
- SafeHandles.cs
- __ConsoleStream.cs
- Queue.cs
- SoapCodeExporter.cs
- EditorPartDesigner.cs
- DataException.cs
- MetaTable.cs
- DecimalKeyFrameCollection.cs
- SplitContainer.cs
- CurrentChangingEventArgs.cs
- CodeVariableDeclarationStatement.cs
- QueryExpression.cs
- Substitution.cs
- AmbiguousMatchException.cs
- GridViewRow.cs
- OrderByLifter.cs
- FlatButtonAppearance.cs
- ValuePatternIdentifiers.cs
- SoapExtensionTypeElement.cs
- XsdBuilder.cs
- ImpersonateTokenRef.cs
- StylusEventArgs.cs
- MULTI_QI.cs
- HttpResponseWrapper.cs
- SqlTypeConverter.cs
- WorkflowQueue.cs
- DataBindEngine.cs
- RegionIterator.cs
- XmlArrayItemAttribute.cs
- EntityReference.cs
- DateBoldEvent.cs
- DocumentCollection.cs
- SignatureHelper.cs
- FullTextBreakpoint.cs
- GlyphRunDrawing.cs
- SpecularMaterial.cs
- BookmarkScopeInfo.cs
- TitleStyle.cs
- TextTreeNode.cs
- CalendarAutomationPeer.cs
- StylusTip.cs
- Utils.cs
- RowParagraph.cs
- ServiceOperationWrapper.cs
- ReadOnlyHierarchicalDataSourceView.cs
- VisualStyleRenderer.cs
- CompareInfo.cs
- SoapInteropTypes.cs
- ToolBar.cs
- _LocalDataStore.cs
- TraceSwitch.cs
- OutputBuffer.cs
- VirtualPathProvider.cs
- HelpPage.cs
- PropertyChangedEventArgs.cs
- PixelFormat.cs
- SafeFileMapViewHandle.cs
- CacheOutputQuery.cs
- DataGridViewColumnCollection.cs
- NumberFunctions.cs
- IgnoreDataMemberAttribute.cs
- ReadContentAsBinaryHelper.cs
- PopOutPanel.cs
- Tool.cs
- TraversalRequest.cs
- ComponentEditorForm.cs
- ParseHttpDate.cs
- HttpDictionary.cs
- WindowsAuthenticationEventArgs.cs
- HostProtectionException.cs
- ClientSettingsProvider.cs
- XmlWrappingWriter.cs
- CommandLibraryHelper.cs
- WhitespaceReader.cs
- AssemblyBuilderData.cs
- RadioButtonPopupAdapter.cs
- KnownBoxes.cs
- InvalidAsynchronousStateException.cs
- Accessible.cs
- SafeFindHandle.cs
- EditorPartCollection.cs
- DropSource.cs
- TypeValidationEventArgs.cs
- MessageAction.cs
- SimpleTypeResolver.cs
- xml.cs
- CompleteWizardStep.cs
- Control.cs
- MetadataPropertyvalue.cs
- WebPartDeleteVerb.cs
- Pen.cs
- UpdatePanel.cs
- CryptoHandle.cs
- PageStatePersister.cs
- ListViewUpdateEventArgs.cs
- UrlMappingsSection.cs