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
- MessageSmuggler.cs
- GeneralTransformGroup.cs
- HtmlInputHidden.cs
- ChineseLunisolarCalendar.cs
- DecimalSumAggregationOperator.cs
- DataComponentNameHandler.cs
- DataGridViewElement.cs
- DataViewManagerListItemTypeDescriptor.cs
- safex509handles.cs
- SemaphoreFullException.cs
- WorkflowRuntimeService.cs
- ConfigurationSettings.cs
- OdbcHandle.cs
- ExtentKey.cs
- EventEntry.cs
- TrustLevelCollection.cs
- TextBoxRenderer.cs
- VariableAction.cs
- DataGridViewRowsRemovedEventArgs.cs
- PerfCounterSection.cs
- wgx_commands.cs
- RepeaterCommandEventArgs.cs
- EventTrigger.cs
- DataGridViewIntLinkedList.cs
- FigureParagraph.cs
- EntityDataSourceViewSchema.cs
- ReflectPropertyDescriptor.cs
- ResXResourceSet.cs
- ChannelSinkStacks.cs
- Compiler.cs
- IndexerReference.cs
- RegexNode.cs
- ClonableStack.cs
- SharedPersonalizationStateInfo.cs
- SerializableAttribute.cs
- PeerFlooder.cs
- DefaultAsyncDataDispatcher.cs
- DbMetaDataFactory.cs
- RubberbandSelector.cs
- HebrewCalendar.cs
- HwndSource.cs
- EventPropertyMap.cs
- CurrentTimeZone.cs
- AutoGeneratedField.cs
- ConsoleKeyInfo.cs
- DataFormats.cs
- DupHandleConnectionReader.cs
- KnownTypeHelper.cs
- ProcessStartInfo.cs
- AttributeEmitter.cs
- ArrayTypeMismatchException.cs
- XpsException.cs
- Quaternion.cs
- RectAnimationBase.cs
- ProviderUtil.cs
- CodePageEncoding.cs
- RelationshipDetailsRow.cs
- BuildProvidersCompiler.cs
- RandomNumberGenerator.cs
- WebPartConnectionsCancelVerb.cs
- IIS7UserPrincipal.cs
- EntryIndex.cs
- WriteTimeStream.cs
- RemoteArgument.cs
- SamlConstants.cs
- SchemaMapping.cs
- TemplateField.cs
- EnumerableWrapperWeakToStrong.cs
- AssemblyAttributesGoHere.cs
- TabControlCancelEvent.cs
- XmlChildEnumerator.cs
- SafeTokenHandle.cs
- RequestCachingSection.cs
- CompressStream.cs
- Operators.cs
- AmbiguousMatchException.cs
- Marshal.cs
- InfoCardRSACryptoProvider.cs
- CustomAttribute.cs
- _emptywebproxy.cs
- BindableAttribute.cs
- XMLSyntaxException.cs
- SpellerError.cs
- shaperfactoryquerycachekey.cs
- FunctionMappingTranslator.cs
- DbConnectionFactory.cs
- TraceData.cs
- TableDetailsCollection.cs
- PageCache.cs
- AdornerHitTestResult.cs
- XmlIlVisitor.cs
- SiteMapPath.cs
- SerializationInfoEnumerator.cs
- IUnknownConstantAttribute.cs
- SoapAttributes.cs
- DbDataReader.cs
- RegisteredScript.cs
- HttpHandlerActionCollection.cs
- WindowsListViewItemStartMenu.cs
- ContentDisposition.cs