Esempio n. 1
0
        public override IECGFormat Read(Stream input, int offset, ECGConfig cfg)
        {
            LastError = 0;
            IECGFormat ret = null;

            if ((input != null) &&
                (input.CanRead))
            {
                ret = new MUSEXMLFormat();

                if (ret.Config != null)
                {
                    ret.Config.Set(cfg);

                    if (!ret.Config.ConfigurationWorks())
                    {
                        LastError = 3;

                        return(null);
                    }
                }

                if (ret.CheckFormat(input, offset))
                {
                    LastError = (ret.Read(input, offset) << 2);
                }

                if (!ret.Works())
                {
                    LastError = 2;
                    ret       = null;
                }
            }
            else
            {
                LastError = 1;
            }
            return(ret);
        }
Esempio n. 2
0
        public override IECGFormat Read(byte[] buffer, int offset, ECGConfig cfg)
        {
            LastError = 0;
            IECGFormat ret = null;

            if (buffer != null)
            {
                ret = new MUSEXMLFormat();

                if (ret.Config != null)
                {
                    ret.Config.Set(cfg);

                    if (!ret.Config.ConfigurationWorks())
                    {
                        LastError = 3;

                        return(null);
                    }
                }

                if (ret.CheckFormat(buffer, offset))
                {
                    LastError = (ret.Read(buffer, offset) << 2);
                }

                if (!ret.Works())
                {
                    LastError = 2;
                    ret       = null;
                }
            }
            else
            {
                LastError = 1;
            }
            return(ret);
        }