From 1c0eca190e642d277a505573702a783855151526 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 3 Jul 2014 18:54:53 +0000 Subject: [PATCH] Remove some unused extensions, Remove Extensions.cs and move methods into better named files with their own namespaces --- BizHawk.Client.Common/SavestateManager.cs | 2 +- BizHawk.Common/BizHawk.Common.csproj | 2 +- .../{Extensions.cs => BufferExtensions.cs} | 22 +++++-------------- .../Extensions/ReflectionExtensions.cs | 2 ++ .../Consoles/Nintendo/GBA/Meteor.cs | 2 +- .../Consoles/Nintendo/Gameboy/GambatteLink.cs | 2 +- .../Consoles/Nintendo/N64/N64.cs | 2 +- .../Consoles/Nintendo/QuickNES/QuickNES.cs | 12 +++++----- .../Consoles/Nintendo/SNES/LibsnesCore.cs | 1 + .../Consoles/Sega/Genesis/GenVDP.cs | 1 + .../Consoles/Sega/Genesis/Genesis.cs | 3 ++- .../Consoles/Sega/Saturn/Yabause.cs | 1 + .../Consoles/Sega/gpgx/GPGX.cs | 2 +- 13 files changed, 25 insertions(+), 29 deletions(-) rename BizHawk.Common/Extensions/{Extensions.cs => BufferExtensions.cs} (86%) diff --git a/BizHawk.Client.Common/SavestateManager.cs b/BizHawk.Client.Common/SavestateManager.cs index 0aa59e931d..3effa11954 100644 --- a/BizHawk.Client.Common/SavestateManager.cs +++ b/BizHawk.Client.Common/SavestateManager.cs @@ -1,7 +1,7 @@ using System; using System.IO; -using BizHawk.Common; +using BizHawk.Common.BufferExtensions; using BizHawk.Common.IOExtensions; namespace BizHawk.Client.Common diff --git a/BizHawk.Common/BizHawk.Common.csproj b/BizHawk.Common/BizHawk.Common.csproj index 3d69abe9c5..03b91869d0 100644 --- a/BizHawk.Common/BizHawk.Common.csproj +++ b/BizHawk.Common/BizHawk.Common.csproj @@ -52,8 +52,8 @@ + - diff --git a/BizHawk.Common/Extensions/Extensions.cs b/BizHawk.Common/Extensions/BufferExtensions.cs similarity index 86% rename from BizHawk.Common/Extensions/Extensions.cs rename to BizHawk.Common/Extensions/BufferExtensions.cs index 5c99177510..fe91cf9580 100644 --- a/BizHawk.Common/Extensions/Extensions.cs +++ b/BizHawk.Common/Extensions/BufferExtensions.cs @@ -1,23 +1,11 @@ -using System; -using System.Linq; -using System.Reflection; -using System.Collections.Generic; +using System; using System.Globalization; using System.IO; -namespace BizHawk.Common +namespace BizHawk.Common.BufferExtensions { - public static class Extensions + public static class BufferExtensions { - public static string GetDirectory(this Assembly asm) - { - var codeBase = asm.CodeBase; - var uri = new UriBuilder(codeBase); - var path = Uri.UnescapeDataString(uri.Path); - - return Path.GetDirectoryName(path); - } - public static void SaveAsHex(this byte[] buffer, TextWriter writer) { foreach (var b in buffer) @@ -90,7 +78,7 @@ namespace BizHawk.Common public static void ReadFromHex(this byte[] buffer, string hex) { - if (hex.Length%2 != 0) + if (hex.Length % 2 != 0) { throw new Exception("Hex value string does not appear to be properly formatted."); } @@ -186,4 +174,4 @@ namespace BizHawk.Common #endregion } -} \ No newline at end of file +} diff --git a/BizHawk.Common/Extensions/ReflectionExtensions.cs b/BizHawk.Common/Extensions/ReflectionExtensions.cs index 1c131b8c99..6b7c1878c3 100644 --- a/BizHawk.Common/Extensions/ReflectionExtensions.cs +++ b/BizHawk.Common/Extensions/ReflectionExtensions.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.IO; +using System.Reflection; namespace BizHawk.Common.ReflectionExtensions { diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs index eb055c0394..f1b2f5153d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using System.IO; -using BizHawk.Common; +using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Nintendo.GBA diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs index 52fff008bd..bf7f903a8b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using BizHawk.Common; +using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Nintendo.SNES; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs index cc6f4ba797..9bcafeb0c9 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs @@ -5,7 +5,7 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; -using BizHawk.Common; +using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Nintendo.N64.NativeApi; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs index 5c3de24dd3..4358073023 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs @@ -1,13 +1,15 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using BizHawk.Emulation.Common; -using System.Runtime.InteropServices; -using BizHawk.Common; using System.ComponentModel; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + using Newtonsoft.Json; +using BizHawk.Common.BufferExtensions; +using BizHawk.Emulation.Common; + namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES { [CoreAttributes( diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index 31f9d6b684..59d4fadec7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using BizHawk.Common; +using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Nintendo.SNES diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/GenVDP.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/GenVDP.cs index ced718ebc0..bfe751b6ea 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/GenVDP.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/GenVDP.cs @@ -3,6 +3,7 @@ using System.IO; using System.Globalization; using BizHawk.Common; +using BizHawk.Common.BufferExtensions; using BizHawk.Common.IOExtensions; using BizHawk.Emulation.Common; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs index 0eff5350d6..4d0cb37cae 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs @@ -5,7 +5,8 @@ using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; -using BizHawk.Common; +using BizHawk.Common.BufferExtensions; + using BizHawk.Emulation.Common; using BizHawk.Emulation.Common.Components; using BizHawk.Emulation.Cores.Components.M68000; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs index 4d540f1129..1691184640 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs @@ -7,6 +7,7 @@ using System.IO; using System.ComponentModel; using BizHawk.Common; +using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.DiscSystem; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs index 5f3b4df268..19ab929ddd 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using BizHawk.Common; +using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; using System.Runtime.InteropServices;