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
- GlyphManager.cs
- SymmetricAlgorithm.cs
- ToolStripArrowRenderEventArgs.cs
- CaretElement.cs
- DataServiceRequestArgs.cs
- PropertyTab.cs
- DataGridViewRowPostPaintEventArgs.cs
- PropertyRecord.cs
- ImageMap.cs
- TrackingDataItemValue.cs
- CrossAppDomainChannel.cs
- BeginStoryboard.cs
- MemberHolder.cs
- RequestCacheManager.cs
- DataSourceCacheDurationConverter.cs
- XmlSerializableServices.cs
- TouchPoint.cs
- TextRangeEdit.cs
- WmpBitmapDecoder.cs
- PropertyPushdownHelper.cs
- ZipIOCentralDirectoryFileHeader.cs
- RayMeshGeometry3DHitTestResult.cs
- AsyncCallback.cs
- CustomAttributeSerializer.cs
- odbcmetadatafactory.cs
- InterleavedZipPartStream.cs
- WebPartActionVerb.cs
- TreeView.cs
- XamlTreeBuilderBamlRecordWriter.cs
- EntityDataReader.cs
- DictionaryTraceRecord.cs
- GeometryHitTestParameters.cs
- TableLayoutSettingsTypeConverter.cs
- ServiceDurableInstanceContextProvider.cs
- HttpWriter.cs
- RawUIStateInputReport.cs
- PackageDigitalSignatureManager.cs
- LineBreakRecord.cs
- HuffmanTree.cs
- BaseUriHelper.cs
- XmlLinkedNode.cs
- ParentUndoUnit.cs
- TableColumn.cs
- selecteditemcollection.cs
- ToolboxItemAttribute.cs
- FileSystemWatcher.cs
- SiteMapSection.cs
- datacache.cs
- Viewport2DVisual3D.cs
- AutomationTextAttribute.cs
- PageContentCollection.cs
- ResolveNameEventArgs.cs
- NetPeerTcpBindingElement.cs
- ProxyElement.cs
- PersonalizationProviderCollection.cs
- IsolatedStorageException.cs
- Transform.cs
- TextModifier.cs
- CustomErrorsSection.cs
- StackBuilderSink.cs
- Triangle.cs
- GridViewDeletedEventArgs.cs
- ResourceProperty.cs
- MLangCodePageEncoding.cs
- WebHttpDispatchOperationSelector.cs
- DataRowExtensions.cs
- DATA_BLOB.cs
- UIElement.cs
- RtfToXamlReader.cs
- XamlFilter.cs
- ReflectTypeDescriptionProvider.cs
- ToolStripOverflow.cs
- Binding.cs
- HashAlgorithm.cs
- PathFigureCollectionConverter.cs
- XmlSchemaType.cs
- PropertyMap.cs
- LocatorPart.cs
- AttributeProviderAttribute.cs
- Transform3D.cs
- SemanticBasicElement.cs
- RSAOAEPKeyExchangeDeformatter.cs
- MergeLocalizationDirectives.cs
- login.cs
- ParserStreamGeometryContext.cs
- OleDbConnection.cs
- TreeNodeBinding.cs
- DynamicResourceExtensionConverter.cs
- BaseProcessProtocolHandler.cs
- StopStoryboard.cs
- TypographyProperties.cs
- ResourcesBuildProvider.cs
- Container.cs
- RouteItem.cs
- TargetException.cs
- IApplicationTrustManager.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- CustomWebEventKey.cs
- DependencyObjectType.cs
- _LocalDataStore.cs