0

私はMONOC#でアプリケーションを作成していて、助けが必要です。私の問題は、Windows XPを実行しているサーバーから写真をロードする必要があり、写真のパスをどのように作成する必要があるかを知る必要があることです。つまり、Windowsはこのようなものです。

IOクラスを使用してストリームとしてロードし、すぐに閉じてファイルを解放します

コードは次のようなものです(これはC#のVBにあり、問題を説明したいのとほぼ同じです):

Public Sub FotoProducto(ByRef whichPicturebox As PictureBox)

   Dim fsPicture As System.IO.FileStream
   Dim sPath As String

   'In windows I use this one and works fine
   "\\MyServer\PhotoFolder\picture.jpg"

   'in linux I supossed it would be:
   sPath = "smb://MyServer/PhotoFolder/picture.jpg"

   'I tried with local files and this code worked
   sPath = "/home/user/images/sample.jpg"

   'I don't know how to acces to files from others machines wich run WinXP
   'using the console, That's the reson why I think I'm writing wrong the path,
   'I've been looking in a lot of forums with no luck.

    Try
        fsPicture = New System.IO.FileStream(sPath , FileMode.Open, FileAccess.Read)
        Adonde.Image = Image.FromStream(fsPicture)
        fsPicture.Close()
        fsPicture.Dispose()
    Catch ex As Exception
        whichPicturebox.Image = My.Resources.Defaultt
    End Try
End Sub

私は本当に前もってあなたをたたきます

4

1 に答える 1

3

mono の IO ライブラリが特に Samba の処理を​​サポートしていない限り、これは機能しないと思います。

正しい方法は、最初にファイル システムのどこかに samba 共有をマウントし、次に直接パスを使用することです。

mount -t smbfs //MyServer/PhotoFolder /mnt/server (add samba options here)

それが完了したら、ファイルシステムの一部であるかのようにファイルにアクセスできます。

Public Sub FotoProducto(ByRef whichPicturebox As PictureBox)

   'path is mounted samba share
   sPath = "/mnt/server/picture.jpg"


End Sub

モノラル アプリケーションを実行中にネットワーク共有にマウントすることもできます。

于 2009-09-29T00:28:14.660 に答える