Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UIElementParagraph.cs
- DbDataRecord.cs
- MulticastDelegate.cs
- AsyncOperation.cs
- CodeGenerator.cs
- DrawItemEvent.cs
- CodeBinaryOperatorExpression.cs
- PreloadedPackages.cs
- AstTree.cs
- NativeMethods.cs
- HttpException.cs
- XsdValidatingReader.cs
- WorkflowServiceBehavior.cs
- CalendarButton.cs
- DoubleSumAggregationOperator.cs
- ChangeToolStripParentVerb.cs
- APCustomTypeDescriptor.cs
- AuthenticationException.cs
- ProxyHwnd.cs
- BitConverter.cs
- OuterGlowBitmapEffect.cs
- BufferBuilder.cs
- StreamResourceInfo.cs
- MimeXmlReflector.cs
- LeftCellWrapper.cs
- isolationinterop.cs
- RSAOAEPKeyExchangeDeformatter.cs
- BrushMappingModeValidation.cs
- XPathAncestorQuery.cs
- ClientUrlResolverWrapper.cs
- UndirectedGraph.cs
- AutomationIdentifierGuids.cs
- SynchronizationValidator.cs
- ResXBuildProvider.cs
- DeviceOverridableAttribute.cs
- WebPartDeleteVerb.cs
- WindowsAuthenticationModule.cs
- COM2ColorConverter.cs
- AddInProcess.cs
- XsltArgumentList.cs
- WeakHashtable.cs
- GACIdentityPermission.cs
- BuildProvider.cs
- ProtocolsConfigurationEntry.cs
- ObjectQueryExecutionPlan.cs
- AutoSizeComboBox.cs
- UnauthorizedWebPart.cs
- SqlTypeConverter.cs
- ToolStrip.cs
- ButtonFlatAdapter.cs
- PointCollectionValueSerializer.cs
- Evidence.cs
- IItemContainerGenerator.cs
- ThicknessAnimationBase.cs
- SqlReorderer.cs
- SecurityDescriptor.cs
- TdsParserStaticMethods.cs
- TransactionInformation.cs
- AsyncResult.cs
- SqlGatherProducedAliases.cs
- BindingContext.cs
- SqlClientPermission.cs
- DecimalKeyFrameCollection.cs
- OracleConnectionFactory.cs
- CacheDependency.cs
- BooleanSwitch.cs
- Binding.cs
- ActivityBuilderHelper.cs
- UIElementAutomationPeer.cs
- AesManaged.cs
- RetrieveVirtualItemEventArgs.cs
- TextTreeRootTextBlock.cs
- HttpListener.cs
- TimeZone.cs
- RegexCapture.cs
- AutomationElementIdentifiers.cs
- EntityProxyFactory.cs
- FullTextBreakpoint.cs
- TailCallAnalyzer.cs
- Form.cs
- WindowsSlider.cs
- OleDbException.cs
- CharStorage.cs
- ResizeGrip.cs
- BitmapPalette.cs
- filewebresponse.cs
- DesignerGenericWebPart.cs
- ProtocolState.cs
- ObjectStateEntryDbDataRecord.cs
- GestureRecognitionResult.cs
- AxisAngleRotation3D.cs
- ReturnEventArgs.cs
- MenuItem.cs
- SRef.cs
- ServiceObjectContainer.cs
- GuidConverter.cs
- MeasurementDCInfo.cs
- ImageListStreamer.cs
- BinaryKeyIdentifierClause.cs
- WindowsGraphicsCacheManager.cs