Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HGlobalSafeHandle.cs
- MouseActionConverter.cs
- WindowPatternIdentifiers.cs
- TranslateTransform.cs
- AnnotationResourceChangedEventArgs.cs
- Privilege.cs
- CollectionAdapters.cs
- QueryGeneratorBase.cs
- MediaCommands.cs
- Profiler.cs
- XmlChildNodes.cs
- CachedFontFamily.cs
- OdbcUtils.cs
- GridToolTip.cs
- TemplateControlCodeDomTreeGenerator.cs
- X509ChainElement.cs
- SiteMapNode.cs
- SqlProvider.cs
- GrammarBuilderRuleRef.cs
- Transform3D.cs
- EncryptedHeader.cs
- RegexBoyerMoore.cs
- XmlSchemaExporter.cs
- Sentence.cs
- DataSet.cs
- ActionFrame.cs
- TextEditorTables.cs
- MailDefinition.cs
- StringOutput.cs
- ComponentChangingEvent.cs
- URLIdentityPermission.cs
- Matrix3DStack.cs
- CmsInterop.cs
- TextServicesContext.cs
- cookiecollection.cs
- WindowsScroll.cs
- QueueProcessor.cs
- GlyphingCache.cs
- TimeManager.cs
- Floater.cs
- AnnotationService.cs
- ZoneMembershipCondition.cs
- DispatcherEventArgs.cs
- GroupBox.cs
- OleDbDataReader.cs
- PreviewPrintController.cs
- OdbcConnection.cs
- CompilerError.cs
- GenericParameterDataContract.cs
- HScrollBar.cs
- DeclaredTypeValidator.cs
- LayoutInformation.cs
- ThreadStateException.cs
- TabRenderer.cs
- Expander.cs
- KeyValueConfigurationCollection.cs
- PolyLineSegmentFigureLogic.cs
- DuplicateWaitObjectException.cs
- SafeNativeMemoryHandle.cs
- JapaneseCalendar.cs
- BoundingRectTracker.cs
- XmlSchemaInfo.cs
- TableLayoutCellPaintEventArgs.cs
- COSERVERINFO.cs
- UriExt.cs
- OdbcFactory.cs
- BCLDebug.cs
- IsolationInterop.cs
- CustomCategoryAttribute.cs
- AddDataControlFieldDialog.cs
- Command.cs
- Set.cs
- ValueQuery.cs
- NumericUpDownAccelerationCollection.cs
- Rotation3DAnimationUsingKeyFrames.cs
- OutOfProcStateClientManager.cs
- DataControlField.cs
- ControlType.cs
- HttpListener.cs
- TransformFinalBlockRequest.cs
- ProfileGroupSettingsCollection.cs
- PingReply.cs
- MulticastOption.cs
- DocumentOrderQuery.cs
- XMLSyntaxException.cs
- Setter.cs
- DrawingContextWalker.cs
- ViewStateException.cs
- ObjectList.cs
- DataService.cs
- SortFieldComparer.cs
- DoubleConverter.cs
- UIPermission.cs
- PropertyTab.cs
- PostBackOptions.cs
- XmlDataSourceNodeDescriptor.cs
- LinqToSqlWrapper.cs
- ScriptingWebServicesSectionGroup.cs
- ShaderEffect.cs
- XPathSelfQuery.cs