Exemplo n.º 1
0
        /// <summary>
        /// We use a few tricks here to obfuscate the Auto_Open Lbl BIFF records.
        /// 1) By default the Lbl Auto_Open record is marked as fBuiltin = true with a single byte 0x01 to represent AUTO_OPEN
        ///    We avoid this easily sig-able series of bytes by using a string instead - which Excel will also process.
        ///    We can use labels like AuTo_OpEn and Excel will still use it - some analyst tools are case sensitive and don't
        ///    detect this.
        /// 2) The string we use for the Lbl can be Unicode, which will further break signatures expecting an ASCII Auto_Open string
        /// 3) We can inject null bytes into the label name and Excel will ignore them when hunting for Auto_Open labels.
        ///    The name manager will only display up to the first null byte - and most excel label parsers will also break on this.
        /// 4) The Unicode BOM character (0xFEFF/0xFFEF) is also disregarded by Excel. We can use this to break detections that will drop
        ///    nulls and look for Auto_Open without being case sensitive. By injecting this with nulls we break most detection.
        /// </summary>
        /// <returns></returns>
        public WorkbookStream ObfuscateAutoOpen(string localizedLabel)
        {
            Random randomUnicodeChar = new Random();

            string[]   badUnicodeChars          = { "\ufefe", "\uffff", "\ufeff", "\ufffe", "\uffef", "\ufff0", "\ufff1", "\ufff6", "\ufefd", "\u0000", "\udddd" };
            int        indexLabel               = 0;
            string     unicodeLabelWithBadChars = "";
            List <Lbl> labels      = GetAllRecordsByType <Lbl>();
            Lbl        autoOpenLbl = labels.First(l => l.fBuiltin && l.Name.Value.Equals("\u0001") ||
                                                  l.Name.Value.ToLower().StartsWith(localizedLabel));
            Lbl replaceLabelStringLbl = ((BiffRecord)autoOpenLbl.Clone()).AsRecordType <Lbl>();

            //Characters that work
            //fefe, ffff, feff, fffe, ffef, fff0, fff1, fff6, fefd, 0000, dddd
            //Pretty much any character that is invalid unicode - though \ucccc doesn't seem to work - need better criteria for parsing

            foreach (char localizedLabelChar in localizedLabel)
            {
                indexLabel = randomUnicodeChar.Next(localizedLabel.Length);
                unicodeLabelWithBadChars += badUnicodeChars[indexLabel] + localizedLabelChar;
            }
            replaceLabelStringLbl.SetName(new XLUnicodeStringNoCch(unicodeLabelWithBadChars, true));
            replaceLabelStringLbl.fBuiltin = false;

            // Hidden removes from the label manager entirely, but doesn't seem to work if fBuiltin is false
            // replaceLabelStringLbl.fHidden = true;

            WorkbookStream obfuscatedStream = ReplaceRecord(autoOpenLbl, replaceLabelStringLbl);

            obfuscatedStream = obfuscatedStream.FixBoundSheetOffsets();
            return(obfuscatedStream);
        }
Exemplo n.º 2
0
        public void getForm()
        {
            int  offsetY = 30, offsetX = 10;
            Form f = new Form();

            f.Height       = 150; f.Width = 400; f.WindowState = FormWindowState.Normal; f.Text = "Смещение"; f.StartPosition = FormStartPosition.CenterScreen;
            f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; f.AutoSize = true;
            System.Drawing.Point insPt = new System.Drawing.Point(5, 5);
            InterfaceDll.Lbl     lbs   = new Lbl(offsetX, offsetY, 100, 15, insPt, f, "Дистанция");
            InterfaceDll.CB      cbs   = new CB(offsetX, offsetY, 200, 15, insPt, f);
            cbs.position(lbs.last(), true);
            //cbs.last().Items.AddRange(new[] { "2.65", "2.8", "3", "4.5", "6" });
            ComponentOccurrence occ = ss[1] as ComponentOccurrence;

            if (occ == null)
            {
                return;
            }
            ins = occ.Constraints[1] as InsertConstraint;
            if (ins == null)
            {
                return;
            }


            cbs.last().Text       = last(ins.Distance);
            InterfaceDll.Btn btns = new Btn(offsetX, offsetY, 100, 20, insPt, f, click, "Добавить");
            btns.center(cbs.last(), offsetY + 5);
            f.Show();
        }
