Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- SynchronizingStream.cs
- GroupBox.cs
- SignatureGenerator.cs
- DefaultAssemblyResolver.cs
- PipeConnection.cs
- Calendar.cs
- XmlSchemaSimpleContent.cs
- SafeReversePInvokeHandle.cs
- VerificationException.cs
- XmlAttributes.cs
- PropertiesTab.cs
- DataGridViewIntLinkedList.cs
- CompletionCallbackWrapper.cs
- SqlTopReducer.cs
- UriTemplateHelpers.cs
- CheckBox.cs
- SqlDataSourceTableQuery.cs
- SynchronizedInputHelper.cs
- ConfigurationManagerInternal.cs
- LinqDataSourceHelper.cs
- SpecialNameAttribute.cs
- AlignmentXValidation.cs
- RedBlackList.cs
- HtmlTernaryTree.cs
- DragCompletedEventArgs.cs
- ConfigurationPermission.cs
- DataSet.cs
- DbUpdateCommandTree.cs
- CharAnimationBase.cs
- DispatcherObject.cs
- AstTree.cs
- ModelMemberCollection.cs
- MimePart.cs
- ConfigViewGenerator.cs
- XamlFilter.cs
- DiscoveryClientChannelBase.cs
- ReturnValue.cs
- AppearanceEditorPart.cs
- SpecialNameAttribute.cs
- ContextStaticAttribute.cs
- DataGridViewComboBoxColumn.cs
- PageFunction.cs
- PrincipalPermission.cs
- ImageFormat.cs
- StoreAnnotationsMap.cs
- SwitchElementsCollection.cs
- PrtTicket_Public_Simple.cs
- HttpCachePolicyElement.cs
- RTLAwareMessageBox.cs
- AuthenticatingEventArgs.cs
- ViewManager.cs
- VideoDrawing.cs
- FontDifferentiator.cs
- WebPartCatalogAddVerb.cs
- Popup.cs
- DotExpr.cs
- Context.cs
- ConnectionStringsExpressionBuilder.cs
- PartitionedStreamMerger.cs
- EnvironmentPermission.cs
- EncodingFallbackAwareXmlTextWriter.cs
- CustomAttributeBuilder.cs
- DataErrorValidationRule.cs
- FontWeight.cs
- FilteredXmlReader.cs
- PreviewPageInfo.cs
- TypeDependencyAttribute.cs
- HttpRawResponse.cs
- DeclarativeCatalogPart.cs
- StyleCollectionEditor.cs
- MSG.cs
- ListInitExpression.cs
- BitmapEncoder.cs
- MarshalDirectiveException.cs
- IntSumAggregationOperator.cs
- ServiceMemoryGates.cs
- TrackingRecord.cs
- EventProviderBase.cs
- DbConnectionOptions.cs
- _NegoStream.cs
- unitconverter.cs
- SessionStateModule.cs
- DbConnectionPool.cs
- EditorServiceContext.cs
- MultiDataTrigger.cs
- NextPreviousPagerField.cs
- GridViewRowEventArgs.cs
- HtmlProps.cs
- WrappedIUnknown.cs
- DefaultDiscoveryServiceExtension.cs
- PolicyDesigner.cs
- ToolStripRenderEventArgs.cs
- KeyConverter.cs
- SpeakProgressEventArgs.cs
- ContactManager.cs
- WindowAutomationPeer.cs
- HttpHandlerActionCollection.cs
- SizeConverter.cs
- CorrelationManager.cs
- WebServiceClientProxyGenerator.cs