Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Xcode wc = new Xcode();

            wc.devicelId = "49aa7db2f4a3ffe0e96216f6b92cde22";

            wc.GetAESkey();

            put(JsonConvert.SerializeObject(wc.GetLoginQRcode()));

            //var BindOpMobile = wechat.BindMobile("+8617607567005", "", 1);

            //put(JsonConvert.SerializeObject(BindOpMobile));
            //wechat.UploadMsgImg();
            //string list = "[\"xxxxxxssss\",\"xxxsssxxssss\",\"xxxsssxxssss\"]";
            //var json = Util.JsonToObject(list);
            //object[] vs = json;
            //Console.WriteLine(vs.Length);

            // var s =  wechat.NewReg(tb_ToUsername.Text,tb_Content.Text);
            //var s = wechat.PushLoginURL(authKey, MyWxid);
            //var s = wechat.UserLogin("0094726042133", "jp5531836", "");
            //put(JsonConvert.SerializeObject(s));

            //if (s.baseResponse.ret == MMPro.MM.RetConst.MM_ERR_IDC_REDIRECT)
            //{
            //    //Console.WriteLine(ManualAuth.dnsInfo.builtinIplist.shortConnectIplist[0].ip);
            //    //byte[] s = Util.Serialize<MM.BuiltinIP>(ManualAuth.dnsInfo.builtinIplist.shortConnectIplist.shortConnectIplist[1]);
            //    int len = (int)s.dnsInfo.builtinIplist.shortconnectIpcount;
            //    Util.shortUrl = "http://" + s.dnsInfo.newHostList.list[1].substitute;
            //}
        }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="Microsoft.Rest.ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Xcode != null)
     {
         Xcode.Validate();
     }
     if (Javascript != null)
     {
         Javascript.Validate();
     }
     if (Xamarin != null)
     {
         Xamarin.Validate();
     }
     if (Android != null)
     {
         Android.Validate();
     }
     if (Uwp != null)
     {
         Uwp.Validate();
     }
     if (Testcloud != null)
     {
         Testcloud.Validate();
     }
 }
Exemplo n.º 3
0
 public void Appender(string code)
 {
     InvokeIfNeeded(() =>
     {
         Xcode.AppendText(code);
     });
 }
Exemplo n.º 4
0
        private void checkManualAuth(string wxnewpass, string wxid)
        {
            var ManualAuth = wechat.ManualAuth(wxnewpass, wxid);

            //-301重定向
            Console.WriteLine(ManualAuth.baseResponse.ret);
            if (ManualAuth.baseResponse.ret == MMPro.MM.RetConst.MM_ERR_IDC_REDIRECT)
            {
                //Console.WriteLine(ManualAuth.dnsInfo.builtinIplist.shortConnectIplist[0].ip);
                //byte[] s = Util.Serialize<MM.BuiltinIP>(ManualAuth.dnsInfo.builtinIplist.shortConnectIplist.shortConnectIplist[1]);
                int len = (int)ManualAuth.dnsInfo.builtinIplist.shortconnectIpcount;
                Util.shortUrl = "http://" + ManualAuth.dnsInfo.newHostList.list[1].substitute;
                put(Util.shortUrl);

                //继续检查状态
                //chek.Start();
                checkLogin(uuid);
            }
            else if (ManualAuth.baseResponse.ret == MMPro.MM.RetConst.MM_OK)
            {
                MyWxid = ManualAuth.accountInfo.wxid;

                put(ManualAuth.accountInfo.wxid);
                put(ObjToJson2 <MM.AccountInfo>(ManualAuth.accountInfo));
                put(ObjToJson2 <MM.BaseResponse>(ManualAuth.baseResponse));
                put(JsonConvert.SerializeObject(ManualAuth.authParam));

                byte[] strECServrPubKey = ManualAuth.authParam.ecdh.ecdhkey.key;
                byte[] aesKey           = new byte[16];
                Xcode.ComputerECCKeyMD5(strECServrPubKey, 57, wechat.pri_key_buf, 328, aesKey);
                //var aesKey = OpenSSLNativeClass.ECDH.DoEcdh(ManualAuth.authParam.ecdh.nid, strECServrPubKey, wechat.pri_key_buf);
                //wechat.CheckEcdh = aesKey.ToString(16, 2);
                wechat.AESKey = AES.AESDecrypt(ManualAuth.authParam.session.key, aesKey).ToString(16, 2);

                wechat.baseRequest = wechat.GetBaseRequest("49aa7db2f4a3ffe0e96218f6b92cde32", wechat.GetAESkey(), (uint)wechat.m_uid, "iPad iPhone OS9.3.3");

                authKey = ManualAuth.authParam.autoAuthKey.buffer;
            }
            else if ((int)ManualAuth.baseResponse.ret == 2)
            {
                MyWxid = ManualAuth.accountInfo.wxid;

                put(ManualAuth.accountInfo.wxid);
                put(ObjToJson2 <MM.AccountInfo>(ManualAuth.accountInfo));
                put(ObjToJson2 <MM.BaseResponse>(ManualAuth.baseResponse));


                //byte[] strECServrPubKey = ManualAuth.authParam.ecdh.ecdhkey.key;
                //var aesKey = OpenSSLNativeClass.ECDH.DoEcdh(713, strECServrPubKey, wechat.pri_key_buf);
                //wechat.CheckEcdh = aesKey.ToString(16, 2);
                //wechat.AESKey = AES.AESDecrypt(ManualAuth.authParam.session.key, aesKey).ToString(16, 2);

                //wechat.baseRequest = wechat.GetBaseRequest("49aa7db2f4a3ffe0e96218f6b92cde32", wechat.GetAESkey(), (uint)wechat.m_uid, "iPad iPhone OS9.3.3");
            }
            else
            {
                put(JsonConvert.SerializeObject(ManualAuth));
            }
        }
