Beispiel #1
0
        public static OpenFileName OpenSaveFileWindow(string FormatName, int fileSize = 256)
        {
            OpenFileName openFileName = new OpenFileName();

            openFileName.structSize   = Marshal.SizeOf(openFileName);
            openFileName.filter       = $"{FormatName}文件(*.{FormatName})\0*.{FormatName}";
            openFileName.file         = new string(new char[fileSize]);
            openFileName.maxFile      = openFileName.file.Length;
            openFileName.fileTitle    = new string(new char[64]);
            openFileName.maxFileTitle = openFileName.fileTitle.Length;
            openFileName.initialDir   = Application.streamingAssetsPath.Replace('/', '\\');//默认路径
            openFileName.title        = "选择文件";
            openFileName.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;

            if (LocalDialog.GetSaveFileName(openFileName))
            {
                UnityEngine.Debug.Log(openFileName.file);
                UnityEngine.Debug.Log(openFileName.fileTitle);
                return(openFileName);
            }
            return(null);
        }
Beispiel #2
0
 public static bool GetSFN([In, Out] OpenFileName ofn)
 {
     return(GetSaveFileName(ofn));
 }
Beispiel #3
0
 public static extern bool GetSaveFileName([In, Out] OpenFileName ofn);