Exemplo n.º 3
0
        private void addControls(Point defaultSize)
        {
            // The description label
            this.lblDescription      = new Lbl(this.Description, this);
            this.lblDescription.Size = new Size(this.Width - 20, this.lblDescription.Height + 1);

            // The size textboxes
            this.tbWidth       = new Tb(this);
            this.tbWidth.Text  = defaultSize.X.ToString();
            this.tbWidth.Size  = new Size(this.tbWidth.Width / 2, this.tbWidth.Height);
            this.tbHeight      = new Tb(this);
            this.tbHeight.Text = defaultSize.Y.ToString();
            this.tbHeight.Size = this.tbWidth.Size;

            // The Ok and Cancel buttons
            this.btnOk        = new Btn("Ok", this);
            this.btnOk.Click += (o, e) => {
                int number;
                if (!int.TryParse(this.tbWidth.Text, out number) || !int.TryParse(this.tbHeight.Text, out number))
                {
                    MessageBox.Show("Please enter an integer value.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            };
            this.btnCancel        = new Btn("Cancel", this);
            this.btnCancel.Click += (o, e) => {
                this.DialogResult = DialogResult.Cancel;
                this.Close();
            };
        }
Exemplo n.º 4
0
        public List <Cell> GetAutoStartCells()
        {
            List <Cell> startCells     = new List <Cell>();
            List <Lbl>  autoOpenLabels = wbs.GetAutoOpenLabels();

            foreach (var autoOpenLbl in autoOpenLabels)
            {
                AbstractPtg peekPtg = autoOpenLbl.rgce.Peek();
                switch (peekPtg)
                {
                //References a cell
                case PtgRef3d ptgRef3d:
                    startCells.Add(new Cell(ptgRef3d.rw, ptgRef3d.col));
                    break;

                //References a different label
                case PtgName ptgName:
                    Lbl referencedLabel = ResolveName(ptgName);
                    while (referencedLabel.rgce.Peek() is PtgName)
                    {
                        referencedLabel = ResolveName(referencedLabel.rgce.Peek() as PtgName);
                    }
                    PtgRef3d ref3d = referencedLabel.rgce.Peek() as PtgRef3d;
                    startCells.Add(new Cell(ref3d.rw, ref3d.col));
                    break;

                default:
                    throw new NotImplementedException();
                }
            }

            return(startCells);
        }
Exemplo n.º 5
0
 public static bool ValidateAccess(Type tipo, Lbl.Sys.Permisos.Operaciones operacion)
 {
         bool Tiene = Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(tipo, operacion);
         if (Tiene == false)
                 Lfx.Workspace.Master.RunTime.Toast("No tiene permiso para realizar la operación solicitada.", "Error");
         return Tiene;
 }
Exemplo n.º 6
0
                public ChatControl IniciarChat(Lbl.Personas.Persona personaRemota, string estacionRemota)
                {
                        if (this.InvokeRequired) {
                                object Res = this.Invoke((Func<object>)(delegate { return this.IniciarChat(personaRemota, estacionRemota); }));
                                return Res as ChatControl;
                        } else {

                                ChatControl NuevoCtrl = new ChatControl();

                                NuevoCtrl.Margin = new Padding(8);
                                NuevoCtrl.Dock = DockStyle.Fill;
                                NuevoCtrl.Visible = true;
                                this.SuspendLayout();
                                this.Controls.Add(NuevoCtrl);
                                this.ResumeLayout(true);

                                NuevoCtrl.IniciarChat(personaRemota, estacionRemota);

                                ToolStripButton Pestania = new ToolStripButton(personaRemota.ToString());
                                Pestania.Margin = new System.Windows.Forms.Padding(2);
                                Pestania.Tag = NuevoCtrl;
                                Pestania.Checked = true;
                                this.Pestanias.Items.Add(Pestania);

                                NuevoCtrl.Select();
                                Listado.Visible = false;

                                return NuevoCtrl;
                        }
                }
Exemplo n.º 7
0
                public EditarCampo(Lbl.Impresion.Campo campo)
                        : this()
                {
                        this.Campo = campo;

                        this.EntradaTexto.Text = this.Campo.Valor;
                        this.EntradaPreimpreso.ValueInt = this.Campo.Preimpreso ? 1 : 0;
                        if (this.Campo.Formato == null || this.Campo.Formato.Length == 0)
                                this.EntradaFormato.TextKey = "*";
                        else
                                this.EntradaFormato.TextKey = this.Campo.Formato;
                        this.EntradaX.ValueInt = this.Campo.Rectangle.X;
                        this.EntradaY.ValueInt = this.Campo.Rectangle.Y;
                        this.EntradaAncho.ValueInt = this.Campo.Rectangle.Width;
                        this.EntradaAlto.ValueInt = this.Campo.Rectangle.Height;
                        this.EntradaAlienacionHorizontal.TextKey = this.Campo.Alignment.ToString();
                        this.EntradaAlienacionVertical.TextKey = this.Campo.LineAlignment.ToString();
                        this.EntradaAjusteTexto.TextKey = this.Campo.Wrap ? "1" : "0";
                        this.EntradaAnchoBorde.ValueInt = this.Campo.AnchoBorde;
                        if (this.Campo.Font != null) {
                                Ignorar_EntradaFuenteFuenteTamano_TextChanged++;
                                this.EntradaFuenteNombre.TextKey = this.Campo.Font.Name;
                                this.EntradaFuenteTamano.ValueDecimal = Convert.ToDecimal(this.Campo.Font.Size);
                                Ignorar_EntradaFuenteFuenteTamano_TextChanged--;
                        } else {
                                this.EntradaFuenteNombre.TextKey = "*";
                                this.EntradaFuenteTamano.ValueDecimal = 10;
                        }

                        this.ActualizarMuestra();
                }
Exemplo n.º 8
0
 public Permiso(Lbl.Personas.Usuario usuario, Objeto tipo, Operaciones ops, ListaIds item)
         : this(usuario.Connection)
 {
         this.Usuario = usuario;
         this.Objeto = tipo;
         this.Operaciones = ops;
         this.Item = item;
 }
Exemplo n.º 9
0
        public WorkbookStream AddLabel(string label, Stack <AbstractPtg> rgce, bool isMacroStack = false)
        {
            /*
             * Labels require a reference to an XTI index which is used to say which
             * BoundSheet8 record maps to the appropriate tab. In order to make this
             * record we need a SupBook record, and ExternSheet record to specify
             * which BoundSheet8 record to use.
             *
             * Currently this assumes there are no SupBook or ExternSheet records in
             * use, handling of these cases for complex decoy docs is coming
             * in the future.
             *
             * TODO handle existing SupBook/ExternSheet records when adding Lbl entries
             */

            List <BoundSheet8> sheets               = WbStream.GetAllRecordsByType <BoundSheet8>();
            List <SupBook>     supBooksExisting     = WbStream.GetAllRecordsByType <SupBook>();
            List <ExternSheet> externSheetsExisting = WbStream.GetAllRecordsByType <ExternSheet>();

            ExternSheet lastExternSheet;

            if (supBooksExisting.Count > 0 || externSheetsExisting.Count > 0)
            {
                lastExternSheet = externSheetsExisting.Last();
            }
            else
            {
                BiffRecord lastCountryRecord = WbStream.GetAllRecordsByType <Country>().Last();

                SupBook     supBookRecord     = new SupBook(sheets.Count, 0x401);
                int         macroOffset       = sheets.TakeWhile(s => s.dt != BoundSheet8.SheetType.Macrosheet).Count();
                ExternSheet externSheetRecord = new ExternSheet(1, new List <XTI>()
                {
                    new XTI(0, macroOffset, macroOffset)
                });

                WbStream        = WbStream.InsertRecord(supBookRecord, lastCountryRecord);
                WbStream        = WbStream.InsertRecord(externSheetRecord, supBookRecord);
                lastExternSheet = externSheetRecord;
            }

            Lbl newLbl = new Lbl(label, 0);

            if (isMacroStack)
            {
                newLbl.fProc = true;
                newLbl.fFunc = true;
            }

            newLbl.SetRgce(rgce);

            WbStream = WbStream.InsertRecord(newLbl, lastExternSheet);
            WbStream = WbStream.FixBoundSheetOffsets();

            return(WbStream);
        }
Exemplo n.º 10
0
 public void IniciarChat(Lbl.Personas.Persona personaRemota, string estacionRemota)
 {
         this.PersonaRemota = personaRemota;
         this.EstacionRemota = estacionRemota;
         
         EntradaConversacion.Text = this.PersonaRemota.Nombre + " está conectado/a en " + this.EstacionRemota + System.Environment.NewLine;
         EntradaEnviar.Select();
         
         this.ActualizarEstado();
 }
Exemplo n.º 11
0
                public static int ProximoNumero(Lbl.Comprobantes.Comprobante comprobante)
                {
                        string TipoReal = "";

                        // Las notas de crédito y débito comparten la numeración de las comprob
                        switch (comprobante.Tipo.Nomenclatura) {
                                case "A":
                                case "FA":
                                case "NCA":
                                case "NDA":
                                        TipoReal = "'FA', 'NCA', 'NDA'";
                                        break;

                                case "B":
                                case "FB":
                                case "NCB":
                                case "NDB":
                                        TipoReal = "'FB', 'NCB', 'NDB'";
                                        break;

                                case "C":
                                case "FC":
                                case "NCC":
                                case "NDC":
                                        TipoReal = "'FC', 'NCC', 'NDC'";
                                        break;

                                case "E":
                                case "FE":
                                case "NCE":
                                case "NDE":
                                        TipoReal = "'FE', 'NCE', 'NDE'";
                                        break;

                                case "M":
                                case "FM":
                                case "NCM":
                                case "NDM":
                                        TipoReal = "'FM', 'NCM', 'NDM'";
                                        break;

                                default:
                                        TipoReal = "'" + comprobante.Tipo.Nomenclatura + "'";
                                        break;
                        }

                        string SqlWhere = "pv=" + comprobante.PV.ToString() + " AND tipo_fac IN (" + TipoReal + ")";
                        if (comprobante is Lbl.Comprobantes.ComprobanteConArticulos) {
                                // Si es comprobante con artículos, agrego una condicion más para los comprobantes de compra
                                SqlWhere += " AND compra=" + (((Lbl.Comprobantes.ComprobanteConArticulos)(comprobante)).Compra ? "1" : "0");
                        }

                        return comprobante.Connection.FieldInt("SELECT MAX(numero) FROM " + comprobante.TablaDatos + " WHERE " + SqlWhere) + 1;
                }
Exemplo n.º 12
0
                /// <summary>
                /// Crea un formulario de edición para el ElementoDeDatos proporcionado.
                /// </summary>
                /// <param name="elemento">El ElementoDeDatos que se quiere editar.</param>
                /// <returns>Un formulario derivado de Lfc.FormularioEdicion.</returns>
                public static Lfc.FormularioEdicion InstanciarFormularioEdicion(Lbl.IElementoDeDatos elemento)
                {
                        Lfc.FormularioEdicion Res = new Lfc.FormularioEdicion();
                        Type TipoControlEdicion = InferirControlEdicion(elemento.GetType());
                        if (TipoControlEdicion == null)
                                return null;

                        Res.ControlUnico = InstanciarControlEdicion(TipoControlEdicion);
                        Res.FromRow(elemento);

                        return Res;
                }
Exemplo n.º 13
0
                private void AgregarImpresora(Lbl.Impresion.Impresora impresora)
                {
                        ListViewItem Itm = Listado.Items.Add(impresora.Id.ToString());
                        Itm.SubItems.Add(impresora.Nombre);
                        Itm.Tag = impresora;

                        if (impresora == m_Resultado) {
                                if (Listado.SelectedItems.Count > 0)
                                        Listado.SelectedItems[0].Selected = false;

                                Itm.Selected = true;
                                Itm.Focused = true;
                        }
                }
Exemplo n.º 14
0
                private void MostrarPermisos(Lbl.Personas.Usuario usuario)
                {
                        Listado.SuspendLayout();
                        Listado.Items.Clear();

                        foreach (Lbl.Sys.Permisos.Permiso Perm in usuario.Pemisos) {
                                this.MostrarPermiso(Perm);
                        }

                        Listado.Sorting = SortOrder.Ascending;
                        Listado.Sort();

                        Listado.ResumeLayout();
                }
Exemplo n.º 15
0
        public WorkbookStream NormalizeAutoOpenLabels()
        {
            List <Lbl> autoOpenLabels = WbStream.GetAutoOpenLabels();

            foreach (var label in autoOpenLabels)
            {
                Lbl fixedLabel = ((BiffRecord)label.Clone()).AsRecordType <Lbl>();
                fixedLabel.SetName(new XLUnicodeStringNoCch("Auto_Open"));
                WbStream = WbStream.ReplaceRecord(label, fixedLabel);
            }

            WbStream = WbStream.FixBoundSheetOffsets();

            return(WbStream);
        }
Exemplo n.º 16
0
        public void TestLabelSerialization()
        {
            WorkbookStream macroWorkbookStream = TestHelpers.GetMultiSheetMacroBytes();

            List <SupBook> supBooks = macroWorkbookStream.GetAllRecordsByType <SupBook>();
            List <Lbl>     labels   = macroWorkbookStream.GetAllRecordsByType <Lbl>();

            Lbl lastLabel  = labels.Last();
            Lbl cloneLabel = ((BiffRecord)lastLabel.Clone()).AsRecordType <Lbl>();

            byte[] labelBytes = lastLabel.GetBytes();
            byte[] cloneBytes = cloneLabel.GetBytes();

            Assert.AreEqual(labelBytes, cloneBytes);
        }
Exemplo n.º 17
0
        public WorkbookStream AddLabel(string label, int rw, int col)
        {
            /*
             * Labels require a reference to an XTI index which is used to say which
             * BoundSheet8 record maps to the appropriate tab. In order to make this
             * record we need a SupBook record, and ExternSheet record to specify
             * which BoundSheet8 record to use.
             *
             * Currently this assumes there are no SupBook or ExternSheet records in
             * use, handling of these cases for complex decoy docs is coming
             * in the future.
             *
             * TODO handle existing SupBook/ExternSheet records when adding Lbl entries
             */

            List <BoundSheet8> sheets               = WbStream.GetAllRecordsByType <BoundSheet8>();
            List <SupBook>     supBooksExisting     = WbStream.GetAllRecordsByType <SupBook>();
            List <ExternSheet> externSheetsExisting = WbStream.GetAllRecordsByType <ExternSheet>();

            if (supBooksExisting.Count > 0 || externSheetsExisting.Count > 0)
            {
                throw new NotImplementedException("Use a Decoy Document with no Labels");
            }

            BiffRecord lastCountryRecord = WbStream.GetAllRecordsByType <Country>().Last();

            SupBook     supBookRecord     = new SupBook(sheets.Count, 0x401);
            int         macroOffset       = sheets.TakeWhile(s => s.dt != BoundSheet8.SheetType.Macrosheet).Count();
            ExternSheet externSheetRecord = new ExternSheet(1, new List <XTI>()
            {
                new XTI(0, macroOffset, macroOffset)
            });

            Stack <AbstractPtg> ptgStack = new Stack <AbstractPtg>();

            ptgStack.Push(new PtgRef3d(rw, col, 0));
            Lbl newLbl = new Lbl(label, 0);

            newLbl.SetRgce(ptgStack);

            WbStream = WbStream.InsertRecord(supBookRecord, lastCountryRecord);
            WbStream = WbStream.InsertRecord(externSheetRecord, supBookRecord);
            WbStream = WbStream.InsertRecord(newLbl, externSheetRecord);
            WbStream = WbStream.FixBoundSheetOffsets();

            return(WbStream);
        }
Exemplo n.º 18
0
                public void MensajeRecibido(Lbl.Notificaciones.INotificacion notif)
                {
                        if (EtiquetaNombre.InvokeRequired) {
                                this.Invoke(new MethodInvoker(delegate { this.MensajeRecibido(notif); }));
                        } else {
                                if (notif != null) {
                                        if (EntradaConversacion.Text.Length > 0)
                                                EntradaConversacion.AppendText(System.Environment.NewLine);
                                        EntradaConversacion.AppendText(this.PersonaRemota.Nombres + ": ");
                                        EntradaConversacion.AppendText(notif.Obs);
                                        EntradaConversacion.SelectionStart = EntradaConversacion.TextLength;
                                }

                                if (this.ParentForm.Visible == false && this.ParentForm.InvokeRequired) {
                                        this.ParentForm.Invoke(new MethodInvoker(delegate { this.ParentForm.Show(); }));
                                }
                        }
                }
Exemplo n.º 19
0
        public override void Draw()
        {
            BackgroundImg.Draw(m_SBatch, null, 0.0f);
            TSOLogoImage.Draw(m_SBatch, null, 0.0f);
            BackButtonIndentImage.Draw(m_SBatch, null, 0.0f);

            foreach (UILabel Lbl in m_CreditsStrings)
            {
                //TODO: Figure out how to stop lines from displaying outside of the screen.
                if (Lbl.YPosition > m_CreditsArea.Position.Y && (Lbl.YPosition < m_CreditsArea.Size.Y))
                {
                    Lbl.Draw(m_SBatch, 0.3f);
                }
            }

            m_WillWrightDiag.Draw(m_SBatch, 0.4f);

            base.Draw();
        }
Exemplo n.º 20
0
        public override void Draw()
        {
            m_SBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null,
                           RasterizerState.CullCounterClockwise, null, Resolution.TransformationMatrix());

            /*BackgroundImg.Draw(m_SBatch, null, 0.0f);
             * TSOLogoImage.Draw(m_SBatch, null, 0.0f);
             * BackButtonIndentImage.Draw(m_SBatch, null, 0.0f);*/

            foreach (UILabel Lbl in m_CreditsStrings)
            {
                //TODO: Clip the credits area!
                if (Lbl.YPosition > m_CreditsArea.Position.Y && (Lbl.YPosition < m_CreditsArea.Size.Y))
                {
                    Lbl.Draw(m_SBatch, 0.3f);
                }
            }

            //m_WillWrightDiag.Draw(m_SBatch, 0.4f);

            base.Draw();

            Manager.Device.Clear(Color.Black);

            m_SBatch.End();

            /*foreach (UIElement Element in m_PResult.Elements.Values)
             * {
             *  if (Element.NeedsClipping)
             *  {
             *      RasterizerState RasterState = new RasterizerState();
             *      RasterState.ScissorTestEnable = true;
             *      RasterState.CullMode = CullMode.CullCounterClockwiseFace;
             *
             *      m_SBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null,
             *         RasterState, null, Resolution.TransformationMatrix());
             *
             *      Element.Draw(m_SBatch, 0.5f);
             *
             *      m_SBatch.End();
             *  }
             * }*/
        }
Exemplo n.º 21
0
        /// <summary>
        /// We use a few tricks here to obfuscate the Auto_Open Lbl BIFF records.
        /// 1) By default the Lbl Auto_Open record is marked as fBuiltin = true with a single byte 0x01 to represent AUTO_OPEN
        ///    We avoid this easily sig-able series of bytes by using a string instead - which Excel will also process.
        ///    We can use labels like AuTo_OpEn and Excel will still use it - some analyst tools are case sensitive and don't
        ///    detect this.
        /// 2) The string we use for the Lbl can be Unicode, which will further break signatures expecting an ASCII Auto_Open string
        /// 3) We can inject null bytes into the label name and Excel will ignore them when hunting for Auto_Open labels.
        ///    The name manager will only display up to the first null byte - and most excel label parsers will also break on this.
        /// 4) The Unicode BOM character (0xFEFF/0xFFEF) is also disregarded by Excel. We can use this to break detections that will drop
        ///    nulls and look for Auto_Open without being case sensitive. By injecting this with nulls we break most detection.
        /// </summary>
        /// <returns></returns>
        public WorkbookStream ObfuscateAutoOpen()
        {
            List <Lbl> labels      = GetAllRecordsByType <Lbl>();
            Lbl        autoOpenLbl = labels.First(l => l.fBuiltin && l.Name.Value.Equals("\u0001") ||
                                                  l.Name.Value.ToLower().StartsWith("auto_open"));
            Lbl replaceLabelStringLbl = ((BiffRecord)autoOpenLbl.Clone()).AsRecordType <Lbl>();

            //Characters that work
            //fefe, ffff, feff, fffe, ffef, fff0, fff1, fff6, fefd, 0000, dddd
            //Pretty much any character that is invalid unicode - though \ucccc doesn't seem to work - need better criteria for parsing
            //TODO [Stealth] Randomize which invalid unicode characters are injected into this string
            replaceLabelStringLbl.SetName(new XLUnicodeStringNoCch("\u0000A\uffffu\u0000\ufefft\ufffeo\uffef_\ufff0O\ufff1p\ufff6e\ufefdn\udddd", true));
            replaceLabelStringLbl.fBuiltin = false;

            // Hidden removes from the label manager entirely, but doesn't seem to work if fBuiltin is false
            // replaceLabelStringLbl.fHidden = true;

            WorkbookStream obfuscatedStream = ReplaceRecord(autoOpenLbl, replaceLabelStringLbl);

            obfuscatedStream = obfuscatedStream.FixBoundSheetOffsets();
            return(obfuscatedStream);
        }
Exemplo n.º 22
0
        public WorkbookStream AddExistingLabel(Lbl existingLbl, ushort iTab = 0)
        {
            List <Lbl>  existingLbls    = WbStream.GetAllRecordsByType <Lbl>();
            ExternSheet lastExternSheet = WbStream.GetAllRecordsByType <ExternSheet>().LastOrDefault();

            existingLbl.itab = iTab;
            if (existingLbls.Count > 0)
            {
                WbStream = WbStream.InsertRecord(existingLbl, existingLbls.Last());
            }
            else
            {
                if (lastExternSheet == null)
                {
                    throw new NotImplementedException("AddExistingLabel assumes an ExternSheet exists");
                }
                WbStream = WbStream.InsertRecord(existingLbl, lastExternSheet);
            }

            WbStream = WbStream.FixBoundSheetOffsets();
            return(WbStream);
        }
Exemplo n.º 23
0
        public void AutoOpenSerializationTest()
        {
            WorkbookStream autoOpenStream = new WorkbookStream(TestHelpers.GetAutoOpenTestBytes());
            List <Lbl>     lbls           = autoOpenStream.GetAllRecordsByType <Lbl>();

            //auto_open_test.xls contains a Lbl for Auto_Open222
            Lbl autoOpenLabel = lbls.First(l => l.fBuiltin);

            byte[] labelBytes = autoOpenLabel.Name.Bytes;

            //Should be length 4, 1 byte for the builtin string lookup, 3 bytes for 222
            Assert.AreEqual(4, autoOpenLabel.cch);

            //Not a unicode string, so fHighBit is 0
            Assert.AreEqual((byte)0x00, labelBytes[0]);
            //Starts with the Auto_Open builtin value of 1
            Assert.AreEqual((byte)0x01, labelBytes[1]);

            //Should be followed by whatever we append to the end, in this case 222
            Assert.AreEqual((byte)'2', labelBytes[2]);
            Assert.AreEqual((byte)'2', labelBytes[3]);
            Assert.AreEqual((byte)'2', labelBytes[4]);
        }
Exemplo n.º 24
0
                public void Mostrar(Lbl.Articulos.Articulo articulo)
                {
                        this.EtiquetaTitulo.Text = "Conformación de existencias de " + articulo.ToString();

                        ListaConformacion.BeginUpdate();
                        ListaConformacion.Items.Clear();
                        System.Data.DataTable Situaciones = this.Connection.Select("SELECT id_situacion, nombre FROM articulos_situaciones WHERE id_situacion IN (SELECT DISTINCT id_situacion FROM articulos_stock WHERE id_articulo=" + articulo.Id.ToString() + ")");
                        
                        foreach (System.Data.DataRow Situacion in Situaciones.Rows) {
                                ListViewGroup Grupo = ListaConformacion.Groups.Add(Situacion["id_situacion"].ToString(), Situacion["nombre"].ToString());
                                System.Data.DataTable Articulos = this.Connection.Select("SELECT serie, cantidad FROM articulos_series WHERE cantidad<>0 AND id_articulo=" + articulo.Id.ToString() + " AND id_situacion=" + Situacion["id_situacion"].ToString());
                                foreach(System.Data.DataRow Articulo in Articulos.Rows){
                                        string Serie = Articulo["serie"].ToString();
                                        ListViewItem Itm = ListaConformacion.Items.Add(Serie);
                                        Itm.SubItems[0].Text = Serie;
                                        Itm.SubItems.Add(Lfx.Types.Formatting.FormatStock(System.Convert.ToDecimal(Articulo["cantidad"]), Lbl.Sys.Config.Articulos.Decimales));
                                        Itm.Group = Grupo;
                                }
                        }

                        DataTable Stocks = this.Connection.Select("SELECT id_articulo, id_situacion, cantidad FROM articulos_stock WHERE id_articulo=" + articulo.Id.ToString() + " AND cantidad<>0 AND id_situacion<>998 AND id_situacion<>999 ORDER BY id_situacion");

                        if (Stocks != null) {
                                ListViewGroup Grupo = ListaConformacion.Groups.Add("000", "Totales por depósito");

                                foreach (System.Data.DataRow Stock in Stocks.Rows) {
                                        Lfx.Data.Row Situacion = this.Connection.Row("articulos_situaciones", "id_situacion", System.Convert.ToInt32(Stock["id_situacion"]));

                                        ListViewItem Itm = ListaConformacion.Items.Add(Situacion["nombre"].ToString());
                                        Itm.SubItems.Add(Lfx.Types.Formatting.FormatStock(System.Convert.ToDecimal(Stock["cantidad"]), Lbl.Sys.Config.Articulos.Decimales));

                                        Itm.Group = Grupo;
                                }
                        }

                        ListaConformacion.EndUpdate();
                }
Exemplo n.º 25
0
        public void TestChangeLabel()
        {
            WorkbookStream macroWorkbookStream = new WorkbookStream(TestHelpers.GetMacroTestBytes());
            List <Lbl>     labels = macroWorkbookStream.GetAllRecordsByType <Lbl>();

            Lbl autoOpenLbl = labels.First(l => l.fBuiltin && l.Name.Value.Equals("\u0001"));

            Lbl replaceLabelStringLbl = ((BiffRecord)autoOpenLbl.Clone()).AsRecordType <Lbl>();

            replaceLabelStringLbl.SetName(new XLUnicodeStringNoCch("Auto_Open", true));
            replaceLabelStringLbl.fBuiltin = false;

            var cloneLabel  = ((BiffRecord)replaceLabelStringLbl.Clone()).AsRecordType <Lbl>();
            var cBytes      = cloneLabel.GetBytes();
            var rLabelBytes = replaceLabelStringLbl.GetBytes();

            Assert.AreEqual(rLabelBytes, cBytes);
            macroWorkbookStream = macroWorkbookStream.ReplaceRecord(autoOpenLbl, replaceLabelStringLbl);
            macroWorkbookStream = macroWorkbookStream.FixBoundSheetOffsets();

            ExcelDocWriter writer = new ExcelDocWriter();

            writer.WriteDocument(TestHelpers.AssemblyDirectory + Path.DirectorySeparatorChar + "changedLabel.xls", macroWorkbookStream.ToBytes());
        }
Exemplo n.º 26
0
        private Stream GenerateTop(int imageWidth)
        {
            if (_state.DistanceMeasurements == null)
            {
                return(null);
            }

            MemoryStream memory = null;
            Font         font   = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel);

            // Ultrasonic sensor reaches to about 3.5 meters; we scale the height of our display to this range:
            double maxExpectedRange = 5000.0d;  // mm

            int imageHeight = imageWidth / 2;

            using (Bitmap bmp = new Bitmap(imageWidth, imageHeight))
            {
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    g.Clear(Color.LightGray);

                    double angularOffset = -90 + _state.AngularRange / 2.0;
                    double piBy180       = Math.PI / 180.0;
                    double halfAngle     = _state.AngularResolution / 2.0;
                    double scale         = imageHeight / maxExpectedRange;
                    double drangeMax     = 0.0d;

                    GraphicsPath path = new GraphicsPath();

                    Dictionary <int, Lbl> labels = new Dictionary <int, Lbl>();

                    for (int pass = 0; pass != 2; pass++)
                    {
                        for (int i = 0; i < _state.DistanceMeasurements.Length; i++)
                        {
                            int range = _state.DistanceMeasurements[i];
                            if (range > 0 && range < 8192)
                            {
                                double angle     = i * _state.AngularResolution - angularOffset;
                                double lowAngle  = (angle - halfAngle) * piBy180;
                                double highAngle = (angle + halfAngle) * piBy180;

                                double drange = range * scale;

                                float lx = (float)(imageHeight + drange * Math.Cos(lowAngle));
                                float ly = (float)(imageHeight - drange * Math.Sin(lowAngle));
                                float hx = (float)(imageHeight + drange * Math.Cos(highAngle));
                                float hy = (float)(imageHeight - drange * Math.Sin(highAngle));

                                if (pass == 0)
                                {
                                    if (i == 0)
                                    {
                                        path.AddLine(imageHeight, imageHeight, lx, ly);
                                    }
                                    path.AddLine(lx, ly, hx, hy);

                                    drangeMax = Math.Max(drangeMax, drange);
                                }
                                else
                                {
                                    g.DrawLine(Pens.DarkBlue, lx, ly, hx, hy);

                                    if (i > 0 && i % 20 == 0 && i < _state.DistanceMeasurements.Length - 10)
                                    {
                                        float  llx        = (float)(imageHeight + drangeMax * 1.3f * Math.Cos(lowAngle));
                                        float  lly        = (float)(imageHeight - drangeMax * 1.3f * Math.Sin(lowAngle));
                                        double roundRange = Math.Round(range / 1000.0d, 1); // meters
                                        string str        = "" + roundRange;
                                        labels.Add(i, new Lbl()
                                        {
                                            label = str, lx = llx, ly = lly
                                        });
                                    }
                                }
                            }
                        }

                        if (pass == 0)
                        {
                            g.FillPath(Brushes.White, path);
                        }
                    }

                    float botWidth = (float)(190 * scale);
                    g.DrawLine(Pens.Red, imageHeight, imageHeight - botWidth, imageHeight, imageHeight);
                    g.DrawLine(Pens.Red, imageHeight - 3, imageHeight - botWidth, imageHeight + 3, imageHeight - botWidth);
                    g.DrawLine(Pens.Red, imageHeight - botWidth, imageHeight - 3, imageHeight - botWidth, imageHeight);
                    g.DrawLine(Pens.Red, imageHeight + botWidth, imageHeight - 3, imageHeight + botWidth, imageHeight);
                    g.DrawLine(Pens.Red, imageHeight - botWidth, imageHeight - 1, imageHeight + botWidth, imageHeight - 1);

                    g.DrawString(_state.TimeStamp.ToString(), font, Brushes.Black, 0, 0);

                    foreach (int x in labels.Keys)
                    {
                        Lbl lbl = labels[x];
                        g.DrawString(lbl.label, font, Brushes.Black, lbl.lx, lbl.ly);
                    }
                }

                memory = new MemoryStream();
                bmp.Save(memory, ImageFormat.Jpeg);
                memory.Position = 0;
            }
            return(memory);
        }
