导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - XOneSocket.java 源代码

正在查看: Minits v4.9.3.32 应用的 XOneSocket.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.xone.android.script.runtimeobjects;

import Wa.d;
import android.text.TextUtils;
import com.xone.android.javascript.XOneJavascript;
import com.xone.android.utils.Utils;
import com.xone.annotations.ScriptAllowed;
import com.xone.interfaces.IRuntimeObject;
import fb.q;
import fb.t;
import ha.AbstractC0751f;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.Socket;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Map;
import org.mozilla.javascript.BaseFunction;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
import qa.EnumC0975b;
import ua.InterfaceC1038m0;
import ua.O0;
import ua.V;
import ua.W;
import ua.X;

@ScriptAllowed
public final class XOneSocket extends BaseFunction implements IRuntimeObject {
    public static final Map t = createTypeInfoData();
    public final InterfaceC1038m0 l;
    public final X m;
    public Socket n;
    public DatagramSocket o;
    public String p;
    public String q;
    public int r;
    public int s = 10000;

    public XOneSocket(InterfaceC1038m0 interfaceC1038m0, X x) {
        this.l = interfaceC1038m0;
        this.m = x;
        XOneJavascript.addFunctions(this);
    }

    private static Map createTypeInfoData() {
        Hashtable hashtable = new Hashtable();
        d dVar = new d("SetProtocol", O0.a);
        dVar.c("Protocol", 1, false);
        String name = dVar.getName();
        Locale locale = Locale.US;
        hashtable.put(name.toLowerCase(locale), dVar);
        d dVar2 = new d("SetAddress", O0.a);
        dVar2.c("Address", 1, false);
        hashtable.put(dVar2.getName().toLowerCase(locale), dVar2);
        d dVar3 = new d("SetPort", O0.a);
        dVar3.c("Port", 1, false);
        hashtable.put(dVar3.getName().toLowerCase(locale), dVar3);
        d dVar4 = new d("SetTimeout", O0.a);
        dVar4.c("Timeout", 1, false);
        hashtable.put(dVar4.getName().toLowerCase(locale), dVar4);
        d dVar5 = new d("Connect", O0.a);
        hashtable.put(dVar5.getName().toLowerCase(locale), dVar5);
        d dVar6 = new d("Send", O0.a);
        dVar6.c("Buffer", 7, false);
        hashtable.put(dVar6.getName().toLowerCase(locale), dVar6);
        d dVar7 = new d("Receive", O0.a);
        dVar7.c("ByteCount", 2, false);
        hashtable.put(dVar7.getName().toLowerCase(locale), dVar7);
        d dVar8 = new d("ReceiveAll", O0.a);
        hashtable.put(dVar8.getName().toLowerCase(locale), dVar8);
        d dVar9 = new d("Disconnect", O0.a);
        hashtable.put(dVar9.getName().toLowerCase(locale), dVar9);
        return hashtable;
    }

    @Override
    public Object GetPropertyManager(String str, Object[] objArr) {
        return null;
    }

    @Override
    public W GetTypeInfo(String str) {
        String lowerCase = str.toLowerCase(Locale.US);
        Map map = t;
        if (map.containsKey(lowerCase)) {
            return (W) map.get(lowerCase);
        }
        return null;
    }

    @Override
    public Object Invoke(String str, EnumC0975b enumC0975b, Object[] objArr) {
        String lowerCase = str.toLowerCase(Locale.US);
        lowerCase.getClass();
        switch (lowerCase) {
            case "settimeout":
                return setTimeout(objArr);
            case "send":
                return send(objArr);
            case "setaddress":
                return setAddress(objArr);
            case "receiveall":
                return receiveAll();
            case "disconnect":
                return disconnect();
            case "setprotocol":
                return setProtocol(objArr);
            case "connect":
                return connect();
            case "receive":
                return receive(objArr);
            case "setport":
                return setPort(objArr);
            default:
                throw new IllegalArgumentException(getName() + "(): Function " + str + " not implemented.");
        }
    }

