Esempio n. 1
0
        static void carregarRegisto(string ficheiro)
        {
            //        Console.Write("I am here Car in method 1 \n ");
            string txtfile = getfile(new_file);

            byte[] array = null;
            //   bool flag = false;
            DecCDRs    rs          = new DecCDRs();
            FileStream input       = null;
            Collection collection3 = new Collection();
            Collection collection  = new Collection();
            Collection collection2 = new Collection();

            Array.Resize <byte>(ref array, 0x22a);
            string path = ficheiro;

            // Console.Write("this is the  Path -->"+path);
            input = File.OpenRead(path);
            // Console.Write("1 -->");
            BinaryReader reader = new BinaryReader(input);
            //Console.Write("2 -->");
            long length = input.Length;

            if ((length % 0x22aL) != 0L)
            {
                Console.Write("3 -->");
            }
            MemoryStream stream2 = new MemoryStream(reader.ReadBytes(Convert.ToInt32(length)));
            int          num5    = Convert.ToInt32((double)(((double)length) / 554.0));
            int          num6    = num5;

            for (int i = 1; i <= num6; i++)
            {
                REG_Detail detail = new REG_Detail();
                stream2.Read(array, 0, 0x22a);
                Array.Resize <byte>(ref array, 0x22a);
                rs.Registo = array;
                REG_Detail detail2 = detail;
                detail2.Csn                   = Conversions.ToLong(rs.decIntg(0, 4, "L"));
                detail2.Length                = Conversions.ToShort(rs.decIntg(4, 2, "L"));
                detail2.Net_Type              = Conversions.ToShort(rs.decIntg(6, 1, "L"));
                detail2.Bill_Type             = rs.decIntg(7, 1, "S");
                detail2.Ans_Time              = rs.decIntg(11, 6, "T");
                detail2.End_Time              = rs.decIntg(0x11, 6, "T");
                detail2.Conversation_Time     = Conversions.ToDouble(rs.decIntg(0x17, 4, "L"));
                detail2.Caller_Address_Nature = Conversions.ToShort(rs.decIntg(0x1d, 1, "L"));
                detail2.Caller_Number         = rs.decIntg(30, 10, "D");
                detail2.Called_Address_Nature = Conversions.ToShort(rs.decIntg(0x2a, 1, "L"));
                detail2.Called_Number         = rs.decIntg(0x2b, 10, "D");
                detail2.Tunk_Group_In         = Conversions.ToLong(rs.decIntg(0x41, 2, "L"));
                detail2.Tunk_Group_Out        = Conversions.ToLong(rs.decIntg(0x43, 2, "L"));
                detail2.Termination_Cod       = Conversions.ToInteger(rs.decIntg(0x4a, 1, "L"));
                detail2.Dial_Number           = rs.decIntg(0x7d, 0x10, "D");
                string now = "CDR_CSN=" + detail2.Csn.ToString() + " " + "CDR_LENGHT=" + detail2.Length.ToString()
                             + " " + "CDR_NET_TYPE=" + detail2.Net_Type.ToString() + " " + "CDR_BILL_TYPE=" + detail2.Bill_Type.ToString()
                             + " " + "CDR_ANS_TIME=" + detail2.Ans_Time.ToString() + " " + "CDR_END_TIME=" + detail2.End_Time.ToString()
                             + " " + "CDR_CONVERSATION_TYPE=" + detail2.Conversation_Time.ToString() + " " + "CDR_CALLER_AD=" +
                             detail2.Caller_Address_Nature.ToString() + " " + "CDR_CALLER_NUMBER=" + detail2.Caller_Number.ToString() + " "
                             + "CDR_CALLER_ADDRESS_NATURE=" + detail2.Called_Address_Nature.ToString() + " "
                             + "CDR_CALLER_NUMBER=" + detail2.Called_Number.ToString() +
                             " " + "CDR_TRUNK_GROUP_IN=" + detail2.Tunk_Group_In.ToString() + " " + "CDR_TRUNK_GROUP_OUT="
                             + detail2.Tunk_Group_Out.ToString() + " " + "CDR_TERMINATION_COD=" + detail2.Termination_Cod.ToString()
                             + " " + "DIAL_NUMBER=" +
                             detail2.Dial_Number.ToString();
                //     Console.Write("We Writing");
                WriteFile(now, new_file);

                //   detail2 = null;
            }
        }