Exemplo n.º 27
0
 public DetalleArticulo(Lbl.Comprobantes.ComprobanteConArticulos comprobante, int itemId)
         : base(comprobante.Connection, itemId)
 {
         this.ElementoPadre = comprobante;
 }
Exemplo n.º 28
0
 public override Lfx.Types.OperationResult SolicitudEliminacion(Lbl.ListaIds codigos)
 {
         Lfx.Workspace.Master.RunTime.Execute("INSTANCIAR Lfc.Comprobantes.Recibos.Anular " + codigos[0].ToString());
         return new Lfx.Types.SuccessOperationResult();
 }
Exemplo n.º 29
0
        private Stream GenerateTop(int imageWidth)
        {
            SonarDataDssSerializable lsd = _state.MostRecentSonar;

            if (lsd == null)
            {
                return(null);
            }

            int nRays = lsd.RangeMeters.Length;

            MemoryStream memory = null;
            Font         font   = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel);

            // Ultrasonic sensor reaches to about 3.5 meters; we scale the height of our display to this range:
            double maxExpectedRange = 5000.0d;  // mm

            int imageHeight = imageWidth / 2;
            int extraHeight = 100;              // shows state of proximity sensors

            using (Bitmap bmp = new Bitmap(imageWidth, imageHeight + extraHeight))
            {
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    g.Clear(Color.LightGray);

                    double angularOffset = -90 + 180.0d / 2.0d;
                    double piBy180       = Math.PI / 180.0d;
                    double halfAngle     = 1.0d / 2.0d;
                    double scale         = imageHeight / maxExpectedRange;
                    double drangeMax     = 0.0d;

                    GraphicsPath path = new GraphicsPath();

                    Dictionary <int, Lbl> labels = new Dictionary <int, Lbl>();

                    for (int pass = 0; pass != 2; pass++)
                    {
                        for (int i = 0; i < nRays; i++)
                        {
                            int range = (int)(lsd.RangeMeters[i] * 1000.0d);

                            if (range > 0 && range < 8192)
                            {
                                double angle     = i * _state.AngularResolution - angularOffset;
                                double lowAngle  = (angle - halfAngle) * piBy180;
                                double highAngle = (angle + halfAngle) * piBy180;

                                double drange = range * scale;

                                float lx = (float)(imageHeight + drange * Math.Cos(lowAngle));
                                float ly = (float)(imageHeight - drange * Math.Sin(lowAngle));
                                float hx = (float)(imageHeight + drange * Math.Cos(highAngle));
                                float hy = (float)(imageHeight - drange * Math.Sin(highAngle));

                                if (pass == 0)
                                {
                                    if (i == 0)
                                    {
                                        path.AddLine(imageHeight, imageHeight, lx, ly);
                                    }
                                    path.AddLine(lx, ly, hx, hy);

                                    drangeMax = Math.Max(drangeMax, drange);
                                }
                                else
                                {
                                    g.DrawLine(Pens.DarkBlue, lx, ly, hx, hy);

                                    if (i > 0 && i % 2 == 0 && i < nRays - 1)
                                    {
                                        float  llx        = (float)(imageHeight + drangeMax * 1.3f * Math.Cos(lowAngle));
                                        float  lly        = (float)(imageHeight - drangeMax * 1.3f * Math.Sin(lowAngle));
                                        double roundRange = Math.Round(range / 1000.0d, 1); // meters
                                        string str        = "" + roundRange;
                                        labels.Add(i, new Lbl()
                                        {
                                            label = str, lx = llx, ly = lly
                                        });
                                    }
                                }
                            }
                        }

                        if (pass == 0)
                        {
                            g.FillPath(Brushes.White, path);
                        }
                    }

                    // now draw the robot. Trackroamer is 680 mm wide.
                    float botHalfWidth = (float)(680 / 2.0d * scale);
                    DrawHelper.drawRobotBoundaries(g, botHalfWidth, imageWidth / 2, imageHeight);

                    g.DrawString(lsd.TimeStamp.ToString(), font, Brushes.Black, 0, 0);

                    foreach (int x in labels.Keys)
                    {
                        Lbl lbl = labels[x];
                        g.DrawString(lbl.label, font, Brushes.Black, lbl.lx, lbl.ly);
                    }

                    // draw a 200x400 image of IR proximity sensors:

                    Rectangle drawRect = new Rectangle(imageWidth / 2 - extraHeight, imageHeight - extraHeight * 2, extraHeight * 2, extraHeight * 4);

                    if (_state.MostRecentProximity != null)
                    {
                        DrawHelper.drawProximityVectors(g, drawRect, _state.MostRecentProximity.arrangedForDrawing, 1);
                    }

                    if (_state.MostRecentParkingSensor != null)
                    {
                        DrawHelper.drawProximityVectors(g, drawRect, _state.MostRecentParkingSensor.arrangedForDrawing, 2);
                    }
                }

                memory = new MemoryStream();
                bmp.Save(memory, ImageFormat.Jpeg);
                memory.Position = 0;
            }
            return(memory);
        }
