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
- FunctionCommandText.cs
- precedingquery.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- Buffer.cs
- SettingsPropertyWrongTypeException.cs
- IOException.cs
- ContentDisposition.cs
- WindowsComboBox.cs
- StorageConditionPropertyMapping.cs
- WebPartAddingEventArgs.cs
- ListViewItemSelectionChangedEvent.cs
- StoreAnnotationsMap.cs
- IconHelper.cs
- WebPartTransformerAttribute.cs
- ExpressionBindingCollection.cs
- EventManager.cs
- XmlWellformedWriterHelpers.cs
- DynamicPropertyHolder.cs
- DataColumnPropertyDescriptor.cs
- EntityConnectionStringBuilder.cs
- InkCanvasInnerCanvas.cs
- ToggleButton.cs
- IpcChannel.cs
- IisTraceListener.cs
- BindingMemberInfo.cs
- ListViewDeletedEventArgs.cs
- OleDbMetaDataFactory.cs
- StylusSystemGestureEventArgs.cs
- Selection.cs
- BaseTemplateParser.cs
- EventMappingSettingsCollection.cs
- OperandQuery.cs
- FileSystemWatcher.cs
- Shape.cs
- TableAdapterManagerMethodGenerator.cs
- SystemIPInterfaceStatistics.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- CallSiteBinder.cs
- SafeEventLogWriteHandle.cs
- SqlDeflator.cs
- FixedTextSelectionProcessor.cs
- DataTableNewRowEvent.cs
- SecurityContext.cs
- XamlTypeMapper.cs
- DoubleAnimation.cs
- ApplicationInfo.cs
- UIElement3DAutomationPeer.cs
- LoginUtil.cs
- Literal.cs
- NativeCompoundFileAPIs.cs
- PermissionListSet.cs
- MaskedTextBoxTextEditorDropDown.cs
- Debugger.cs
- HttpDictionary.cs
- DbProviderFactory.cs
- SoapReflectionImporter.cs
- AppModelKnownContentFactory.cs
- UniqueConstraint.cs
- Visual3D.cs
- BooleanConverter.cs
- SoapSchemaImporter.cs
- MarkerProperties.cs
- RichTextBoxConstants.cs
- ToolStripDesignerAvailabilityAttribute.cs
- GregorianCalendar.cs
- ProjectionPlan.cs
- isolationinterop.cs
- Deserializer.cs
- PropertyChange.cs
- Rect3D.cs
- AsyncCompletedEventArgs.cs
- ProxyWebPartConnectionCollection.cs
- MemoryMappedFile.cs
- StopStoryboard.cs
- CharacterString.cs
- Package.cs
- RemotingService.cs
- OperationResponse.cs
- RowVisual.cs
- CodeIdentifiers.cs
- CallId.cs
- DetailsViewInsertEventArgs.cs
- KeyValueConfigurationCollection.cs
- TextBoxAutomationPeer.cs
- WebPartZoneBase.cs
- ConnectionsZone.cs
- MSAAWinEventWrap.cs
- XmlComplianceUtil.cs
- AsymmetricAlgorithm.cs
- M3DUtil.cs
- Item.cs
- StylusPointCollection.cs
- ProcessModule.cs
- BaseDataBoundControl.cs
- MetadataCacheItem.cs
- ToolStripProgressBar.cs
- DomainLiteralReader.cs
- HtmlControl.cs
- OdbcInfoMessageEvent.cs
- ImageField.cs