本文整理汇总了C#中System.Windows.Forms.SaveFileDialog.ShowHawkDialog方法的典型用法代码示例。如果您正苦于以下问题:C# SaveFileDialog.ShowHawkDialog方法的具体用法?C# SaveFileDialog.ShowHawkDialog怎么用?C# SaveFileDialog.ShowHawkDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.SaveFileDialog
的用法示例。
在下文中一共展示了SaveFileDialog.ShowHawkDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTasProjSaveFileFromUser
public static FileInfo GetTasProjSaveFileFromUser(string currentFile)
{
var sfd = new SaveFileDialog();
if (!string.IsNullOrWhiteSpace(currentFile))
{
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
sfd.InitialDirectory = Path.GetDirectoryName(currentFile);
}
else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null);
}
else
{
sfd.FileName = "NULL";
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null);
}
sfd.Filter = "Tas Project Files (*.tasproj)|*.tasproj|All Files|*.*";
sfd.RestoreDirectory = true;
var result = sfd.ShowHawkDialog();
if (result != DialogResult.OK)
{
return null;
}
return new FileInfo(sfd.FileName);
}
示例2: SaveFileDialog
public static FileInfo SaveFileDialog(string currentFile, string path, string fileType, string fileExt)
{
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var sfd = new SaveFileDialog
{
FileName = !string.IsNullOrWhiteSpace(currentFile)
? Path.GetFileName(currentFile)
: PathManager.FilesystemSafeName(Global.Game) + "." + fileExt,
InitialDirectory = path,
Filter = string.Format("{0} (*.{1})|*.{1}|All Files|*.*", fileType, fileExt),
RestoreDirectory = true,
};
var result = sfd.ShowHawkDialog();
if (result != DialogResult.OK)
{
return null;
}
return new FileInfo(sfd.FileName);
}
示例3: BrowseBtn_Click
private void BrowseBtn_Click(object sender, EventArgs e)
{
var sfd = new SaveFileDialog
{
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
DefaultExt = "." + Global.MovieSession.Movie.PreferredExtension,
FileName = RecordBox.Text,
OverwritePrompt = false,
Filter = "Movie Files (*." + Global.MovieSession.Movie.PreferredExtension + ")|*." + Global.MovieSession.Movie.PreferredExtension + "|All Files|*.*"
};
var result = sfd.ShowHawkDialog();
if (result == DialogResult.OK
&& !string.IsNullOrWhiteSpace(sfd.FileName))
{
RecordBox.Text = sfd.FileName;
}
}
示例4: Screenshot
public void Screenshot()
{
var sfd = new SaveFileDialog
{
FileName = PathManager.FilesystemSafeName(Global.Game) + "-Nametables",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"),
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
RestoreDirectory = true
};
var result = sfd.ShowHawkDialog();
if (result != DialogResult.OK)
{
return;
}
var file = new FileInfo(sfd.FileName);
using (Bitmap b = new Bitmap(Width, Height))
{
Rectangle rect = new Rectangle(new Point(0, 0), Size);
DrawToBitmap(b, rect);
ImageFormat i;
string extension = file.Extension.ToUpper();
switch (extension)
{
default:
case ".PNG":
i = ImageFormat.Png;
break;
case ".BMP":
i = ImageFormat.Bmp;
break;
}
b.Save(file.FullName, i);
}
}
示例5: NewScriptMenuItem_Click
private void NewScriptMenuItem_Click(object sender, EventArgs e)
{
var sfd = new SaveFileDialog
{
InitialDirectory = !string.IsNullOrWhiteSpace(_luaList.Filename) ?
Path.GetDirectoryName(_luaList.Filename) :
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LuaPathFragment, null),
DefaultExt = ".lua",
FileName = !string.IsNullOrWhiteSpace(_luaList.Filename) ?
Path.GetFileNameWithoutExtension(_luaList.Filename) :
Path.GetFileNameWithoutExtension(Global.Game.Name),
OverwritePrompt = true,
Filter = "Lua Scripts (*.lua)|*.lua|All Files (*.*)|*.*"
};
var result = sfd.ShowHawkDialog();
if (result == DialogResult.OK
&& !string.IsNullOrWhiteSpace(sfd.FileName))
{
string defaultTemplate = "while true do\n\temu.frameadvance();\nend";
File.WriteAllText(sfd.FileName, defaultTemplate);
_luaList.Add(new LuaFile(Path.GetFileNameWithoutExtension(sfd.FileName), sfd.FileName));
UpdateDialog();
System.Diagnostics.Process.Start(sfd.FileName);
}
}
示例6: GetSaveFileFromUser
private FileInfo GetSaveFileFromUser()
{
var sfd = new SaveFileDialog();
if (!string.IsNullOrWhiteSpace(_luaList.Filename))
{
sfd.FileName = Path.GetFileNameWithoutExtension(_luaList.Filename);
sfd.InitialDirectory = Path.GetDirectoryName(_luaList.Filename);
}
else if (Global.Game != null)
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = PathManager.GetLuaPath();
}
else
{
sfd.FileName = "NULL";
sfd.InitialDirectory = PathManager.GetLuaPath();
}
sfd.Filter = "Lua Session Files (*.luases)|*.luases|All Files|*.*";
sfd.RestoreDirectory = true;
var result = sfd.ShowHawkDialog();
if (result != DialogResult.OK)
{
return null;
}
return new FileInfo(sfd.FileName);
}
示例7: SaveMacroAs
public static bool SaveMacroAs(MovieZone macro)
{
SaveFileDialog dialog = new SaveFileDialog();
// Create directory?
bool create = false;
if (!Directory.Exists(SuggestedFolder()))
{
Directory.CreateDirectory(SuggestedFolder());
create = true;
}
dialog.InitialDirectory = SuggestedFolder();
dialog.FileName = macro.Name;
dialog.Filter = "Movie Macros (*.bk2m)|*.bk2m|All Files|*.*";
DialogResult result = dialog.ShowHawkDialog();
if (result != DialogResult.OK)
{
if (create)
Directory.Delete(dialog.InitialDirectory);
return false;
}
macro.Save(dialog.FileName);
Global.Config.RecentMacros.Add(dialog.FileName);
return true;
}
示例8: GetSaveFileFromUser
private static string GetSaveFileFromUser()
{
var sfd = new SaveFileDialog
{
Filter = "Text (*.txt)|*.txt|All Files|*.*",
RestoreDirectory = true
};
if (Global.Emulator is NullEmulator)
{
sfd.FileName = "MemoryDump";
sfd.InitialDirectory = PathManager.GetBasePathAbsolute();
}
else
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = Path.GetDirectoryName(PathManager.MakeAbsolutePath(Global.Config.RecentRoms.MostRecent, null));
}
var result = sfd.ShowHawkDialog();
return result == DialogResult.OK ? sfd.FileName : string.Empty;
}
示例9: ScreenshotAsMenuItem_Click
private void ScreenshotAsMenuItem_Click(object sender, EventArgs e)
{
var path = String.Format(PathManager.ScreenshotPrefix(Global.Game) + ".{0:yyyy-MM-dd HH.mm.ss}.png", DateTime.Now);
var sfd = new SaveFileDialog
{
InitialDirectory = Path.GetDirectoryName(path),
FileName = Path.GetFileName(path),
Filter = "PNG File (*.png)|*.png"
};
var result = sfd.ShowHawkDialog();
if (result == DialogResult.OK)
{
TakeScreenshot(sfd.FileName);
}
}
示例10: GetBinarySaveFileFromUser
private string GetBinarySaveFileFromUser()
{
var sfd = new SaveFileDialog
{
Filter = GetSaveFileFilter(),
RestoreDirectory = true,
InitialDirectory = RomDirectory
};
if (_domain.Name == "File on Disk")
{
sfd.FileName = RomName;
}
else
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
}
var result = sfd.ShowHawkDialog();
return result == DialogResult.OK ? sfd.FileName : string.Empty;
}
示例11: GetCdlSaveFileFromUser
public static FileInfo GetCdlSaveFileFromUser(string currentFile)
{
var sfd = new SaveFileDialog
{
Filter = "Code Data Logger Files (*.cdl)|*.cdl|All Files|*.*",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
RestoreDirectory = true
};
if (!string.IsNullOrWhiteSpace(currentFile))
{
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
}
var result = sfd.ShowHawkDialog();
if (result != DialogResult.OK)
{
return null;
}
return new FileInfo(sfd.FileName);
}
示例12: GetCheatSaveFileFromUser
public static FileInfo GetCheatSaveFileFromUser(string currentFile)
{
var sfd = new SaveFileDialog();
if (!string.IsNullOrWhiteSpace(currentFile))
{
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
}
else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
}
sfd.InitialDirectory = PathManager.GetCheatsPath(Global.Game);
sfd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*";
sfd.RestoreDirectory = true;
var result = sfd.ShowHawkDialog();
if (result != DialogResult.OK)
{
return null;
}
return new FileInfo(sfd.FileName);
}
示例13: GetBinarySaveFileFromUser
private string GetBinarySaveFileFromUser()
{
var sfd = new SaveFileDialog
{
Filter = GetSaveFileFilter(),
RestoreDirectory = true
};
if (Global.Emulator is NullEmulator)
{
sfd.FileName = "MemoryDump";
sfd.InitialDirectory = PathManager.GetBasePathAbsolute();
}
else
{
if (_domain.Name == "File on Disk")
{
sfd.FileName = Path.GetFileName(Global.Config.RecentRoms.MostRecent);
}
else
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
}
sfd.InitialDirectory = Path.GetDirectoryName(PathManager.MakeAbsolutePath(Global.Config.RecentRoms.MostRecent, null));
}
var result = sfd.ShowHawkDialog();
return result == DialogResult.OK ? sfd.FileName : string.Empty;
}
示例14: SaveStateAs
private void SaveStateAs()
{
if (!Global.Emulator.HasSavestates())
{
return;
}
var path = PathManager.GetSaveStatePath(Global.Game);
var file = new FileInfo(path);
if (file.Directory != null && file.Directory.Exists == false)
{
file.Directory.Create();
}
var sfd = new SaveFileDialog
{
AddExtension = true,
DefaultExt = "State",
Filter = "Save States (*.State)|*.State|All Files|*.*",
InitialDirectory = path,
FileName = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave0.State"
};
var result = sfd.ShowHawkDialog();
if (result == DialogResult.OK)
{
SaveState(sfd.FileName, sfd.FileName, false);
}
}
示例15: _RecordAv
//.........这里部分代码省略.........
}
aw.SetAudioParameters(44100, 2, 16);
// select codec token
// do this before save dialog because ffmpeg won't know what extension it wants until it's been configured
if (unattended)
{
aw.SetDefaultVideoCodecToken();
}
else
{
var token = aw.AcquireVideoCodecToken(this);
if (token == null)
{
GlobalWin.OSD.AddMessage("A/V capture canceled.");
aw.Dispose();
return;
}
aw.SetVideoCodecToken(token);
}
// select file to save to
if (unattended)
{
aw.OpenFile(filename);
}
else
{
string ext = aw.DesiredExtension();
string pathForOpenFile;
//handle directories first
if (ext == "<directory>")
{
var fbd = new FolderBrowserEx();
if (fbd.ShowDialog() == DialogResult.Cancel)
{
aw.Dispose();
return;
}
pathForOpenFile = fbd.SelectedPath;
}
else
{
var sfd = new SaveFileDialog();
if (Global.Game != null)
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + "." + ext; //dont use Path.ChangeExtension, it might wreck game names with dots in them
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null);
}
else
{
sfd.FileName = "NULL";
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null);
}
sfd.Filter = string.Format("{0} (*.{0})|*.{0}|All Files|*.*", ext);
var result = sfd.ShowHawkDialog();
if (result == DialogResult.Cancel)
{
aw.Dispose();
return;
}
pathForOpenFile = sfd.FileName;
}
aw.OpenFile(pathForOpenFile);
}
// commit the avi writing last, in case there were any errors earlier
_currAviWriter = aw;
GlobalWin.OSD.AddMessage("A/V capture started");
AVIStatusLabel.Image = Properties.Resources.AVI;
AVIStatusLabel.ToolTipText = "A/V capture in progress";
AVIStatusLabel.Visible = true;
}
catch
{
GlobalWin.OSD.AddMessage("A/V capture failed!");
aw.Dispose();
throw;
}
if (_dumpaudiosync)
{
Global.Emulator.EndAsyncSound();
}
else
{
_aviSoundInput = !Global.Emulator.StartAsyncSound()
? new MetaspuAsync(Global.Emulator.SyncSoundProvider, ESynchMethod.ESynchMethod_V)
: Global.Emulator.SoundProvider;
}
_dumpProxy = new MetaspuSoundProvider(ESynchMethod.ESynchMethod_V);
RewireSound();
}