    public final void X(String str) {
        if (TextUtils.isEmpty(this.p)) {
            throw new IllegalStateException(str + "(): Set the protocol first");
        }
        if (TextUtils.isEmpty(this.q)) {
            throw new IllegalStateException(str + "(): Set the address first");
        }
        if (this.r != 0) {
            return;
        }
        throw new IllegalStateException(str + "(): Set the port number first");
    }

    @Override
    public Object call(Context context, Scriptable scriptable, Scriptable scriptable2, Object[] objArr) {
        return new XOneSocket(this.l, this.m);
    }

    @com.xone.annotations.ScriptAllowed
    public com.xone.android.script.runtimeobjects.XOneSocket connect() {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.script.runtimeobjects.XOneSocket.connect():com.xone.android.script.runtimeobjects.XOneSocket");
    }

    @ScriptAllowed
    public XOneSocket disconnect() {
        try {
            Socket socket = this.n;
            if (socket != null) {
                socket.close();
            }
            DatagramSocket datagramSocket = this.o;
            if (datagramSocket != null) {
                datagramSocket.close();
            }
            return this;
        } catch (IOException e) {
            throw AbstractC0751f.e(e);
        }
    }

    @Override
    public String getDefaultMethod() {
        return "";
    }

    @Override
    public String getName() {
        return "Socket";
    }

    @Override
    public V getScope() {
        return this.m.c();
    }

    @com.xone.annotations.ScriptAllowed
    public org.mozilla.javascript.typedarrays.NativeInt8Array receive(java.lang.Object... r8) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.script.runtimeobjects.XOneSocket.receive(java.lang.Object[]):org.mozilla.javascript.typedarrays.NativeInt8Array");
    }

    @com.xone.annotations.ScriptAllowed
    public org.mozilla.javascript.typedarrays.NativeInt8Array receiveAll() {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.script.runtimeobjects.XOneSocket.receiveAll():org.mozilla.javascript.typedarrays.NativeInt8Array");
    }

    @com.xone.annotations.ScriptAllowed
    public com.xone.android.script.runtimeobjects.XOneSocket send(java.lang.Object... r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.script.runtimeobjects.XOneSocket.send(java.lang.Object[]):com.xone.android.script.runtimeobjects.XOneSocket");
    }

    @ScriptAllowed
    public XOneSocket setAddress(Object... objArr) {
        Utils.g("SetAddress", objArr, 1);
        String z = t.z(objArr[0], "");
        this.q = z;
        if (!TextUtils.isEmpty(z)) {
            return this;
        }
        throw new IllegalArgumentException("SetAddress(): Empty address argument");
    }

    @ScriptAllowed
    public XOneSocket setPort(Object... objArr) {
        Utils.g("SetPort", objArr, 1);
        int p = q.p(objArr[0], 0);
        this.r = p;
        if (p >= 1 && p <= 65535) {
            return this;
        }
        throw new IllegalArgumentException("SetPort(): Port number must be between 1-65535");
    }

    @ScriptAllowed
    public XOneSocket setProtocol(Object... objArr) {
        Utils.g("SetProtocol", objArr, 1);
        String z = t.z(objArr[0], "");
        this.p = z;
        if (TextUtils.isEmpty(z)) {
            throw new IllegalArgumentException("SetProtocol(): Empty protocol argument");
        }
        String str = this.p;
        str.getClass();
        if (str.equals("tcp") || str.equals("udp")) {
            return this;
        }
        throw new IllegalArgumentException("SetProtocol(): Unknown protocol " + this.p);
    }

    @ScriptAllowed
    public XOneSocket setTimeout(Object... objArr) {
        Utils.g("SetTimeout", objArr, 1);
        this.s = q.p(objArr[0], 10000);
        return this;
    }
}