summaryrefslogtreecommitdiff
path: root/NET/worlds/core/Std.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/core/Std.java')
-rw-r--r--NET/worlds/core/Std.java332
1 files changed, 332 insertions, 0 deletions
diff --git a/NET/worlds/core/Std.java b/NET/worlds/core/Std.java
new file mode 100644
index 0000000..f332fbf
--- /dev/null
+++ b/NET/worlds/core/Std.java
@@ -0,0 +1,332 @@
+/* */ package NET.worlds.core;
+/* */
+/* */ import java.io.File;
+/* */ import java.io.InputStream;
+/* */ import java.io.PrintStream;
+/* */ import java.net.InetAddress;
+/* */ import java.net.Socket;
+/* */ import java.util.Date;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class Std
+/* */ {
+/* */ public static final String JavaVersion = "1922a10";
+/* */ public static final String JavaBuildDate = "2020031200";
+/* */ private static String productName;
+/* */ private static int lastTime;
+/* */
+/* */ public static void assertFail(String file, int line)
+/* */ {
+/* 58 */ String msg = "Assertion failed: file " + file + ", line " + line;
+/* 59 */ dumpStackTrace();
+/* 60 */ exit();
+/* */ }
+/* */
+/* */ public static String replaceStr(String in, String seek, String replace) {
+/* 64 */ if ((seek == null) || (replace == null)) {
+/* 65 */ return in;
+/* */ }
+/* */ int idx;
+/* 68 */ while ((idx = in.indexOf(seek)) != -1) { int idx;
+/* 69 */ String tmp = in.substring(0, idx) + replace +
+/* 70 */ in.substring(idx + seek.length());
+/* 71 */ in = tmp;
+/* */ }
+/* */
+/* 74 */ return in;
+/* */ }
+/* */
+/* */ public static native void exit();
+/* */
+/* */ public static void dumpStackTrace()
+/* */ {
+/* */ try {
+/* 82 */ throw new Error("");
+/* */ } catch (Error e) {
+/* 84 */ e.printStackTrace(System.out);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public static String getProductName()
+/* */ {
+/* 91 */ assert (productName != null);
+/* */
+/* 93 */ return productName;
+/* */ }
+/* */
+/* */ public static void initProductName() {
+/* 97 */ assert (productName == null);
+/* 98 */ productName = IniFile.gamma().getIniString("PRODUCT_NAME",
+/* 99 */ "Worlds.com - The 3D Entertainment Portal");
+/* */
+/* */
+/* 102 */ productName = IniFile.override().getIniString("productName",
+/* 103 */ productName);
+/* */ }
+/* */
+/* */ private static native int nativeGetMillis();
+/* */
+/* */ private static synchronized int getMillis() {
+/* 109 */ return nativeGetMillis();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static native int getTimeZero();
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static native long getPerformanceFrequency();
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static native long getPerformanceCount();
+/* */
+/* */
+/* */
+/* */
+/* */ public static boolean sleep(float seconds)
+/* */ {
+/* */ try
+/* */ {
+/* 137 */ Thread.sleep((seconds * 1000.0F));
+/* */ } catch (InterruptedException e) {
+/* 139 */ return true;
+/* */ }
+/* */
+/* 142 */ return false;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static int getFastTime()
+/* */ {
+/* 157 */ if (lastTime == 0)
+/* 158 */ getRealTime();
+/* 159 */ return lastTime;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public static int getRealTime()
+/* */ {
+/* 166 */ lastTime = getMillis();
+/* 167 */ return lastTime;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public static int getSynchronizedTime()
+/* */ {
+/* 175 */ initSyncTime();
+/* 176 */ return getFastTime() / 1000 + syncTimeBase;
+/* */ }
+/* */
+/* 179 */ static boolean syncTimeInited = false;
+/* */
+/* */ static int syncTimeBase;
+/* 182 */ static boolean offline = IniFile.override().getIniInt("Offline", 0) == 1;
+/* 183 */ static boolean stopOnFault = IniFile.gamma().getIniInt("StopOnHttpFault", 0) == 1;
+/* 184 */ static String timeServer = IniFile.override().getIniString("timeServer", "time.worlds.net");
+/* */
+/* */ static void initSyncTime()
+/* */ {
+/* 188 */ if ((offline) || (stopOnFault)) {
+/* 189 */ syncTimeInited = true;
+/* 190 */ syncTimeBase = 0;
+/* 191 */ return;
+/* */ }
+/* */
+/* 194 */ if (!syncTimeInited) {
+/* 195 */ syncTimeInited = true;
+/* */ try {
+/* 197 */ InetAddress ip = InetAddress.getByName(timeServer);
+/* 198 */ Socket s = new Socket(ip, 37);
+/* */
+/* 200 */ InputStream is = s.getInputStream();
+/* 201 */ int b1 = is.read();
+/* 202 */ int b2 = is.read();
+/* 203 */ int b3 = is.read();
+/* 204 */ int b4 = is.read();
+/* 205 */ is.close();
+/* 206 */ long time = (b1 << 24) + (b2 << 16) + (b3 << 8) + b4;
+/* */
+/* */
+/* 209 */ time -= -1141367296L;
+/* 210 */ syncTimeBase = (int)time - getFastTime() / 1000;
+/* 211 */ s.close();
+/* */ } catch (Exception e) {
+/* 213 */ System.out.println("Error retrieving network time: " + e);
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static native boolean instanceOf(Object paramObject, Class<?> paramClass);
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static native String getenv(String paramString);
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static long GetDiskFreeSpace(String drive)
+/* */ {
+/* 236 */ long value = -1L;
+/* */ try
+/* */ {
+/* 239 */ if (drive == null) {
+/* 240 */ drive = ".";
+/* */ }
+/* 242 */ File f = new File(drive);
+/* 243 */ value = f.getFreeSpace() / 1024L;
+/* */ }
+/* */ catch (Exception ex) {
+/* 246 */ value = -1L;
+/* */ }
+/* */
+/* 249 */ return value;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public static long GetDiskFreeSpace()
+/* */ {
+/* 256 */ return GetDiskFreeSpace(null);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public static void printThreads()
+/* */ {
+/* 264 */ ThreadGroup tg = Thread.currentThread().getThreadGroup();
+/* 265 */ Thread[] ta = new Thread[100];
+/* 266 */ int n = tg.enumerate(ta);
+/* 267 */ tg.list();
+/* 268 */ for (int i = 0; i < n; i++) {
+/* 269 */ if (ta[i].isDaemon()) {
+/* 270 */ System.out.println("is daemon");
+/* */ } else {
+/* 272 */ System.out.println("isn't daemon");
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */ public static void printlnOut(String msg)
+/* */ {
+/* 279 */ System.out.println(msg);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public static native boolean byteArraysEqual(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2);
+/* */
+/* */
+/* */
+/* */
+/* */ public static native String getBuildInfo();
+/* */
+/* */
+/* */
+/* */
+/* */ public static native int getVersion();
+/* */
+/* */
+/* */
+/* */ public static String getJavaVersion()
+/* */ {
+/* 301 */ return "1922a10";
+/* */ }
+/* */
+/* */ public static String getJavaBuildDate() {
+/* 305 */ return "2020031200";
+/* */ }
+/* */
+/* */
+/* */ public static native String getClientVersion();
+/* */
+/* */
+/* */ private static native int getBuildYear();
+/* */
+/* */
+/* */ private static native int getBuildMonth();
+/* */
+/* */ private static native int getBuildDay();
+/* */
+/* */ public static long getBuildDate()
+/* */ {
+/* 321 */ return
+/* 322 */ Date.UTC(getBuildYear(), getBuildMonth(), getBuildDay(), 0, 0, 0);
+/* */ }
+/* */
+/* */ public static native int checkNativeHeap();
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\core\Std.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file