public void SerialiseConvertsMessageToXaml()
 {
     var input = new Blank();
     var output = MessageSerialiser.Serialise(input);
     var expected = "<Blank xmlns=\"urn:cruisecontrol:common\" />";
     Assert.AreEqual(expected, output);
 }
 private void Update()
 {
     potentialNewHome = ((Blank[])(FindObjectsOfType(typeof(Blank)))).
                        Where(blank => (transform.position - blank.transform.position).magnitude <= radius).
                        OrderBy(blank => (transform.position - blank.transform.position).sqrMagnitude).
                        FirstOrDefault();
 }
Exemplo n.º 3
0
        public void CopiaQrParaPastaLaser(List <Blank> blanks)
        {
            /** Em rede
             * //using (new NetworkConnection(NetworkPath, Credentials))
             * //{
             * //}
             **/
            if (blanks.Count > 0)
            {
                // Pega o primeiro QR Codes da lista
                Blank blankReceived = blanks.Where(b => b.Status == Blank.StatusBlank.Recebido).FirstOrDefault();

                if (!(blankReceived is null))
                {
                    // Monta caminho completo com nome da imagem
                    string imgToSave = Path.Combine(NetworkPath, $"{blankReceived.BlankId}.png");

                    Thread.Sleep(1000);

                    if (!File.Exists(imgToSave))
                    {
                        // Copia pra pasta da laser
                        File.Copy(blankReceived.ImagePath, imgToSave, false);
                        // Atualiza status para 'Enviado'
                        blankReceived.Status                       = Blank.StatusBlank.EnviadoImpressao;
                        blankReceived.UpdatedAt                    = DateTime.Now;
                        FlagsEscrita.QrEnviadoImpressao            = true;
                        this.InvokeExtension(f => f.txtFlags.Text += $"QR Code Id => {blankReceived.BlankId} Status => {blankReceived.Status.BlankStatusToString()} {Environment.NewLine}");
                    }
                }
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Lead lead = new Lead
            {
                Name    = "Elcin",
                Surname = "Xelilov",
                Age     = 23,
                ApplyAt = new DateTime(2019, 3, 4)
            };
            User man = new User();

            man.Count = 23;

            Blank blank = new Blank();

            blank.user = man;
            //Console.WriteLine(blank.user.Count);

            Order order = new Order();

            order.Status = OrderStatus.Pending;
            switch (order.Status)
            {
            case OrderStatus.Accepted:
                Console.WriteLine((int)OrderStatus.Accepted);
                break;

            case OrderStatus.Pending:
                Console.WriteLine((int)OrderStatus.Pending);
                break;
            }
        }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        //raycast and check if our hand is empty
        RaycastHit hit;

        if (Physics.Raycast(pointer.position, pointer.forward, out hit, 5f, thingsWeCanGrab) && hand.currentAttachedObject == null)
        {
            Interactable          interactable = hit.collider.gameObject.GetComponent <Interactable>();
            SteamVR_Input_Sources source       = hand.handType;
            //are we pressing grip and trigger?
            if (hit.collider.gameObject.CompareTag("Box"))
            {
                if (hand.grabGripAction[source].state == true && hit.collider.gameObject.GetComponent <Box>().touchable)
                {
                    //does the interactable component exist?
                    if (interactable != null)
                    {
                        //move the object to your hand
                        interactable.transform.LookAt(transform);
                        interactable.gameObject.GetComponent <Rigidbody>().AddRelativeForce(Vector3.forward * 500, ForceMode.Force);
                        attachedObject = interactable.gameObject;
                        isAttached     = true;
                        //attaching to hand is in the late update function
                    }
                }
            }
            blank = hit.collider.gameObject.GetComponentInChildren <Blank>();
        }
        else
        {
        }
    }
Exemplo n.º 6
0
        private Blank GetMasterPage()
        {
            MasterPage masterPage = Page.Master;
            Blank      headerPage = (Blank)masterPage;

            return(headerPage);
        }
Exemplo n.º 7
0
        public static Blank Annul(Blank blank)
        {
            Blank result = WebManager.Current.Annul(blank);

            RemoveFromCache("Data_");
            return(result);
        }
Exemplo n.º 8
0
        private void AccessFolderWatcher_Deleted(object sender, FileSystemEventArgs e)
        {
            try
            {
                if (bolEmProducao)
                {
                    // Busca QR Code por Id com o nome da imagem na pasta
                    Blank blank = LoteEmProducao.Blanks.Where(b => b.BlankId == e.Name.GetIdQrCodeFromFilename()).FirstOrDefault();

                    if (!(blank is null) && (blank.Status == Blank.StatusBlank.EnviadoImpressao))
                    {
                        //QrCode qrUpdated = _superService.UpdateStatusCode(qrToPrinted.IdQrCode, (int)QrCodeStatus.StatusQr.Printed);
                        blank.Status            = Blank.StatusBlank.Validado;
                        blank.ImpressaoCompleta = true;
                        this.InvokeExtension(f => f.txtFlags.Text += $"QR Code Id => {blank.BlankId} Status => {blank.Status.BlankStatusToString()} {Environment.NewLine}");
                    }

                    FlagsEscrita.QrEnviadoImpressao = false;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 9
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Blank != null ? Blank.GetHashCode() : 0) * 397 ^ (POIs != null ? POIs.GetHashCode() : 0));
     }
 }
Exemplo n.º 10
0
        public void TestFillFormFromModel()
        {
            Blank data = new Blank("firstname", "test", "*****@*****.**", "ad");

            BlankPage blankForm = new BlankPage(browser);

            blankForm.FillAndSubmitForm(data);
        }
