Example #1
0
            public bool addVDMXGroup(ushort nIndex, VDMXGroupCache vgc)
            {
                bool bResult = true;

                if (nIndex > m_numRecs)
                {
                    bResult = false;
                    throw new ArgumentOutOfRangeException("nIndex is greater than the number of VDMX Groups + 1.");
                }
                else
                {
                    m_groups.Insert(nIndex, vgc.Clone());
                    m_numRecs++;
                    m_bDirty = true;

                    // Go fix up all of the ratio records
                    for (int i = 0; i < m_numRatios; i++)
                    {
                        if (((RatioCache)m_ratRange[i]).VDMXGroupThisRatio >= nIndex)
                        {
                            ((RatioCache)m_ratRange[i]).VDMXGroupThisRatio++;
                        }
                    }
                }

                return(bResult);
            }
Example #2
0
                public object Clone()
                {
                    VDMXGroupCache vgc = new VDMXGroupCache();

                    vgc.recs    = recs;
                    vgc.startsz = startsz;
                    vgc.endsz   = endsz;
                    vgc.m_entry = new ArrayList(recs);

                    for (int i = 0; i < recs; i++)
                    {
                        vgc.m_entry.Add(((vTableRecordCache)m_entry[i]).Clone());
                    }

                    return(vgc);
                }
Example #3
0
            public VDMXGroupCache getVDMXGroup(ushort nIndex)
            {
                VDMXGroupCache vgc = null;


                if (nIndex >= m_numRecs)
                {
                    throw new ArgumentOutOfRangeException("nIndex is greater than the number of VDMX Groups.");
                }
                else
                {
                    vgc = (VDMXGroupCache)((VDMXGroupCache)m_groups[nIndex]).Clone();
                }

                return(vgc);
            }
Example #4
0
            public bool setVDMXGroup(ushort nIndex, VDMXGroupCache vgc)
            {
                bool bResult = true;

                if (nIndex >= m_numRecs)
                {
                    bResult = false;
                    throw new ArgumentOutOfRangeException("nIndex is greater than the number of VDMX Groups.");
                }
                else
                {
                    m_groups[nIndex] = vgc.Clone();
                    m_bDirty         = true;
                }

                return(bResult);
            }
Example #5
0
            public bool removeVDMXGroup(ushort nIndex, VDMXGroupCache vgc)
            {
                bool bResult = true;

                if (nIndex >= m_numRecs)
                {
                    bResult = false;
                    throw new ArgumentOutOfRangeException("nIndex is greater than the number of VDMX Groups.");
                }
                else
                {
                    for (int i = 0; i < m_numRatios; i++)
                    {
                        if (((RatioCache)m_ratRange[i]).VDMXGroupThisRatio == nIndex)
                        {
                            bResult = false;
                            throw new ArgumentException("VDMX Group can not be removed because a Ratio Record is using it");
                        }
                    }

                    m_groups.RemoveAt(nIndex);
                    m_numRecs--;
                    m_bDirty = true;

                    // Go fix up all of the ratio records
                    for (int i = 0; i < m_numRatios; i++)
                    {
                        if (((RatioCache)m_ratRange[i]).VDMXGroupThisRatio > nIndex)
                        {
                            ((RatioCache)m_ratRange[i]).VDMXGroupThisRatio--;
                        }
                    }
                }

                return(bResult);
            }
Example #6
0
                public object Clone()
                {
                    VDMXGroupCache vgc = new VDMXGroupCache();
                    vgc.recs =  recs;
                    vgc.startsz = startsz;
                    vgc.endsz = endsz;
                    vgc.m_entry = new ArrayList( recs );

                    for( int i = 0; i < recs; i++ )
                    {
                        vgc.m_entry.Add( ((vTableRecordCache)m_entry[i]).Clone());            
                    }

                    return vgc;
                }
