LastError() 공개 정적인 메소드

public static LastError ( ) : Win32ErrorCode
리턴 Win32ErrorCode
예제 #1
0
                    public static Directory7[] OpenDirectory(string fullFolderName)
                    {
                        WIN32_FIND_DATA data;
                        var             handle = DllImportCaller.lib.FindFirstFile7(fullFolderName, out data);

                        if (handle == -1)
                        {
                            var err = DllImportCaller.LastError().ToString();

                            if (err == "-2147483643")
                            {
                                throw new System.IO.IOException("Forbidden or not exist");
                            }
                            else
                            {
                                throw new Exception(err);
                            }
                        }

                        var list = new List <Directory7>();

                        list.Add(new Directory7(data, fullFolderName, true)); //add first defined "out data"


                        int next;

                        while ((next = DllImportCaller.lib.FindNextFile7(handle, out data)) != 0)
                        {
                            list.Add(new Directory7(data, System.IO.Path.Combine(fullFolderName, data.cFileName), false));//continue to add
                        }

                        var r = DllImportCaller.lib.FindClose7(handle);

                        return(list.ToArray());
                    }
예제 #2
0
                public static File7 Open(string fullPath, string mode)
                {
                    int handle = DllImportCaller.lib.fopen7(fullPath, mode);

                    if (handle == 0)
                    {
                        throw new Exception(DllImportCaller.LastError().ToString());
                    }

                    return(new File7(handle));
                }
예제 #3
0
                public int GetFileSize()
                {
                    checkDisposed();

                    int val = DllImportCaller.lib.fsize7(Handle);

                    if (val == -1)
                    {
                        throw new Exception(DllImportCaller.LastError().ToString());
                    }

                    return(val);
                }