Exemplo n.º 30
0
                private void MostrarImpresoras(Lbl.ColeccionGenerica<Lbl.Impresion.TipoImpresora> impresoras)
                {
                        Listado.SuspendLayout();
                        Listado.Items.Clear();

                        if (impresoras != null) {
                                foreach (Lbl.Impresion.TipoImpresora Impr in impresoras) {
                                        this.MostrarImpresora(Impr);
                                }
                        }

                        Listado.ResumeLayout();
                }
Exemplo n.º 31
0
                private void MostrarImpresora(Lbl.Impresion.TipoImpresora impresora)
                {
                        string Key = impresora.GetHashCode().ToString();
                        ListViewItem Itm = Listado.Items.Add(Key, Key, 0);
                        Itm.Tag = impresora;

                        if (impresora.Sucursal == null)
                                Itm.SubItems.Add("Todas");
                        else
                                Itm.SubItems.Add(impresora.Sucursal.Nombre);

                        if (impresora.Estacion == null)
                                Itm.SubItems.Add("Todas");
                        else
                                Itm.SubItems.Add(impresora.Estacion);

                        if (impresora.PuntoDeVenta == null)
                                Itm.SubItems.Add("Todos");
                        else
                                Itm.SubItems.Add(impresora.PuntoDeVenta.ToString());

                        Itm.SubItems.Add(impresora.Impresora.ToString());
                }
