2017-06-07 21:02:29 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2017-07-22 19:27:41 +00:00
|
|
|
|
namespace Glove.INI {
|
2017-06-07 21:02:29 +00:00
|
|
|
|
public class Value {
|
|
|
|
|
private string Raw;
|
|
|
|
|
|
|
|
|
|
public Value(string raw) {
|
|
|
|
|
Raw = raw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static implicit operator string(Value value) {
|
|
|
|
|
return value.Raw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static implicit operator bool(Value value) {
|
|
|
|
|
return Boolean.TryParse(value.Raw, out bool retval)
|
|
|
|
|
? retval
|
|
|
|
|
: false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-08 21:01:34 +00:00
|
|
|
|
public static implicit operator Int32(Value value) {
|
|
|
|
|
return Int32.TryParse(value.Raw, out Int32 retval)
|
2017-06-07 21:02:29 +00:00
|
|
|
|
? retval
|
|
|
|
|
: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static implicit operator double(Value value) {
|
|
|
|
|
return Double.TryParse(value.Raw, out double retval)
|
|
|
|
|
? retval
|
|
|
|
|
: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|