示例#1
0
 public SpawnListElement(StringConv conv, int weight, double chance, object val)
 {
     this.conv   = conv;
     this.weight = weight;
     this.chance = chance;
     this.val    = val;
 }
示例#2
0
 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!");
        }
示例#8
0
文件: FpsLayer.cs 项目: sinshu/dtf
        ///	<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);           // 色を復帰
        }
示例#9
0
 /// <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);
示例#10
0
 /// <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);
示例#11
0
 /// <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);
示例#12
0
 /// <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);
示例#13
0
 /// <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);
示例#14
0
 /// <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);
示例#15
0
 /// <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);
示例#16
0
 /// <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);
示例#17
0
 /// <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);
示例#18
0
 /// <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);
示例#19
0
 /// <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);
示例#20
0
 /// <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);
示例#21
0
 /// <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);
示例#22
0
 /// <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);
示例#23
0
 /// <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>();
 }
示例#25
0
 /// <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>();
 }
示例#27
0
 /// <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);
示例#28
0
 /// <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);
示例#29
0
 /// <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;
 }