Example #7
0
            public bool removeVDMXGroup( ushort nIndex, VDMXGroupCache vgc )
            {
                bool bResult = true;
                
                if( nIndex >= m_numRecs )
                {
                    bResult = false;
                    throw new ArgumentOutOfRangeException( "nIndex is greater than the number of VDMX Groups." );
                }
                else
                {
                    for( int i = 0; i < m_numRatios; i++ )
                    {
                        if( ((RatioCache)m_ratRange[i]).VDMXGroupThisRatio == nIndex )
                        {
                            bResult = false;
                            throw new ArgumentException( "VDMX Group can not be removed because a Ratio Record is using it" );
                        }
                    }

                    m_groups.RemoveAt( nIndex );
                    m_numRecs--;
                    m_bDirty = true;
                    
                    // Go fix up all of the ratio records
                    for( int i = 0; i < m_numRatios; i++ )
                    {
                        if( ((RatioCache)m_ratRange[i]).VDMXGroupThisRatio > nIndex )
                        {
                            ((RatioCache)m_ratRange[i]).VDMXGroupThisRatio--;
                        }
                    }
                }

                return bResult;
            }
Example #8
0
            public bool addVDMXGroup( ushort nIndex, VDMXGroupCache vgc )
            {
                bool bResult = true;
                
                if( nIndex > m_numRecs )
                {
                    bResult = false;
                    throw new ArgumentOutOfRangeException( "nIndex is greater than the number of VDMX Groups + 1." );
                }
                else
                {
                    m_groups.Insert( nIndex, vgc.Clone());
                    m_numRecs++;
                    m_bDirty = true;

                    // Go fix up all of the ratio records
                    for( int i = 0; i < m_numRatios; i++ )
                    {
                        if( ((RatioCache)m_ratRange[i]).VDMXGroupThisRatio >= nIndex )
                        {
                            ((RatioCache)m_ratRange[i]).VDMXGroupThisRatio++;
                        }
                    }
                }

                return bResult;
            }
Example #9
0
            public bool setVDMXGroup( ushort nIndex, VDMXGroupCache vgc )
            {
                bool bResult = true;
                
                if( nIndex >= m_numRecs )
                {
                    bResult = false;
                    throw new ArgumentOutOfRangeException( "nIndex is greater than the number of VDMX Groups." );
                }
                else
                {
                    m_groups[nIndex] = vgc.Clone();
                    m_bDirty = true;
                }

                return bResult;
            }
Example #10
0
            protected ArrayList m_groups; // VDMXGroupCache[]

            // constructor
            public VDMX_cache(Table_VDMX OwnerTable)
            {

                m_version = OwnerTable.version;
                m_numRecs = OwnerTable.numRecs;
                m_numRatios = OwnerTable.numRatios;

                m_ratRange = new ArrayList( m_numRatios );
                m_groups = new ArrayList( m_numRecs );

                // Used to detrmine which vdmx goes with which ratio
                ushort[] VDMXOffsets = new ushort[m_numRecs]; 

                
                VDMXOffsets[0] = (ushort)(Table_VDMX.FieldOffsets.ratRange + (m_numRatios * 4) + (m_numRatios * 2));

                // Fill in the VDMX groups
                for( ushort i = 0; i < m_numRecs; i++ )
                {

                    VDMXGroupCache vgc = new VDMXGroupCache();
                    vgc.recs = OwnerTable.GetVdmxGroup( i ).recs;
                    vgc.startsz = OwnerTable.GetVdmxGroup( i ).startsz;
                    vgc.endsz = OwnerTable.GetVdmxGroup( i ).endsz;

                    for( ushort ii = 0; ii < vgc.recs; ii++ )
                    {
                        Vdmx.vTable vt = OwnerTable.GetVdmxGroup( i ).GetEntry( ii );
                        vgc.addVTableRecordCache( ii, vt.yPelHeight, vt.yMax, vt. yMin ); 
                    }

                    m_groups.Add( vgc );

                    if( i < (m_numRecs - 1))
                    {
                        VDMXOffsets[i+1] = (ushort)(VDMXOffsets[i] + 4 + ( vgc.recs * 6 ));
                    }

                }

                // Fill in the ratios
                for( ushort i = 0; i < m_numRatios; i++ )
                {
                    RatioCache rc = new RatioCache();
                    rc.bCharSet = OwnerTable.GetRatioRange( i ).bCharSet;
                    rc.xRatio = OwnerTable.GetRatioRange( i ).xRatio;
                    rc.yStartRatio = OwnerTable.GetRatioRange( i ).yStartRatio;
                    rc.yEndRatio = OwnerTable.GetRatioRange( i ).yEndRatio;

                    // Go through each of the offsets I saved above and match with this ratios offset
                    // When we find the right one save this group to this ratio
                    // later when we save the buffer we will redetermine these offsets
                    for( ushort ii = 0; ii < m_numRatios; ii++ )
                    {
                        if( VDMXOffsets[ii] == OwnerTable.GetVdmxGroupOffset( i ))
                        {
                            rc.VDMXGroupThisRatio = ii;
                            break;
                        }
                    }

                    m_ratRange.Add( rc );    
                }
            }