Esempio n. 2
0
        static void carregarRegisto(string ficheiro)
        {
            //        Console.Write("I am here Car in method 1 \n ");
            string txtfile = getfile(new_file);
            byte[] array = null;
             //   bool flag = false;
            DecCDRs rs = new DecCDRs();
            FileStream input = null;
            Collection collection3 = new Collection();
            Collection collection = new Collection();
            Collection collection2 = new Collection();
            Array.Resize<byte>(ref array, 0x22a);
            string path = ficheiro;
               // Console.Write("this is the  Path -->"+path);
            input = File.OpenRead(path);
               // Console.Write("1 -->");
            BinaryReader reader = new BinaryReader(input);
            //Console.Write("2 -->");
            long length = input.Length;
            if ((length % 0x22aL) != 0L)
            {
                Console.Write("3 -->");
            }
            MemoryStream stream2 = new MemoryStream(reader.ReadBytes(Convert.ToInt32(length)));
            int num5 = Convert.ToInt32((double)(((double)length) / 554.0));
            int num6 = num5;
            for (int i = 1; i <= num6; i++)
            {
                REG_Detail detail = new REG_Detail();
                stream2.Read(array, 0, 0x22a);
                Array.Resize<byte>(ref array, 0x22a);
                rs.Registo = array;
                REG_Detail detail2 = detail;
                detail2.Csn = Conversions.ToLong(rs.decIntg(0, 4, "L"));
                detail2.Length = Conversions.ToShort(rs.decIntg(4, 2, "L"));
                detail2.Net_Type = Conversions.ToShort(rs.decIntg(6, 1, "L"));
                detail2.Bill_Type = rs.decIntg(7, 1, "S");
                detail2.Ans_Time = rs.decIntg(11, 6, "T");
                detail2.End_Time = rs.decIntg(0x11, 6, "T");
                detail2.Conversation_Time = Conversions.ToDouble(rs.decIntg(0x17, 4, "L"));
                detail2.Caller_Address_Nature = Conversions.ToShort(rs.decIntg(0x1d, 1, "L"));
                detail2.Caller_Number = rs.decIntg(30, 10, "D");
                detail2.Called_Address_Nature = Conversions.ToShort(rs.decIntg(0x2a, 1, "L"));
                detail2.Called_Number = rs.decIntg(0x2b, 10, "D");
                detail2.Tunk_Group_In = Conversions.ToLong(rs.decIntg(0x41, 2, "L"));
                detail2.Tunk_Group_Out = Conversions.ToLong(rs.decIntg(0x43, 2, "L"));
                detail2.Termination_Cod = Conversions.ToInteger(rs.decIntg(0x4a, 1, "L"));
                detail2.Dial_Number = rs.decIntg(0x7d, 0x10, "D");
                string now = "CDR_CSN=" + detail2.Csn.ToString() + " " + "CDR_LENGHT=" + detail2.Length.ToString()
                    +" "+ "CDR_NET_TYPE=" +detail2.Net_Type.ToString() + " " + "CDR_BILL_TYPE=" + detail2.Bill_Type.ToString()
                    + " " + "CDR_ANS_TIME=" + detail2.Ans_Time.ToString() + " " + "CDR_END_TIME=" + detail2.End_Time.ToString()
                    + " " + "CDR_CONVERSATION_TYPE=" + detail2.Conversation_Time.ToString() + " " + "CDR_CALLER_AD=" +
                    detail2.Caller_Address_Nature.ToString() + " " + "CDR_CALLER_NUMBER=" + detail2.Caller_Number.ToString()+" "
                    + "CDR_CALLER_ADDRESS_NATURE=" + detail2.Called_Address_Nature.ToString() + " "
                    + "CDR_CALLER_NUMBER=" + detail2.Called_Number.ToString() +
                    " " + "CDR_TRUNK_GROUP_IN=" + detail2.Tunk_Group_In.ToString() + " " + "CDR_TRUNK_GROUP_OUT="
                    + detail2.Tunk_Group_Out.ToString() + " " + "CDR_TERMINATION_COD=" + detail2.Termination_Cod.ToString()
                    + " " + "DIAL_NUMBER=" +
                    detail2.Dial_Number.ToString();
               //     Console.Write("We Writing");
                WriteFile(now, new_file);

             //   detail2 = null;
            }
        }