public SpawnListElement(StringConv conv, int weight, double chance, object val) { this.conv = conv; this.weight = weight; this.chance = chance; this.val = val; }
public ListElement(StringConv conv, int addIndex, int key, object val) { this.addIndex = addIndex; this.key = key; this.conv = conv; this.val = val; }
public void DatetimeTest() { var dt = new DateTime(2017, 10, 1, 10, 10, 12, 933); var str = StringConv.ToString(dt); var expectedStr = dt.ToString(CultureInfo.CurrentCulture); str.ShouldBe(expectedStr); }
public void GuidTest() { var guid = new Guid(); var str1 = guid.ToString(); var str2 = StringConv.ToString(guid); str1.ShouldBe(str2); }
public void ValueTypeTest() { var str1 = StringConv.ToString(1); var str2 = StringConv.ToString(1.1D); str1.ShouldBe("1"); str2.ShouldBe("1.1"); }
public SpawnRangeListElement(StringConv conv, int addMin, int addMax, int start, int end, int weight, object val) { this.conv = conv; this.addMin = addMin; this.addMax = addMax; this.start = start; this.end = end; this.weight = weight; this.val = val; }
public void ObjectTest() { var one = new One(); var two = new Two(); var str1 = StringConv.ToString(one); var str2 = StringConv.ToString(two); str1.ShouldBe("Cosmos.Test.Conversions.ObjectConversionTest+One"); str2.ShouldBe("i'm two!"); }
/// <summary> /// 描画メソッド。 /// Screen2DGlの線の太さを変更しているので注意。 /// </summary> public void OnDraw(Screen2DGl screen, int x, int y) { if (fpstimer == null) { return; } int fps = (int)fpstimer.Fps; int realfps = fpstimer.RealFpsInt; screen.SetLineWidth((int)((float)size) / 6 + 1); // string txt = realfps.ToString("D6"); string txt = StringConv.ToDecZeroSuppress(realfps, 6) + "FPS"; int r, g, b; screen.GetColor(out r, out g, out b); // 色を保存 screen.SetColor(0, 120, 0); screen.DrawString(txt, x, y, size); screen.SetColor(r, g, b); // 色を復帰 }
/// <summary> /// Cast nullable <see cref="double"/> to <see cref="string"/> with specified precision. /// </summary> /// <param name="number"></param> /// <param name="digits"></param> /// <returns></returns> public static string CastToString(this double?number, int digits) => StringConv.DoubleToString(number, digits);
/// <summary> /// Cast nullable <see cref="float"/> to <see cref="string"/> with specified precision. /// </summary> /// <param name="number"></param> /// <param name="digits"></param> /// <returns></returns> public static string CastToString(this float?number, int digits) => StringConv.FloatToString(number, digits);
/// <summary> /// Cast nullable <see cref="double"/> to <see cref="string"/>. /// </summary> /// <param name="number"></param> /// <returns></returns> public static string CastToString(this double?number) => StringConv.DoubleToString(number);
/// <summary> /// Convert <see cref="object"/> to <see cref="string"/> safety. /// </summary> /// <param name="obj"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string ToString(object obj, string defaultVal = default) => StringConv.ObjectSafeToString(obj, defaultVal);
/// <summary> /// Cast nullable <see cref="float"/> to <see cref="string"/>. /// </summary> /// <param name="number"></param> /// <returns></returns> public static string CastToString(this float?number) => StringConv.FloatToString(number);
/// <summary> /// Cast nullable <see cref="decimal"/> to <see cref="string"/> with specified precision. /// </summary> /// <param name="number"></param> /// <param name="digits"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string CastToString(this decimal?number, int digits, string defaultVal = "") => StringConv.DecimalToString(number, digits, defaultVal);
/// <summary> /// Convert <see cref="decimal"/> to <see cref="string"/>. /// </summary> /// <param name="num"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string ToString(decimal num, string defaultVal = "0") => StringConv.DecimalToString(num, defaultVal);
/// <summary> /// Cast nullable <see cref="uint"/> to <see cref="string"/>. /// </summary> /// <param name="number"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string CastToString(this uint?number, string defaultVal = "") => StringConv.UInt32ToString(number, defaultVal);
/// <summary> /// Convert nullable <see cref="double"/> to <see cref="string"/>. /// </summary> /// <param name="num"></param> /// <returns></returns> public static string ToString(double?num) => StringConv.DoubleToString(num);
/// <summary> /// Convert <see cref="int"/> to <see cref="string"/>. /// </summary> /// <param name="num"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string ToString(int num, string defaultVal = "0") => StringConv.Int32ToString(num, defaultVal);
/// <summary> /// Convert nullable <see cref="uint"/> to <see cref="string"/>. /// </summary> /// <param name="num"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string ToString(uint?num, string defaultVal = "") => StringConv.UInt32ToString(num, defaultVal);
/// <summary> /// Convert nullable <see cref="ushort"/> to <see cref="string"/>. /// </summary> /// <param name="num"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string ToString(ushort?num, string defaultVal = "") => StringConv.UInt16ToString(num, defaultVal);
/// <summary> /// Convert <see cref="short"/> to <see cref="string"/>. /// </summary> /// <param name="num"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string ToString(short num, string defaultVal = "0") => StringConv.Int16ToString(num, defaultVal);
/// <summary> /// Convert nullable <see cref="decimal"/> to <see cref="string"/> with specified precision. /// </summary> /// <param name="num"></param> /// <param name="digits"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string ToString(decimal?num, int digits, string defaultVal = "") => StringConv.DecimalToString(num, digits, defaultVal);
/// <summary> /// Cast <see cref="decimal"/> to <see cref="string"/>. /// </summary> /// <param name="number"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string CastToString(this decimal number, string defaultVal = "") => StringConv.DecimalToString(number, defaultVal);
public PriorityListBoxViewModel(StringConv conv) { StringConv = conv; Collection = new ObservableCollection <PriorityElement>(); }
/// <summary> /// Cast <see cref="object"/> to <see cref="string"/>. /// </summary> /// <param name="obj"></param> /// <returns></returns> public static string CastToString(this object obj) => StringConv.ObjectSafeToString(obj);
public SpawnRangeListBoxViewModel(StringConv conv) { StringConv = conv; Collection = new ObservableCollection <SpawnRangeListElement>(); }
/// <summary> /// Cast nullable <see cref="short"/> to <see cref="string"/>. /// </summary> /// <param name="number"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string CastToString(this ushort?number, string defaultVal = "") => StringConv.UInt16ToString(number, defaultVal);
/// <summary> /// Convert nullable <see cref="double"/> to <see cref="string"/> with specified precision. /// </summary> /// <param name="num"></param> /// <param name="digits"></param> /// <returns></returns> public static string ToString(double?num, int digits) => StringConv.DoubleToString(num, digits);
/// <summary> /// Cast <see cref="long"/> to <see cref="string"/>. /// </summary> /// <param name="number"></param> /// <param name="defaultVal"></param> /// <returns></returns> public static string CastToString(this long number, string defaultVal = "") => StringConv.Int64ToString(number, defaultVal);
public PriorityElement(StringConv conv, Priority priority, object value) { this.conv = conv; this.priority = priority; this.value = value; }