Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / SyntaxCheck.cs / 1305376 / 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
- TraceLevelStore.cs
- ConsumerConnectionPointCollection.cs
- ObjectDataSourceChooseMethodsPanel.cs
- PropertyCondition.cs
- GlyphTypeface.cs
- ColumnMapVisitor.cs
- MULTI_QI.cs
- FlowDocumentView.cs
- Util.cs
- SplineKeyFrames.cs
- ElementHostPropertyMap.cs
- ProcessInputEventArgs.cs
- PackagePartCollection.cs
- Fx.cs
- Page.cs
- AdobeCFFWrapper.cs
- TdsParserStateObject.cs
- RowBinding.cs
- WhitespaceRule.cs
- FeatureAttribute.cs
- DeclarationUpdate.cs
- DocumentReferenceCollection.cs
- GridPatternIdentifiers.cs
- HtmlImageAdapter.cs
- TagPrefixAttribute.cs
- NetNamedPipeBinding.cs
- GridViewAutomationPeer.cs
- ConvertEvent.cs
- StorageEntitySetMapping.cs
- BrowserDefinitionCollection.cs
- FontStyleConverter.cs
- assertwrapper.cs
- TextServicesHost.cs
- CopyNodeSetAction.cs
- StrongNameUtility.cs
- CollectionViewSource.cs
- InstancePersistenceException.cs
- XmlSchemaSequence.cs
- GeometryModel3D.cs
- DBBindings.cs
- BackgroundFormatInfo.cs
- ServiceTimeoutsBehavior.cs
- DesignerHelpers.cs
- XmlParser.cs
- DeferredElementTreeState.cs
- WsdlServiceChannelBuilder.cs
- cryptoapiTransform.cs
- UnicodeEncoding.cs
- DataObjectPastingEventArgs.cs
- DesignerInterfaces.cs
- HtmlHistory.cs
- PhonemeConverter.cs
- CaseInsensitiveOrdinalStringComparer.cs
- CallbackValidator.cs
- MethodRental.cs
- ProcessHostFactoryHelper.cs
- Util.cs
- TreeView.cs
- Tracer.cs
- EntitySqlQueryBuilder.cs
- SocketAddress.cs
- FileDetails.cs
- LocationReference.cs
- SmtpReplyReaderFactory.cs
- DataGridViewCellCancelEventArgs.cs
- DesignerTextViewAdapter.cs
- SchemaNames.cs
- AxisAngleRotation3D.cs
- ListSurrogate.cs
- DataGridViewCellEventArgs.cs
- SecurityException.cs
- VSDExceptions.cs
- HtmlInputButton.cs
- FormatSettings.cs
- TextFormatterHost.cs
- UiaCoreProviderApi.cs
- CompilerTypeWithParams.cs
- DataGridViewCellConverter.cs
- DbDataAdapter.cs
- XslTransform.cs
- DockPattern.cs
- DbLambda.cs
- DbConnectionOptions.cs
- SafeEventLogWriteHandle.cs
- XmlILIndex.cs
- InheritedPropertyChangedEventArgs.cs
- HttpProtocolImporter.cs
- RequestResizeEvent.cs
- Process.cs
- ArcSegment.cs
- AnnotationHelper.cs
- RealizationDrawingContextWalker.cs
- CodeExporter.cs
- ClrPerspective.cs
- FontEmbeddingManager.cs
- EngineSite.cs
- ErrorFormatter.cs
- PersonalizableTypeEntry.cs
- RoutedEventConverter.cs
- TypeDescriptorContext.cs