Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- MetaModel.cs
- ButtonField.cs
- InputElement.cs
- LinqToSqlWrapper.cs
- HostingEnvironment.cs
- DesignerTransaction.cs
- Vector.cs
- URLIdentityPermission.cs
- EndpointNotFoundException.cs
- Rotation3DAnimation.cs
- OracleRowUpdatedEventArgs.cs
- ValidationHelper.cs
- DateTimeValueSerializer.cs
- SchemaTableOptionalColumn.cs
- Manipulation.cs
- ViewManager.cs
- ComAwareEventInfo.cs
- AppDomainAttributes.cs
- ProxyWebPartManager.cs
- AsymmetricKeyExchangeDeformatter.cs
- InternalException.cs
- PersonalizationProvider.cs
- CompareValidator.cs
- TextFormatter.cs
- DataServiceBuildProvider.cs
- SmtpClient.cs
- SettingsProperty.cs
- FixedTextView.cs
- NonParentingControl.cs
- Popup.cs
- HtmlTableCell.cs
- ComponentResourceManager.cs
- XmlSerializer.cs
- CharacterMetricsDictionary.cs
- TypeBuilder.cs
- DataGridViewRowHeaderCell.cs
- DebuggerService.cs
- DetailsViewDeletedEventArgs.cs
- PipeSecurity.cs
- KnownTypeDataContractResolver.cs
- HideDisabledControlAdapter.cs
- DbProviderManifest.cs
- CompositeControl.cs
- ChannelBinding.cs
- TimeoutException.cs
- XmlSchemaComplexType.cs
- TraceUtility.cs
- UnsafeNativeMethodsMilCoreApi.cs
- ConnectionPoolManager.cs
- IISMapPath.cs
- ProcessModelSection.cs
- PenContext.cs
- RectConverter.cs
- URLMembershipCondition.cs
- MouseEvent.cs
- ComplexPropertyEntry.cs
- EdmToObjectNamespaceMap.cs
- BindingValueChangedEventArgs.cs
- UIHelper.cs
- InstanceLockLostException.cs
- BoolExpression.cs
- QueryStatement.cs
- OleDbException.cs
- UIElement3D.cs
- baseaxisquery.cs
- AddressHeader.cs
- ObjectQueryExecutionPlan.cs
- CodeBlockBuilder.cs
- IPPacketInformation.cs
- Registry.cs
- CacheDependency.cs
- ObjectConverter.cs
- MimeTextImporter.cs
- HuffmanTree.cs
- TextServicesDisplayAttributePropertyRanges.cs
- HierarchicalDataSourceIDConverter.cs
- SimpleWorkerRequest.cs
- HyperLinkStyle.cs
- MobileUserControl.cs
- MatrixStack.cs
- ToolStripItemDesigner.cs
- WebServiceMethodData.cs
- SortedDictionary.cs
- BooleanKeyFrameCollection.cs
- TypeSystem.cs
- _NegotiateClient.cs
- DirectionalLight.cs
- SelectionEditingBehavior.cs
- GcHandle.cs
- WebPartConnectionsEventArgs.cs
- SchemaMapping.cs
- TimeSpan.cs
- CompareValidator.cs
- FileLogRecordHeader.cs
- CodeRegionDirective.cs
- DataGridViewLinkColumn.cs
- XamlClipboardData.cs
- WebPartConnectionsDisconnectVerb.cs
- safelinkcollection.cs
- Dictionary.cs