mirror of
https://github.com/cyberark/PipeViewer
synced 2026-06-06 15:34:28 +00:00
Added selected rows count
This commit is contained in:
Generated
-1
@@ -466,7 +466,6 @@
|
||||
this.Name = "ColumnSelection";
|
||||
this.ShowIcon = false;
|
||||
this.Text = "PipeViewer Column Selection";
|
||||
this.Load += new System.EventHandler(this.ColumnSelection_Load);
|
||||
this.groupBoxNamedPipe.ResumeLayout(false);
|
||||
this.groupBoxNamedPipe.PerformLayout();
|
||||
this.groupBoxTimeStamp.ResumeLayout(false);
|
||||
|
||||
Generated
+27
-16
@@ -61,6 +61,7 @@
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.toolStripStatusLabelTotalNamedPipes = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabelTotalSelectedRows = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.toolStripButtonRefresh = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButtonClear = new System.Windows.Forms.ToolStripButton();
|
||||
@@ -112,14 +113,14 @@
|
||||
this.ColumnLastAccessTime,
|
||||
this.ColumnLastWriteTime,
|
||||
this.ColumnChangeTime});
|
||||
this.dataGridView1.Location = new System.Drawing.Point(4, 64);
|
||||
this.dataGridView1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.dataGridView1.Location = new System.Drawing.Point(3, 52);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.ReadOnly = true;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1268, 451);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(951, 366);
|
||||
this.dataGridView1.TabIndex = 0;
|
||||
this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseClick);
|
||||
this.dataGridView1.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_ColumnHeaderMouseClick);
|
||||
this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
|
||||
//
|
||||
// ColumnName
|
||||
//
|
||||
@@ -274,8 +275,7 @@
|
||||
this.helpToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(1273, 24);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(955, 24);
|
||||
this.menuStrip1.TabIndex = 1;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
@@ -311,12 +311,12 @@
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[]
|
||||
{this.toolStripStatusLabelTotalNamedPipes});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 537);
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripStatusLabelTotalNamedPipes,
|
||||
this.toolStripStatusLabelTotalSelectedRows});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 432);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(1273, 22);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(955, 22);
|
||||
this.statusStrip1.TabIndex = 2;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
@@ -326,6 +326,12 @@
|
||||
this.toolStripStatusLabelTotalNamedPipes.Size = new System.Drawing.Size(118, 17);
|
||||
this.toolStripStatusLabelTotalNamedPipes.Text = "toolStripStatusLabel1";
|
||||
//
|
||||
// toolStripStatusLabelTotalSelectedRows
|
||||
//
|
||||
this.toolStripStatusLabelTotalSelectedRows.Name = "toolStripStatusLabelTotalSelectedRows";
|
||||
this.toolStripStatusLabelTotalSelectedRows.Size = new System.Drawing.Size(97, 17);
|
||||
this.toolStripStatusLabelTotalSelectedRows.Text = "| Selected Rows: ";
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -338,7 +344,7 @@
|
||||
this.colorPermissionsButton});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(1273, 25);
|
||||
this.toolStrip1.Size = new System.Drawing.Size(955, 25);
|
||||
this.toolStrip1.TabIndex = 3;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
@@ -415,9 +421,9 @@
|
||||
// hScrollBar1
|
||||
//
|
||||
this.hScrollBar1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.hScrollBar1.Location = new System.Drawing.Point(0, 519);
|
||||
this.hScrollBar1.Location = new System.Drawing.Point(0, 414);
|
||||
this.hScrollBar1.Name = "hScrollBar1";
|
||||
this.hScrollBar1.Size = new System.Drawing.Size(1273, 18);
|
||||
this.hScrollBar1.Size = new System.Drawing.Size(955, 18);
|
||||
this.hScrollBar1.TabIndex = 5;
|
||||
this.hScrollBar1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar1_Scroll);
|
||||
//
|
||||
@@ -446,9 +452,9 @@
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1273, 559);
|
||||
this.ClientSize = new System.Drawing.Size(955, 454);
|
||||
this.Controls.Add(this.hScrollBar1);
|
||||
this.Controls.Add(this.toolStrip1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
@@ -456,7 +462,6 @@
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "Form1";
|
||||
this.Text = "PipeViewer";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
@@ -480,6 +485,12 @@
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelTotalNamedPipes;
|
||||
|
||||
//***************************************************************************
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelTotalSelectedRows;
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
private System.Windows.Forms.ToolStripButton toolStripButtonClear;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButtonFilter;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButtonFind;
|
||||
|
||||
+41
-3
@@ -22,6 +22,9 @@ namespace PipeViewer
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
private int m_NamedPipesNumber;
|
||||
// *********************************************
|
||||
private int m_SelectedRowsNumber;
|
||||
// *********************************************
|
||||
private Tuple<String, String> m_RightClickContent;
|
||||
private ListView m_LastListViewColumnFilter = new ListView();
|
||||
private ListView m_LastListViewHighlighFilter = new ListView();
|
||||
@@ -162,7 +165,40 @@ namespace PipeViewer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ******************************************************************************
|
||||
int CountSelectedRows(DataGridView dataGridView)
|
||||
{
|
||||
int count = 0;
|
||||
HashSet<int> RowsSet = new HashSet<int>();
|
||||
// Loop through the selected cells and count them
|
||||
foreach (DataGridViewCell cell in dataGridView.SelectedCells)
|
||||
{
|
||||
// Check if the cell is not a header cell
|
||||
// And if the cell row index is not in the set
|
||||
if (cell.RowIndex >= 0 && cell.ColumnIndex >= 0 && !RowsSet.Contains(cell.RowIndex))
|
||||
{
|
||||
// Add the cell row number to the set
|
||||
RowsSet.Add(cell.RowIndex);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
// ******************************************************************************
|
||||
|
||||
|
||||
// ******************************************************************************
|
||||
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Call the CountSelectedCells function and update the count wherever you want to display it
|
||||
int selectedrowCount = CountSelectedRows(dataGridView1);
|
||||
|
||||
// Do something with the selectedCellCount, for example, display it in a label
|
||||
toolStripStatusLabelTotalSelectedRows.Text = "| Total Selected Rows: " + selectedrowCount.ToString();
|
||||
}
|
||||
// ******************************************************************************
|
||||
|
||||
|
||||
//private delegate void initializePipeListCallBack();
|
||||
//private void initializePipeList()
|
||||
@@ -378,6 +414,9 @@ namespace PipeViewer
|
||||
dataGridView1.Refresh();
|
||||
m_NamedPipesNumber = 0;
|
||||
toolStripStatusLabelTotalNamedPipes.Text = "Total Named Pipes: 0";
|
||||
// *********************************************
|
||||
toolStripStatusLabelTotalNamedPipes.Text = "Total Selected Rows: 0";
|
||||
// *********************************************
|
||||
}
|
||||
|
||||
private void toolStripButtonGrid_Click(object sender, EventArgs e)
|
||||
@@ -482,7 +521,7 @@ namespace PipeViewer
|
||||
private void openPipeChat(string pipeName)
|
||||
{
|
||||
PipeChatForm pipeChat = new PipeChatForm(pipeName);
|
||||
pipeChat.ShowDialog();
|
||||
pipeChat.Show();
|
||||
}
|
||||
|
||||
private void FindWindow_searchForMatch(string i_SearchString, bool i_SearchDown, bool i_MatchWholeWord, bool i_MatchSensitive)
|
||||
@@ -1129,7 +1168,6 @@ namespace PipeViewer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void copyCellToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
<value>353, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>25</value>
|
||||
<value>156</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
|
||||
Generated
+6
-6
@@ -296,10 +296,10 @@ namespace PipeViewer
|
||||
// TextTab
|
||||
//
|
||||
this.TextTab.Controls.Add(this.textBox);
|
||||
this.TextTab.Location = new System.Drawing.Point(4, 25);
|
||||
this.TextTab.Location = new System.Drawing.Point(4, 22);
|
||||
this.TextTab.Name = "TextTab";
|
||||
this.TextTab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.TextTab.Size = new System.Drawing.Size(918, 93);
|
||||
this.TextTab.Size = new System.Drawing.Size(918, 96);
|
||||
this.TextTab.TabIndex = 0;
|
||||
this.TextTab.Text = "Text";
|
||||
this.TextTab.UseVisualStyleBackColor = true;
|
||||
@@ -314,7 +314,7 @@ namespace PipeViewer
|
||||
this.textBox.Multiline = true;
|
||||
this.textBox.Name = "textBox";
|
||||
this.textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.textBox.Size = new System.Drawing.Size(912, 87);
|
||||
this.textBox.Size = new System.Drawing.Size(912, 90);
|
||||
this.textBox.TabIndex = 2;
|
||||
this.textBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_KeyDown);
|
||||
this.textBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox_KeyPress);
|
||||
@@ -322,10 +322,10 @@ namespace PipeViewer
|
||||
// BinaryTab
|
||||
//
|
||||
this.BinaryTab.Controls.Add(this.chatHexBox);
|
||||
this.BinaryTab.Location = new System.Drawing.Point(4, 25);
|
||||
this.BinaryTab.Location = new System.Drawing.Point(4, 22);
|
||||
this.BinaryTab.Name = "BinaryTab";
|
||||
this.BinaryTab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.BinaryTab.Size = new System.Drawing.Size(918, 123);
|
||||
this.BinaryTab.Size = new System.Drawing.Size(918, 96);
|
||||
this.BinaryTab.TabIndex = 1;
|
||||
this.BinaryTab.Text = "Binary";
|
||||
this.BinaryTab.UseVisualStyleBackColor = true;
|
||||
@@ -339,7 +339,7 @@ namespace PipeViewer
|
||||
this.chatHexBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.chatHexBox.Name = "chatHexBox";
|
||||
this.chatHexBox.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255)))));
|
||||
this.chatHexBox.Size = new System.Drawing.Size(912, 117);
|
||||
this.chatHexBox.Size = new System.Drawing.Size(912, 90);
|
||||
this.chatHexBox.StringViewVisible = true;
|
||||
this.chatHexBox.TabIndex = 0;
|
||||
this.chatHexBox.UseFixedBytesPerLine = true;
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace PipeViewer
|
||||
|
||||
private void startClient()
|
||||
{
|
||||
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
startClientDelgation s = new startClientDelgation(startClient);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
Write-Host "pipe server"
|
||||
$count = 0
|
||||
$pipeName = "Foo"
|
||||
|
||||
$pipe = New-Object System.IO.Pipes.NamedPipeServerStream($pipeName, [System.IO.Pipes.PipeDirection]::InOut, 1, [System.IO.Pipes.PipeTransmissionMode]::Message, [System.IO.Pipes.PipeOptions]::None)
|
||||
|
||||
try {
|
||||
Write-Host "waiting for client"
|
||||
$pipe.WaitForConnection()
|
||||
Write-Host "got client"
|
||||
|
||||
while ($true) {
|
||||
Write-Host "writing message $count"
|
||||
|
||||
# Read data from the client
|
||||
$readBuffer = New-Object byte[] 1024
|
||||
$bytesRead = $pipe.Read($readBuffer, 0, $readBuffer.Length)
|
||||
$receivedData = [System.Text.Encoding]::ASCII.GetString($readBuffer, 0, $bytesRead)
|
||||
Write-Host $receivedData
|
||||
|
||||
# Convert data to uppercase
|
||||
$responseData = $receivedData.ToUpper()
|
||||
|
||||
# Write data to the client
|
||||
$responseBytes = [System.Text.Encoding]::ASCII.GetBytes($responseData)
|
||||
$pipe.Write($responseBytes, 0, $responseBytes.Length)
|
||||
$pipe.Flush()
|
||||
|
||||
$count++
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
}
|
||||
finally {
|
||||
$pipe.Dispose()
|
||||
}
|
||||
Reference in New Issue
Block a user