more warning cleanups including some bad configurations in client.common and pcedebugger projects

This commit is contained in:
adelikat 2013-10-27 18:01:36 +00:00
parent 9473f6840b
commit 79a9e7cdc4
6 changed files with 114 additions and 115 deletions

View File

@ -22,6 +22,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@ -31,6 +32,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib"> <Reference Include="ICSharpCode.SharpZipLib">

View File

@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@ -29,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />

View File

@ -628,13 +628,14 @@ namespace BizHawk.Emulation.Consoles.Calculator
public void Dispose() { } public void Dispose() { }
public Link LinkPort; public Link LinkPort;
public class Link public class Link
{ {
readonly TI83 Parent; readonly TI83 Parent;
private FileStream CurrentFile; private FileStream CurrentFile;
private int FileBytesLeft; //private int FileBytesLeft;
private byte[] VariableData; private byte[] VariableData;
private Action NextStep; private Action NextStep;
private Queue<byte> CurrentData = new Queue<byte>(); private Queue<byte> CurrentData = new Queue<byte>();
@ -789,93 +790,93 @@ namespace BizHawk.Emulation.Consoles.Calculator
} }
} }
public void SendFileToCalc(FileStream FS, bool Verify) public void SendFileToCalc(FileStream FS, bool Verify)
{ {
if (Verify) if (Verify)
VerifyFile(FS); VerifyFile(FS);
FS.Seek(55, SeekOrigin.Begin); FS.Seek(55, SeekOrigin.Begin);
CurrentFile = FS; CurrentFile = FS;
SendNextFile(); SendNextFile();
} }
private void VerifyFile(FileStream FS) private void VerifyFile(FileStream FS)
{ {
//Verify the file format. //Verify the file format.
byte[] Expected = new byte[] { 0x2a, 0x2a, 0x54, 0x49, 0x38, 0x33, 0x2a, 0x2a, 0x1a, 0x0a, 0x00 }; byte[] Expected = new byte[] { 0x2a, 0x2a, 0x54, 0x49, 0x38, 0x33, 0x2a, 0x2a, 0x1a, 0x0a, 0x00 };
byte[] Actual = new byte[11]; byte[] Actual = new byte[11];
FS.Seek(0, SeekOrigin.Begin); FS.Seek(0, SeekOrigin.Begin);
FS.Read(Actual, 0, 11); FS.Read(Actual, 0, 11);
//Check the header. //Check the header.
for (int n = 0; n < 11; n++) for (int n = 0; n < 11; n++)
if (Expected[n] != Actual[n]) if (Expected[n] != Actual[n])
{ {
FS.Close(); FS.Close();
throw new IOException("Invalid Header."); throw new IOException("Invalid Header.");
} }
//Seek to the end of the comment. //Seek to the end of the comment.
FS.Seek(53, SeekOrigin.Begin); FS.Seek(53, SeekOrigin.Begin);
int Size = FS.ReadByte() + FS.ReadByte() * 256; int Size = FS.ReadByte() + FS.ReadByte() * 256;
if (FS.Length != Size + 57) if (FS.Length != Size + 57)
{ {
FS.Close(); FS.Close();
throw new IOException("Invalid file length."); throw new IOException("Invalid file length.");
} }
//Verify the checksum. //Verify the checksum.
ushort Checksum = 0; ushort Checksum = 0;
for (int n = 0; n < Size; n++) for (int n = 0; n < Size; n++)
Checksum += (ushort)FS.ReadByte(); Checksum += (ushort)FS.ReadByte();
ushort ActualChecksum = (ushort)(FS.ReadByte() + FS.ReadByte() * 256); ushort ActualChecksum = (ushort)(FS.ReadByte() + FS.ReadByte() * 256);
if (Checksum != ActualChecksum) if (Checksum != ActualChecksum)
{ {
FS.Close(); FS.Close();
throw new IOException("Invalid Checksum."); throw new IOException("Invalid Checksum.");
} }
} }
private void SendNextFile() private void SendNextFile()
{ {
byte[] Header = new byte[13]; byte[] Header = new byte[13];
if (!CurrentFile.CanRead || CurrentFile.Read(Header, 0, 13) != 13) if (!CurrentFile.CanRead || CurrentFile.Read(Header, 0, 13) != 13)
{ {
//End of file. //End of file.
CurrentFile.Close(); CurrentFile.Close();
return; return;
} }
int Size = Header[2] + Header[3] * 256; int Size = Header[2] + Header[3] * 256;
VariableData = new byte[Size + 2]; VariableData = new byte[Size + 2];
CurrentFile.Read(VariableData, 0, Size + 2); CurrentFile.Read(VariableData, 0, Size + 2);
//Request to send the file. //Request to send the file.
CurrentData.Clear(); CurrentData.Clear();
CurrentData.Enqueue(0x03); CurrentData.Enqueue(0x03);
CurrentData.Enqueue(0xC9); CurrentData.Enqueue(0xC9);
foreach (byte B in Header) foreach (byte B in Header)
CurrentData.Enqueue(B); CurrentData.Enqueue(B);
//Calculate the checksum for the command. //Calculate the checksum for the command.
ushort Checksum = 0; ushort Checksum = 0;
for (int n = 2; n < Header.Length; n++) for (int n = 2; n < Header.Length; n++)
Checksum += Header[n]; Checksum += Header[n];
CurrentData.Enqueue((byte)(Checksum % 256)); CurrentData.Enqueue((byte)(Checksum % 256));
CurrentData.Enqueue((byte)(Checksum / 256)); CurrentData.Enqueue((byte)(Checksum / 256));
//Finalize the command. //Finalize the command.
CurrentStatus = Status.PrepareReceive; CurrentStatus = Status.PrepareReceive;
NextStep = ReceiveReqAck; NextStep = ReceiveReqAck;
Parent.LinkActive = true; Parent.LinkActive = true;
} }
private void ReceiveReqAck() private void ReceiveReqAck()
{ {
@ -912,13 +913,13 @@ namespace BizHawk.Emulation.Consoles.Calculator
CurrentData.Enqueue(0x15); CurrentData.Enqueue(0x15);
//Add variable data. //Add variable data.
foreach (byte B in VariableData) foreach (byte B in VariableData)
CurrentData.Enqueue(B); CurrentData.Enqueue(B);
//Calculate the checksum. //Calculate the checksum.
ushort Checksum = 0; ushort Checksum = 0;
for (int n = 2; n < VariableData.Length; n++) for (int n = 2; n < VariableData.Length; n++)
Checksum += VariableData[n]; Checksum += VariableData[n];
CurrentData.Enqueue((byte)(Checksum % 256)); CurrentData.Enqueue((byte)(Checksum % 256));
CurrentData.Enqueue((byte)(Checksum / 256)); CurrentData.Enqueue((byte)(Checksum / 256));
@ -957,7 +958,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
private void OutOfMemory() private void OutOfMemory()
{ {
CurrentFile.Close(); CurrentFile.Close();
Parent.LinkActive = false; Parent.LinkActive = false;
CurrentData.Clear(); CurrentData.Clear();
@ -982,13 +983,16 @@ namespace BizHawk.Emulation.Consoles.Calculator
Parent.LinkActive = true; Parent.LinkActive = true;
} }
//adelikat: This isn't used (yet?) and causes a warning. Did you really mean to override finalize? if so it should be protected virtual, else rename this
/*
private void Finalize() private void Finalize()
{ {
CurrentData.Clear(); CurrentData.Clear();
Parent.LinkActive = false; Parent.LinkActive = false;
NextStep = null; NextStep = null;
SendNextFile(); SendNextFile();
} }
*/
} }
} }
} }