Exemplo n.º 5
0
        private void Btn_DataLogin_Click(object sender, EventArgs e)
        {
            var UserLoign = wechat.UserLogin(tb_ToUsername.Text, tb_AtUserlist.Text, tb_Content.Text);


            if (UserLoign.baseResponse.ret == MMPro.MM.RetConst.MM_ERR_IDC_REDIRECT)
            {
                //Console.WriteLine(ManualAuth.dnsInfo.builtinIplist.shortConnectIplist[0].ip);
                //byte[] s = Util.Serialize<MM.BuiltinIP>(ManualAuth.dnsInfo.builtinIplist.shortConnectIplist.shortConnectIplist[1]);
                int len = (int)UserLoign.dnsInfo.builtinIplist.shortconnectIpcount;
                Util.shortUrl = "http://" + UserLoign.dnsInfo.newHostList.list[1].substitute;
                Btn_DataLogin_Click(Btn_DataLogin, new EventArgs());
            }
            else if (UserLoign.baseResponse.ret == MMPro.MM.RetConst.MM_OK)
            {
                MyWxid = UserLoign.accountInfo.wxid;

                put(UserLoign.accountInfo.wxid);
                put(ObjToJson2 <MM.AccountInfo>(UserLoign.accountInfo));
                put(ObjToJson2 <MM.BaseResponse>(UserLoign.baseResponse));


                byte[] strECServrPubKey = UserLoign.authParam.ecdh.ecdhkey.key;
                byte[] aesKey           = new byte[16];
                Xcode.ComputerECCKeyMD5(strECServrPubKey, 57, wechat.pri_key_buf, 328, aesKey);
                //var aesKey = OpenSSLNativeClass.ECDH.DoEcdh(ManualAuth.authParam.ecdh.nid, strECServrPubKey, wechat.pri_key_buf);
                //wechat.CheckEcdh = aesKey.ToString(16, 2);
                wechat.AESKey = AES.AESDecrypt(UserLoign.authParam.session.key, aesKey).ToString(16, 2);

                //wechat.baseRequest = wechat.GetBaseRequest(wechat.devicelId, wechat.AESKey.ToByteArray(16, 2), (uint)wechat.m_uid, "iMac iPhone OS9.3.3");

                authKey = UserLoign.authParam.autoAuthKey.buffer;
                put(JsonConvert.SerializeObject(UserLoign.authParam));
            }
            else
            {
                put(JsonConvert.SerializeObject(UserLoign.baseResponse));
            }
        }
