public static string[] ExtractArrayTimeFromArray(ushort[] ParamRTU, TimeFormats TimeF)
        {
            if (TimeF == TimeFormats.STMFormat)
            {
                string[] strs = new string[6];
                if (ParamRTU.Length != 4)
                {
                    throw new Exception("Invalid data!");
                }

                strs[0] = (ParamRTU[3] & 0x00FF).ToString("X2");
                strs[1] = ((ParamRTU[2] >> 8) & 0x00FF).ToString("X2");
                strs[2] = (ParamRTU[2] & 0x00FF).ToString("X2");
                strs[3] = (ParamRTU[0] & 0x003F).ToString("X2");
                strs[4] = ((ParamRTU[0] >> 8) & 0x001F).ToString("X2");
                strs[5] = "20" + (ParamRTU[1] & 0x00FF).ToString("X2");
                return(strs);
            }
            else if (TimeF == TimeFormats.ADSPFormat)
            {
                string[] strs = new string[6];
                if (ParamRTU.Length != 7)
                {
                    throw new Exception("Invalid data!");
                }

                string str = "";
                str = str + (ParamRTU[2] & 0x00FF).ToString("X2") + ":";
                str = str + (ParamRTU[1] & 0x00FF).ToString("X2") + ":" + (ParamRTU[0] & 0x00FF).ToString("X2") + " ";

                str = str + (ParamRTU[4] & 0x00FF).ToString("X2") + "/" + (ParamRTU[5] & 0x001F).ToString("X2") + "/";
                str = str + "20" + (ParamRTU[6] & 0x00FF).ToString("X2");

                strs[0] = (ParamRTU[2] & 0x00FF).ToString("X2");
                strs[1] = (ParamRTU[1] & 0x00FF).ToString("X2");
                strs[2] = (ParamRTU[0] & 0x00FF).ToString("X2");
                strs[3] = (ParamRTU[4] & 0x00FF).ToString("X2");
                strs[4] = (ParamRTU[5] & 0x001F).ToString("X2");
                strs[5] = "20" + (ParamRTU[6] & 0x00FF).ToString("X2");
                return(strs);
            }
            else if (TimeF == TimeFormats.RTCFormat)
            {
                string[] strs = new string[6];
                if (ParamRTU.Length != 4)
                {
                    throw new Exception("Invalid data!");
                }

                strs[0] = ConvertFuncs.FromBCD((ushort)(ParamRTU[3] & 0x003F)).ToString("D2");
                strs[1] = ConvertFuncs.FromBCD((ushort)((ParamRTU[2] & 0xFF00) >> 8)).ToString("D2");
                strs[2] = ConvertFuncs.FromBCD((ushort)(ParamRTU[2] & 0x00FF)).ToString("D2");
                strs[3] = ConvertFuncs.FromBCD((ushort)(ParamRTU[0] & 0x003F)).ToString("D2");
                strs[4] = ConvertFuncs.FromBCD((ushort)((ParamRTU[0] & 0x1F00) >> 8)).ToString("D2");
                strs[5] = "20" + ConvertFuncs.FromBCD((ushort)(ParamRTU[1] & 0x00FF)).ToString("D2");

                return(strs);
            }
            return(null);
        }
        public static string ExtractTimeFromArray(ushort[] ParamRTU, TimeFormats TimeF, int Index = 0)
        {
            if (TimeF == TimeFormats.STMFormat)
            {
                if (ParamRTU.Length - Index < 4)
                {
                    throw new Exception("Invalid data!");
                }

                string str = "";
                str = str + (ParamRTU[3 + Index] & 0x00FF).ToString("X2") + ":";
                str = str + ((ParamRTU[2 + Index] >> 8) & 0x00FF).ToString("X2") + ":" + (ParamRTU[2 + Index] & 0x00FF).ToString("X2") + " ";

                str = str + (ParamRTU[0 + Index] & 0x003F).ToString("X2") + "/" + ((ParamRTU[0 + Index] >> 8) & 0x001F).ToString("X2") + "/";
                str = str + "20" + (ParamRTU[1 + Index] & 0x00FF).ToString("X2");
                return(str);
            }
            else if (TimeF == TimeFormats.ADSPFormat)
            {
                if (ParamRTU.Length - Index < 7)
                {
                    throw new Exception("Invalid data!");
                }

                string str = "";

                str = (ParamRTU[4 + Index] & 0x00FF).ToString("X2") + "/" + (ParamRTU[5 + Index] & 0x001F).ToString("X2") + "/" +
                      "20" + (ParamRTU[6 + Index] & 0x00FF).ToString("X2") + " " +
                      (ParamRTU[2 + Index] & 0x00FF).ToString("X2") + ":" +
                      (ParamRTU[1 + Index] & 0x00FF).ToString("X2") + ":" + (ParamRTU[0 + Index] & 0x00FF).ToString("X2") /* + "." + (ParamRTU[3]).ToString("D3")*/;


                return(str);
            }
            else if (TimeF == TimeFormats.RTCFormat)
            {
                if (ParamRTU.Length - Index < 4)
                {
                    throw new Exception("Invalid data!");
                }

                string str = "";

                str = ConvertFuncs.FromBCD((ushort)(ParamRTU[0 + Index] & 0x003F)).ToString("D2") + " / " + ConvertFuncs.FromBCD((ushort)((ParamRTU[0 + Index] & 0x1F00) >> 8)).ToString("D2") + " / " +
                      "20" + ConvertFuncs.FromBCD((ushort)(ParamRTU[1 + Index] & 0x00FF)).ToString("D2") + "   " +
                      ConvertFuncs.FromBCD((ushort)(ParamRTU[3 + Index] & 0x003F)).ToString("D2") + ":" +
                      ConvertFuncs.FromBCD((ushort)((ParamRTU[2 + Index] & 0xFF00) >> 8)).ToString("D2") + ":" + ConvertFuncs.FromBCD((ushort)(ParamRTU[2 + Index] & 0x00FF)).ToString("D2") +
                      "." + (ParamRTU[3 + Index] >> 6).ToString("D3");


                return(str);
            }
            return("");
        }