Skip to content

Commit

Permalink
fixing finalize
Browse files Browse the repository at this point in the history
change finalize to destructor
  • Loading branch information
Welly committed Jan 2, 2013
1 parent 5824797 commit 780e63c
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 51 deletions.
23 changes: 14 additions & 9 deletions GSMCommServer/GSMCommServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Runtime.Remoting" />
<Reference Include="GSMCommShared">
<HintPath>.\GSMCommServerReferences\GSMCommShared.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="GSMCommunication">
<HintPath>.\GSMCommServerReferences\GSMCommunication.dll</HintPath>
</Reference>
<Reference Include="PDUConverter">
<HintPath>.\GSMCommServerReferences\PDUConverter.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
Expand Down Expand Up @@ -78,5 +69,19 @@
<DesignTimeSharedInput>false</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GSMCommShared\GSMCommShared.csproj">
<Project>{71ea4054-a98a-46ba-84fa-81652db72b72}</Project>
<Name>GSMCommShared</Name>
</ProjectReference>
<ProjectReference Include="..\GSMCommunication\GSMCommunication.csproj">
<Project>{32b76f1e-b022-47c6-86ec-28639d348067}</Project>
<Name>GSMCommunication</Name>
</ProjectReference>
<ProjectReference Include="..\PDUConverter\PDUConverter.csproj">
<Project>{5e657efe-0a30-466d-b025-ff177e23a727}</Project>
<Name>PDUConverter</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
40 changes: 26 additions & 14 deletions GSMCommServer/Server/SmsServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,32 @@ public void Dispose()
this.StopInternal();
}

/// <summary>
/// Finalizes the class.
/// </summary>
protected override void Finalize()
{
try
{
this.Dispose();
}
finally
{
this.Finalize();
}
}
~SmsServer()
{
try
{
this.Dispose();
}
finally
{
//this.Finalize();
}
}

///// <summary>
///// Finalizes the class.
///// </summary>
//protected override void Finalize()
//{
// try
// {
// this.Dispose();
// }
// finally
// {
// this.Finalize();
// }
//}

