您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->MyWebPages51aspx汉化最终版>>App-Code/FCKEditor/Util.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:MyWebPages51aspx汉化最终版
当前文件:文件类型 MyWebPagesStarterKit/App_Code/FCKEditor/Util.cs打开代码结构图
普通视图
		            
1/* 2 * FCKeditor - The text editor for internet 3 * Copyright (C) 2003-2005 Frederico Caldeira Knabben 4 * 5 * Licensed under the terms of the GNU Lesser General Public License: 6 * http://www.opensource.org/licenses/lgpl-license.php 7 * 8 * For further information visit: 9 * http://www.fckeditor.net/ 10 * 11 * "Support Open Source software. What about a donation today?" 12 * 13 * File Name: Util.cs 14 * Useful tools. 15 * 16 * File Authors: 17 * Frederico Caldeira Knabben (fredck@fckeditor.net) 18 */ 19 20using System ; 21using System.Runtime.InteropServices ; 22using System.IO ; 23using System.Collections ; 24 25namespace FredCK.FCKeditorV2 26{ 27 public sealed class Util 28 { 29 // The "_mkdir" function is used by the "CreateDirectory" method. 30 [DllImport("msvcrt.dll", SetLastError=true)] 31 private static extern int _mkdir(string path) ; 32 33 private Util() 34 {} 35 36 /// <summary> 37 /// This method should provide safe substitude for Directory.CreateDirectory(). 38 /// </summary> 39 /// <param name="path">The directory path to be created.</param> 40 /// <returns>A <see cref="System.IO.DirectoryInfo"/> object for the created directory.</returns> 41 /// <remarks> 42 /// <para> 43 /// This method creates all the directory structure if needed. 44 /// </para> 45 /// <para> 46 /// The System.IO.Directory.CreateDirectory() method has a bug that gives an 47 /// error when trying to create a directory and the user has no rights defined 48 /// in one of its parent directories. The CreateDirectory() should be a good 49 /// replacement to solve this problem. 50 /// </para> 51 /// </remarks> 52 public static DirectoryInfo CreateDirectory( string path ) 53 { 54 ArrayList oDirsToCreate = new ArrayList() ; 55 56 // Create the directory info object for that dir (normalized to its absolute representation). 57 DirectoryInfo oDir = new DirectoryInfo( Path.GetFullPath( path ) ) ; 58 59 // Check the entire path structure to find directories that must be created. 60 while ( oDir != null && !oDir.Exists ) 61 { 62 oDirsToCreate.Add( oDir.FullName ) ; 63 oDir = oDir.Parent ; 64 } 65 66 // "oDir == null" means that the check arrives in the root and it doesn't exist too. 67 if ( oDir == null ) 68 throw( new System.IO.DirectoryNotFoundException( "Directory \"" + oDirsToCreate[ oDirsToCreate.Count-1 ] + "\" not found." ) ) ; 69 70 // Create all directories that must be created (from bottom to top). 71 for( int i = oDirsToCreate.Count - 1 ; i >= 0 ; i-- ) 72 { 73 string sPath = (string)oDirsToCreate[i] ; 74 int iReturn = _mkdir( sPath ) ; 75 76 if ( iReturn != 0 ) 77 throw new ApplicationException("Error calling [msvcrt.dll]:_wmkdir(" + sPath + "), error code: " + iReturn ); 78 } 79 80 return new DirectoryInfo( path ) ; 81 } 82 } 83} 84
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:MyWebPages51aspx汉化最终版
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号