bool SaveSequence(ClosedXML.Excel.IXLWorksheet sheet, int row) { sheet.Cell(row, 1).Value = TempPokemon.No; sheet.Cell(row, 2).Value = TempPokemon.Name; sheet.Cell(row, 3).Value = TempPokemon.Character; sheet.Cell(row, 4).Value = TempPokemon.Item; sheet.Cell(row, 5).Value = TempPokemon.Ability; for (int i = 0; i < 6; i++) { sheet.Cell(row, i + 10).Value = TempPokemon.EffortValue[i]; sheet.Cell(row, i + 16).Value = TempPokemon.IndividualValue[i]; sheet.Cell(row, i + 22).Value = TempPokemon.Statistics[i]; } for (int i = 0; i < 4; i++) { try { sheet.Cell(row, i + 6).Value = TempPokemon.Weapon[i]; } catch (IndexOutOfRangeException) { System.Windows.Forms.MessageBox.Show("ワザの入力が正しくありません"); for (int j = 1; j <= 27; j++) { sheet.Cell(row, j).Value = ""; } return(false); } } return(true); }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildLogsExtended.DataSourceEntities.BuildLog.Default dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Build_1_Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Solution_1Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Solution_1_Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.BuildEventCode_1_Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.BuildId; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.BuildEventCodeId; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Message; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.EventTime; }
public override void WriteHeaderLineToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Build_1_Name"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Id"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Solution_1Id"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Solution_1_Name"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "BuildEventCode_1_Name"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "BuildId"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "BuildEventCodeId"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Message"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "EventTime"; }
public override void WriteHeaderLineToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, int row) { char cell = 'A'; string cellKey; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "StatusCode"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Name"; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, Elmah.DataSourceEntities.ElmahStatusCode dataItem, int row) { char cell = 'A'; string cellKey; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.StatusCode; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildLogsExtended.DataSourceEntities.Build.UpdateNameRequest dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildExtensionPack.DataSourceEntities.BuildEventCode.KeyInformation dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.EventCode; }
public override void WriteHeaderLineToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Id"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Name"; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildLogsExtended.DataSourceEntities.Build.DefaultGroupedDataView dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.SolutionId; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.CountPerFK; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; }
public override void WriteHeaderLineToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, int row) { char cell = 'A'; string cellKey; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "MapItemCategory"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Identifiers"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Name"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "AddressType"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Address"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "SpatialLocation"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Url"; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, Elmah.DataSourceEntities.MapItem dataItem, int row) { char cell = 'A'; string cellKey; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.MapItemCategory; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Identifiers; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.AddressType; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Address; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = Framework.Helpers.GeoHelperSinglton.Instance.GeographyToGmlV3(dataItem.SpatialLocation); cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Url; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildLogsExtended.DataSourceEntities.Solution dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.ExternalParentId; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Description; }
/// <summary> /// 選擇檔案後觸發的上傳檔案事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rauXLSXUpload_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e) { if (rauXLSXUpload.UploadedFiles.Count > 0) // 判斷是否有上傳檔案 { List <string> lsTempPath = new List <string>(); foreach (Telerik.Web.UI.UploadedFile postedFile in rauXLSXUpload.UploadedFiles) // 巡覽上傳的所有檔案 { if (postedFile != null) { string extensionName = System.IO.Path.GetExtension(postedFile.FileName); if (extensionName.Equals(".xls") || extensionName.Equals(".xlsx")) // 沒有 { using (FileStream filestream = postedFile.InputStream as FileStream) using (ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(filestream)) { lsTempPath.Add(filestream.Name); ClosedXML.Excel.IXLWorksheet sheet = null; try { sheet = wb.Worksheets.Worksheet("Sheet1"); } catch { sheet = wb.Worksheets.Worksheet("工作表1"); } if (sheet == null) // 找不到工作表就離開 { break; } ktxtTABLE_NAME.Text = sheet.Cell(1, 1).GetString(); // 表格名稱 int rowIndex = 3; DataTable dtSource = getDefalutTable(); // 每次都當最新的 while (!sheet.Cell(rowIndex, 2).IsEmpty()) // 欄位名稱是空的 { DataRow ndr = dtSource.NewRow(); ndr["PK"] = sheet.Cell(rowIndex, 1).GetString().ToUpper().Trim(); // 鍵值 ndr["COLUMN_NAME"] = sheet.Cell(rowIndex, 2).GetString().ToUpper().Trim(); // 欄位名稱 ndr["DATA_TYPE"] = sheet.Cell(rowIndex, 3).GetString().ToUpper().Trim(); // 欄位類型 ndr["ALLOW_NULL"] = sheet.Cell(rowIndex, 4).GetString().ToUpper().Trim(); // 允許NULL ndr["DEFAULT_VALUE"] = ""; // 預設值 ndr["COLUMN_DESC"] = sheet.Cell(rowIndex, 5).GetString().ToUpper().Trim(); // 說明 dtSource.Rows.Add(ndr); rowIndex++; } ViewState["gvColumns"] = dtSource; gvColumns.DataSource = ViewState["gvColumns"]; gvColumns.DataBind(); } } } } // 刪除暫存檔 foreach (string _tmpPath in lsTempPath) { File.Delete(_tmpPath); } } }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildExtensionPack.DataSourceEntities.Build dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.SolutionId; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Description; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.BuildStartTime; }
/// <summary> /// Write a share ACL into worksheet and the evolution of his ACL. /// </summary> /// <param name="worksheet"></param> /// <param name="shareACL"></param> /// <param name="row">Row number to start from</param> /// <returns>First free row number</returns> static int WriteShare(ClosedXML.Excel.IXLWorksheet worksheet, SMBShareACL shareACL, int row) { if (Config.Debug) { Console.WriteLine("[*] Writing share on " + row.ToString() + " " + shareACL.share.ToString() + " ACLs ..."); } int col = 1; if (shareACL.shareACL.Count > 0) { row = InsertACL( worksheet, shareACL.share.hostname, shareACL.share.ToString(), shareACL.share.shareInfo.shi1_remark, 0, shareACL.shareACL, row, null, (shareACL.shareACLEvolution.Count > 0) ? shareACL.shareACLEvolution.First().Value.Keys.ToList() : null ); } else { worksheet.Cell(row, col++).Value = shareACL.share.hostname; worksheet.Cell(row, col++).Value = shareACL.share.ToString(); worksheet.Cell(row, col++).Value = shareACL.share.shareInfo.shi1_remark; worksheet.Cell(row, col++).Value = 0; worksheet.Cell(row, col++).Value = "No ACE"; worksheet.Cell(row, col++).Value = ""; worksheet.Cell(row, col++).Value = shareACL.discoveryDateTime; row++; } if (shareACL.shareACLEvolution.Count > 0) { row = InsertACLEvolution( worksheet, shareACL.share.hostname, shareACL.share.ToString(), shareACL.share.shareInfo.shi1_remark, 0, shareACL.shareACLEvolution, row, shareACL.shareACL.Keys.ToList() ); } return(row); }
private void ScriviOre( ClosedXML.Excel.IXLWorksheet meseSheet, List <RowExcel> dataOutput) { int row = 3; var it = new CultureInfo("it-IT"); while (dataOutput.Count() > 0) { var itemRowOutput = dataOutput.Select(a => a).OrderBy(a => a.Data).FirstOrDefault(); dataOutput.Remove(itemRowOutput); if (!meseSheet.Cell(row, 4).IsEmpty()) { meseSheet.Row(row).InsertRowsBelow(1); row++; } meseSheet.Cell(row, 1).Value = itemRowOutput.Data.ToString("dd/MM/yyyy"); meseSheet.Cell(row, 2).Value = itemRowOutput.Data.ToString("ddd", it); meseSheet.Cell(row, 3).Value = System.Globalization.ISOWeek.GetWeekOfYear(itemRowOutput.Data); meseSheet.Cell(row, 4).Value = itemRowOutput.Commessa; meseSheet.Cell(row, 6).Value = itemRowOutput.NumeroOre; meseSheet.Cell(row, 5).Value = itemRowOutput.SedeLavoro; if (itemRowOutput.Pasto) { Pernotto(meseSheet, row); } row++; } }
public override void WriteHeaderLineToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Id"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Name"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "IsSystemBuiltIn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "UniqueIdentifier"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "BitColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "UniqueidentifierColumn"; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildExtensionPack.DataSourceEntities.Organization.KeyInformation dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.IsSystemBuiltIn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.UniqueIdentifier; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.BitColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.UniqueidentifierColumn; }
public override void WriteHeaderLineToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, int row) { char cell = 'A'; string cellKey; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ElmahApplication_Name"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ErrorId"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ElmahHost_Name"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ElmahSource_Name"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ElmahStatusCode_Name"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ElmahType_Name"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ElmahUser_Name"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Application"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Host"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Type"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Source"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Message"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "User"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "StatusCode"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "TimeUtc"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Sequence"; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "AllXml"; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, Elmah.DataSourceEntities.ELMAH_Error dataItem, int row) { char cell = 'A'; string cellKey; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.ErrorId; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Application; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Host; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Type; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Source; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Message; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.User; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.StatusCode; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.TimeUtc; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Sequence; cellKey = GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.AllXml; }
/// <summary> /// Write the first row on the Excel worksheet. /// </summary> /// <param name="worksheet">An Excel worksheet object on which we write</param> /// <param name="row">The row number where to write</param> /// <param name="col">The column number where to write</param> /// <returns>The next empty row</returns> private static int WriteHeader(ClosedXML.Excel.IXLWorksheet worksheet, int row = 1, int col = 1) { worksheet.Cell(row, col++).Value = "Hostname"; worksheet.Cell(row, col++).Value = "UNC Path"; worksheet.Cell(row, col++).Value = "Remark"; worksheet.Cell(row, col++).Value = "Level"; worksheet.Cell(row, col++).Value = "ACE status"; worksheet.Cell(row, col++).Value = "ACE_ID"; worksheet.Cell(row, col++).Value = "DateTime"; worksheet.Cell(row, col++).Value = "AccessControlType"; worksheet.Cell(row, col++).Value = "CompactReadableFileSystemRights"; worksheet.Cell(row, col++).Value = "ReadableFileSystemRights"; worksheet.Cell(row, col++).Value = "ReadableIdentityReference"; worksheet.Cell(row, col++).Value = "IdentityReference"; worksheet.Cell(row, col++).Value = "Owner"; worksheet.Cell(row, col++).Value = "OwnerSID"; worksheet.Cell(row, col++).Value = "IsInherited"; worksheet.Cell(row, col++).Value = "InheritanceFlags"; worksheet.Cell(row, col++).Value = "PropagationFlags"; col = 1; return(++row); }
/// <summary> /// Write ACL into worksheet. /// </summary> /// <param name="worksheet"></param> /// <param name="hostname"></param> /// <param name="shareName"></param> /// <param name="remark"></param> /// <param name="level"></param> /// <param name="acl"></param> /// <param name="row">Row number to start from</param> /// <param name="lastScan">List of ACE_ID of the previous scan</param> /// <param name="nextScan">List of ACE_ID of the scan after the current one</param> /// <returns></returns> static int InsertACL(ClosedXML.Excel.IXLWorksheet worksheet, string hostname, string shareName, string remark, int level, Dictionary <string, Dictionary <string, string> > acl, int row, List <string> lastScan = null, List <string> nextScan = null) { int col = 1; if (acl.Count > 0) { foreach (var entry in acl) { if (Config.Debug && entry.Key != "noACE") { Console.WriteLine("[*] Writing share ACE on " + row.ToString() + " " + entry.Value["AccessControlType"] + " " + entry.Value["ReadableFileSystemRights"] + " to " + entry.Value["ReadableIdentityReference"] + " on " + shareName); } worksheet.Cell(row, col++).Value = hostname; worksheet.Cell(row, col++).Value = shareName; worksheet.Cell(row, col++).Value = remark; worksheet.Cell(row, col++).Value = level; if (entry.Key == "noACE") { worksheet.Cell(row, col++).Value = "No ACE"; worksheet.Cell(row, col++).Value = ""; worksheet.Cell(row, col++).Value = entry.Value["DiscoveryDateTime"]; } else { if (nextScan != null && lastScan != null) { if (lastScan.Contains(entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"]) && nextScan.Contains(entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"])) { worksheet.Cell(row, col++).Value = "No change"; } else if (!lastScan.Contains(entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"]) && nextScan.Contains(entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"])) { worksheet.Cell(row, col++).Value = "New ACE"; } else if (lastScan.Contains(entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"]) && !nextScan.Contains(entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"])) { worksheet.Cell(row, col++).Value = "ACE Removed "; } else { worksheet.Cell(row, col++).Value = "ACE Removed"; } } else if (nextScan != null) { worksheet.Cell(row, col++).Value = nextScan.Contains(entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"]) ? "New ACE" : "ACE removed"; } else if (lastScan != null) { worksheet.Cell(row, col++).Value = lastScan.Contains(entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"]) ? "No change" : "New ACE"; } else { worksheet.Cell(row, col++).Value = "New ACE"; } worksheet.Cell(row, col++).Value = entry.Value["IdentityReference"] + "-" + entry.Value["FileSystemRights"]; worksheet.Cell(row, col++).Value = entry.Value["DiscoveryDateTime"]; worksheet.Cell(row, col++).Value = entry.Value["AccessControlType"]; worksheet.Cell(row, col++).Value = entry.Value["CompactReadableFileSystemRights"]; worksheet.Cell(row, col++).Value = entry.Value["ReadableFileSystemRights"]; worksheet.Cell(row, col++).Value = (entry.Value["ReadableIdentityReference"].StartsWith("S-1-5")) ? TranslateSid(entry.Value["ReadableIdentityReference"]) : entry.Value["ReadableIdentityReference"]; worksheet.Cell(row, col++).Value = entry.Value["IdentityReference"]; worksheet.Cell(row, col++).Value = (entry.Value["Owner"].StartsWith("S-1-5")) ? TranslateSid(entry.Value["Owner"]) : entry.Value["Owner"]; worksheet.Cell(row, col++).Value = entry.Value["OwnerSID"]; worksheet.Cell(row, col++).Value = entry.Value["IsInherited"]; worksheet.Cell(row, col++).Value = entry.Value["InheritanceFlags"]; worksheet.Cell(row, col++).Value = entry.Value["PropagationFlags"]; } col = 1; row++; } } return(row); }
/// <summary> /// Write recursively ACL of share's subdirectories into worksheet. /// </summary> /// <param name="worksheet">Worksheet to write on</param> /// <param name="shareSubDirectoriesResult">A list of ScanDirectoryResult object</param> /// <param name="row">The row number to write on</param> /// <param name="level">The depth of the directory regarding the share root</param> /// <param name="shareRemark">A remark about the directory</param> /// <returns>First free row number</returns> private static int WriteShareDirectories(ClosedXML.Excel.IXLWorksheet worksheet, Dictionary <string, ScanDirectoryResult> shareSubDirectoriesResult, int row, int level = 0, string shareRemark = "") { bool debug = false; if (Environment.GetEnvironmentVariable("SMBShareMapperDebug") != null) { debug = true; } foreach (ScanDirectoryResult scanDirectoryResult in shareSubDirectoriesResult.Values) { if (debug) { Console.WriteLine("[*] Writing directory " + scanDirectoryResult.shareDirectoryACL.shareDirectory + " ACLs ..."); } int col = 1; if (scanDirectoryResult.shareDirectoryACL.directoryACL.Count > 0) { row = InsertACL( worksheet, ExtractHostNameFromPath(scanDirectoryResult.shareDirectoryACL.shareDirectory), scanDirectoryResult.shareDirectoryACL.shareDirectory, shareRemark, level, scanDirectoryResult.shareDirectoryACL.directoryACL, row, null, (scanDirectoryResult.shareDirectoryACL.directoryACLEvolution.Count > 0) ? scanDirectoryResult.shareDirectoryACL.directoryACLEvolution.First().Value.Keys.ToList(): null ); } else { worksheet.Cell(row, col++).Value = ExtractHostNameFromPath(scanDirectoryResult.shareDirectoryACL.shareDirectory); worksheet.Cell(row, col++).Value = scanDirectoryResult.shareDirectoryACL.shareDirectory; worksheet.Cell(row, col++).Value = shareRemark; worksheet.Cell(row, col++).Value = level; worksheet.Cell(row, col++).Value = "No ACE"; worksheet.Cell(row, col++).Value = ""; worksheet.Cell(row, col++).Value = scanDirectoryResult.shareDirectoryACL.discoveryDateTime; row++; } if (scanDirectoryResult.shareDirectoryACL.directoryACLEvolution.Count > 0) { row = InsertACLEvolution( worksheet, ExtractHostNameFromPath(scanDirectoryResult.shareDirectoryACL.shareDirectory), scanDirectoryResult.shareDirectoryACL.shareDirectory, shareRemark, level, scanDirectoryResult.shareDirectoryACL.directoryACLEvolution, row, scanDirectoryResult.shareDirectoryACL.directoryACL.Keys.ToList() ); } if (scanDirectoryResult.shareDirectorySubDirectories.Count > 0) { row = WriteShareDirectories(worksheet, scanDirectoryResult.shareDirectorySubDirectories, row, level + 1); } } return(row); }
public override void WriteHeaderLineToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Id"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "RecursivePath__"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ParentId"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Name"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "IsSystemBuiltIn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "UniqueIdentifier"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "CreatedDateTime"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "CharColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "VarcharColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "TextColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "NcharColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "NvarcharColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "NtextColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "BitColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "BinaryColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "VarbinaryColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ImageColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "TinyintColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "SmallintColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "IntColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "BigintColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "DecimalColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "NumericColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "SmallmoneyColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "MoneyColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "FloatColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "RealColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "DatetimeColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Datetime2Column"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "SmalldatetimeColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "DateColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "TimeColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "UniqueidentifierColumn"; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildExtensionPack.DataSourceEntities.Organization.DefaultWithPath dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.RecursivePath__; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.ParentId; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.IsSystemBuiltIn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.UniqueIdentifier; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.CreatedDateTime; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.CharColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.VarcharColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.TextColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.NcharColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.NvarcharColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.NtextColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.BitColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.BinaryColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.VarbinaryColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.ImageColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.TinyintColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.SmallintColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.IntColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.BigintColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.DecimalColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.NumericColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.SmallmoneyColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.MoneyColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.FloatColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.RealColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.DatetimeColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Datetime2Column; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.SmalldatetimeColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.DateColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.TimeColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.UniqueidentifierColumn; }
public override void WriteHeaderLineToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Organization_1_UniqueIdentifier"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Organization_1_UniqueidentifierColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Organization_1_Name"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Id"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Organization_2Id"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Organization_2_UniqueIdentifier"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Organization_2_UniqueidentifierColumn"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Organization_2_Name"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "ExternalParentId"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Name"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "Description"; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = "OrganizationId"; }
public override void WriteDataItemToClosedXmlWorkSheet(ClosedXML.Excel.IXLWorksheet worksheet, MSBuildExtensionPack.DataSourceEntities.Solution.Default dataItem, int row) { char cell = 'A'; string cellKey; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Organization_1_UniqueIdentifier; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Organization_1_UniqueidentifierColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Organization_1_Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Organization_2Id; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Organization_2_UniqueIdentifier; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Organization_2_UniqueidentifierColumn; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Organization_2_Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.ExternalParentId; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Name; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.Description; cellKey = Framework.Services.ClosedXmlHelper.GetCellKey(row, cell++); worksheet.Cell(cellKey).Value = dataItem.OrganizationId; }
private static void Pernotto(ClosedXML.Excel.IXLWorksheet meseSheet, int row) { meseSheet.Cell(row, 13).Value = "x"; meseSheet.Cell(row, 14).Value = "x"; meseSheet.Cell(row, 15).Value = "x"; }