remove some unused code, and a few other misc cleanups

This commit is contained in:
adelikat 2019-12-06 19:22:23 -06:00
parent 4e7d19fa18
commit 70840c1b54
6 changed files with 12 additions and 82 deletions

View File

@ -2,11 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
class ArgParser
public class ArgParser
//parses command line arguments and adds the values to a class attribute
//default values are null for strings and false for boolean
//the last value will overwrite previously set values
@ -161,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
}
}
//inititalize socket server
// initialize socket server
if (socket_ip != null && socket_port > 0)
{
GlobalWin.socketServer = new Communication.SocketServer();
@ -185,13 +184,8 @@ namespace BizHawk.Client.EmuHawk
return args.FirstOrDefault(arg => arg.StartsWith("--config=", StringComparison.InvariantCultureIgnoreCase))?.Substring(9);
}
}
class ArgParserException : Exception
public class ArgParserException : Exception
{
public ArgParserException()
{
}
public ArgParserException(string message) : base(message)
{
}

View File

@ -1,52 +1,14 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace BizHawk.Client.EmuHawk
{
public unsafe static class Win32
public static unsafe class Win32
{
public static bool Is64BitProcess { get { return (IntPtr.Size == 8); } }
public static bool Is64BitOperatingSystem { get { return Is64BitProcess || InternalCheckIsWow64(); } }
[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWow64Process(
[In] IntPtr hProcess,
[Out] out bool wow64Process
);
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll")]
public static extern bool FreeLibrary(IntPtr hModule);
static bool InternalCheckIsWow64()
{
if ((Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1) ||
Environment.OSVersion.Version.Major >= 6)
{
using (var p = System.Diagnostics.Process.GetCurrentProcess())
{
bool retVal;
if (!IsWow64Process(p.Handle, out retVal))
{
return false;
}
return retVal;
}
}
else
{
return false;
}
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct RECT
@ -238,7 +200,6 @@ namespace BizHawk.Client.EmuHawk
public const int WAVE_FORMAT_PCM = 1;
public const int AVIIF_KEYFRAME = 0x00000010;
[Flags]
public enum OpenFileStyle : uint
{
@ -434,13 +395,11 @@ namespace BizHawk.Client.EmuHawk
// Release an open AVI stream
[DllImport("avifil32.dll")]
public static extern int AVIStreamRelease(
IntPtr pavi);
public static extern int AVIStreamRelease(IntPtr pavi);
// Release an open AVI stream
[DllImport("avifil32.dll")]
public static extern int AVIFileRelease(
IntPtr pfile);
public static extern int AVIFileRelease(IntPtr pfile);
// Replacement of mmioFOURCC macros

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
@ -16,25 +10,13 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
}
public BmpView BmpView { get { return bmpView1; } }
[Browsable(false)]
public bool ShouldDraw { get { return this.Visible; } }
public BmpView BmpView => bmpView1;
public override string ToString()
{
return Text;
}
public void SetDetails(IList<Tuple<string, string>> details)
{
listView1.Items.Clear();
foreach (var t in details)
{
listView1.Items.Add(new ListViewItem(new string[] { t.Item1, t.Item2 }));
}
}
private void MobileDetailView_SizeChanged(object sender, EventArgs e)
{
// bmp view is always square

View File

@ -26,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist]
private List<RollColumn> Columns
{
get { return TraceView.AllColumns; }
get => TraceView.AllColumns;
set
{
TraceView.AllColumns.Clear();
@ -42,7 +42,7 @@ namespace BizHawk.Client.EmuHawk
private FileInfo _logFile;
private FileInfo LogFile
{
get { return _logFile; }
get => _logFile;
set
{
_logFile = value;
@ -94,10 +94,7 @@ namespace BizHawk.Client.EmuHawk
});
}
public bool UpdateBefore
{
get { return false; }
}
public bool UpdateBefore => false;
public bool AskSaveChanges()
{

View File

@ -10,7 +10,6 @@ namespace BizHawk.Client.EmuHawk
public partial class VirtualPadTargetScreen : UserControl, IVirtualPadControl
{
private readonly Pen BlackPen = new Pen(Brushes.Black, 2);
private readonly Pen WhitePen = new Pen(Brushes.White, 2);
private readonly Pen GrayPen = new Pen(Brushes.Gray, 2);
private readonly Pen RedPen = new Pen(Brushes.Red, 2);
@ -19,8 +18,8 @@ namespace BizHawk.Client.EmuHawk
private bool _readonly;
private bool _isSet; // The tool has to keep track of this because there is currently no way to know if a float button is being autoheld or just held
private int? _overrideX = null;
private int? _overrideY = null;
private int? _overrideX;
private int? _overrideY;
public VirtualPadTargetScreen()
{

View File

@ -10,7 +10,6 @@ namespace BizHawk.Client.EmuHawk
[Schema("INTV")]
public class IntvSchema : IVirtualPadSchema
{
private string UnpluggedControllerName => typeof(UnpluggedController).DisplayName();
private string StandardControllerName => typeof(StandardController).DisplayName();
private string AnalogControllerName => typeof(FakeAnalogController).DisplayName();