update applovin demo upload
This commit is contained in:
@@ -159,6 +159,37 @@ if ($dlg.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
|
||||
return result
|
||||
}
|
||||
|
||||
func PickSaveFile(title, defaultName string, filters []FileFilter, initialDir string) string {
|
||||
filterStr := "All files|*.*"
|
||||
if len(filters) > 0 {
|
||||
parts := make([]string, 0, len(filters))
|
||||
for _, f := range filters {
|
||||
exts := make([]string, 0, len(f.Extensions))
|
||||
for _, e := range f.Extensions {
|
||||
exts = append(exts, "*."+e)
|
||||
}
|
||||
parts = append(parts, fmt.Sprintf("%s|%s", f.Name, strings.Join(exts, ";")))
|
||||
}
|
||||
filterStr = strings.Join(parts, "|")
|
||||
}
|
||||
script := fmt.Sprintf(`
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
$dlg = New-Object System.Windows.Forms.SaveFileDialog
|
||||
$dlg.Title = '%s'
|
||||
$dlg.Filter = '%s'
|
||||
$dlg.FileName = '%s'
|
||||
if ('%s'.Length -gt 0) { $dlg.InitialDirectory = '%s' }
|
||||
if ($dlg.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
|
||||
Write-Output $dlg.FileName
|
||||
}
|
||||
`, psEscape(title), psEscape(filterStr), psEscape(defaultName), psEscape(initialDir), psEscape(initialDir))
|
||||
out, err := exec.Command("powershell", "-NoProfile", "-NonInteractive", "-STA", "-Command", script).Output()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(string(out))
|
||||
}
|
||||
|
||||
func PickFolder(title, initialDir string) string {
|
||||
script := fmt.Sprintf(`
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
|
||||
Reference in New Issue
Block a user