/// <summary>
/// Tells if the remoting server is currently running.
Expand Down
21 changes: 13 additions & 8 deletions GSMCommunication/GSMCommunication.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{32b76f1e-b022-47c6-86ec-28639d348067}</ProjectGuid>
<ProjectGuid>{32B76F1E-B022-47C6-86EC-28639D348067}</ProjectGuid>
<SchemaVersion>2</SchemaVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -19,6 +19,7 @@
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
Expand All @@ -31,13 +32,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="PDUConverter">
<HintPath>.\GSMCommunicationReferences\PDUConverter.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="GSMCommShared">
<HintPath>.\GSMCommunicationReferences\GSMCommShared.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -246,5 +241,15 @@
<DesignTimeSharedInput>false</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GSMCommShared\GSMCommShared.csproj">
<Project>{71ea4054-a98a-46ba-84fa-81652db72b72}</Project>
<Name>GSMCommShared</Name>
</ProjectReference>
<ProjectReference Include="..\PDUConverter\PDUConverter.csproj">
<Project>{5e657efe-0a30-466d-b025-ff177e23a727}</Project>
<Name>PDUConverter</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion GSMCommunication/GsmCommunication/GsmCommMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public void DeleteMessage(int index, string storage)
/// </remarks>
public void DeleteMessages(DeleteScope scope, string storage)
{
int num = scope;
int num = (int)scope;
DeleteFlag deleteFlag = (DeleteFlag)Enum.Parse(typeof(DeleteFlag), num.ToString());
string[] str = new string[5];
str[0] = "Deleting \"";
Expand Down
25 changes: 13 additions & 12 deletions GSMCommunication/GsmCommunication/GsmPhone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ public void DeleteMessage(int index, DeleteFlag delflag)
str[3] = delflag.ToString();
str[4] = "...";
this.LogIt(LogLevel.Info, string.Concat(str));
int num = delflag;
int num = (int)delflag;
string str1 = string.Concat("AT+CMGD=", index.ToString(), ",", num.ToString());
this.ExecAndReceiveMultiple(str1);
}
Expand Down Expand Up @@ -1031,7 +1031,7 @@ private int GetMessageServiceErrorCode(string input)
/// <returns>A <see cref="T:GsmComm.GsmCommunication.MessageStorageInfo" /> object that contains details about the supported storages.</returns>
public MessageStorageInfo GetMessageStorages()
{
MessageStorageInfo messageStorageInfo;
MessageStorageInfo messageStorageInfo = new MessageStorageInfo { };
lock (this)
{
this.VerifyValidConnection();
Expand Down Expand Up @@ -1196,9 +1196,9 @@ public MemoryStatusWithStorage GetPhonebookMemoryStatus()
/// <param name="upperBound">Receives the upper bound of the phonebook</param>
/// <param name="nLength">Receives the maximum number length, 0 if unknown</param>
/// <param name="tLength">Receives the maximum text length, 0 if unknown</param>
public void GetPhonebookSize(out int lowerBound, out int upperBound, out int nLength, out int tLength)
unsafe public void GetPhonebookSize(out int lowerBound, out int upperBound, out int nLength, out int tLength)
{
int num;
//int num;
int num1;
lock (this)
{
Expand All @@ -1213,26 +1213,27 @@ public void GetPhonebookSize(out int lowerBound, out int upperBound, out int nLe
}
lowerBound = int.Parse(match.Groups[1].Value);
upperBound = int.Parse(match.Groups[2].Value);
int& numPointer = nLength;
//int* numPointer = &nLength;
if (match.Groups[3].Value != "")
{
num = int.Parse(match.Groups[3].Value);
nLength = int.Parse(match.Groups[3].Value);
}
else
{
num = 0;
nLength = 0;
}
*(numPointer) = num;
int& numPointer1 = tLength;
//*(numPointer) = num;

//int* numPointer1 = &tLength;
if (match.Groups[4].Value != "")
{
num1 = int.Parse(match.Groups[4].Value);
tLength = int.Parse(match.Groups[4].Value);
}
else
{
num1 = 0;
tLength = 0;
}
*(numPointer1) = num1;
//*(numPointer1) = num1;
string[] strArrays = new string[8];
strArrays[0] = "lowerBound=";
strArrays[1] = lowerBound.ToString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private bool IsCompleteDeliverPduModeIndication(string input)
Match match = regex.Match(input);
if (match.Success)
{
match.Groups[1].Value;
//match.Groups[1].Value;
int num = int.Parse(match.Groups[2].Value);
string value = match.Groups[3].Value;
if (BcdWorker.CountBytes(value) <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ public MessageIndicationSettings(int mode, int mt, int bm, int ds, int bfr)
/// <param name="ds">Specifies how new SMS-STATUS-REPORT messages should be indicated.</param>
/// <param name="bfr">Specifies how the indication buffer should be handled when indications are activated, i.e.
/// when <see cref="P:GsmComm.GsmCommunication.MessageIndicationSettings.Mode" /> is set to any value except <see cref="F:GsmComm.GsmCommunication.MessageIndicationMode.DoNotForward" />.</param>
public MessageIndicationSettings(MessageIndicationMode mode, SmsDeliverIndicationStyle mt, CbmIndicationStyle bm, SmsStatusReportIndicationStyle ds, IndicationBufferSetting bfr) : this(mode, mt, bm, ds, bfr)
public MessageIndicationSettings(MessageIndicationMode mode, SmsDeliverIndicationStyle mt, CbmIndicationStyle bm, SmsStatusReportIndicationStyle ds, IndicationBufferSetting bfr)
: this((int)mode, (int)mt, (int)bm, (int)ds, (int)bfr)
{
}
}
Expand Down
2 changes: 1 addition & 1 deletion GSMCommunication/GsmCommunication/SerialPortFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void InitializeDcb()
{
SerialPortFixer.Dcb flags = new SerialPortFixer.Dcb();
this.GetCommStateNative(ref flags);
flags.Flags = flags.Flags & -16385;
flags.Flags = (uint)(flags.Flags & -16385);
this.SetCommStateNative(ref flags);
}

Expand Down
6 changes: 4 additions & 2 deletions PDUConverter/GsmComm.PduConverter/PduParts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public static string DecodeText(byte[] userData, byte dataCodingScheme)
}
case 1:
{
Label0:
//Label0:
str = PduParts.Decode7BitText(userData);
break;
}
Expand All @@ -155,7 +155,9 @@ public static string DecodeText(byte[] userData, byte dataCodingScheme)
}
default:
{
goto Label0;
//goto Label0;
str = PduParts.Decode7BitText(userData);
break;
}
}
return str;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Drawing;
using System.Text;

/// <summary>
Expand All @@ -23,7 +24,7 @@ public class SmartMessageFactory
static SmartMessageFactory()
{
SmartMessageFactory.refNumber = 1;
SmartMessageFactory.EmptyOperatorLogo = SmartMessageFactory.CreateOperatorLogo(new OtaBitmap(null), "000", "00");
SmartMessageFactory.EmptyOperatorLogo = SmartMessageFactory.CreateOperatorLogo(new OtaBitmap((Bitmap)null), "000", "00");
}

public SmartMessageFactory()
Expand Down
2 changes: 1 addition & 1 deletion PDUConverter/GsmComm.PduConverter/SmsTimestamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public SmsTimestamp(DateTime timestamp, int timeZoneOffset)
/// <exception cref="T:System.ArgumentException">value is not an <see cref="T:GsmComm.PduConverter.SmsTimestamp" />.</exception>
public int CompareTo(object value)
{
if (value as SmsTimestamp == null)
if (!(value is SmsTimestamp))
{
if (value != null)
{
Expand Down

0 comments on commit 780e63c

Please sign in to comment.