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
- ThemeDirectoryCompiler.cs
- FormatConvertedBitmap.cs
- FlowNode.cs
- altserialization.cs
- GlyphRunDrawing.cs
- WindowsGraphics2.cs
- RequestSecurityTokenResponse.cs
- VectorAnimationBase.cs
- TraceSwitch.cs
- CustomDictionarySources.cs
- DataGridDesigner.cs
- SmtpTransport.cs
- HttpCookieCollection.cs
- DecoratedNameAttribute.cs
- DebugView.cs
- GridLengthConverter.cs
- GridView.cs
- InvalidPrinterException.cs
- ManifestResourceInfo.cs
- StateMachine.cs
- Logging.cs
- FilteredXmlReader.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- InvalidFilterCriteriaException.cs
- RegionInfo.cs
- FormatterConverter.cs
- OutOfProcStateClientManager.cs
- RenderDataDrawingContext.cs
- XsltFunctions.cs
- ActiveXHost.cs
- ListViewContainer.cs
- WMICapabilities.cs
- ListViewCancelEventArgs.cs
- QilDataSource.cs
- UserPreferenceChangedEventArgs.cs
- FormViewPageEventArgs.cs
- XmlElementAttributes.cs
- GridViewRow.cs
- AsymmetricKeyExchangeFormatter.cs
- SapiRecognizer.cs
- IgnoreFileBuildProvider.cs
- BaseDataListDesigner.cs
- Formatter.cs
- DrawListViewItemEventArgs.cs
- PostBackOptions.cs
- ListSortDescriptionCollection.cs
- HttpModulesSection.cs
- ManagementScope.cs
- basevalidator.cs
- TableRow.cs
- WarningException.cs
- XmlEventCache.cs
- Repeater.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- UInt16Storage.cs
- Lease.cs
- QueryPageSettingsEventArgs.cs
- StringConverter.cs
- HtmlWindow.cs
- EventMappingSettings.cs
- RelatedImageListAttribute.cs
- ExitEventArgs.cs
- AssociatedControlConverter.cs
- EntitySqlQueryBuilder.cs
- ServiceRoute.cs
- LinearQuaternionKeyFrame.cs
- DataControlPagerLinkButton.cs
- PropertyEmitterBase.cs
- PenContexts.cs
- ToolStripDropDown.cs
- SafeCoTaskMem.cs
- DataGridViewImageColumn.cs
- FrameworkElement.cs
- TypeRestriction.cs
- WebResourceAttribute.cs
- ChildrenQuery.cs
- RegexStringValidatorAttribute.cs
- Ray3DHitTestResult.cs
- XmlElementList.cs
- DocumentPageView.cs
- TransactionProtocolConverter.cs
- SetIterators.cs
- WorkflowElementDialogWindow.xaml.cs
- CompilerCollection.cs
- ExpressionParser.cs
- HttpPostedFile.cs
- SoapSchemaMember.cs
- RenderOptions.cs
- Geometry3D.cs
- XmlStreamNodeWriter.cs
- DebugView.cs
- TemplateComponentConnector.cs
- ProfileProvider.cs
- DbProviderSpecificTypePropertyAttribute.cs
- DesignerActionListCollection.cs
- TextLineResult.cs
- TraceRecord.cs
- ParseHttpDate.cs
- FrameworkElement.cs
- IdentitySection.cs