Exemplo n.º 32
0
 public NotificacionMemoria(Lbl.Personas.Persona destinatario, string estacionDestino)
         : this()
 {
         this.Destinatario = destinatario;
         this.EstacionDestino = estacionDestino;
 }
Exemplo n.º 33
0
 public CuentaCorriente(Lbl.Personas.Persona persona)
 {
         this.Persona = persona;
 }
Exemplo n.º 34
0
                public static decimal DescancelarImpagos(Lbl.Personas.Persona cliente, Lbl.Comprobantes.ColeccionComprobanteImporte listaComprob, Lbl.Comprobantes.Comprobante comprob, decimal importe)
                {
                        // Doy los comprob por cancelados
                        decimal TotalACancelar = Math.Abs(importe);

                        //"Descancelo" comprob
                        if (listaComprob != null && listaComprob.Count > 0) {
                                // Si hay una lista de comprob, los descancelo
                                foreach (ComprobanteImporte CompImp in listaComprob) {
                                        // Intento descancelar todo
                                        decimal Cancelando = CompImp.Importe;

                                        // Si mes demasiado, hago un pago parcial
                                        if (Cancelando > CompImp.Comprobante.ImporteCancelado)
                                                Cancelando = CompImp.Comprobante.ImporteCancelado;

                                        // Si se acabó la plata, hago un pago parcial
                                        if (Cancelando > TotalACancelar)
                                                Cancelando = TotalACancelar;

                                        // Si alcanzo a cancelar algo, lo asiento
                                        if (Cancelando > 0)
                                                CompImp.Comprobante.DescancelarImporte(Cancelando, comprob);

                                        TotalACancelar = TotalACancelar - Cancelando;
                                        if (TotalACancelar == 0)
                                                break;
                                }
                        }

                        if (TotalACancelar > 0) {
                                // Si queda más saldo, sigo buscando facturas a descancelar
                                qGen.Select SelFacConSaldo = new qGen.Select("comprob");
                                SelFacConSaldo.WhereClause = new qGen.Where();
                                SelFacConSaldo.WhereClause.AddWithValue("impresa", qGen.ComparisonOperators.NotEqual, 0);
                                SelFacConSaldo.WhereClause.AddWithValue("anulada", 0);
                                SelFacConSaldo.WhereClause.AddWithValue("numero", qGen.ComparisonOperators.GreaterThan, 0);
                                SelFacConSaldo.WhereClause.AddWithValue("id_formapago", qGen.ComparisonOperators.In, new int[] { 1, 3, 99 });
                                SelFacConSaldo.WhereClause.AddWithValue("cancelado", qGen.ComparisonOperators.GreaterThan, 0);
                                SelFacConSaldo.WhereClause.AddWithValue("id_cliente", cliente.Id);
                                SelFacConSaldo.WhereClause.AddWithValue("tipo_fac", qGen.ComparisonOperators.In, new string[] { "FA", "FB", "FC", "FE", "FM", "NDA", "NDB", "NDC", "NDE", "NDM" });
                                if (importe > 0) {
                                        // Cancelo facturas y ND regulares
                                        SelFacConSaldo.WhereClause.AddWithValue("compra", 0);
                                } else {
                                        // Cancelo facturas y de compra
                                        SelFacConSaldo.WhereClause.AddWithValue("compra", qGen.ComparisonOperators.NotEqual, 0);
                                }
                                SelFacConSaldo.Order = "id_comprob DESC";
                                using (System.Data.DataTable FacturasConSaldo = cliente.Connection.Select(SelFacConSaldo)) {
                                        foreach (System.Data.DataRow Factura in FacturasConSaldo.Rows) {
                                                Lbl.Comprobantes.ComprobanteConArticulos Fact = new ComprobanteConArticulos(cliente.Connection, (Lfx.Data.Row)Factura);

                                                decimal SaldoFactura = Fact.ImporteCancelado;
                                                decimal ImporteASaldar = SaldoFactura;

                                                if (ImporteASaldar > TotalACancelar)
                                                        ImporteASaldar = TotalACancelar;

                                                Fact.DescancelarImporte(ImporteASaldar, comprob);

                                                TotalACancelar -= ImporteASaldar;

                                                if (TotalACancelar <= 0)
                                                        break;
                                        }
                                }
                        }

                        /* if (TotalACancelar > 0) {
                                Lbl.Cajas.Concepto Conc;
                                if (comprob is Recibo)
                                        Conc = ((Recibo)comprob).Concepto;
                                else
                                        Conc = Lbl.Cajas.Concepto.AjustesYMovimientos;
                                cliente.CuentaCorriente.Movimiento(true, Conc, "Anulación de " + comprob.ToString(), TotalACancelar * DireccionCtaCte, comprob.Obs, comprob as Lbl.Comprobantes.ComprobanteConArticulos, comprob as Lbl.Comprobantes.Recibo, null);
                                TotalACancelar = 0;
                        } */

                        // Devuelvo el sobrante
                        return TotalACancelar;
                }
Exemplo n.º 35
0
                public void Movimiento(bool auto, Lbl.Cajas.Concepto concepto, string textoConcepto,
                        Lbl.Personas.Persona cliente, decimal importe, string obs,
                        Lbl.Comprobantes.ComprobanteConArticulos factura, Lbl.Comprobantes.Recibo recibo, string comprobantes)
                {
                        if (Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(this, Lbl.Sys.Permisos.Operaciones.Mover) == false) {
                                throw new Lfx.Types.Exceptions.AccessDeniedException("No tiene permiso para hacer movimientos en la caja solicitada");
                        }

                        decimal SaldoActual = this.ObtenerSaldo(true);

                        qGen.TableCommand InsertarMovimiento = new qGen.Insert(this.Connection, "cajas_movim");
			InsertarMovimiento.Fields.AddWithValue("id_caja", this.Id);
			InsertarMovimiento.Fields.AddWithValue("auto", auto ? 1 : 0);
                        if (concepto == null)
                                InsertarMovimiento.Fields.AddWithValue("id_concepto", null);
                        else
                                InsertarMovimiento.Fields.AddWithValue("id_concepto", concepto.Id);
                        InsertarMovimiento.Fields.AddWithValue("concepto", textoConcepto);
                        InsertarMovimiento.Fields.AddWithValue("id_persona", Lbl.Sys.Config.Actual.UsuarioConectado.Id);
                        if (cliente == null)
                                InsertarMovimiento.Fields.AddWithValue("id_cliente", null);
                        else
                                InsertarMovimiento.Fields.AddWithValue("id_cliente", cliente.Id);
			InsertarMovimiento.Fields.AddWithValue("fecha", qGen.SqlFunctions.Now);
			InsertarMovimiento.Fields.AddWithValue("importe", importe);
                        if (factura == null)
                                InsertarMovimiento.Fields.AddWithValue("id_comprob", null);
                        else
                                InsertarMovimiento.Fields.AddWithValue("id_comprob", factura.Id);
                        if (recibo == null)
                                InsertarMovimiento.Fields.AddWithValue("id_recibo", null);
                        else
                                InsertarMovimiento.Fields.AddWithValue("id_recibo", recibo.Id);
			InsertarMovimiento.Fields.AddWithValue("comprob", comprobantes);
			InsertarMovimiento.Fields.AddWithValue("saldo", SaldoActual + importe);
			InsertarMovimiento.Fields.AddWithValue("obs", obs);
			this.Connection.Execute(InsertarMovimiento);
		}
Exemplo n.º 36
0
 public DetalleArticulo(Lbl.Comprobantes.ComprobanteConArticulos comprobante, Lfx.Data.Row row)
         : base(comprobante.Connection, row)
 {
         this.ElementoPadre = comprobante;
 }
