You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Übungen_LF6_WinFormanwendung
{
public partial class BinarySlicer : Form
{
string[] binaryInput = new string[1000];
int checkAscii = -1;
int curSlices = 1;
int gesSlices = 0;
public BinarySlicer()
{
InitializeComponent();
}
private void button_ende_Click(object sender, EventArgs e)
{
this.Close();
}
private void button_Slice_Click(object sender, EventArgs e)
{
//listBox_InputArray.Items.Clear();
for (int nums = 1; nums <= textBox_InputArray.Text.Length; nums++)
{
checkAscii = nums % 8;
if (checkAscii == 0)
{
gesSlices++;
textBox_InputArray.Select(nums - 8, 8);
binaryInput[gesSlices] = textBox_InputArray.SelectedText;
}
}
textBox_currSlice.Text = Convert.ToString(curSlices);
textBox_gesSlice.Text = Convert.ToString(gesSlices);
listBox_OutputArray.Items.Clear();
listBox_OutputArray.Items.Add(binaryInput[curSlices]);
}
private void button_Prev_Click(object sender, EventArgs e)
{
if (curSlices > 1)
{
curSlices--;
textBox_currSlice.Text = Convert.ToString(curSlices);
listBox_OutputArray.Items.Clear();
listBox_OutputArray.Items.Add(binaryInput[curSlices]);
}
}
private void button_Next_Click(object sender, EventArgs e)
{
if (curSlices < gesSlices)
{
curSlices++;
textBox_currSlice.Text = Convert.ToString(curSlices);
listBox_OutputArray.Items.Clear();
listBox_OutputArray.Items.Add(binaryInput[curSlices]);
}
}
}
}