Example #11
0
            protected ArrayList m_groups;   // VDMXGroupCache[]

            // constructor
            public VDMX_cache(Table_VDMX OwnerTable)
            {
                m_version   = OwnerTable.version;
                m_numRecs   = OwnerTable.numRecs;
                m_numRatios = OwnerTable.numRatios;

                m_ratRange = new ArrayList(m_numRatios);
                m_groups   = new ArrayList(m_numRecs);

                // Used to detrmine which vdmx goes with which ratio
                ushort[] VDMXOffsets = new ushort[m_numRecs];


                VDMXOffsets[0] = (ushort)(Table_VDMX.FieldOffsets.ratRange + (m_numRatios * 4) + (m_numRatios * 2));

                // Fill in the VDMX groups
                for (ushort i = 0; i < m_numRecs; i++)
                {
                    VDMXGroupCache vgc = new VDMXGroupCache();
                    vgc.recs    = OwnerTable.GetVdmxGroup(i).recs;
                    vgc.startsz = OwnerTable.GetVdmxGroup(i).startsz;
                    vgc.endsz   = OwnerTable.GetVdmxGroup(i).endsz;

                    for (ushort ii = 0; ii < vgc.recs; ii++)
                    {
                        Vdmx.vTable vt = OwnerTable.GetVdmxGroup(i).GetEntry(ii);
                        vgc.addVTableRecordCache(ii, vt.yPelHeight, vt.yMax, vt.yMin);
                    }

                    m_groups.Add(vgc);

                    if (i < (m_numRecs - 1))
                    {
                        VDMXOffsets[i + 1] = (ushort)(VDMXOffsets[i] + 4 + (vgc.recs * 6));
                    }
                }

                // Fill in the ratios
                for (ushort i = 0; i < m_numRatios; i++)
                {
                    RatioCache rc = new RatioCache();
                    rc.bCharSet    = OwnerTable.GetRatioRange(i).bCharSet;
                    rc.xRatio      = OwnerTable.GetRatioRange(i).xRatio;
                    rc.yStartRatio = OwnerTable.GetRatioRange(i).yStartRatio;
                    rc.yEndRatio   = OwnerTable.GetRatioRange(i).yEndRatio;

                    // Go through each of the offsets I saved above and match with this ratios offset
                    // When we find the right one save this group to this ratio
                    // later when we save the buffer we will redetermine these offsets
                    for (ushort ii = 0; ii < m_numRatios; ii++)
                    {
                        if (VDMXOffsets[ii] == OwnerTable.GetVdmxGroupOffset(i))
                        {
                            rc.VDMXGroupThisRatio = ii;
                            break;
                        }
                    }

                    m_ratRange.Add(rc);
                }
            }