コード例 #1
0
        public void GetNewGeneration(Grid currentGenGrid)
        {
            for (var r = 0; r < NextGenGrid.Row; r++)
            {
                for (var c = 0; c < NextGenGrid.Col; c++)
                {
                    var neighbouringCells    = CellFilter.FindNeighbouringCells(r, c, currentGenGrid.Row, currentGenGrid.Col);
                    var surroundingLiveCells = CellFilter.GetSurroundingLiveCells(currentGenGrid, neighbouringCells);

                    var willBeAlive = WillBeAlive(currentGenGrid.GetCell(r, c).IsAlive, surroundingLiveCells);

                    NextGenGrid.SetCell(r, c, new Cell(willBeAlive));
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Performs cell column redaction in excel file format
 /// </summary>
 public static void TabularDocumentRedaction()
 {
     using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath)))
     {
         var filter = new CellFilter()
         {
             ColumnIndex   = 1, // zero-based 2nd column
             WorkSheetName = "Customers"
         };
         var expression          = new Regex("^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
         RedactionSummary result = doc.RedactWith(new CellColumnRedaction(filter, expression, new ReplacementOptions("[customer email]")));
         if (result.Success)
         {
             doc.Save(new SaveOptions()
             {
                 AddSuffix = true
             });
         }
         ;
     }
 }