Skip to content

Commit a809515

Browse files
committed
Command line Huwaei CDR converter
This is a C# command line script to convert HUWAEI CDRs into human readable text files.
0 parents  commit a809515

24 files changed

+4460
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{11995BA6-1582-4ACB-A92F-F845E1A0050D}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{11995BA6-1582-4ACB-A92F-F845E1A0050D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{11995BA6-1582-4ACB-A92F-F845E1A0050D}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{11995BA6-1582-4ACB-A92F-F845E1A0050D}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{11995BA6-1582-4ACB-A92F-F845E1A0050D}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal
56.5 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{11995BA6-1582-4ACB-A92F-F845E1A0050D}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>ConsoleApplication1</RootNamespace>
11+
<AssemblyName>ConsoleApplication1</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="Microsoft.VisualBasic" />
36+
<Reference Include="Microsoft.VisualBasic.Compatibility" />
37+
<Reference Include="Microsoft.VisualBasic.Compatibility.Data" />
38+
<Reference Include="System" />
39+
<Reference Include="System.Core" />
40+
<Reference Include="System.Xml.Linq" />
41+
<Reference Include="System.Data.DataSetExtensions" />
42+
<Reference Include="Microsoft.CSharp" />
43+
<Reference Include="System.Data" />
44+
<Reference Include="System.Xml" />
45+
</ItemGroup>
46+
<ItemGroup>
47+
<Compile Include="DescodificaCDRS\DecCDRs.cs" />
48+
<Compile Include="Program.cs" />
49+
<Compile Include="Properties\AssemblyInfo.cs" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<None Include="App.config" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<Folder Include="DescodificaCDRS\My\Resources\" />
56+
</ItemGroup>
57+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
59+
Other similar extension points exist, see Microsoft.Common.targets.
60+
<Target Name="BeforeBuild">
61+
</Target>
62+
<Target Name="AfterBuild">
63+
</Target>
64+
-->
65+
</Project>
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
namespace DescodificaCDRs
2+
{
3+
4+
using Microsoft.VisualBasic;
5+
using System;
6+
using System.Globalization;
7+
using Microsoft.VisualBasic.CompilerServices;
8+
9+
10+
public class DecCDRs
11+
{
12+
13+
private int ind;
14+
private byte[] mregisto;
15+
16+
public string decIntg(short Inicio, short Tamanho, string Tipo)
17+
{
18+
19+
20+
byte[] mbocado = null;
21+
string str = null;
22+
if (Tamanho > 1)
23+
{
24+
Array.Resize<byte>(ref mbocado, Tamanho);
25+
}
26+
else
27+
{
28+
Array.Resize<byte>(ref mbocado, 1);
29+
}
30+
int VBt_i4L0 = Tamanho - 1;
31+
this.ind = 0;
32+
while (this.ind <= VBt_i4L0)
33+
{
34+
mbocado[this.ind] = this.mregisto[Inicio + this.ind];
35+
this.ind++;
36+
}
37+
switch (Tipo)
38+
{
39+
case "L":
40+
{
41+
Array.Reverse(mbocado);
42+
str = "&H";
43+
int VBt_i4L1 = Tamanho - 1;
44+
this.ind = 0;
45+
while (this.ind <= VBt_i4L1)
46+
{
47+
str = str + Conversion.Hex(mbocado[this.ind]);
48+
this.ind++;
49+
}
50+
string nowd = Conversions.ToLong(str).ToString();//Josue
51+
// showupl(nowd);//Josue Here we get the CDR_CSN,CDR_LENGTH and CDR_NET_TYPE
52+
//After the T CDR_CONVERSATION,CDR CALLER AD
53+
return nowd;//Josue
54+
// return Conversions.ToLong(str).ToString();
55+
}
56+
case "T":
57+
{
58+
str = "20";
59+
int VBt_i4L2 = Tamanho - 1;
60+
this.ind = 0;
61+
while (this.ind <= VBt_i4L2)
62+
{
63+
str = str + mbocado[this.ind].ToString().PadLeft(2, '0');
64+
this.ind++;
65+
}
66+
// showupt(str);//Josue CDR_ANS_TYP,CDR_END_TYP
67+
return str;
68+
}
69+
case "D":
70+
{
71+
str = "";
72+
int VBt_i4L3 = Tamanho - 1;
73+
this.ind = 0;
74+
while (this.ind <= VBt_i4L3)
75+
{
76+
str = str + Conversion.Hex(mbocado[this.ind]).ToString().PadLeft(2, '0');
77+
this.ind++;
78+
}
79+
string now = str.Replace('F', ' ').Trim();//Josue
80+
81+
// showupd(now);//Josue CDR_TYPE_BILL. AFTER L CDR CALLED_AD
82+
return now;//Josue
83+
// return str.Replace('F', ' ').Trim();
84+
}
85+
case "S":
86+
{
87+
str = "";
88+
int VBt_i4L4 = Tamanho - 1;
89+
this.ind = 0;
90+
while (this.ind <= VBt_i4L4)
91+
{
92+
str = str + Conversion.Hex(mbocado[this.ind]).ToString().PadLeft(2, '0');
93+
this.ind++;
94+
}
95+
// showups(str);//Josue Stuff
96+
return str;
97+
}
98+
}
99+
return "";
100+
}
101+
102+
public byte[] Registo
103+
{
104+
set
105+
{
106+
107+
this.mregisto = value;
108+
109+
110+
}
111+
}
112+
113+
114+
//Josue Stuff
115+
public void showups(string r)
116+
{
117+
// for (int i = 0; i < r.Length; i++)
118+
// {
119+
// string result = ToString(" "+r[i]);
120+
Console.WriteLine("i am Here D this is the string --> " + r);
121+
// }
122+
}
123+
124+
public void showupd(string r)
125+
{
126+
// for (int i = 0; i < r.Length; i++)
127+
// {
128+
// string result = ToString(" "+r[i]);
129+
Console.WriteLine("i am Here D this is the string --> " + r);
130+
// }
131+
}
132+
133+
public void showupt(string r)
134+
{
135+
// for (int i = 0; i < r.Length; i++)
136+
// {
137+
// string result = ToString(" "+r[i]);
138+
Console.WriteLine("i am Here T this is the string --> " + r);
139+
// }
140+
}
141+
142+
public void showupl(string r)
143+
{
144+
// for (int i = 0; i < r.Length; i++)
145+
// {
146+
// string result = ToString(" "+r[i]);
147+
Console.WriteLine("i am Here L this is the string --> " + r);
148+
// }
149+
}
150+
}
151+
}
152+

0 commit comments

Comments
 (0)