mirror of
https://github.com/chylex/Query.git
synced 2025-06-17 16:39:56 +02:00
Reformat code
This commit is contained in:
parent
9a386d25f4
commit
a283fe7c9e
AppCalc
AppConv
General
Units
Utils
AppWindows
Base
Query
@ -151,9 +151,15 @@ namespace AppCalc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case "+": stack.Push(operand1+operand2); break;
|
case "+":
|
||||||
case "-": stack.Push(operand1-operand2); break;
|
stack.Push(operand1 + operand2);
|
||||||
case "*": stack.Push(operand1*operand2); break;
|
break;
|
||||||
|
case "-":
|
||||||
|
stack.Push(operand1 - operand2);
|
||||||
|
break;
|
||||||
|
case "*":
|
||||||
|
stack.Push(operand1 * operand2);
|
||||||
|
break;
|
||||||
|
|
||||||
case "/":
|
case "/":
|
||||||
if (operand2 == 0M) {
|
if (operand2 == 0M) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
namespace AppCalc {
|
namespace AppCalc {
|
||||||
internal static class Operators{
|
static class Operators {
|
||||||
internal static readonly string[] With2Operands = { "+", "-", "*", "/", "%", "^" };
|
internal static readonly string[] With2Operands = { "+", "-", "*", "/", "%", "^" };
|
||||||
|
|
||||||
internal static int GetPrecedence(string token) {
|
internal static int GetPrecedence(string token) {
|
||||||
|
@ -4,7 +4,7 @@ using System.Globalization;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace AppConv.General {
|
namespace AppConv.General {
|
||||||
internal abstract class DecimalUnitConverterBase<T> : IUnitType where T : struct{
|
abstract class DecimalUnitConverterBase<T> : IUnitType where T : struct {
|
||||||
internal sealed class DecimalFuncMap : Dictionary<T, Func<decimal, decimal>> {
|
internal sealed class DecimalFuncMap : Dictionary<T, Func<decimal, decimal>> {
|
||||||
public DecimalFuncMap() {}
|
public DecimalFuncMap() {}
|
||||||
public DecimalFuncMap(int capacity) : base(capacity) {}
|
public DecimalFuncMap(int capacity) : base(capacity) {}
|
||||||
@ -19,23 +19,11 @@ namespace AppConv.General{
|
|||||||
protected abstract DecimalFuncMap ConvertTo { get; }
|
protected abstract DecimalFuncMap ConvertTo { get; }
|
||||||
protected abstract DecimalFuncMap ConvertFrom { get; }
|
protected abstract DecimalFuncMap ConvertFrom { get; }
|
||||||
|
|
||||||
protected virtual int Precision{
|
protected virtual int Precision => 0;
|
||||||
get{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual bool CaseCheck{
|
protected virtual bool CaseCheck => false;
|
||||||
get{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual NumberStyles NumberStyle{
|
protected virtual NumberStyles NumberStyle => NumberStyles.Float & ~NumberStyles.AllowLeadingSign;
|
||||||
get{
|
|
||||||
return NumberStyles.Float & ~NumberStyles.AllowLeadingSign;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual string ProcessSrc(string src) {
|
protected virtual string ProcessSrc(string src) {
|
||||||
return src;
|
return src;
|
||||||
@ -82,7 +70,7 @@ namespace AppConv.General{
|
|||||||
src = ProcessSrc(src);
|
src = ProcessSrc(src);
|
||||||
dst = ProcessDst(dst);
|
dst = ProcessDst(dst);
|
||||||
|
|
||||||
KeyValuePair<string, T>[] pairs = new KeyValuePair<string, T>[2];
|
var pairs = new KeyValuePair<string, T>[2];
|
||||||
|
|
||||||
for (int index = 0; index < 2; index++) {
|
for (int index = 0; index < 2; index++) {
|
||||||
string str = index == 0 ? src : dst;
|
string str = index == 0 ? src : dst;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace AppConv.General {
|
namespace AppConv.General {
|
||||||
internal abstract class DecimalUnitConverterSimple<T> : DecimalUnitConverterBase<T> where T : struct{
|
abstract class DecimalUnitConverterSimple<T> : DecimalUnitConverterBase<T> where T : struct {
|
||||||
// ReSharper disable once StaticMemberInGenericType
|
// ReSharper disable once StaticMemberInGenericType
|
||||||
private static readonly Func<decimal, decimal> FuncNoChange = val => val;
|
private static readonly Func<decimal, decimal> FuncNoChange = val => val;
|
||||||
|
|
||||||
@ -11,35 +11,15 @@ namespace AppConv.General{
|
|||||||
|
|
||||||
private int invalidUnitObject = -1;
|
private int invalidUnitObject = -1;
|
||||||
|
|
||||||
protected sealed override NameMap Names{
|
protected sealed override NameMap Names => UnitNames;
|
||||||
get{
|
|
||||||
return UnitNames;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed override DecimalFuncMap ConvertFrom{
|
protected sealed override DecimalFuncMap ConvertFrom => MapFrom;
|
||||||
get{
|
|
||||||
return MapFrom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed override DecimalFuncMap ConvertTo{
|
protected sealed override DecimalFuncMap ConvertTo => MapTo;
|
||||||
get{
|
|
||||||
return MapTo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override int Precision{
|
protected override int Precision => 3;
|
||||||
get{
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool CaseCheck{
|
protected override bool CaseCheck => true;
|
||||||
get{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void AddUnit(T unitObject, params string[] names) {
|
protected void AddUnit(T unitObject, params string[] names) {
|
||||||
foreach (string name in names) {
|
foreach (string name in names) {
|
||||||
@ -56,7 +36,7 @@ namespace AppConv.General{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void SetInvalidUnitObject(T unitObject) {
|
protected void SetInvalidUnitObject(T unitObject) {
|
||||||
this.invalidUnitObject = (int)(object)unitObject;
|
invalidUnitObject = (int) (object) unitObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected sealed override bool IsValueInvalid(T value) {
|
protected sealed override bool IsValueInvalid(T value) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
namespace AppConv.General {
|
namespace AppConv.General {
|
||||||
internal interface IUnitType{
|
interface IUnitType {
|
||||||
bool TryProcess(string src, string dst, out string result);
|
bool TryProcess(string src, string dst, out string result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,15 @@
|
|||||||
using AppConv.General;
|
using AppConv.General;
|
||||||
|
|
||||||
namespace AppConv.Units {
|
namespace AppConv.Units {
|
||||||
internal class Angle : DecimalUnitConverterSimple<Angle.Units>{
|
class Angle : DecimalUnitConverterSimple<Angle.Units> {
|
||||||
internal enum Units {
|
internal enum Units {
|
||||||
Invalid = 0, Degree, Radian, Gradian
|
Invalid = 0,
|
||||||
|
Degree,
|
||||||
|
Radian,
|
||||||
|
Gradian
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override int Precision{
|
protected override int Precision => 4;
|
||||||
get{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Angle() {
|
public Angle() {
|
||||||
AddUnit(Units.Degree, "deg", "degree", "degrees", "arc degree", "arc degrees", "arcdegree", "arcdegrees", "°");
|
AddUnit(Units.Degree, "deg", "degree", "degrees", "arc degree", "arc degrees", "arcdegree", "arcdegrees", "°");
|
||||||
|
@ -1,9 +1,24 @@
|
|||||||
using AppConv.General;
|
using AppConv.General;
|
||||||
|
|
||||||
namespace AppConv.Units {
|
namespace AppConv.Units {
|
||||||
internal class Area : DecimalUnitConverterSimple<Area.Units>{
|
class Area : DecimalUnitConverterSimple<Area.Units> {
|
||||||
internal enum Units {
|
internal enum Units {
|
||||||
Invalid = 0, SquareMM, SquareCM, SquareDM, SquareM, SquareKM, SquareMile, SquareYard, SquareFoot, SquareInch, Acre, Centiare, Deciare, Are, Decare, Hectare
|
Invalid = 0,
|
||||||
|
SquareMM,
|
||||||
|
SquareCM,
|
||||||
|
SquareDM,
|
||||||
|
SquareM,
|
||||||
|
SquareKM,
|
||||||
|
SquareMile,
|
||||||
|
SquareYard,
|
||||||
|
SquareFoot,
|
||||||
|
SquareInch,
|
||||||
|
Acre,
|
||||||
|
Centiare,
|
||||||
|
Deciare,
|
||||||
|
Are,
|
||||||
|
Decare,
|
||||||
|
Hectare
|
||||||
}
|
}
|
||||||
|
|
||||||
public Area() {
|
public Area() {
|
||||||
|
@ -5,9 +5,14 @@ using AppConv.General;
|
|||||||
using AppConv.Utils;
|
using AppConv.Utils;
|
||||||
|
|
||||||
namespace AppConv.Units {
|
namespace AppConv.Units {
|
||||||
internal class Length : DecimalUnitConverterSimple<Length.Units>{
|
class Length : DecimalUnitConverterSimple<Length.Units> {
|
||||||
internal enum Units {
|
internal enum Units {
|
||||||
Invalid = 0, Meter, Inch, Foot, Yard, Mile
|
Invalid = 0,
|
||||||
|
Meter,
|
||||||
|
Inch,
|
||||||
|
Foot,
|
||||||
|
Yard,
|
||||||
|
Mile
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string[] NamesInch = { "in", "inch", "inches", "\"", "''" };
|
private static readonly string[] NamesInch = { "in", "inch", "inches", "\"", "''" };
|
||||||
|
@ -6,7 +6,7 @@ using AppConv.Utils;
|
|||||||
using Base;
|
using Base;
|
||||||
|
|
||||||
namespace AppConv.Units {
|
namespace AppConv.Units {
|
||||||
internal class Radix : IUnitType{
|
class Radix : IUnitType {
|
||||||
private static readonly Dictionary<string, int> RadixDescriptions = new Dictionary<string, int> {
|
private static readonly Dictionary<string, int> RadixDescriptions = new Dictionary<string, int> {
|
||||||
{ "UNARY", 1 },
|
{ "UNARY", 1 },
|
||||||
{ "BINARY", 2 },
|
{ "BINARY", 2 },
|
||||||
|
@ -3,9 +3,11 @@ using AppConv.General;
|
|||||||
using AppConv.Utils;
|
using AppConv.Utils;
|
||||||
|
|
||||||
namespace AppConv.Units {
|
namespace AppConv.Units {
|
||||||
internal class Storage : DecimalUnitConverterSimple<Storage.Units>{
|
class Storage : DecimalUnitConverterSimple<Storage.Units> {
|
||||||
internal enum Units {
|
internal enum Units {
|
||||||
Invalid = 0, Byte, Bit
|
Invalid = 0,
|
||||||
|
Byte,
|
||||||
|
Bit
|
||||||
}
|
}
|
||||||
|
|
||||||
public Storage() {
|
public Storage() {
|
||||||
@ -16,7 +18,7 @@ namespace AppConv.Units {
|
|||||||
|
|
||||||
SetInvalidUnitObject(Units.Invalid);
|
SetInvalidUnitObject(Units.Invalid);
|
||||||
|
|
||||||
SI.ExtededProperties bitConversionProperties = new SI.ExtededProperties{
|
var bitConversionProperties = new SI.ExtededProperties {
|
||||||
FactorPredicate = factor => factor > 0 && factor % 3 == 0,
|
FactorPredicate = factor => factor > 0 && factor % 3 == 0,
|
||||||
FromFunctionGenerator = exponent => () => (decimal) Math.Pow(1024, -(int) (exponent / 3)),
|
FromFunctionGenerator = exponent => () => (decimal) Math.Pow(1024, -(int) (exponent / 3)),
|
||||||
ToFunctionGenerator = exponent => () => (decimal) Math.Pow(1024, (int) (exponent / 3))
|
ToFunctionGenerator = exponent => () => (decimal) Math.Pow(1024, (int) (exponent / 3))
|
||||||
|
@ -4,9 +4,17 @@ using AppConv.General;
|
|||||||
using Base.Utils;
|
using Base.Utils;
|
||||||
|
|
||||||
namespace AppConv.Units {
|
namespace AppConv.Units {
|
||||||
internal class Temperature : DecimalUnitConverterBase<Temperature.Units>{
|
class Temperature : DecimalUnitConverterBase<Temperature.Units> {
|
||||||
internal enum Units {
|
internal enum Units {
|
||||||
Invalid = 0, Celsius, Kelvin, Fahrenheit, Rankine, Delisle, Newton, Reaumur, Romer
|
Invalid = 0,
|
||||||
|
Celsius,
|
||||||
|
Kelvin,
|
||||||
|
Fahrenheit,
|
||||||
|
Rankine,
|
||||||
|
Delisle,
|
||||||
|
Newton,
|
||||||
|
Reaumur,
|
||||||
|
Romer
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly NameMap UnitNames = new NameMap(21) {
|
private static readonly NameMap UnitNames = new NameMap(21) {
|
||||||
@ -57,35 +65,15 @@ namespace AppConv.Units{
|
|||||||
|
|
||||||
private static readonly Regex RegexCleanup = new Regex("deg(?:rees?)?|°", RegexUtils.Text);
|
private static readonly Regex RegexCleanup = new Regex("deg(?:rees?)?|°", RegexUtils.Text);
|
||||||
|
|
||||||
protected override NameMap Names{
|
protected override NameMap Names => UnitNames;
|
||||||
get{
|
|
||||||
return UnitNames;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DecimalFuncMap ConvertFrom{
|
protected override DecimalFuncMap ConvertFrom => FromCelsius;
|
||||||
get{
|
|
||||||
return FromCelsius;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DecimalFuncMap ConvertTo{
|
protected override DecimalFuncMap ConvertTo => ToCelsius;
|
||||||
get{
|
|
||||||
return ToCelsius;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override int Precision{
|
protected override int Precision => 2;
|
||||||
get{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override NumberStyles NumberStyle{
|
protected override NumberStyles NumberStyle => NumberStyles.Float;
|
||||||
get{
|
|
||||||
return NumberStyles.Float;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string ProcessSrc(string src) {
|
protected override string ProcessSrc(string src) {
|
||||||
return RegexCleanup.Replace(src, "");
|
return RegexCleanup.Replace(src, "");
|
||||||
|
@ -2,9 +2,15 @@
|
|||||||
using AppConv.Utils;
|
using AppConv.Utils;
|
||||||
|
|
||||||
namespace AppConv.Units {
|
namespace AppConv.Units {
|
||||||
internal class Volume : DecimalUnitConverterSimple<Volume.Units>{
|
class Volume : DecimalUnitConverterSimple<Volume.Units> {
|
||||||
internal enum Units {
|
internal enum Units {
|
||||||
Invalid = 0, Liter, CubicMM, CubicCM, CubicDM, CubicM, CubicKM
|
Invalid = 0,
|
||||||
|
Liter,
|
||||||
|
CubicMM,
|
||||||
|
CubicCM,
|
||||||
|
CubicDM,
|
||||||
|
CubicM,
|
||||||
|
CubicKM
|
||||||
}
|
}
|
||||||
|
|
||||||
public Volume() {
|
public Volume() {
|
||||||
|
@ -2,9 +2,13 @@
|
|||||||
using AppConv.Utils;
|
using AppConv.Utils;
|
||||||
|
|
||||||
namespace AppConv.Units {
|
namespace AppConv.Units {
|
||||||
internal class Weight : DecimalUnitConverterSimple<Weight.Units>{
|
class Weight : DecimalUnitConverterSimple<Weight.Units> {
|
||||||
internal enum Units {
|
internal enum Units {
|
||||||
Invalid = 0, Gram, Pound, Ounce, Stone
|
Invalid = 0,
|
||||||
|
Gram,
|
||||||
|
Pound,
|
||||||
|
Ounce,
|
||||||
|
Stone
|
||||||
}
|
}
|
||||||
|
|
||||||
public Weight() {
|
public Weight() {
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace AppConv.Utils {
|
namespace AppConv.Utils {
|
||||||
internal static class RadixConversion{
|
static class RadixConversion {
|
||||||
private const string Characters = "0123456789ABCDEF";
|
private const string Characters = "0123456789ABCDEF";
|
||||||
|
|
||||||
public static bool IsBaseValid(int checkedBase) {
|
public static bool IsBaseValid(int checkedBase) {
|
||||||
@ -62,7 +62,7 @@ namespace AppConv.Utils{
|
|||||||
return Characters[(int) wip].ToString();
|
return Characters[(int) wip].ToString();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
StringBuilder converted = new StringBuilder();
|
var converted = new StringBuilder();
|
||||||
|
|
||||||
while (wip >= toBase) {
|
while (wip >= toBase) {
|
||||||
int index = (int) (wip % toBase);
|
int index = (int) (wip % toBase);
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using AppConv.General;
|
using AppConv.General;
|
||||||
|
|
||||||
namespace AppConv.Utils {
|
namespace AppConv.Utils {
|
||||||
internal static class SI{
|
static class SI {
|
||||||
private static readonly List<Tuple<string, string, int>> Factors = new List<Tuple<string, string, int>> {
|
private static readonly List<Tuple<string, string, int>> Factors = new List<Tuple<string, string, int>> {
|
||||||
new Tuple<string, string, int>("yotta", "Y", 24),
|
new Tuple<string, string, int>("yotta", "Y", 24),
|
||||||
new Tuple<string, string, int>("zetta", "Z", 21),
|
new Tuple<string, string, int>("zetta", "Z", 21),
|
||||||
|
@ -5,29 +5,31 @@ using System.IO;
|
|||||||
using Base;
|
using Base;
|
||||||
|
|
||||||
namespace AppSys.Handlers {
|
namespace AppSys.Handlers {
|
||||||
internal class HandlerApps : IHandler{
|
class HandlerApps : IHandler {
|
||||||
private static readonly string PathSystem = Environment.GetFolderPath(Environment.SpecialFolder.System);
|
private static readonly string PathSystem = Environment.GetFolderPath(Environment.SpecialFolder.System);
|
||||||
|
|
||||||
private static readonly Dictionary<string, ProcessStartInfo> Mappings = new Dictionary<string, ProcessStartInfo> {
|
private static readonly Dictionary<string, ProcessStartInfo> Mappings = new Dictionary<string, ProcessStartInfo> {
|
||||||
{ "audio", new ProcessStartInfo{
|
{
|
||||||
|
"audio", new ProcessStartInfo {
|
||||||
FileName = Path.Combine(PathSystem, "control.exe"),
|
FileName = Path.Combine(PathSystem, "control.exe"),
|
||||||
Arguments = "mmsys.cpl"
|
Arguments = "mmsys.cpl"
|
||||||
} },
|
}
|
||||||
|
}, {
|
||||||
{ "programs", new ProcessStartInfo{
|
"programs", new ProcessStartInfo {
|
||||||
FileName = Path.Combine(PathSystem, "control.exe"),
|
FileName = Path.Combine(PathSystem, "control.exe"),
|
||||||
Arguments = "appwiz.cpl"
|
Arguments = "appwiz.cpl"
|
||||||
} },
|
}
|
||||||
|
}, {
|
||||||
{ "system", new ProcessStartInfo{
|
"system", new ProcessStartInfo {
|
||||||
FileName = Path.Combine(PathSystem, "control.exe"),
|
FileName = Path.Combine(PathSystem, "control.exe"),
|
||||||
Arguments = "sysdm.cpl"
|
Arguments = "sysdm.cpl"
|
||||||
} },
|
}
|
||||||
|
}, {
|
||||||
{ "environment", new ProcessStartInfo{
|
"environment", new ProcessStartInfo {
|
||||||
FileName = Path.Combine(PathSystem, "rundll32.exe"),
|
FileName = Path.Combine(PathSystem, "rundll32.exe"),
|
||||||
Arguments = "sysdm.cpl,EditEnvironmentVariables"
|
Arguments = "sysdm.cpl,EditEnvironmentVariables"
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> Substitutions = new Dictionary<string, string> {
|
private static readonly Dictionary<string, string> Substitutions = new Dictionary<string, string> {
|
||||||
@ -52,6 +54,7 @@ namespace AppSys.Handlers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
using (Process.Start(Mappings[key])) {}
|
using (Process.Start(Mappings[key])) {}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ using System.Text;
|
|||||||
using Base;
|
using Base;
|
||||||
|
|
||||||
namespace AppSys.Handlers {
|
namespace AppSys.Handlers {
|
||||||
internal class HandlerProcesses : IHandler{
|
class HandlerProcesses : IHandler {
|
||||||
public bool Matches(Command cmd) {
|
public bool Matches(Command cmd) {
|
||||||
return cmd.Text.StartsWith("kill ", StringComparison.InvariantCultureIgnoreCase);
|
return cmd.Text.StartsWith("kill ", StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ namespace AppSys.Handlers{
|
|||||||
return "No.";
|
return "No.";
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder build = new StringBuilder();
|
var build = new StringBuilder();
|
||||||
build.Append("Killed ").Append(succeeded).Append(" process").Append(succeeded == 1 ? "" : "es");
|
build.Append("Killed ").Append(succeeded).Append(" process").Append(succeeded == 1 ? "" : "es");
|
||||||
|
|
||||||
if (failed > 0) {
|
if (failed > 0) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using Base;
|
using Base;
|
||||||
|
|
||||||
namespace AppSys {
|
namespace AppSys {
|
||||||
internal interface IHandler{
|
interface IHandler {
|
||||||
bool Matches(Command cmd);
|
bool Matches(Command cmd);
|
||||||
string Handle(Command cmd);
|
string Handle(Command cmd);
|
||||||
}
|
}
|
||||||
|
@ -27,14 +27,10 @@ namespace Base{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSingleToken{
|
public bool IsSingleToken => Text.IndexOf(' ') == -1;
|
||||||
get{
|
|
||||||
return Text.IndexOf(' ') == -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Command(string text) {
|
public Command(string text) {
|
||||||
this.Text = text;
|
Text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command ReplaceBrackets(MatchEvaluator evaluator) {
|
public Command ReplaceBrackets(MatchEvaluator evaluator) {
|
||||||
|
@ -5,7 +5,7 @@ namespace Base{
|
|||||||
public Command Command { get; private set; }
|
public Command Command { get; private set; }
|
||||||
|
|
||||||
public CommandEventArgs(string text) {
|
public CommandEventArgs(string text) {
|
||||||
this.Command = new Command(text);
|
Command = new Command(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,10 @@ using System.Windows.Forms;
|
|||||||
namespace Query.Controls {
|
namespace Query.Controls {
|
||||||
sealed partial class QueryHistoryLog : UserControl {
|
sealed partial class QueryHistoryLog : UserControl {
|
||||||
public enum EntryType {
|
public enum EntryType {
|
||||||
UserInput, CommandResult, Information, Error
|
UserInput,
|
||||||
|
CommandResult,
|
||||||
|
Information,
|
||||||
|
Error
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Dictionary<EntryType, Color> EntryColorMap = new Dictionary<EntryType, Color> {
|
private static readonly Dictionary<EntryType, Color> EntryColorMap = new Dictionary<EntryType, Color> {
|
||||||
|
@ -17,8 +17,8 @@ namespace Query.Controls{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Setup(CommandHistory historyObj, Action<string> logFunc) {
|
public void Setup(CommandHistory historyObj, Action<string> logFunc) {
|
||||||
this.history = historyObj;
|
history = historyObj;
|
||||||
this.log = logFunc;
|
log = logFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCommandRan() {
|
private void OnCommandRan() {
|
||||||
|
@ -5,17 +5,9 @@ namespace Query.Core{
|
|||||||
private readonly List<string> queries = new List<string>();
|
private readonly List<string> queries = new List<string>();
|
||||||
private readonly List<string> results = new List<string>();
|
private readonly List<string> results = new List<string>();
|
||||||
|
|
||||||
public IList<string> Queries{
|
public IList<string> Queries => queries;
|
||||||
get{
|
|
||||||
return queries;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IList<string> Results{
|
public IList<string> Results => results;
|
||||||
get{
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddQuery(string text) {
|
public void AddQuery(string text) {
|
||||||
queries.Add(text);
|
queries.Add(text);
|
||||||
|
Loading…
Reference in New Issue
Block a user