Exemplo n.º 37
0
 public ImpresorComprobante(Lbl.ElementoDeDatos elemento, IDbTransaction transaction)
         : base(elemento, transaction) { }
Exemplo n.º 38
0
                /// <summary>
                /// Asienta un movimiento en la cuenta corriente, y cancela comprobantes asociados.
                /// </summary>
                /// <param name="auto">Indica si es un movimiento automático (generado por el sistema) o manual (generado por el usuario).</param>
                /// <param name="concepto">El concepto bajo el cual se realiza el movimiento.</param>
                /// <param name="textoConcepto">El texto que describe al concepto.</param>
                /// <param name="importeDebito">El importe a debitar de la cuenta. Un importe negativo indica un crédito.</param>
                /// <param name="obs">Observaciones.</param>
                /// <param name="comprob">El comprobante asociado a este movimiento.</param>
                /// <param name="recibo">El recibo asociado a este movimiento.</param>
                /// <param name="textoComprob">Un texto sobre los comprobantes asociados al sistema.</param>
                /// <param name="extras">Colección de campos adicionales para el registro.</param>
                public void Movimiento(bool auto, 
                        Lbl.Cajas.Concepto concepto,
                        string textoConcepto,
                        decimal importeDebito,
                        string obs,
                        Lbl.Comprobantes.ComprobanteConArticulos comprob,
                        Lbl.Comprobantes.Recibo recibo,
                        string textoComprob,
                        Dictionary<string, object> extras)
                {
                        decimal SaldoActual = this.ObtenerSaldo(true);
                        decimal NuevoSaldo = SaldoActual + importeDebito;

                        qGen.Insert ComandoInsertarMovimiento = new qGen.Insert(this.Connection, this.TablaDatos);
				
                        ComandoInsertarMovimiento.Fields.AddWithValue("auto", auto ? (int)1 : (int)0);
                        if (concepto == null)
                                ComandoInsertarMovimiento.Fields.AddWithValue("id_concepto", null);
                        else
                                ComandoInsertarMovimiento.Fields.AddWithValue("id_concepto", concepto.Id);
                        ComandoInsertarMovimiento.Fields.AddWithValue("concepto", textoConcepto);
                        ComandoInsertarMovimiento.Fields.AddWithValue("id_cliente", this.Persona.Id);
			ComandoInsertarMovimiento.Fields.AddWithValue("fecha", qGen.SqlFunctions.Now);
                        ComandoInsertarMovimiento.Fields.AddWithValue("importe", importeDebito);
                        if (comprob == null)
                                ComandoInsertarMovimiento.Fields.AddWithValue("id_comprob", null);
                        else
                                ComandoInsertarMovimiento.Fields.AddWithValue("id_comprob", comprob.Id);
                        if (recibo == null)
                                ComandoInsertarMovimiento.Fields.AddWithValue("id_recibo", null);
                        else
                                ComandoInsertarMovimiento.Fields.AddWithValue("id_recibo", recibo.Id);
                        ComandoInsertarMovimiento.Fields.AddWithValue("comprob", textoComprob);
                        ComandoInsertarMovimiento.Fields.AddWithValue("saldo", NuevoSaldo);
                        ComandoInsertarMovimiento.Fields.AddWithValue("obs", obs);

                        if (extras != null && extras.Count > 0) {
                                foreach (KeyValuePair<string, object> extra in extras) {
                                        ComandoInsertarMovimiento.Fields.AddWithValue(extra.Key, extra.Value);
                                }
                        }
                        this.Connection.Execute(ComandoInsertarMovimiento);

                        qGen.Update ComandoActualizarCliente = new qGen.Update("personas");
                        ComandoActualizarCliente.Fields.AddWithValue("saldo_ctacte", NuevoSaldo);
                        ComandoActualizarCliente.WhereClause = new qGen.Where("id_persona", this.Persona.Id);
                        this.Connection.Execute(ComandoActualizarCliente);
                }
Exemplo n.º 39
0
 public virtual Lfx.Types.OperationResult SolicitudEliminacion(Lbl.ListaIds codigos)
 {
         return this.DesactivarRegistros(codigos);
 }
Exemplo n.º 40
0
                private void QuitarImpresora(Lbl.Impresion.TipoImpresora impresora)
                {
                        Lbl.Comprobantes.Tipo Tipo = this.Elemento as Lbl.Comprobantes.Tipo;

                        Tipo.Impresoras.Remove(impresora);
                        Listado.Items.RemoveByKey(impresora.GetHashCode().ToString());
                }
Exemplo n.º 41
0
        public WorkbookStream AddLabel(string label, Stack <AbstractPtg> rgce, bool isHidden = false, bool isUnicode = false, bool isMacroStack = false)
        {
            /*
             * Labels require a reference to an XTI index which is used to say which
             * BoundSheet8 record maps to the appropriate tab. In order to make this
             * record we need a SupBook record, and ExternSheet record to specify
             * which BoundSheet8 record to use.
             */

            List <SupBook>     supBooksExisting     = WbStream.GetAllRecordsByType <SupBook>();
            List <ExternSheet> externSheetsExisting = WbStream.GetAllRecordsByType <ExternSheet>();
            List <Lbl>         existingLbls         = WbStream.GetAllRecordsByType <Lbl>();

            ExternSheet lastExternSheet;

            if (supBooksExisting.Count > 0 || externSheetsExisting.Count > 0)
            {
                lastExternSheet = externSheetsExisting.Last();
            }
            else
            {
                InitializeGlobalStreamLabels();
                lastExternSheet = WbStream.GetAllRecordsByType <ExternSheet>().Last();;
            }

            // For now we assume that any labels being added belong to the last BoundSheet8 we added
            Lbl newLbl = new Lbl(label, (ushort)(WbStream.GetAllRecordsByType <BoundSheet8>().Count));

            if (isUnicode)
            {
                newLbl.SetName(new XLUnicodeStringNoCch(label, true));
            }

            if (isMacroStack)
            {
                newLbl.fProc = true;
                newLbl.fFunc = true;
            }

            if (isHidden)
            {
                newLbl.fHidden = true;
            }

            if (rgce != null)
            {
                newLbl.SetRgce(rgce);
            }
            else
            {
                newLbl.cce = 0;
            }

            if (existingLbls.Count > 0)
            {
                WbStream = WbStream.InsertRecord(newLbl, existingLbls.Last());
            }
            else
            {
                WbStream = WbStream.InsertRecord(newLbl, lastExternSheet);
            }

            WbStream = WbStream.FixBoundSheetOffsets();
            return(WbStream);
        }
Exemplo n.º 42
0
 public void Movimiento(bool auto,
         Lbl.Cajas.Concepto concepto,
         string textoConcepto,
         decimal importeDebito,
         string obs,
         Lbl.Comprobantes.ComprobanteConArticulos comprob,
         Lbl.Comprobantes.Recibo recibo,
         string textoComprob)
 {
         this.Movimiento(auto, concepto, textoConcepto, importeDebito, obs, comprob, recibo, textoComprob, null);
 }
Exemplo n.º 43
0
 /// <summary>
 /// add a definedName data object
 /// </summary>
 /// <param name="name"></param>
 public void addDefinedName(Lbl name)
 {
     this.definedNameList.Add(name);
 }
Exemplo n.º 44
0
 public ComprobanteImporte(Lbl.Comprobantes.ComprobanteConArticulos comprob, decimal importe)
 {
         this.Comprobante = comprob;
         this.Importe = importe;
 }
Exemplo n.º 45
0
                public Lfx.Types.OperationResult CancelarImporte(decimal importe, Lbl.Comprobantes.Comprobante comprob)
		{
			if(this.ImporteCancelado + importe > this.Total)
                                throw new Lfx.Types.DomainException("ComprobanteConArticulos.CancelarImporte: El importe a cancelar no puede ser mayor que el saldo impago");
			this.ImporteCancelado += importe;
			qGen.Update Actualizar = new qGen.Update("comprob", new qGen.Where("id_comprob", this.Id));
			Actualizar.Fields.AddWithValue("cancelado", this.ImporteCancelado);
			this.Connection.Execute(Actualizar);

                        if (comprob is Lbl.Comprobantes.Recibo) {
                                qGen.Insert AsentarComprobantesDeEsteRecibo = new qGen.Insert("recibos_comprob");
                                AsentarComprobantesDeEsteRecibo.Fields.AddWithValue("id_comprob", this.Id);
                                AsentarComprobantesDeEsteRecibo.Fields.AddWithValue("id_recibo", comprob.Id);
                                AsentarComprobantesDeEsteRecibo.Fields.AddWithValue("importe", importe);
                                this.Connection.Execute(AsentarComprobantesDeEsteRecibo);
                        } else if (comprob is Lbl.Comprobantes.ComprobanteConArticulos) {
                                Lbl.Comprobantes.ComprobanteConArticulos factura = comprob as Lbl.Comprobantes.ComprobanteConArticulos;
                                qGen.Insert AsentarComprobantesDeEsteRecibo = new qGen.Insert("comprob_comprob");
                                AsentarComprobantesDeEsteRecibo.Fields.AddWithValue("id_comprob", factura.Id);
                                AsentarComprobantesDeEsteRecibo.Fields.AddWithValue("id_comprob_rel", this.Id);
                                AsentarComprobantesDeEsteRecibo.Fields.AddWithValue("importe", importe);
                                this.Connection.Execute(AsentarComprobantesDeEsteRecibo);
                        }
			return new Lfx.Types.SuccessOperationResult();
		}