Exemplo n.º 6
0
    public override bool Execute()
    {
        bool isDevice = (TargetOS == TargetNames.iOS || TargetOS == TargetNames.tvOS);

        if (!string.IsNullOrEmpty(MainLibraryFileName))
        {
            if (!File.Exists(Path.Combine(AppDir, MainLibraryFileName)))
            {
                throw new ArgumentException($"MainLibraryFileName='{MainLibraryFileName}' was not found in AppDir='{AppDir}'");
            }
        }

        if (ProjectName.Contains(' '))
        {
            throw new ArgumentException($"ProjectName='{ProjectName}' should not contain spaces");
        }

        string[] excludes = Array.Empty <string>();
        if (ExcludeFromAppDir != null)
        {
            excludes = ExcludeFromAppDir
                       .Where(i => !string.IsNullOrEmpty(i.ItemSpec))
                       .Select(i => i.ItemSpec)
                       .ToArray();
        }

        string binDir = Path.Combine(AppDir, $"bin-{ProjectName}-{Arch}");

        if (!string.IsNullOrEmpty(OutputDirectory))
        {
            binDir = OutputDirectory;
        }
        Directory.CreateDirectory(binDir);

        var assemblerFiles       = new List <string>();
        var assemblerFilesToLink = new List <string>();

        foreach (ITaskItem file in Assemblies)
        {
            // use AOT files if available
            var obj     = file.GetMetadata("AssemblerFile");
            var llvmObj = file.GetMetadata("LlvmObjectFile");
            if (!string.IsNullOrEmpty(obj))
            {
                assemblerFiles.Add(obj);
            }

            if (!string.IsNullOrEmpty(llvmObj))
            {
                assemblerFilesToLink.Add(llvmObj);
            }
        }

        if (((!ForceInterpreter && (isDevice || ForceAOT)) && !assemblerFiles.Any()))
        {
            throw new InvalidOperationException("Need list of AOT files for device builds.");
        }

        if (!string.IsNullOrEmpty(DiagnosticPorts))
        {
            bool validDiagnosticsConfig = false;

            if (string.IsNullOrEmpty(RuntimeComponents))
            {
                validDiagnosticsConfig = false;
            }
            else if (RuntimeComponents.Equals("*", StringComparison.OrdinalIgnoreCase))
            {
                validDiagnosticsConfig = true;
            }
            else if (RuntimeComponents.Contains("diagnostics_tracing", StringComparison.OrdinalIgnoreCase))
            {
                validDiagnosticsConfig = true;
            }

            if (!validDiagnosticsConfig)
            {
                throw new ArgumentException("Using DiagnosticPorts require diagnostics_tracing runtime component.");
            }
        }

        if (EnableAppSandbox && (string.IsNullOrEmpty(DevTeamProvisioning) || DevTeamProvisioning == "-"))
        {
            throw new ArgumentException("DevTeamProvisioning must be set to a valid value when App Sandbox is enabled, using '-' is not supported.");
        }

        var generator = new Xcode(Log, TargetOS, Arch);

        if (GenerateXcodeProject)
        {
            XcodeProjectPath = generator.GenerateXCode(ProjectName, MainLibraryFileName, assemblerFiles, assemblerFilesToLink,
                                                       AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, NativeMainSource);

            if (BuildAppBundle)
            {
                if (isDevice && string.IsNullOrEmpty(DevTeamProvisioning))
                {
                    // DevTeamProvisioning shouldn't be empty for arm64 builds
                    Log.LogMessage(MessageImportance.High, "DevTeamProvisioning is not set, BuildAppBundle step is skipped.");
                }
                else
                {
                    AppBundlePath = generator.BuildAppBundle(XcodeProjectPath, Optimized, DevTeamProvisioning);
                }
            }
        }
        else if (GenerateCMakeProject)
        {
            generator.GenerateCMake(ProjectName, MainLibraryFileName, assemblerFiles, assemblerFilesToLink,
                                    AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, NativeMainSource);
        }

        return(true);
    }
