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
- MissingSatelliteAssemblyException.cs
- mda.cs
- baseaxisquery.cs
- FormViewModeEventArgs.cs
- EncodingFallbackAwareXmlTextWriter.cs
- ScrollViewer.cs
- QueryOutputWriter.cs
- CroppedBitmap.cs
- InputScope.cs
- EntityWithChangeTrackerStrategy.cs
- FileLevelControlBuilderAttribute.cs
- ListViewEditEventArgs.cs
- CompositeControl.cs
- CodeCatchClauseCollection.cs
- StylusEditingBehavior.cs
- DESCryptoServiceProvider.cs
- MetafileHeaderWmf.cs
- FixedPageProcessor.cs
- AvtEvent.cs
- ImageIndexEditor.cs
- XamlContextStack.cs
- MinimizableAttributeTypeConverter.cs
- RefExpr.cs
- LineBreakRecord.cs
- XmlWhitespace.cs
- ViewPort3D.cs
- ProtocolsConfigurationHandler.cs
- IPCCacheManager.cs
- TraceHwndHost.cs
- ViewStateException.cs
- CompilerInfo.cs
- Calendar.cs
- RuntimeHandles.cs
- SqlCachedBuffer.cs
- ResponseStream.cs
- MsmqBindingBase.cs
- MethodToken.cs
- DataSourceView.cs
- DbSetClause.cs
- WindowsImpersonationContext.cs
- MessageContractMemberAttribute.cs
- ConstraintCollection.cs
- Point3DAnimationUsingKeyFrames.cs
- SoapInteropTypes.cs
- ObjectComplexPropertyMapping.cs
- GeneralTransform2DTo3D.cs
- PropertyPathWorker.cs
- InstanceDescriptor.cs
- DNS.cs
- CornerRadiusConverter.cs
- TransactionChannelFactory.cs
- ConstraintStruct.cs
- GridViewRowCollection.cs
- XmlTextAttribute.cs
- HorizontalAlignConverter.cs
- TcpChannelHelper.cs
- PropertyPushdownHelper.cs
- CodeEntryPointMethod.cs
- NonBatchDirectoryCompiler.cs
- GridViewColumnCollectionChangedEventArgs.cs
- FileSystemEventArgs.cs
- KeyedPriorityQueue.cs
- MulticastDelegate.cs
- NetMsmqBindingCollectionElement.cs
- InstanceCreationEditor.cs
- UniqueIdentifierService.cs
- StoreItemCollection.Loader.cs
- MinimizableAttributeTypeConverter.cs
- StoreContentChangedEventArgs.cs
- WebPartConnectionsEventArgs.cs
- Form.cs
- PenThreadWorker.cs
- ReaderContextStackData.cs
- ReflectTypeDescriptionProvider.cs
- EnvironmentPermission.cs
- ServiceNameElement.cs
- DataBoundControl.cs
- NegotiationTokenAuthenticatorStateCache.cs
- XslCompiledTransform.cs
- IgnoreSection.cs
- FileLogRecord.cs
- StorageMappingItemLoader.cs
- XmlAnyElementAttribute.cs
- RadioButtonStandardAdapter.cs
- TableLayoutStyleCollection.cs
- NumberFormatter.cs
- GlyphElement.cs
- ListComponentEditorPage.cs
- Utils.cs
- WindowClosedEventArgs.cs
- DynamicQueryableWrapper.cs
- FontStretchConverter.cs
- InfocardExtendedInformationEntry.cs
- ExpressionNode.cs
- MSG.cs
- AlternateViewCollection.cs
- MdImport.cs
- HideDisabledControlAdapter.cs
- CapabilitiesSection.cs
- XsdDataContractExporter.cs