Exemplo n.º 46
0
        public WorkbookStream AddLabel(string label, Stack <AbstractPtg> rgce, bool isHidden = false, bool isUnicode = false, bool isMacroStack = false)
        {
            /*
             * Labels require a reference to an XTI index which is used to say which
             * BoundSheet8 record maps to the appropriate tab. In order to make this
             * record we need a SupBook record, and ExternSheet record to specify
             * which BoundSheet8 record to use.
             *
             * Currently this assumes there are no SupBook or ExternSheet records in
             * use, handling of these cases for complex decoy docs is coming
             * in the future.
             *
             * TODO handle existing SupBook/ExternSheet records when adding Lbl entries
             */

            List <SupBook>     supBooksExisting     = WbStream.GetAllRecordsByType <SupBook>();
            List <ExternSheet> externSheetsExisting = WbStream.GetAllRecordsByType <ExternSheet>();
            List <Lbl>         existingLbls         = WbStream.GetAllRecordsByType <Lbl>();

            ExternSheet lastExternSheet;

            if (supBooksExisting.Count > 0 || externSheetsExisting.Count > 0)
            {
                lastExternSheet = externSheetsExisting.Last();
            }
            else
            {
                InitializeGlobalStreamLabels();
                lastExternSheet = WbStream.GetAllRecordsByType <ExternSheet>().Last();;
            }

            Lbl newLbl = new Lbl(label, 0);

            if (isUnicode)
            {
                newLbl.SetName(new XLUnicodeStringNoCch(label, true));
            }

            if (isMacroStack)
            {
                newLbl.fProc = true;
                newLbl.fFunc = true;
            }

            if (isHidden)
            {
                newLbl.fHidden = true;
            }

            if (rgce != null)
            {
                newLbl.SetRgce(rgce);
            }
            else
            {
                newLbl.cce = 0;
            }

            if (existingLbls.Count > 0)
            {
                WbStream = WbStream.InsertRecord(newLbl, existingLbls.Last());
            }
            else
            {
                WbStream = WbStream.InsertRecord(newLbl, lastExternSheet);
            }

            WbStream = WbStream.FixBoundSheetOffsets();
            return(WbStream);
        }
Exemplo n.º 47
0
                public Lfx.Types.OperationResult DescancelarImporte(decimal importe, Lbl.Comprobantes.Comprobante comprob)
                {
                        if (importe > this.ImporteCancelado)
                                throw new Lfx.Types.DomainException("ComprobanteConArticulos.CancelarImporte: El importe a cancelar no puede ser mayor que el saldo impago");
                        this.ImporteCancelado -= importe;
                        qGen.Update Actualizar = new qGen.Update("comprob", new qGen.Where("id_comprob", this.Id));
                        Actualizar.Fields.AddWithValue("cancelado", this.ImporteCancelado);
                        this.Connection.Execute(Actualizar);

                        // Debería eliminar la asociación entre este comprobante y el recibo (o NC) que lo canceló orignalmente?
                        return new Lfx.Types.SuccessOperationResult();
                }
    public override void Init(StateMachine sm)
    {
        PlaySong_RequirePremium expressionStack_20_0;
        PlaySong_RequirePremium expressionStack_F_0;
        PlaySong_RequirePremium expressionStack_5B_0;
        PlaySong_RequirePremium expressionStack_37_0;
        PlaySong_RequirePremium expressionStack_BB_0;
        PlaySong_RequirePremium expressionStack_A0_0;
        PlaySong_RequirePremium expressionStack_115_0;
        PlaySong_RequirePremium expressionStack_FA_0;
        PlaySong_RequirePremium expressionStack_4A_0;
        PlaySong_RequirePremium expressionStack_147_0;
        PlaySong_RequirePremium expressionStack_12C_0;
        PlaySong_RequirePremium expressionStack_18A_0;
        PlaySong_RequirePremium expressionStack_16F_0;
        PlaySong_RequirePremium expressionStack_1BC_0;
        PlaySong_RequirePremium expressionStack_1A1_0;
        PlaySong_RequirePremium expressionStack_1EE_0;
        PlaySong_RequirePremium expressionStack_1D3_0;

        base.Init(sm);
        if (c81193aa65fc97f84386cf99073fed074 != null)
        {
            expressionStack_20_0 = this;
            goto Label_0020;
        }
        else
        {
            expressionStack_F_0 = this;
        }
        c81193aa65fc97f84386cf99073fed074 = new Lbl.GetText(PlaySong_RequirePremium.c395d9350e4a64cb4289d2d20ca271bbe);
        expressionStack_20_0 = expressionStack_F_0;
Label_0020:
        expressionStack_20_0.LblTitle = new Lbl(c81193aa65fc97f84386cf99073fed074);
        if (c73ae2378544bd2d8e513b1f4e8f3b38b != null)
        {
            expressionStack_5B_0 = this;
            goto Label_005B;
        }
        else
        {
            expressionStack_37_0 = this;
        }
Label_0037:
        switch (1)
        {
        case 0:
            goto Label_0037;

        default:
        {
            PlaySong_RequirePremium expressionStack_44_0;
            PlaySong_RequirePremium expressionStack_41_0 = expressionStack_37_0;
            if (1 != 0)
            {
                expressionStack_4A_0 = expressionStack_41_0;
                break;
            }
            else
            {
                expressionStack_44_0 = expressionStack_41_0;
            }
            expressionStack_4A_0 = expressionStack_44_0;
            break;
        }
        }
        c73ae2378544bd2d8e513b1f4e8f3b38b = new Lbl.GetText(PlaySong_RequirePremium.cab7727bce9cf1b6c786fe6ea3a1b18f6);
        expressionStack_5B_0 = expressionStack_4A_0;
Label_005B:
        expressionStack_5B_0.LblSubtitle = new Lbl(c73ae2378544bd2d8e513b1f4e8f3b38b);
        this.LblSongTitle  = new Lbl(new Lbl.GetText(this.c2939d478ffde8d3388f9ad7f73b0cf57));
        this.LblSongArtist = new Lbl(new Lbl.GetText(this.c7a6da1369248c5888b04b477f361c985));
        if (c1ce592135371948ec3c8f698cb09a483 != null)
        {
            expressionStack_BB_0 = this;
            goto Label_00BB;
        }
        else
        {
            expressionStack_A0_0 = this;
        }
Label_00A0:
        switch (2)
        {
        case 0:
            goto Label_00A0;

        default:
        {
            PlaySong_RequirePremium expressionStack_AA_0 = expressionStack_A0_0;
            c1ce592135371948ec3c8f698cb09a483 = new Lbl.GetText(PlaySong_RequirePremium.cc84234cbaed601c3a25467d8c5bfc086);
            expressionStack_BB_0 = expressionStack_AA_0;
            break;
        }
        }
Label_00BB:
        expressionStack_BB_0.BtnBuy = new Btn(new Lbl(c1ce592135371948ec3c8f698cb09a483), new Btn.BtnPressEvent(this.cce55ab874645c60e2c713909a5c95fd0));
        this.LblCost = new Lbl(new Lbl.GetText(this.c435a2cdfa1d38583d1cc1c478a1aa4e9));
        if (cf206ec275150451ba064513906a44697 != null)
        {
            expressionStack_115_0 = this;
            goto Label_0115;
        }
        else
        {
            expressionStack_FA_0 = this;
        }
Label_00FA:
        switch (7)
        {
        case 0:
            goto Label_00FA;

        default:
        {
            PlaySong_RequirePremium expressionStack_104_0 = expressionStack_FA_0;
            cf206ec275150451ba064513906a44697 = new Lbl.GetText(PlaySong_RequirePremium.cc89b598ee217930d16cc6d62419eedfe);
            expressionStack_115_0             = expressionStack_104_0;
            break;
        }
        }
Label_0115:
        expressionStack_115_0.LblBuyInfo = new Lbl(cf206ec275150451ba064513906a44697);
        if (c97629f23073677692295ce76aea0d41c != null)
        {
            expressionStack_147_0 = this;
            goto Label_0147;
        }
        else
        {
            expressionStack_12C_0 = this;
        }
Label_012C:
        switch (2)
        {
        case 0:
            goto Label_012C;

        default:
        {
            PlaySong_RequirePremium expressionStack_136_0 = expressionStack_12C_0;
            c97629f23073677692295ce76aea0d41c = new Lbl.GetText(PlaySong_RequirePremium.c62028644c106b943b66a63f9e8ff8ca0);
            expressionStack_147_0             = expressionStack_136_0;
            break;
        }
        }
Label_0147:
        expressionStack_147_0.BtnShop = new Btn(new Lbl(c97629f23073677692295ce76aea0d41c), new Btn.BtnPressEvent(this.c396b2cb8e50d2a36fe984f811d71fd9b));
        if (c08fe855b4c02fd4c727a9ea28f38a1ca != null)
        {
            expressionStack_18A_0 = this;
            goto Label_018A;
        }
        else
        {
            expressionStack_16F_0 = this;
        }
Label_016F:
        switch (4)
        {
        case 0:
            goto Label_016F;

        default:
        {
            PlaySong_RequirePremium expressionStack_179_0 = expressionStack_16F_0;
            c08fe855b4c02fd4c727a9ea28f38a1ca = new Lbl.GetText(PlaySong_RequirePremium.cc00e8fecf68433b0803e84ea056a0757);
            expressionStack_18A_0             = expressionStack_179_0;
            break;
        }
        }
Label_018A:
        expressionStack_18A_0.LblShopInfo = new Lbl(c08fe855b4c02fd4c727a9ea28f38a1ca);
        if (ce31b5faf9a61d6000272aaf2d1472ded != null)
        {
            expressionStack_1BC_0 = this;
            goto Label_01BC;
        }
        else
        {
            expressionStack_1A1_0 = this;
        }
Label_01A1:
        switch (1)
        {
        case 0:
            goto Label_01A1;

        default:
        {
            PlaySong_RequirePremium expressionStack_1AB_0 = expressionStack_1A1_0;
            ce31b5faf9a61d6000272aaf2d1472ded = new Lbl.GetText(PlaySong_RequirePremium.c5aec49661365f97deb8dd47dfdd30ff3);
            expressionStack_1BC_0             = expressionStack_1AB_0;
            break;
        }
        }
Label_01BC:
        expressionStack_1BC_0.LblTotal = new Lbl(ce31b5faf9a61d6000272aaf2d1472ded);
        if (ca94b848db1a3d378fe7b61d2bd6aaaf3 != null)
        {
            expressionStack_1EE_0 = this;
            goto Label_01EE;
        }
        else
        {
            expressionStack_1D3_0 = this;
        }
Label_01D3:
        switch (5)
        {
        case 0:
            goto Label_01D3;

        default:
        {
            PlaySong_RequirePremium expressionStack_1DD_0 = expressionStack_1D3_0;
            ca94b848db1a3d378fe7b61d2bd6aaaf3 = new Lbl.GetText(PlaySong_RequirePremium.c0881b82407d67be10ed19a8b69dc797a);
            expressionStack_1EE_0             = expressionStack_1DD_0;
            break;
        }
        }
Label_01EE:
        expressionStack_1EE_0.LblCoinsCount = new Lbl(ca94b848db1a3d378fe7b61d2bd6aaaf3);
    }