Exemplo n.º 11
0
        public void SerialiseConvertsMessageToXaml()
        {
            var input    = new Blank();
            var output   = MessageSerialiser.Serialise(input);
            var expected = "<Blank xmlns=\"urn:cruisecontrol:common\" />";

            Assert.AreEqual(expected, output);
        }
Exemplo n.º 12
0
 public void FillAndSubmitForm(Blank data)
 {
     firstName.SendKeys(data.FirstName);
     lastName.SendKeys(data.LastName);
     email.SendKeys(data.Email);
     message.SendKeys(data.Message);
     SubmitButton.Click();
 }
Exemplo n.º 13
0
 private void ResetBoard()
 {
     for (int row = 0; row < board.GetLength(0); row++)
     {
         for (int col = 0; col < board.GetLength(1); col++)
         {
             board[row, col] = new Blank();
         }
     }
 }
Exemplo n.º 14
0
        /**
         * Performs a shallow copy of the specified cell
         */
        private WritableCell shallowCopyCell(Cell cell)
        {
            CellType     ct      = cell.getType();
            WritableCell newCell = null;

            if (ct == CellType.LABEL)
            {
                newCell = new Label((LabelCell)cell);
            }
            else if (ct == CellType.NUMBER)
            {
                newCell = new Number((NumberCell)cell);
            }
            else if (ct == CellType.DATE)
            {
                newCell = new ExcelDateTime((DateCell)cell);
            }
            else if (ct == CellType.BOOLEAN)
            {
                newCell = new Boolean((BooleanCell)cell);
            }
            else if (ct == CellType.NUMBER_FORMULA)
            {
                newCell = new ReadNumberFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.STRING_FORMULA)
            {
                newCell = new ReadStringFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.BOOLEAN_FORMULA)
            {
                newCell = new ReadBooleanFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.DATE_FORMULA)
            {
                newCell = new ReadDateFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.FORMULA_ERROR)
            {
                newCell = new ReadErrorFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.EMPTY)
            {
                if (cell.getCellFormat() != null)
                {
                    // It is a blank cell, rather than an empty cell, so
                    // it may have formatting information, so
                    // it must be copied
                    newCell = new Blank(cell);
                }
            }

            return(newCell);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Adds a BLANK Biffrecord to the internal list
        /// additional the method adds the specific BLANK Data to a data container
        /// </summary>
        /// <param name="number">NUMBER Biffrecord</param>
        public void addBLANK(Blank blank)
        {
            this.BLANKList.Add(blank);
            RowData   rowData = this.getSpecificRow(blank.rw);
            BlankCell cell    = new BlankCell();

            cell.Col        = blank.col;
            cell.Row        = blank.rw;
            cell.TemplateID = blank.ixfe;
            rowData.addCell(cell);
        }
Exemplo n.º 16
0
        public void InfiniteCycleAndInfiniteCycleRemarks()
        {
            Department        d1          = new Department(1, 1, 2, 2, true, false);
            Department        d2          = new Department(2, 2, 1, 1);
            Department        d3          = new Department(3, 1, 2, 1, false, true);
            List <Department> departments = new List <Department>();

            departments.Add(d1); departments.Add(d2); departments.Add(d3);
            Blank        blank  = new Blank();
            List <Blank> result = blank.GetBlank(d3, departments, out string remark);

            Assert.AreEqual(" Бесконечный цикл  Ни разу не были в этом отделе ", remark);
        }
Exemplo n.º 17
0
        public void TwoDeps()
        {
            Department        d1          = new Department(1, 1, 2, 2, true, false);
            Department        d2          = new Department(2, 2, 1, 1, false, true);
            List <Department> departments = new List <Department>();

            departments.Add(d1); departments.Add(d2);
            Blank        blank  = new Blank();
            List <Blank> result = blank.GetBlank(d1, departments, out string remark);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("1, ", result[0].ToStr());
            Assert.AreEqual("", remark);
        }
Exemplo n.º 18
0
        public void ZeroTimesRemark()
        {
            Department        d1          = new Department(1, 1, 2, 3, 2, 3, 2, 3, true, false);
            Department        d2          = new Department(2, 2, 1, 3);
            Department        d3          = new Department(3, 1, 2, 1, false, true);
            List <Department> departments = new List <Department>();

            departments.Add(d1); departments.Add(d2); departments.Add(d3);
            Blank        blank   = new Blank();
            List <Blank> result1 = blank.GetBlank(d2, departments, out string remark1);

            Assert.AreEqual(0, result1.Count);
            Assert.AreEqual(" Ни разу не были в этом отделе ", remark1);
        }
Exemplo n.º 19
0
        public void InfiniteCycleRemark()
        {
            Department        d1          = new Department(1, 1, 2, 2, true, false);
            Department        d2          = new Department(2, 2, 1, 1);
            Department        d3          = new Department(3, 1, 2, 1, false, true);
            List <Department> departments = new List <Department>();

            departments.Add(d1); departments.Add(d2); departments.Add(d3);
            Blank        blank  = new Blank();
            List <Blank> result = blank.GetBlank(d1, departments, out string remark);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("1, ", result[0].ToStr());
            Assert.AreEqual(" Бесконечный цикл ", remark);
        }
Exemplo n.º 20
0
        static public void LoadImageFromCard(Card c, PictureBox pb)
        {
            if (OnTopBox != null)
            {
                BackImage();
            }
            byte num_card = c.Number;

            if (c is Blank)
            {
                Blank bc = (Blank)c;
                num_card = (byte)bc._blank;
            }
            pb.Load(@"Cards\" + c.ToString() + "\\" + num_card.ToString() + ".jpg");
        }
Exemplo n.º 21
0
        public void CycleOneTime()
        {
            Department        d1          = new Department(1, 1, 3, 2, 3, 2, 1, 2, true, false);
            Department        d2          = new Department(2, 1, 2, 1);
            Department        d3          = new Department(3, 1, 2, 1, false, true);
            List <Department> departments = new List <Department>();

            departments.Add(d1); departments.Add(d2); departments.Add(d3);
            Blank        blank   = new Blank();
            List <Blank> result1 = blank.GetBlank(d1, departments, out string remark);

            Assert.AreEqual(2, result1.Count);
            Assert.AreEqual("2, ", result1[0].ToStr());
            Assert.AreEqual("1, 3, ", result1[1].ToStr());
        }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            Department        d1   = new Department(1, 1, 2, 2, true, false);
            Department        d2   = new Department(2, 2, 1, 1);
            Department        d3   = new Department(3, 1, 2, 1, false, true);
            List <Department> deps = new List <Department>();

            deps.Add(d1); deps.Add(d2); deps.Add(d3);
            Blank        blank  = new Blank();
            List <Blank> blanks = blank.GetBlank(d1, deps, out string remark);

            Console.WriteLine(remark);
            foreach (var bl in blanks)
            {
                Console.WriteLine(bl.ToStr());
            }
        }
Exemplo n.º 23
0
        /**
         * Checks the cell ranges for intersections, or if the merged cells
         * contains more than one item of data
         */
        private void checkRanges()
        {
            try
            {
                SheetRangeImpl range = null;

                // Check all the ranges to make sure they only contain one entry
                for (int i = 0; i < ranges.Count; i++)
                {
                    range = (SheetRangeImpl)ranges[i];

                    // Get the cell in the top left
                    Cell tl    = range.getTopLeft();
                    Cell br    = range.getBottomRight();
                    bool found = false;

                    for (int c = tl.getColumn(); c <= br.getColumn(); c++)
                    {
                        for (int r = tl.getRow(); r <= br.getRow(); r++)
                        {
                            Cell cell = sheet.getCell(c, r);
                            if (cell.getType() != CellType.EMPTY)
                            {
                                if (!found)
                                {
                                    found = true;
                                }
                                else
                                {
                                    //logger.warn("Range " + range +
                                    //            " contains more than one data cell.  " +
                                    //            "Setting the other cells to blank.");
                                    Blank b = new Blank(c, r);
                                    sheet.addCell(b);
                                }
                            }
                        }
                    }
                }
            }
            catch (WriteException e)
            {
                // This should already have been checked - bomb out
                Assert.verify(false);
            }
        }
Exemplo n.º 24
0
        public void DifferentToDepSameSeals()
        {
            Department        d1          = new Department(1, 1, 100, 3, true, false);
            Department        d2          = new Department(2, 3, 1, 3);
            Department        d3          = new Department(3, 1, 2, 3, 2, 1, 3, 4);
            Department        d4          = new Department(4, 100, 101, 3, false, true);
            List <Department> departments = new List <Department>();

            departments.Add(d1); departments.Add(d2); departments.Add(d3); departments.Add(d4);
            Blank        blank  = new Blank();
            List <Blank> result = blank.GetBlank(d3, departments, out string remark);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("1, 2, ", result[0].ToStr());
            //Assert.AreEqual("2, 1, ", result[1].ToStr());
            Assert.AreEqual("", remark);
        }
Exemplo n.º 25
0
        private void CancelaProcesso()
        {
            try
            {
                if (!bolEmProducao)
                {
                    if (Directory.GetFiles(NetworkPath).Where(file => file.IndexOf("png", StringComparison.OrdinalIgnoreCase) > 0).Count() > 0)
                    {
                        foreach (FileInfo fileInfo in new DirectoryInfo(NetworkPath).EnumerateFiles())
                        {
                            if (fileInfo.Name.Contains(".png"))
                            {
                                FlagsEscrita.FinalLote = false;
                                int blankId = fileInfo.Name.GetIdQrCodeFromFilename();

                                if (File.Exists(fileInfo.FullName))
                                {
                                    File.Delete(fileInfo.FullName);
                                    FlagsEscrita.QrEnviadoImpressao = false;
                                }

                                if (!(LoteEmProducao is null))
                                {
                                    Blank blank = LoteEmProducao.Blanks.Where(b => b.BlankId == blankId).FirstOrDefault();

                                    if (!(blank is null))
                                    {
                                        blank.Status = Blank.StatusBlank.Recebido;

                                        if (LoteEmProducao.Blanks.All(b => b.Status == Blank.StatusBlank.Recebido))
                                        {
                                            LoteEmProducao.Status = Lote.StatusLote.Recebido;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 26
0
        private void GenerateDefault()
        {
            GameObjects = new GameObject[W, H];

            for (int i = 0; i < W; i++)
            {
                for (int j = 0; j < H; j++)
                {
                    if (i == 0 || j == 0 || i == W - 1 || j == H - 1)
                    {
                        GameObjects[i, j] = new Wall();
                    }
                    else
                    {
                        GameObjects[i, j] = new Blank();
                    }
                }
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Handles OrderWindow PrintReservedTicket button event
        /// </summary>
        private void OnPrintReservedTicket()
        {
            List <Spot> spots = new List <Spot>();

            if (SelectedTicket.BlankId > 0)
            {
                ConfirmationBox cb = new ConfirmationBox
                {
                    Message = String.Format(
                        "Вы действительно желаете перепечатать билет № {0}, {1}, {2}, {3} ряд, {4} место?\nБланк № {5} будет аннулирован.",
                        SelectedTicket.Id, SelectedTicket.SideName, SelectedTicket.SectorName, SelectedTicket.RowNum,
                        SelectedTicket.SeatNum, SelectedTicket.BlankId)
                };
                bool?result = cb.ShowDialog();
                if (result ?? false)
                {
                    Blank blank = new Blank()
                    {
                        Id = SelectedTicket.BlankId
                    };
                    Access.Annul(blank);
                    SelectedTicket.BlankId = 0;
                }
            }

            if (SelectedTicket.Status == ItemStatus.Sold && SelectedTicket.BlankId == 0)
            {
                Blank[] blanks = Access.GetBlanks(0, 1, ItemStatus.OnSale);
                Spot    spot   = new Spot
                {
                    Id     = SelectedTicket.Id,
                    Status = SelectedTicket.Status,
                    Blank  = blanks[0]
                };
                SelectedTicket.BlankId = spot.Blank.Id;
                spots.Add(spot);
                ProcessPrint(spots);
            }

            ReloadOrder();
        }
Exemplo n.º 28
0
    public void Dropped()
    {
        Update();

        bool allowed = false;

        if (transform.GetComponentInChildren <GunComponent>() is MagasineComponent && potentialNewHome.transform.parent.parent.GetComponent <Holder>().GetTypeAllowance() == 1)
        {
            allowed = true;
        }
        else if (transform.GetComponentInChildren <GunComponent>() is MuzzleComponent && potentialNewHome.transform.parent.parent.GetComponent <Holder>().GetTypeAllowance() == 2)
        {
            allowed = true;
        }
        else if (transform.GetComponentInChildren <GunComponent>() is TriggerComponent && potentialNewHome.transform.parent.parent.GetComponent <Holder>().GetTypeAllowance() == 3)
        {
            allowed = true;
        }
        else if (potentialNewHome.transform.parent.parent.GetComponent <Holder>().GetTypeAllowance() == 4)
        {
            allowed = true;
        }

        if (potentialNewHome != null && potentialNewHome.resident == null && allowed)
        {
            home.resident = null;
            home.transform.parent.parent.GetComponent <Holder>().RemoveMod(transform.GetComponentInChildren <GunComponent>());
            home             = potentialNewHome;
            transform.parent = home.transform.parent;
            home.resident    = this;
            int index;
            Int32.TryParse(potentialNewHome.transform.parent.name.Replace("Slot", ""), out index);
            potentialNewHome.transform.parent.parent.GetComponent <Holder>().AddMod(transform.GetComponentInChildren <GunComponent>(), index - 1);
        }
        transform.localPosition = Vector3.zero;
    }
Exemplo n.º 29
0
        /// <summary>
        /// Read game/machine information
        /// </summary>
        /// <param name="reader">XmlReader to use to parse the machine</param>
        /// <param name="dirs">List of dirs to prepend to the game name</param>
        /// <param name="filename">Name of the file to be parsed</param>
        /// <param name="sysid">System ID for the DAT</param>
        /// <param name="srcid">Source ID for the DAT</param>
        /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
        /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
        /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param>
        private void ReadMachine(
            XmlReader reader,
            List <string> dirs,

            // Standard Dat parsing
            string filename,
            int sysid,
            int srcid,

            // Miscellaneous
            bool keep,
            bool clean,
            bool remUnicode)
        {
            // If we have an empty machine, skip it
            if (reader == null)
            {
                return;
            }

            // Otherwise, add what is possible
            reader.MoveToContent();

            string key           = "";
            string temptype      = reader.Name;
            bool   containsItems = false;

            // Create a new machine
            MachineType machineType = MachineType.NULL;

            if (Utilities.GetYesNo(reader.GetAttribute("isbios")) == true)
            {
                machineType |= MachineType.Bios;
            }
            if (Utilities.GetYesNo(reader.GetAttribute("isdevice")) == true) // Listxml-specific, used by older DATs
            {
                machineType |= MachineType.Device;
            }
            if (Utilities.GetYesNo(reader.GetAttribute("ismechanical")) == true) // Listxml-specific, used by older DATs
            {
                machineType |= MachineType.Mechanical;
            }

            string  dirsString = (dirs != null && dirs.Count() > 0 ? string.Join("/", dirs) + "/" : "");
            Machine machine    = new Machine
            {
                Name        = dirsString + reader.GetAttribute("name"),
                Description = dirsString + reader.GetAttribute("name"),
                SourceFile  = reader.GetAttribute("sourcefile"),
                Board       = reader.GetAttribute("board"),
                RebuildTo   = reader.GetAttribute("rebuildto"),
                Runnable    = Utilities.GetYesNo(reader.GetAttribute("runnable")), // Listxml-specific, used by older DATs

                Comment = "",

                CloneOf  = reader.GetAttribute("cloneof") ?? "",
                RomOf    = reader.GetAttribute("romof") ?? "",
                SampleOf = reader.GetAttribute("sampleof") ?? "",

                MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType),
            };

            if (Type == "SuperDAT" && !keep)
            {
                string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value;
                if (!String.IsNullOrWhiteSpace(tempout))
                {
                    machine.Name = tempout;
                }
            }

            while (!reader.EOF)
            {
                // We only want elements
                if (reader.NodeType != XmlNodeType.Element)
                {
                    reader.Read();
                    continue;
                }

                // Get the roms from the machine
                switch (reader.Name)
                {
                case "comment":     // There can be multiple comments by spec
                    machine.Comment += reader.ReadElementContentAsString();
                    break;

                case "description":
                    machine.Description = reader.ReadElementContentAsString();
                    break;

                case "year":
                    machine.Year = reader.ReadElementContentAsString();
                    break;

                case "manufacturer":
                    machine.Manufacturer = reader.ReadElementContentAsString();
                    break;

                case "publisher":     // Not technically supported but used by some legacy DATs
                    machine.Publisher = reader.ReadElementContentAsString();
                    break;

                case "trurip":     // This is special metadata unique to TruRip
                    ReadTruRip(reader.ReadSubtree(), machine);

                    // Skip the trurip node now that we've processed it
                    reader.Skip();
                    break;

                case "release":
                    containsItems = true;

                    DatItem release = new Release
                    {
                        Name     = reader.GetAttribute("name"),
                        Region   = reader.GetAttribute("region"),
                        Language = reader.GetAttribute("language"),
                        Date     = reader.GetAttribute("date"),
                        Default  = Utilities.GetYesNo(reader.GetAttribute("default")),
                    };

                    release.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(release, clean, remUnicode);

                    reader.Read();
                    break;

                case "biosset":
                    containsItems = true;

                    DatItem biosset = new BiosSet
                    {
                        Name        = reader.GetAttribute("name"),
                        Description = reader.GetAttribute("description"),
                        Default     = Utilities.GetYesNo(reader.GetAttribute("default")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    biosset.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(biosset, clean, remUnicode);

                    reader.Read();
                    break;

                case "rom":
                    containsItems = true;

                    DatItem rom = new Rom
                    {
                        Name       = reader.GetAttribute("name"),
                        Size       = Utilities.GetSize(reader.GetAttribute("size")),
                        CRC        = Utilities.CleanHashData(reader.GetAttribute("crc"), Constants.CRCLength),
                        MD5        = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length),
                        SHA1       = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length),
                        SHA256     = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length),
                        SHA384     = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length),
                        SHA512     = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length),
                        MergeTag   = reader.GetAttribute("merge"),
                        ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")),
                        Date       = Utilities.GetDate(reader.GetAttribute("date")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    rom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(rom, clean, remUnicode);

                    reader.Read();
                    break;

                case "disk":
                    containsItems = true;

                    DatItem disk = new Disk
                    {
                        Name       = reader.GetAttribute("name"),
                        MD5        = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length),
                        SHA1       = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length),
                        SHA256     = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length),
                        SHA384     = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length),
                        SHA512     = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length),
                        MergeTag   = reader.GetAttribute("merge"),
                        ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    disk.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(disk, clean, remUnicode);

                    reader.Read();
                    break;

                case "sample":
                    containsItems = true;

                    DatItem samplerom = new Sample
                    {
                        Name = reader.GetAttribute("name"),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    samplerom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(samplerom, clean, remUnicode);

                    reader.Read();
                    break;

                case "archive":
                    containsItems = true;

                    DatItem archiverom = new Archive
                    {
                        Name = reader.GetAttribute("name"),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    archiverom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(archiverom, clean, remUnicode);

                    reader.Read();
                    break;

                default:
                    reader.Read();
                    break;
                }
            }

            // If no items were found for this machine, add a Blank placeholder
            if (!containsItems)
            {
                Blank blank = new Blank()
                {
                    SystemID = sysid,
                    System   = filename,
                    SourceID = srcid,
                };
                blank.CopyMachineInformation(machine);

                // Now process and add the rom
                ParseAddHelper(blank, clean, remUnicode);
            }
        }
Exemplo n.º 30
0
        public static Bitmap MapTileGraphicC2(int xC2, int yC2) => MapTileGraphic[(((xC2 + 2 * Map.Instance.Xdim) % (2 * Map.Instance.Xdim)) - yC2 % 2) / 2, yC2];  // Return tile graphics for civ2-coords input

        // Extract icon from civ2.exe file
        //public static void ImportCiv2Icon()
        //{
        //    try
        //    {
        //        Civ2Icon = Icon.ExtractAssociatedIcon(Settings.Civ2Path + "civ2.exe");
        //    }
        //    catch
        //    {
        //        Debug.WriteLine("Civ2.exe not found!");
        //    }
        //}

        public static void TerrainBitmapsImportFromFile(string path)
        {
            // Read file in local directory. If it doesn't exist there, read it in root civ2 directory.
            var terrain1 = new Bitmap(640, 480, PixelFormat.Format32bppRgba);
            //var terrain1 = new Image<Rgba32>(640, 480);
            string FilePath_local = path + Path.DirectorySeparatorChar + "TERRAIN1.GIF";
            string FilePath_root  = Settings.Civ2Path + "TERRAIN1.GIF";

            if (File.Exists(FilePath_local))
            {
                terrain1 = new Bitmap(FilePath_local);
            }
            else if (File.Exists(FilePath_root))
            {
                terrain1 = new Bitmap(FilePath_root);
            }
            else
            {
                Debug.WriteLine("TERRAIN1.GIF not found!");
            }

            var terrain2 = new Bitmap(640, 480, PixelFormat.Format32bppRgba);

            FilePath_local = path + Path.DirectorySeparatorChar + "TERRAIN2.GIF";
            FilePath_root  = Settings.Civ2Path + "TERRAIN2.GIF";
            if (File.Exists(FilePath_local))
            {
                terrain2 = new Bitmap(FilePath_local);
            }
            else if (File.Exists(FilePath_root))
            {
                terrain2 = new Bitmap(FilePath_root);
            }
            else
            {
                Debug.WriteLine("TERRAIN2.GIF not found!");
            }

            // Initialize objects
            Desert     = new Bitmap[4];
            Plains     = new Bitmap[4];
            Grassland  = new Bitmap[4];
            ForestBase = new Bitmap[4];
            HillsBase  = new Bitmap[4];
            MtnsBase   = new Bitmap[4];
            Tundra     = new Bitmap[4];
            Glacier    = new Bitmap[4];
            Swamp      = new Bitmap[4];
            Jungle     = new Bitmap[4];
            Ocean      = new Bitmap[4];
            Coast      = new Bitmap[8, 4];
            River      = new Bitmap[16];
            Forest     = new Bitmap[16];
            Mountains  = new Bitmap[16];
            Hills      = new Bitmap[16];
            RiverMouth = new Bitmap[4];
            Road       = new Bitmap[9];
            Railroad   = new Bitmap[9];

            // Define transparent colors
            Color transparentGray = Color.FromArgb(135, 135, 135);  // Define transparent back color (gray)
            Color transparentPink = Color.FromArgb(255, 0, 255);    // Define transparent back color (pink)
            Color transparentCyan = Color.FromArgb(0, 255, 255);    // Define transparent back color (cyan)

            // Tiles
            for (int i = 0; i < 4; i++)
            {
                Desert[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), 1, 64, 32));
                Desert[i].ReplaceColors(transparentGray, Colors.Transparent);
                Desert[i].ReplaceColors(transparentPink, Colors.Transparent);
                Plains[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (2 * 1) + (1 * 32), 64, 32));
                Plains[i].ReplaceColors(transparentGray, Colors.Transparent);
                Plains[i].ReplaceColors(transparentPink, Colors.Transparent);
                Grassland[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (3 * 1) + (2 * 32), 64, 32));
                Grassland[i].ReplaceColors(transparentGray, Colors.Transparent);
                Grassland[i].ReplaceColors(transparentPink, Colors.Transparent);
                ForestBase[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (4 * 1) + (3 * 32), 64, 32));
                ForestBase[i].ReplaceColors(transparentGray, Colors.Transparent);
                ForestBase[i].ReplaceColors(transparentPink, Colors.Transparent);
                HillsBase[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (5 * 1) + (4 * 32), 64, 32));
                HillsBase[i].ReplaceColors(transparentGray, Colors.Transparent);
                HillsBase[i].ReplaceColors(transparentPink, Colors.Transparent);
                MtnsBase[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (6 * 1) + (5 * 32), 64, 32));
                MtnsBase[i].ReplaceColors(transparentGray, Colors.Transparent);
                MtnsBase[i].ReplaceColors(transparentPink, Colors.Transparent);
                Tundra[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (7 * 1) + (6 * 32), 64, 32));
                Tundra[i].ReplaceColors(transparentGray, Colors.Transparent);
                Tundra[i].ReplaceColors(transparentPink, Colors.Transparent);
                Glacier[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (8 * 1) + (7 * 32), 64, 32));
                Glacier[i].ReplaceColors(transparentGray, Colors.Transparent);
                Glacier[i].ReplaceColors(transparentPink, Colors.Transparent);
                Swamp[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (9 * 1) + (8 * 32), 64, 32));
                Swamp[i].ReplaceColors(transparentGray, Colors.Transparent);
                Swamp[i].ReplaceColors(transparentPink, Colors.Transparent);
                Jungle[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (10 * 1) + (9 * 32), 64, 32));
                Jungle[i].ReplaceColors(transparentGray, Colors.Transparent);
                Jungle[i].ReplaceColors(transparentPink, Colors.Transparent);
                Ocean[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), (11 * 1) + (10 * 32), 64, 32));
                Ocean[i].ReplaceColors(transparentGray, Colors.Transparent);
                Ocean[i].ReplaceColors(transparentPink, Colors.Transparent);
            }

            // 4 small dither tiles
            DitherBlank = new Bitmap[2, 2];
            DitherDots  = new Bitmap[2, 2];
            for (int tileX = 0; tileX < 2; tileX++)
            {
                for (int tileY = 0; tileY < 2; tileY++)
                {
                    DitherBlank[tileX, tileY] = terrain1.Clone(new Rectangle((tileX * 32) + 1, (tileY * 16) + 447, 32, 16));
                    DitherDots[tileX, tileY]  = DitherBlank[tileX, tileY];
                    DitherDots[tileX, tileY].ReplaceColors(transparentGray, Colors.Transparent);
                    DitherDots[tileX, tileY].ReplaceColors(transparentPink, Colors.Transparent);
                }
            }

            // Blank tile
            Blank = terrain1.Clone(new Rectangle(131, 447, 64, 32));
            Blank.ReplaceColors(transparentGray, Colors.Transparent);

            // Dither base (only useful for grasland?)
            DitherBase = terrain1.Clone(new Rectangle(196, 447, 64, 32));

            // Replace black dither pixels with base pixels
            DitherDesert    = new Bitmap[2, 2]; // 4 dither tiles for one 64x32 map tile
            DitherPlains    = new Bitmap[2, 2];
            DitherGrassland = new Bitmap[2, 2];
            DitherForest    = new Bitmap[2, 2];
            DitherHills     = new Bitmap[2, 2];
            DitherMountains = new Bitmap[2, 2];
            DitherTundra    = new Bitmap[2, 2];
            DitherGlacier   = new Bitmap[2, 2];
            DitherSwamp     = new Bitmap[2, 2];
            DitherJungle    = new Bitmap[2, 2];
            Color replacementColor;

            for (int tileX = 0; tileX < 2; tileX++)
            {    // For 4 directions (NE, SE, SW, NW)
                for (int tileY = 0; tileY < 2; tileY++)
                {
                    DitherDesert[tileX, tileY]    = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherPlains[tileX, tileY]    = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherGrassland[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherForest[tileX, tileY]    = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherHills[tileX, tileY]     = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherMountains[tileX, tileY] = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherTundra[tileX, tileY]    = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherGlacier[tileX, tileY]   = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherSwamp[tileX, tileY]     = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    DitherJungle[tileX, tileY]    = new Bitmap(32, 16, PixelFormat.Format32bppRgba);
                    for (int col = 0; col < 32; col++)
                    {
                        for (int row = 0; row < 16; row++)
                        {
                            // replacementColor = DitherBlank.GetPixel(tileX * 32 + col, tileY * 16 + row);
                            replacementColor = DitherBlank[tileX, tileY].GetPixel(col, row);
                            if (replacementColor == Color.FromArgb(0, 0, 0))
                            {
                                DitherDesert[tileX, tileY].SetPixel(col, row, Desert[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherPlains[tileX, tileY].SetPixel(col, row, Plains[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherGrassland[tileX, tileY].SetPixel(col, row, Grassland[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherForest[tileX, tileY].SetPixel(col, row, ForestBase[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherHills[tileX, tileY].SetPixel(col, row, HillsBase[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherMountains[tileX, tileY].SetPixel(col, row, MtnsBase[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherTundra[tileX, tileY].SetPixel(col, row, Tundra[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherGlacier[tileX, tileY].SetPixel(col, row, Glacier[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherSwamp[tileX, tileY].SetPixel(col, row, Swamp[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                                DitherJungle[tileX, tileY].SetPixel(col, row, Jungle[0].GetPixel((tileX * 32) + col, (tileY * 16) + row));
                            }
                            else
                            {
                                DitherDesert[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherPlains[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherGrassland[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherForest[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherHills[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherMountains[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherTundra[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherGlacier[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherSwamp[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                                DitherJungle[tileX, tileY].SetPixel(col, row, Color.FromArgb(0, 0, 0, 0));
                            }
                        }
                    }
                }
            }

            // Rivers, Forest, Mountains, Hills
            for (int i = 0; i < 16; i++)
            {
                River[i] = terrain2.Clone(new Rectangle((i % 8) + 1 + ((i % 8) * 64), 3 + (i / 8) + ((2 + (i / 8)) * 32), 64, 32));
                River[i].ReplaceColors(transparentGray, Colors.Transparent);
                River[i].ReplaceColors(transparentPink, Colors.Transparent);
                Forest[i] = terrain2.Clone(new Rectangle((i % 8) + 1 + ((i % 8) * 64), 5 + (i / 8) + ((4 + (i / 8)) * 32), 64, 32));
                Forest[i].ReplaceColors(transparentGray, Colors.Transparent);
                Forest[i].ReplaceColors(transparentPink, Colors.Transparent);
                Mountains[i] = terrain2.Clone(new Rectangle((i % 8) + 1 + ((i % 8) * 64), 7 + (i / 8) + ((6 + (i / 8)) * 32), 64, 32));
                Mountains[i].ReplaceColors(transparentGray, Colors.Transparent);
                Mountains[i].ReplaceColors(transparentPink, Colors.Transparent);
                Hills[i] = terrain2.Clone(new Rectangle((i % 8) + 1 + ((i % 8) * 64), 9 + (i / 8) + ((8 + (i / 8)) * 32), 64, 32));
                Hills[i].ReplaceColors(transparentGray, Colors.Transparent);
                Hills[i].ReplaceColors(transparentPink, Colors.Transparent);
            }

            // River mouths
            for (int i = 0; i < 4; i++)
            {
                RiverMouth[i] = terrain2.Clone(new Rectangle(i + 1 + (i * 64), (11 * 1) + (10 * 32), 64, 32));
                RiverMouth[i].ReplaceColors(transparentGray, Colors.Transparent);
                RiverMouth[i].ReplaceColors(transparentPink, Colors.Transparent);
                RiverMouth[i].ReplaceColors(transparentCyan, Colors.Transparent);
            }

            // Coast
            for (int i = 0; i < 8; i++)
            {
                Coast[i, 0] = terrain2.Clone(new Rectangle((2 * i) + 1 + (2 * i * 32), 429, 32, 16));                                // N
                Coast[i, 0].ReplaceColors(transparentGray, Colors.Transparent);
                Coast[i, 1] = terrain2.Clone(new Rectangle((2 * i) + 1 + (2 * i * 32), 429 + (1 * 1) + (1 * 16), 32, 16));           // S
                Coast[i, 1].ReplaceColors(transparentGray, Colors.Transparent);
                Coast[i, 2] = terrain2.Clone(new Rectangle((2 * i) + 1 + (2 * i * 32), 429 + (2 * 1) + (2 * 16), 32, 16));           // W
                Coast[i, 2].ReplaceColors(transparentGray, Colors.Transparent);
                Coast[i, 3] = terrain2.Clone(new Rectangle((2 * (i + 1)) + (((2 * i) + 1) * 32), 429 + (2 * 1) + (2 * 16), 32, 16)); // E
                Coast[i, 3].ReplaceColors(transparentGray, Colors.Transparent);
            }

            // Road & railorad
            for (int i = 0; i < 9; i++)
            {
                Road[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), 364, 64, 32));
                Road[i].ReplaceColors(transparentGray, Colors.Transparent);
                Road[i].ReplaceColors(transparentPink, Colors.Transparent);
                Railroad[i] = terrain1.Clone(new Rectangle(i + 1 + (i * 64), 397, 64, 32));
                Railroad[i].ReplaceColors(transparentGray, Colors.Transparent);
                Railroad[i].ReplaceColors(transparentPink, Colors.Transparent);
            }

            Irrigation = terrain1.Clone(new Rectangle(456, 100, 64, 32));
            Irrigation.ReplaceColors(transparentGray, Colors.Transparent);
            Irrigation.ReplaceColors(transparentPink, Colors.Transparent);

            Farmland = terrain1.Clone(new Rectangle(456, 133, 64, 32));
            Farmland.ReplaceColors(transparentGray, Colors.Transparent);
            Farmland.ReplaceColors(transparentPink, Colors.Transparent);

            Mining = terrain1.Clone(new Rectangle(456, 166, 64, 32));
            Mining.ReplaceColors(transparentGray, Colors.Transparent);
            Mining.ReplaceColors(transparentPink, Colors.Transparent);

            Pollution = terrain1.Clone(new Rectangle(456, 199, 64, 32));
            Pollution.ReplaceColors(transparentGray, Colors.Transparent);
            Pollution.ReplaceColors(transparentPink, Colors.Transparent);

            Shield = terrain1.Clone(new Rectangle(456, 232, 64, 32));
            Shield.ReplaceColors(transparentGray, Colors.Transparent);
            Shield.ReplaceColors(transparentPink, Colors.Transparent);

            terrain1.Dispose();
            terrain2.Dispose();
        }
Exemplo n.º 31
0
        /// <summary>
        /// Read software information
        /// </summary>
        /// <param name="reader">XmlReader representing a machine block</param>
        /// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
        /// <param name="filename">Name of the file to be parsed</param>
        /// <param name="indexId">Index ID for the DAT</param>
        private void ReadSoftware(XmlReader reader, bool statsOnly, string filename, int indexId)
        {
            // If we have an empty machine, skip it
            if (reader == null)
            {
                return;
            }

            // Otherwise, add what is possible
            reader.MoveToContent();

            int  diskno        = 0;
            bool containsItems = false;

            // Create a new machine
            Machine machine = new Machine();

            while (!reader.EOF)
            {
                // We only want elements
                if (reader.NodeType != XmlNodeType.Element)
                {
                    reader.Read();
                    continue;
                }

                // Get the roms from the machine
                switch (reader.Name)
                {
                case "title":
                    machine.Name = reader.ReadElementContentAsString();
                    break;

                case "genmsxid":
                    machine.GenMSXID = reader.ReadElementContentAsString();
                    break;

                case "system":
                    machine.System = reader.ReadElementContentAsString();
                    break;

                case "company":
                    machine.Manufacturer = reader.ReadElementContentAsString();
                    break;

                case "year":
                    machine.Year = reader.ReadElementContentAsString();
                    break;

                case "country":
                    machine.Country = reader.ReadElementContentAsString();
                    break;

                case "dump":
                    containsItems = ReadDump(reader.ReadSubtree(), machine, diskno, statsOnly, filename, indexId);
                    diskno++;

                    // Skip the dump now that we've processed it
                    reader.Skip();
                    break;

                default:
                    reader.Read();
                    break;
                }
            }

            // If no items were found for this machine, add a Blank placeholder
            if (!containsItems)
            {
                Blank blank = new Blank()
                {
                    Source = new Source
                    {
                        Index = indexId,
                        Name  = filename,
                    },
                };

                blank.CopyMachineInformation(machine);

                // Now process and add the rom
                ParseAddHelper(blank, statsOnly);
            }
        }
Exemplo n.º 32
0
        /**
         * Performs a shallow copy of the specified cell
         */
        private WritableCell shallowCopyCell(Cell cell)
        {
            CellType ct = cell.getType();
            WritableCell newCell = null;

            if (ct == CellType.LABEL)
                {
                newCell = new Label((LabelCell)cell);
                }
            else if (ct == CellType.NUMBER)
                {
                newCell = new Number((NumberCell)cell);
                }
            else if (ct == CellType.DATE)
                {
                newCell = new ExcelDateTime((DateCell)cell);
                }
            else if (ct == CellType.BOOLEAN)
                {
                newCell = new Boolean((BooleanCell)cell);
                }
            else if (ct == CellType.NUMBER_FORMULA)
                {
                newCell = new ReadNumberFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.STRING_FORMULA)
                {
                newCell = new ReadStringFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.BOOLEAN_FORMULA)
                {
                newCell = new ReadBooleanFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.DATE_FORMULA)
                {
                newCell = new ReadDateFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.FORMULA_ERROR)
                {
                newCell = new ReadErrorFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.EMPTY)
                {
                if (cell.getCellFormat() != null)
                    {
                    // It is a blank cell, rather than an empty cell, so
                    // it may have formatting information, so
                    // it must be copied
                    newCell = new Blank(cell);
                    }
                }

            return newCell;
        }
Exemplo n.º 33
0
 public void BasePropertiesAreSerialised()
 {
     var original = new Blank();
     original.DoRoundTripTest();
 }
Exemplo n.º 34
0
        /**
         * Checks the cell ranges for intersections, or if the merged cells
         * contains more than one item of data
         */
        private void checkRanges()
        {
            try
                {
                SheetRangeImpl range = null;

                // Check all the ranges to make sure they only contain one entry
                for (int i = 0; i < ranges.Count; i++)
                    {
                    range = (SheetRangeImpl)ranges[i];

                    // Get the cell in the top left
                    Cell tl = range.getTopLeft();
                    Cell br = range.getBottomRight();
                    bool found = false;

                    for (int c = tl.getColumn(); c <= br.getColumn(); c++)
                        {
                        for (int r = tl.getRow(); r <= br.getRow(); r++)
                            {
                            Cell cell = sheet.getCell(c, r);
                            if (cell.getType() != CellType.EMPTY)
                                {
                                if (!found)
                                    {
                                    found = true;
                                    }
                                else
                                    {
                                    //logger.warn("Range " + range +
                                    //            " contains more than one data cell.  " +
                                    //            "Setting the other cells to blank.");
                                    Blank b = new Blank(c, r);
                                    sheet.addCell(b);
                                    }
                                }
                            }
                        }
                    }
                }
            catch (WriteException e)
                {
                // This should already have been checked - bomb out
                Assert.verify(false);
                }
        }
Exemplo n.º 35
0
 public BlankLineExpression(Blank blank)
 {
     this.blank = blank;
 }