Exemplo n.º 7
0
    public override bool Execute()
    {
        Utils.Logger = Log;
        bool isDevice = Arch.Equals("arm64", StringComparison.InvariantCultureIgnoreCase) && TargetOS != TargetNames.MacCatalyst;

        if (!File.Exists(Path.Combine(AppDir, MainLibraryFileName)))
        {
            throw new ArgumentException($"MainLibraryFileName='{MainLibraryFileName}' was not found in AppDir='{AppDir}'");
        }

        if (ProjectName.Contains(" "))
        {
            throw new ArgumentException($"ProjectName='{ProjectName}' should not contain spaces");
        }

        string[] excludes = Array.Empty <string>();
        if (ExcludeFromAppDir != null)
        {
            excludes = ExcludeFromAppDir
                       .Where(i => !string.IsNullOrEmpty(i.ItemSpec))
                       .Select(i => i.ItemSpec)
                       .ToArray();
        }

        string binDir = Path.Combine(AppDir, $"bin-{ProjectName}-{Arch}");

        if (!string.IsNullOrEmpty(OutputDirectory))
        {
            binDir = OutputDirectory;
        }
        Directory.CreateDirectory(binDir);

        var assemblerFiles = new List <string>();

        foreach (ITaskItem file in Assemblies)
        {
            // use AOT files if available
            var obj = file.GetMetadata("AssemblerFile");
            if (!string.IsNullOrEmpty(obj))
            {
                assemblerFiles.Add(obj);
            }
        }

        if (((!ForceInterpreter && (isDevice || ForceAOT)) && !assemblerFiles.Any()))
        {
            throw new InvalidOperationException("Need list of AOT files for device builds.");
        }

        if (ForceInterpreter && ForceAOT)
        {
            throw new InvalidOperationException("Interpreter and AOT cannot be enabled at the same time");
        }

        if (GenerateXcodeProject)
        {
            Xcode generator = new Xcode(TargetOS);
            generator.EnableRuntimeLogging = EnableRuntimeLogging;

            XcodeProjectPath = generator.GenerateXCode(ProjectName, MainLibraryFileName, assemblerFiles,
                                                       AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, Optimized, NativeMainSource);

            if (BuildAppBundle)
            {
                if (isDevice && string.IsNullOrEmpty(DevTeamProvisioning))
                {
                    // DevTeamProvisioning shouldn't be empty for arm64 builds
                    Utils.LogInfo("DevTeamProvisioning is not set, BuildAppBundle step is skipped.");
                }
                else
                {
                    AppBundlePath = generator.BuildAppBundle(XcodeProjectPath, Arch, Optimized, DevTeamProvisioning);
                }
            }
        }

        return(true);
    }