View File

@ -11,7 +11,8 @@
<RootNamespace>BizHawk.PCE_Debugger</RootNamespace> <RootNamespace>BizHawk.PCE_Debugger</RootNamespace>
<AssemblyName>BizHawk.PCE_Debugger</AssemblyName> <AssemblyName>BizHawk.PCE_Debugger</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@ -65,7 +66,9 @@
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@ -1,17 +1,17 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.1008 // Runtime Version:4.0.30319.18052
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace BizHawk.PCE_Debugger.Properties namespace BizHawk.PCE_Debugger.Properties {
{ using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@ -22,48 +22,40 @@ namespace BizHawk.PCE_Debugger.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources internal class Resources {
{
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() internal Resources() {
{
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager internal static global::System.Resources.ResourceManager ResourceManager {
{ get {
get if (object.ReferenceEquals(resourceMan, null)) {
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BizHawk.PCE_Debugger.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BizHawk.PCE_Debugger.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture internal static global::System.Globalization.CultureInfo Culture {
{ get {
get
{
return resourceCulture; return resourceCulture;
} }
set set {
{
resourceCulture = value; resourceCulture = value;
} }
} }

View File

@ -1,28 +1,24 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.1008 // Runtime Version:4.0.30319.18052
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace BizHawk.PCE_Debugger.Properties namespace BizHawk.PCE_Debugger.Properties {
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default public static Settings Default {
{ get {
get
{
return defaultInstance; return defaultInstance;
} }
} }