-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
79 lines (78 loc) · 3.6 KB
/
Program.cs
File metadata and controls
79 lines (78 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using Microsoft.Win32;
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Collections.Generic;
namespace WacomArea {
public class Converter {
static Dictionary<string, float> TabletArea = new Dictionary<string, float>();
static Dictionary<string, int> WacomArea = new Dictionary<string, int>();
static public void Main(string[] args) {
Console.WriteLine("Would you like to convert Wacom to Hawku area or Hawku to Wacom area?");
Console.WriteLine("[1] Wacom To Hawku area");
Console.WriteLine("[2] Hawku to Wacom area");
int choice = int.Parse(Console.ReadLine());
if (choice == 1) {
WacToHaw();
}
else if (choice == 2) {
HawToWac();
}
}
static public void HawToWac() {
Console.WriteLine("Wacom Area Converter made by Fysix");
Console.WriteLine("What is your area width?: ");
float w = float.Parse(Console.ReadLine());
Console.WriteLine("What is your area height?: ");
float h = float.Parse(Console.ReadLine());
Console.WriteLine("What is your area X position?: ");
float x = float.Parse(Console.ReadLine());
Console.WriteLine("What is your area Y position?: ");
float y = float.Parse(Console.ReadLine());
TabletArea.Add("width", w);
TabletArea.Add("height", h);
TabletArea.Add("xpos", x);
TabletArea.Add("ypos", y);
double wacomLeft = (TabletArea["xpos"] - TabletArea["width"] / 2) * 100.0;
double wacomRight = (TabletArea["xpos"] + TabletArea["width"] / 2) * 100.0;
double wacomTop = (TabletArea["ypos"] - TabletArea["height"] / 2) * 100.0;
double wacomBottom = (TabletArea["ypos"] + TabletArea["height"] / 2) * 100.0;
Console.WriteLine("Left: " + Math.Round(wacomLeft));
Console.WriteLine("Right: " + Math.Round(wacomRight));
Console.WriteLine("Top: " + Math.Round(wacomTop));
Console.WriteLine("Bottom: " + Math.Round(wacomBottom));
Console.ReadKey();
}
static public void WacToHaw() {
double ConversionFactor = 15200.0 / 152.0;
Console.WriteLine("Wacom Area Converter made by Fysix");
Console.WriteLine("What is your area Left?: ");
float l = float.Parse(Console.ReadLine());
Console.WriteLine("What is your area Right?: ");
float r = float.Parse(Console.ReadLine());
Console.WriteLine("What is your area Top?: ");
float t = float.Parse(Console.ReadLine());
Console.WriteLine("What is your area Bottom: ");
float b = float.Parse(Console.ReadLine());
TabletArea.Add("top", t);
TabletArea.Add("left", l);
TabletArea.Add("right", r);
TabletArea.Add("bottom", b);
double hawkuWidth = (r - l) / ConversionFactor;
hawkuWidth = Math.Round((double)hawkuWidth, 2);
double hawkuHeight = (b - t) / ConversionFactor;
hawkuHeight = Math.Round((double)hawkuHeight, 2);
double hawkuX = (hawkuWidth / 2) + (l / ConversionFactor);
hawkuX = Math.Round((double)hawkuX, 2);
double hawkuY = (hawkuHeight / 2) + (t / ConversionFactor);
hawkuY = Math.Round((double)hawkuY, 2);
Console.WriteLine("Width: " + hawkuWidth);
Console.WriteLine("Height: " + hawkuHeight);
Console.WriteLine("X: " + hawkuX);
Console.WriteLine("Y: " + hawkuY);
Console.ReadKey();
}
}
}