Exemplo n.º 49
0
 public DetalleArticulo(Lbl.ElementoDeDatos elementoPadre)
         : base(elementoPadre.Connection)
 {
         this.ElementoPadre = elementoPadre;
 }
Exemplo n.º 50
0
                public virtual Lfx.Types.OperationResult DesactivarRegistros(Lbl.ListaIds codigos)
                {
                        System.Data.IDbTransaction Trans = this.Connection.BeginTransaction();

                        qGen.Select SelElementos = new qGen.Select(this.AtributoDatos.TablaDatos);
                        SelElementos.WhereClause = new qGen.Where(this.AtributoDatos.CampoId, qGen.ComparisonOperators.In, codigos.ToArray());

                        System.Data.DataTable TablaElementos = this.Connection.Select(SelElementos);
                        foreach (System.Data.DataRow RegElem in TablaElementos.Rows) {
                                Lbl.IElementoDeDatos Elem = Lbl.Instanciador.Instanciar(this.ElementoTipo, this.Connection, (Lfx.Data.Row)RegElem);
                                if (Elem is Lbl.IEstadosEstandar)
                                        ((Lbl.IEstadosEstandar)(Elem)).Activar(false);
                        }
                        Trans.Commit();

                        return new Lfx.Types.SuccessOperationResult();
                }
Exemplo n.º 51
0
        /// <summary>
        /// Extracts the data from the stream
        /// </summary>
        public override void extractData()
        {
            BiffHeader bh;

            //try
            //{
            while (this.StreamReader.BaseStream.Position < this.StreamReader.BaseStream.Length)
            {
                bh.id     = (RecordType)this.StreamReader.ReadUInt16();
                bh.length = this.StreamReader.ReadUInt16();
                // Debugging output
                TraceLogger.DebugInternal("BIFF {0}\t{1}\t", bh.id, bh.length);

                switch (bh.id)
                {
                case RecordType.BoundSheet8:
                {
                    // Extracts the Boundsheet data
                    BoundSheet8 bs = new BoundSheet8(this.StreamReader, bh.id, bh.length);
                    TraceLogger.DebugInternal(bs.ToString());

                    SheetData sheetData = null;

                    switch (bs.dt)
                    {
                    case BoundSheet8.SheetType.Worksheet:
                        sheetData      = new WorkSheetData();
                        this.oldOffset = this.StreamReader.BaseStream.Position;
                        this.StreamReader.BaseStream.Seek(bs.lbPlyPos, SeekOrigin.Begin);
                        WorksheetExtractor se = new WorksheetExtractor(this.StreamReader, sheetData as WorkSheetData);
                        this.StreamReader.BaseStream.Seek(oldOffset, SeekOrigin.Begin);
                        break;

                    case BoundSheet8.SheetType.Chartsheet:
                        ChartSheetData chartSheetData = new ChartSheetData();

                        this.oldOffset = this.StreamReader.BaseStream.Position;
                        this.StreamReader.BaseStream.Seek(bs.lbPlyPos, SeekOrigin.Begin);
                        chartSheetData.ChartSheetSequence = new ChartSheetSequence(this.StreamReader);
                        this.StreamReader.BaseStream.Seek(oldOffset, SeekOrigin.Begin);

                        sheetData = chartSheetData;
                        break;

                    default:
                        TraceLogger.Info("Unsupported sheet type: {0}", bs.dt);
                        break;
                    }

                    if (sheetData != null)
                    {
                        // add general sheet info
                        sheetData.boundsheetRecord = bs;
                        this.workBookData.addBoundSheetData(sheetData);
                    }
                }
                break;

                case RecordType.Template:
                {
                    this.workBookData.Template = true;
                }
                break;

                case RecordType.SST:
                {
                    /* reads the shared string table biff record and following continue records
                     * creates an array of bytes and then puts that into a memory stream
                     * this all is used to create a longer biffrecord then 8224 bytes. If theres a string
                     * beginning in the SST that is then longer then the 8224 bytes, it continues in the
                     * CONTINUE BiffRecord, so the parser has to read over the SST border.
                     * The problem here is, that the parser has to overread the continue biff record header
                     */
                    //SST sst;
                    //UInt16 length = bh.length;

                    //// save the old offset from this record begin
                    //this.oldOffset = this.StreamReader.BaseStream.Position;
                    //// create a list of bytearrays to store the following continue records
                    //// List<byte[]> byteArrayList = new List<byte[]>();
                    //byte[] buffer = new byte[length];
                    //LinkedList<VirtualStreamReader> vsrList = new LinkedList<VirtualStreamReader>();
                    //buffer = this.StreamReader.ReadBytes((int)length);
                    //// byteArrayList.Add(buffer);

                    //// create a new memory stream and a new virtualstreamreader
                    //MemoryStream bufferstream = new MemoryStream(buffer);
                    //VirtualStreamReader binreader = new VirtualStreamReader(bufferstream);
                    //BiffHeader bh2;
                    //bh2.id = (RecordType)this.StreamReader.ReadUInt16();

                    //while (bh2.id == RecordType.Continue)
                    //{
                    //    bh2.length = (UInt16)(this.StreamReader.ReadUInt16());

                    //    buffer = new byte[bh2.length];

                    //    // create a buffer with the bytes from the records and put that array into the
                    //    // list
                    //    buffer = this.StreamReader.ReadBytes((int)bh2.length);
                    //    // byteArrayList.Add(buffer);

                    //    // create for each continue record a new streamreader !!
                    //    MemoryStream contbufferstream = new MemoryStream(buffer);
                    //    VirtualStreamReader contreader = new VirtualStreamReader(contbufferstream);
                    //    vsrList.AddLast(contreader);


                    //    // take next Biffrecord ID
                    //    bh2.id = (RecordType)this.StreamReader.ReadUInt16();
                    //}
                    //// set the old position of the stream
                    //this.StreamReader.BaseStream.Position = this.oldOffset;

                    SST sst = new SST(this.StreamReader, bh.id, bh.length);
                    //this.StreamReader.BaseStream.Position = this.oldOffset + bh.length;
                    this.workBookData.SstData = sst;
                }
                break;

                case RecordType.EOF:
                {
                    // Reads the end of the internal file !!!
                    this.StreamReader.BaseStream.Seek(0, SeekOrigin.End);
                }
                break;

                case RecordType.ExternSheet:
                {
                    ExternSheet extsheet = new ExternSheet(this.StreamReader, bh.id, bh.length);
                    this.externSheets.Add(extsheet);
                    this.workBookData.addExternSheetData(extsheet);
                }
                break;

                case RecordType.SupBook:
                {
                    SupBook supbook = new SupBook(this.StreamReader, bh.id, bh.length);
                    this.supBooks.Add(supbook);
                    this.workBookData.addSupBookData(supbook);
                }
                break;

                case RecordType.XCT:
                {
                    XCT xct = new XCT(this.StreamReader, bh.id, bh.length);
                    this.XCTList.Add(xct);
                    this.workBookData.addXCT(xct);
                }
                break;

                case RecordType.CRN:
                {
                    CRN crn = new CRN(this.StreamReader, bh.id, bh.length);
                    this.CRNList.Add(crn);
                    this.workBookData.addCRN(crn);
                }
                break;

                case RecordType.ExternName:
                {
                    ExternName externname = new ExternName(this.StreamReader, bh.id, bh.length);
                    this.workBookData.addEXTERNNAME(externname);
                }
                break;

                case RecordType.Format:
                {
                    Format format = new Format(this.StreamReader, bh.id, bh.length);
                    this.workBookData.styleData.addFormatValue(format);
                }
                break;

                case RecordType.XF:
                {
                    XF xf = new XF(this.StreamReader, bh.id, bh.length);
                    this.workBookData.styleData.addXFDataValue(xf);
                }
                break;

                case RecordType.Style:
                {
                    Style style = new Style(this.StreamReader, bh.id, bh.length);
                    this.workBookData.styleData.addStyleValue(style);
                }
                break;

                case RecordType.Font:
                {
                    Font font = new Font(this.StreamReader, bh.id, bh.length);
                    this.workBookData.styleData.addFontData(font);
                }
                break;

                case RecordType.NAME:
                case RecordType.Lbl:
                {
                    Lbl name = new Lbl(this.StreamReader, bh.id, bh.length);
                    this.workBookData.addDefinedName(name);
                }
                break;

                case RecordType.BOF:
                {
                    this.workBookData.BOF = new BOF(this.StreamReader, bh.id, bh.length);
                }
                break;

                case RecordType.CodeName:
                {
                    this.workBookData.CodeName = new CodeName(this.StreamReader, bh.id, bh.length);
                }
                break;

                case RecordType.FilePass:
                {
                    throw new ExtractorException(ExtractorException.FILEENCRYPTED);
                }
                break;

                case RecordType.Palette:
                {
                    Palette palette = new Palette(this.StreamReader, bh.id, bh.length);
                    workBookData.styleData.setColorList(palette.rgbColorList);
                }
                break;

                default:
                {
                    // this else statement is used to read BiffRecords which aren't implemented
                    byte[] buffer = new byte[bh.length];
                    buffer = this.StreamReader.ReadBytes(bh.length);
                    TraceLogger.Debug("Unknown record found. ID {0}", bh.id);
                }
                break;
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    TraceLogger.Error(ex.Message);
            //    TraceLogger.Debug(ex.ToString());
            //}
        }