Exemplo n.º 8
0
    public override bool Execute()
    {
        Utils.Logger = Log;
        bool isDevice = Arch.Equals("arm64", StringComparison.InvariantCultureIgnoreCase);

        if (isDevice && string.IsNullOrEmpty(CrossCompiler))
        {
            throw new ArgumentException("arm64 arch requires CrossCompiler");
        }

        if (!File.Exists(Path.Combine(AppDir, MainLibraryFileName)))
        {
            throw new ArgumentException($"MainLibraryFileName='{MainLibraryFileName}' was not found in AppDir='{AppDir}'");
        }

        if (ProjectName.Contains(" "))
        {
            throw new ArgumentException($"ProjectName='{ProjectName}' should not contain spaces");
        }

        if (UseLlvm && string.IsNullOrEmpty(LlvmPath))
        {
            // otherwise we might accidentally use some random llc/opt from PATH (installed with clang)
            throw new ArgumentException($"LlvmPath shoun't be empty when UseLlvm is set");
        }

        string[] excludes = new string[0];
        if (ExcludeFromAppDir != null)
        {
            excludes = ExcludeFromAppDir
                       .Where(i => !string.IsNullOrEmpty(i.ItemSpec))
                       .Select(i => i.ItemSpec)
                       .ToArray();
        }
        string[] libsToAot = Directory.GetFiles(AppDir, "*.dll")
                             .Where(f => !excludes.Contains(Path.GetFileName(f)))
                             .ToArray();

        string binDir = Path.Combine(AppDir, $"bin-{ProjectName}-{Arch}");

        if (!string.IsNullOrEmpty(OutputDirectory))
        {
            binDir = OutputDirectory;
        }
        Directory.CreateDirectory(binDir);

        // run AOT compilation only for devices
        if (isDevice)
        {
            if (string.IsNullOrEmpty(CrossCompiler))
            {
                throw new InvalidOperationException("cross-compiler is not set");
            }

            AotCompiler.PrecompileLibraries(CrossCompiler, Arch, !DisableParallelAot, binDir, libsToAot,
                                            new Dictionary <string, string> {
                { "MONO_PATH", AppDir }
            },
                                            Optimized, UseLlvm, LlvmPath);
        }

        // generate modules.m
        AotCompiler.GenerateLinkAllFile(
            Directory.GetFiles(binDir, "*.dll.o"),
            Path.Combine(binDir, "modules.m"));

        if (GenerateXcodeProject)
        {
            XcodeProjectPath = Xcode.GenerateXCode(ProjectName, MainLibraryFileName,
                                                   AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, NativeMainSource);

            if (BuildAppBundle)
            {
                if (isDevice && string.IsNullOrEmpty(DevTeamProvisioning))
                {
                    // DevTeamProvisioning shouldn't be empty for arm64 builds
                    Utils.LogInfo("DevTeamProvisioning is not set, BuildAppBundle step is skipped.");
                }
                else
                {
                    AppBundlePath = Xcode.BuildAppBundle(
                        Path.Combine(binDir, ProjectName, ProjectName + ".xcodeproj"),
                        Arch, Optimized, DevTeamProvisioning);
                }
            }
        }

        return(true);
    }
Exemplo n.º 9
0
    public override bool Execute()
    {
        Utils.Logger = Log;
        bool isDevice = Arch.Equals("arm64", StringComparison.InvariantCultureIgnoreCase);

        if (!File.Exists(Path.Combine(AppDir, MainLibraryFileName)))
        {
            throw new ArgumentException($"MainLibraryFileName='{MainLibraryFileName}' was not found in AppDir='{AppDir}'");
        }

        if (ProjectName.Contains(" "))
        {
            throw new ArgumentException($"ProjectName='{ProjectName}' should not contain spaces");
        }

        string[] excludes = new string[0];
        if (ExcludeFromAppDir != null)
        {
            excludes = ExcludeFromAppDir
                       .Where(i => !string.IsNullOrEmpty(i.ItemSpec))
                       .Select(i => i.ItemSpec)
                       .ToArray();
        }

        string binDir = Path.Combine(AppDir, $"bin-{ProjectName}-{Arch}");

        if (!string.IsNullOrEmpty(OutputDirectory))
        {
            binDir = OutputDirectory;
        }
        Directory.CreateDirectory(binDir);

        var assemblerFiles = new List <string>();

        foreach (ITaskItem file in Assemblies)
        {
            // use AOT files if available
            var obj = file.GetMetadata("AssemblerFile");
            if (!String.IsNullOrEmpty(obj))
            {
                assemblerFiles.Add(obj);
            }
        }

        if (isDevice && !assemblerFiles.Any())
        {
            throw new InvalidOperationException("Need list of AOT files for device builds.");
        }

        // generate modules.m
        GenerateLinkAllFile(
            assemblerFiles,
            Path.Combine(binDir, "modules.m"));

        if (GenerateXcodeProject)
        {
            XcodeProjectPath = Xcode.GenerateXCode(ProjectName, MainLibraryFileName, assemblerFiles,
                                                   AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, NativeMainSource);

            if (BuildAppBundle)
            {
                if (isDevice && string.IsNullOrEmpty(DevTeamProvisioning))
                {
                    // DevTeamProvisioning shouldn't be empty for arm64 builds
                    Utils.LogInfo("DevTeamProvisioning is not set, BuildAppBundle step is skipped.");
                }
                else
                {
                    AppBundlePath = Xcode.BuildAppBundle(
                        Path.Combine(binDir, ProjectName, ProjectName + ".xcodeproj"),
                        Arch, Optimized, DevTeamProvisioning);
                }
            }
        }

        return(true);
    }