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
- BaseDataList.cs
- SqlCacheDependencyDatabase.cs
- FormatSettings.cs
- KeyTime.cs
- ConfigurationElementCollection.cs
- RegexCapture.cs
- DataSvcMapFileSerializer.cs
- WindowsSpinner.cs
- Enumerable.cs
- StorageModelBuildProvider.cs
- MetadataItem_Static.cs
- LinearQuaternionKeyFrame.cs
- TreeViewDataItemAutomationPeer.cs
- BaseDataBoundControl.cs
- DataGridViewCellConverter.cs
- InvalidChannelBindingException.cs
- MatrixValueSerializer.cs
- PageCatalogPartDesigner.cs
- InvalidWMPVersionException.cs
- SqlStatistics.cs
- SqlLiftIndependentRowExpressions.cs
- SchemaImporterExtensionsSection.cs
- CategoryNameCollection.cs
- XDRSchema.cs
- EmptyEnumerator.cs
- MdImport.cs
- ExceptionUtil.cs
- LeafCellTreeNode.cs
- _ContextAwareResult.cs
- DecimalAnimationUsingKeyFrames.cs
- ImageCodecInfoPrivate.cs
- RestHandler.cs
- CustomAttributeBuilder.cs
- SingleObjectCollection.cs
- PeerNearMe.cs
- TypeSystem.cs
- ProgressiveCrcCalculatingStream.cs
- CustomTypeDescriptor.cs
- Document.cs
- IsolatedStorage.cs
- unitconverter.cs
- TileBrush.cs
- ImmComposition.cs
- RegexWorker.cs
- PropertyTab.cs
- ExceptionRoutedEventArgs.cs
- QilNode.cs
- TextEffect.cs
- UnsafeNativeMethods.cs
- FilterQuery.cs
- ErrorHandler.cs
- CompensationToken.cs
- DoWorkEventArgs.cs
- XmlAttribute.cs
- ZipIOBlockManager.cs
- ForceCopyBuildProvider.cs
- SafePointer.cs
- CommonRemoteMemoryBlock.cs
- FreeFormDragDropManager.cs
- SequentialOutput.cs
- DataContract.cs
- HtmlTableRow.cs
- SoapSchemaMember.cs
- SchemaImporter.cs
- CodeNamespace.cs
- XmlUtil.cs
- IndexingContentUnit.cs
- ListBase.cs
- ScriptIgnoreAttribute.cs
- DesignerProperties.cs
- securestring.cs
- TextTabProperties.cs
- BaseParagraph.cs
- OletxCommittableTransaction.cs
- EndPoint.cs
- OdbcDataReader.cs
- MetadataCacheItem.cs
- DocumentReference.cs
- ItemCollection.cs
- Stream.cs
- WebScriptEnablingBehavior.cs
- DbFunctionCommandTree.cs
- EventArgs.cs
- SupportsEventValidationAttribute.cs
- ListViewDataItem.cs
- ScrollEventArgs.cs
- ValueUnavailableException.cs
- SelectionPatternIdentifiers.cs
- DateTimeConstantAttribute.cs
- FixedSOMTable.cs
- PropagatorResult.cs
- ByteViewer.cs
- WorkflowServiceBehavior.cs
- ActiveXSite.cs
- MtomMessageEncoder.cs
- XmlEncodedRawTextWriter.cs
- MetabaseSettings.cs
- QilSortKey.cs
- HttpRequest.cs
- CodeTypeParameterCollection.cs