using System;
using System.Text;
namespace SAMP.API {
public class Util {
#region Accessors & Mutators
///
/// Gets a value indicating whether the current platform is Linux.
///
public static bool IsLinux {
get {
int iPlatform = (int)Environment.OSVersion.Platform;
return (iPlatform == 4) || (iPlatform == 6) || (iPlatform == 128);
}
}
///
/// Gets a value indicating whether the current platform is Windows.
///
public static bool IsWindows {
get {
return !IsLinux;
}
}
///
/// Gets the uptime of the actual server in milliseconds. (The machine, NOT the SA:MP server.)
///
public static TimeSpan TickCount {
get {
return TimeSpan.FromMilliseconds(Core.Natives.GetTickCount());
}
}
#endregion
#region Public Methods
///
/// Outputs a formatted string on the console (the server window, not the in-game chat).
///
/// The format string.
/// Indefinite number of arguments of any tag.
public static void Log(string format, params object[] args) {
Core.Natives.logprintf(string.Format(format, args));
}
///
/// Gets the name of a weapon.
///
/// The Weapon ID you want to know the name of.
/// The weapon name.
public static string GetWeaponName(int weaponid) {
StringBuilder pstrWeaponName = new StringBuilder(50);
Core.Natives.GetWeaponName(weaponid, pstrWeaponName, pstrWeaponName.Capacity);
return pstrWeaponName.ToString();
}
#endregion
};
};