⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 disk_class.vb

📁 采用VB.net编写的网络硬盘,这只是一个模型,对编写网络硬盘的朋友有一定的引导做用
💻 VB
字号:
Imports System.web

Public Class Disk_Class
    Public Function getParentDirectory()

        ' this function works for /main/db/test/ as well as /main/db/test.aspx
        System.Web.HttpContext(context = System.Web.HttpContext.Current)
        Dim path As String = context.Session("Path").ToString()
        If path = "./" Then
            Return "../"                    ' trivial, no string manipulation required
        ElseIf path = "/" Then
            Return "/"                      ' can't go higher than root
        Else
            ' remove trailing "/" at end of path
            If path.LastIndexOf("/") = path.Length - 1 Then
                path = path.Remove(path.LastIndexOf("/"), (path.Length - path.LastIndexOf("/")))
                Try
                    'remove the characters after the last occurence of / in the string. => parent directory
                    path = path.Remove(path.LastIndexOf("/"), (path.Length - path.LastIndexOf("/")))
                    Return path + "/"

				catch System.ArgumentOutOfRangeException(ex)

                    Return "/" 'default to root
                End Try
            End If
        End If

    End Function

    Public Function ReportError(ByVal problem As String, ByVal tech As String, ByVal suggestion As String)

        ' outputs error, in english, and in tech, and with any suggestions.
        System.Web.HttpContext(context = System.Web.HttpContext.Current)
        Dim output As String = "<font color=red><BIG>Problem:</BIG> " + problem + "</font><hr>"
        output += "Suggestion: " + suggestion + "<hr>"
        output += "<small>Technical details: " + tech + "</small><hr>"
        context.Response.Write(output)

    End Function
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -