Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Threading;
- using System.Timers;
- using System.Runtime.InteropServices;
- using System.Diagnostics;
- using System.Threading;
- namespace LPTTest
- {
- public partial class Form1 : Form
- {
- PerformanceCounter counter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
- ManualResetEvent ev = new ManualResetEvent(false);
- public static int i = 0, j = 0, adress = 888, adress1 = 890;
- public Form1()
- {
- InitializeComponent();
- PortAccess.Output(888, 0);
- PortAccess.Output(890, 4);
- //new Thread(new ThreadStart(Method)).Start();
- }
- bool cpu = false;
- float perc = 0;
- //public void Method()
- //{
- // while (true)
- // {
- // ev.WaitOne();
- // perc = counter.NextValue();
- // PortAccess.Output(890, 4);
- // PortAccess.Output(888, (int)(perc*2.55));
- // }
- //}
- void onCheckBoxClick(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- }
- private void button2_Click(object sender, EventArgs e)
- {
- }
- static void bain()
- {
- }
- static void testdata()
- {
- }
- private void Form1_FormClosing(object sender, FormClosingEventArgs e)
- {
- PortAccess.Output(adress, 0);
- PortAccess.Output(adress1, 11);
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void button3_Click(object sender, EventArgs e)
- {
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- static void ShowCPU()
- {
- }
- private void button4_Click(object sender, EventArgs e)
- {
- }
- static List<float> AvCPU = new List<float>();
- static PerformanceCounter cpuCounter;
- void doS()
- {
- }
- public class PortAccess
- {
- [DllImport("inpout32.dll", EntryPoint = "Out32")]
- public static extern void Output(int adress, int value);
- }
- void doP()
- {
- }
- private void Form1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar.ToString() == "1")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 128 + 1);
- }
- if (e.KeyChar.ToString() == "2")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 128 + 2);
- }
- if (e.KeyChar.ToString() == "3")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 128 + 4);
- }
- if (e.KeyChar.ToString() == "4")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 128 + 8);
- }
- if (e.KeyChar.ToString() == "5")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 64 + 1);
- }
- if (e.KeyChar.ToString() == "6")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 64 + 2);
- }
- if (e.KeyChar.ToString() == "7")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 64 + 4);
- }
- if (e.KeyChar.ToString() == "8")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 64 + 8);
- }
- if (e.KeyChar.ToString() == "9")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 32 + 4);
- }
- if (e.KeyChar.ToString() == "0")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 32 + 8);
- }
- if (e.KeyChar.ToString() == "-")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 16 + 4);
- }
- if (e.KeyChar.ToString() == "q")
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 16 + 8);
- }
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- perc = counter.NextValue();
- percent.Text = perc.ToString();
- PortAccess.Output(888, 255 - (255 - (int)perc));
- }
- private void button2_Click_1(object sender, EventArgs e)
- {
- PortAccess.Output(890, 4);
- PortAccess.Output(888, 128 + int.Parse(val.Text));
- }
- private void button3_Click_1(object sender, EventArgs e)
- {
- PortAccess.Output(888, 0);
- PortAccess.Output(890, 11);
- }
- private void button4_Click_1(object sender, EventArgs e)
- {
- int value = 0;
- int value1 = 0;
- if (checkBox1.Checked) value += 1;
- if (checkBox2.Checked) value += 2;
- if (checkBox3.Checked) value += 4;
- if (checkBox4.Checked) value += 8;
- if (checkBox5.Checked) value += 16;
- if (checkBox6.Checked) value += 32;
- if (checkBox7.Checked) value += 64;
- if (checkBox8.Checked) value += 128;
- if (checkBox9.Checked) value1 += 1;
- if (checkBox10.Checked) value1 += 2;
- if (checkBox11.Checked) value1 += 3;
- if (checkBox12.Checked) value1 += 4;
- PortAccess.Output(888, value);
- PortAccess.Output(890, 4);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement