Beispiel #1
0
        public static void fGetHttp(ParamHttp _oParam)
        {
//if(_oParam.sURL[8] == 'a'){


            Console.WriteLine("------------------------fGetHttp : " + _oParam.sURL);


            //if(!_oParam.bDownloadFile) {
            if (true)
            {
                LaunchTool _oLaunchUrl = new LaunchTool();
                _oLaunchUrl.dOut   = new LaunchTool.dIOut(fHttpOut);
                _oLaunchUrl.dError = new LaunchTool.dIError(fHttpOutInfo);

                _oLaunchUrl.bHidden = true;
                _oLaunchUrl.dExit   = new LaunchTool.dIExit(fUrlRequestComplete);
                _oLaunchUrl.oCustom = (Object)_oParam;

                //_oLaunchUrl.bRunInThread = false;
                //_oLaunchUrl.bWaitEndForOutput = true;
                _oParam.sResult = "";

                //	_oLaunchUrl.fLaunchExe( PathHelper.ToolDir + "curl/curl.exe", "-i  -k -L  -A \"Cwc - app\" \"" + _oParam.sURL + "\"");
                //_oLaunchUrl.fLaunchExe( PathHelper.ToolDir + "curl/curl.exe", "--anyauth -f -i  -k -L  -A \"Cwc - app\" \"" + _oParam.sURL + "\"");
                //_oLaunchUrl.fLaunchExe( PathHelper.ToolDir + "wget/wget.exe", "--no-check-certificate -S -O - \"" + _oParam.sURL + "\"");
                if (!_oParam.bDownloadFile)
                {
                    _oLaunchUrl.fLaunchExe(PathHelper.ToolDir + "wget/wget.exe", "--no-check-certificate -S -O - \"" + _oParam.sURL + "\"");
                }
                else
                {
                    //    _oLaunchUrl.dOut += new LaunchTool.dIOut(fHttpConsole);
                    //  _oLaunchUrl.dError += new LaunchTool.dIError(fHttpConsole);

                    Console.WriteLine("------------------Download File !! ");
                    _oLaunchUrl.fLaunchExe(PathHelper.ToolDir + "wget/wget.exe", "--no-check-certificate -O \"" + _oParam.sToFile + "\" \"" + _oParam.sURL + "\"");
                }
                //
            }
            else
            {
                BackgroundWorker oWorkHttp;
                oWorkHttp = new BackgroundWorker();
                oWorkHttp.WorkerSupportsCancellation = true;
                oWorkHttp.DoWork             += new DoWorkEventHandler(fHttpRequestTagRelease);
                oWorkHttp.RunWorkerCompleted += new RunWorkerCompletedEventHandler(fHttpRequestComplete);
                oWorkHttp.RunWorkerAsync(_oParam);
            }
//}
        }
Beispiel #2
0
        //private  LaunchTool oLaunchCmd = null;

        public void fLaunchConsoleCmd(string sCurrentCmd)
        {
            ///// CURRENT APP Launch
            if (Data.oLaunchProject.oCurLaunch != null)
            {
                oCurLaunch.fSend(sCurrentCmd);
                Debug.fPrint("");
                return;
            }

            ///// CONSOLE Launch
            if (sCurrentCmd.Trim() == "")
            {
                fConsoleExit(null);
                return;
            }

            oCurLaunch = new LaunchTool();
            //      _oLaunchUrl.bWaitEndForOutput = true;
            oCurLaunch.bRedirectOutput = false; //Important
            // _oLaunchUrl.bRunInThread = false;

            oCurLaunch.dOut   = new LaunchTool.dIOut(fConsoleOut);
            oCurLaunch.dError = new LaunchTool.dIError(fConsoleOut);
            oCurLaunch.dExit  = new LaunchTool.dIExit(fConsoleExit);
            // _oLaunchUrl. = true;

            Debug.fPrint("");

            oCurLaunch.fLaunchExe("cmd.exe", "/C " + sCurrentCmd);
        }
Beispiel #3
0
        public ModeIDE()
        {
            //	LaunchTool oCppAst =  new LaunchTool();

            //oCppAst.sWorkPath = PathHelper.Module; //Disabled?
            oCppAst.dOut = new LaunchTool.dIOut(fCppAstOut);
            //		_oCppAst.dExit = new LaunchTool.dIExit(fGitCloneEnd);
            // oCppAst. = false;


            oCppAst.fLaunchExe(PathHelper.ToolDir + "cppast/cppast.exe", "");
        }
Beispiel #4
0
        internal static void fLaunchUpdate(string sCurrFolder, string _sVersion)
        {
            LaunchTool _oUpd = new LaunchTool();

            _oUpd.bOutput         = false;
            _oUpd.UseShellExecute = true;
            _oUpd.fLaunchExe(sCurrFolder + "cwc.exe", " -wCwcUpd " + PathHelper.GetExeDirectory() + " -wCwcVer " + _sVersion, "", "", true);
            //		Console.WriteLine("Update to ver "  +_sVersion );
            while (!_oUpd.bExeLaunched && Base.bAlive)
            {
                Thread.Sleep(1);
            }
            SysAPI.fQuit(true);
        }
Beispiel #5
0
        public void fExtractSevenZip(string zipFileName, string targetDir, string _sFullTargetDir, ModuleLink _oLink = null, object _oCustom = null)
        {
            //Debug.fPrint("-Extact : " + zipFileName);
            //    Output.TraceWarning("-Extact : " + zipFileName);

            LaunchTool _o7z = new LaunchTool();

            _o7z.oModule = _oLink;
            _o7z.oCustom = _oCustom;
            _o7z.dExit   = new LaunchTool.dIExit(fCompressionExit);
            _o7z.bHidden = true;
            _o7z.dOut    = fExtractOut;
            _o7z.dError  = fExtractOut;
            _o7z.fLaunchExe(PathHelper.ToolDir + "7z/7z.exe", "x \"" + zipFileName + "\"  -bsp2 -y -o\"" + targetDir + "\"", zipFileName, _sFullTargetDir, true);
        }
Beispiel #6
0
        internal static void fRestart(string sCurrFolder)
        {
            LaunchTool _oUpd = new LaunchTool();

            _oUpd.bOutput         = false;
            _oUpd.UseShellExecute = true;
            //	_oUpd.fLaunchExe( sCurrFolder + "cwc.exe", "Updated ", "","",true);
            _oUpd.fLaunchExe(sCurrFolder + "cwc.exe", "-wCwcUpdated " + Data.sUpdateVer, "", "", true);
            //				_process.StartInfo.Arguments = "Updated " + _sVersion + " " + Data.sWorkDir + " " + Data.sResendArg;
            while (!_oUpd.bExeLaunched && Base.bAlive)
            {
                Thread.Sleep(1);
            }
            SysAPI.fQuit(true);
        }
Beispiel #7
0
        public static string fDelocaliseExe(string _sPath)
        {
//fLaunchConsoleCmd("");



            LaunchTool _oSubCmd = new LaunchTool();

            _oSubCmd.dExit = new LaunchTool.dIExit(fDelocaliseEnd);

            _oSubCmd.bRedirectOutput = false;
            //_oSubCmd.bReturnBoth= true;
            _oSubCmd.bReturnError = true;
            //_oSubCmd.bRunInThread = false;
            _oSubCmd.bWaitEndForOutput = true;

            string sResult = _oSubCmd.fLaunchExe(_sPath, " @wDeloc ");

            _oSubCmd.fSend("Cwc:Launch by " + Data.MainProcess.Handle); //Remove "pause" bug ?

            while (_oSubCmd.bExeLaunch)
            {
                //Thread.Sleep(1);
                Thread.CurrentThread.Join(1);
            }
            sResult = _oSubCmd.sError;


            int _nBegin = sResult.IndexOf("wOut");

            if (_nBegin != -1)
            {
                sResult = sResult.Substring(_nBegin);
            }

            //	fDebug("!!RESULT!: " + sResult);
            //fDebug("-----------------------------: ");

            return(sResult);
        }
Beispiel #8
0
        public bool fLaunch(string _sPath, bool _bSanitize = false, string _sSubArg = "")
        {
            if (_sPath.Length > 1 && _sPath[_sPath.Length - 1] == '/') //Not a file
            {
                Output.TraceError("Path is not a File: " + _sPath);
                return(false);
            }
            //   Output.TraceError("Try: " + _sPath);

            bool _bDebug       = true;//Temp
            bool _bLaunchDebug = false;

            if (_bDebug)
            {
                _bLaunchDebug = true;
            }



            //	Debug.fTrace("Launch: " + _sPath);



            // if (oCurLaunch == null) { //We can reLaunch !? => Run button
            if (File.Exists(_sPath))
            {
                if (Data.oGuiConsole != null)
                {
                    Data.oGuiConsole.fLaunchPrj();
                }


                oCurLaunch = new LaunchTool();

                //oCurLaunch.bWaitEndForOutput = true;
                //	oCurLaunch.bRunInThread = false;

                oCurLaunch.bRedirectOutput = false;


                string _sArg     = "";
                string _sExePath = _sPath;
                if (Data.fGetGlobalVar("_sPlatform") == "Web_Emsc")
                {
                    _bDebug = false;     // No GDB
                    oCurLaunch.bRedirectOutput = true;
                    oCurLaunch.bHidden         = true;
                    oCurLaunch.UseShellExecute = true;


                    //	bWeb = true;
                    //	bSanitize = false;
                    string _sBrowser = Data.fGetViewIn();
                    _sArg = "\"" + Data.fGetGlobalVar("vWebRT_Emsc") + "emrun\" ";
                    //_sArg +=  "--serve_after_close ";
                    //_sArg +=  "--serve_after_exit ";

                    _sArg += "--browser \"" + _sBrowser + "\" ";
                    //_sArg +=  "--kill_exit ";
                    //sArg +=  "--kill_start ";

                    _sArg += "\"" + _sExePath + "\" ";


                    _sExePath = Data.fGetGlobalVar("vWebRT_Python") + "python.exe";

                    //_sWorkPath = _sExePath;

                    //	public
                }
                else
                {
                    //Normal
                    //	oCurLaunch.bDontKill = true;
                    //oCurLaunch.UseShellExecute = false;
                }

                _sArg += _sSubArg;
                _sArg  = _sArg.Trim();
                //Output.TraceWarning("_sSubArg " + _sSubArg);

                oCurLaunch.dError = new LaunchTool.dIError(fAppError); //Too much error in Emsc?
                oCurLaunch.dOut   = new LaunchTool.dIOut(fAppOut);

                oCurLaunch.dExit = new LaunchTool.dIExit(fExit);

                string _sPrintArg = "";
                if (_sArg != "")
                {
                    _sPrintArg = " [" + _sExePath + " " + _sArg + "]";
                }



                if (_bLaunchDebug)
                {
                    Output.TraceAction("Debug: " + _sPath + _sPrintArg);
                }
                else
                {
                    Output.TraceAction("Run: " + _sPath + _sPrintArg);
                }

                if (_bDebug)
                {
                    //Better way?
                    string       _sCompiler = Data.fGetGlobalVar("_wToolchain");
                    string       _sPlatform = Data.fGetGlobalVar("_sConfig_Type");
                    CompilerData _oCompiler = Finder.fUseCompiler(_sCompiler, _sPlatform);
                    string       _sDebugger = _oCompiler.oGblConfigType.fGetNode(null, new string[] { "Exe", "Debugger" }, "");
                    GDB          _oGdb      = new GDB(this, oCurLaunch, _sDebugger, _sExePath, _oCompiler, _sArg); //Create debugger proxy
                }
                else
                {
                    oCurLaunch.fLaunchExe(_sExePath, _sArg);
                }


                //_oPreload.dExit = new LaunchTool.dIExit(fUrlRequestComplete);
                //	Output.TraceWarning("------------------------");

/*
 *                  oCurLaunch.oForm = this;
 *                  oCurLaunch.bSanitize = _bSanitize;
 *                  oCurLaunch.fLaunchExe(_sPath);
 */

                return(true);
            }
            else
            {
                Output.TraceError("Executable not found: " + _sPath);
            }
            //      }
            return(false);
        }
Beispiel #9
0
        public GDB(LaunchProject _oLaunchProject, LaunchTool _oProcess, string _sGdbPath, string _sExePath, CompilerData _oCompiler, string _sSubArg = "")
        {
            nLimitNbOutput = LIMIT_OUTPUT;
            singleton      = this;

            if (_sSubArg != "")
            {
                _sSubArg = " " + _sSubArg;
            }


            oLaunchProject = _oLaunchProject;
            oProcess       = _oProcess;

            oProcess.dOut   = new LaunchTool.dIOut(fAppOut);
            oProcess.dError = new LaunchTool.dIError(fAppError);

            oProcess.bHidden         = true;
            oProcess.bRedirectOutput = true; //DBG assole in !bRedirectOutput

            oProcess.sWorkPath = Path.GetDirectoryName(_sExePath);
            //Output.TraceAction("Dir: " +  oProcess.sWorkPath );


            //oProcess.fLaunchExe(_sGdbPath, "--args " + _oCompiler.oModuleData.sCurrFolder+ _oCompiler.sExe_Sanitizer + " " + " -exit_code_if_errors 1 -malloc_callstacks -no_soft_kills   -no_soft_kills  -pause_at_exit  -batch -crash_at_unaddressable -crash_at_error " + _sExePath   );

            bool _bSanitize = true;

            //bool _bSanitize = false;

            if (Data.fIsDataTrue("Options/Debug Type/Sanitizer"))
            {
                //if(_bSanitize) {
                //oProcess.bExterneLaunch = false;
                //  oProcess.bHidden = false;
                //     oProcess.bRedirectOutput = false;
                // oProcess.fLaunchExe(_sGdbPath, "--args " + _oCompiler.oModuleData.sCurrFolder+ _oCompiler.sExe_Sanitizer + " " + " -v -exit_code_if_errors 1 -malloc_callstacks -no_soft_kills -batch -pause_at_exit " + _sExePath   );
                // oProcess.fLaunchExe( _oCompiler.oModuleData.sCurrFolder+ _oCompiler.sExe_Sanitizer,  " -v -exit_code_if_errors 1 -malloc_callstacks -no_soft_kills -batch -pause_at_exit " + _sExePath   );


                string _sSanitizer = _oCompiler.oGblConfigType.fGetNode(null, new string[] { "Exe", "Sanitizer" }, "");

                // oProcess.fLaunchExe( _oCompiler.oModuleData.sCurrFolder+ _oCompiler.sExe_Sanitizer,  " -no_callstack_use_fp   -no_callstack_use_top_fp  -v -exit_code_if_errors 1 -malloc_callstacks  -batch " + _sExePath   ); //-no_soft_kills
                oProcess.fLaunchExe(_sSanitizer, " -no_callstack_use_fp   -no_callstack_use_top_fp  -v -exit_code_if_errors 1 -malloc_callstacks  -batch " + _sExePath + _sSubArg);       //-no_soft_kills

                return;
            }
            else                                                                           //   if(Data.fIsDataTrue("Options/Debug Type/Debugger") ){
            {
                oProcess.fLaunchExe(_sGdbPath, "--args \"" + _sExePath + "\"" + _sSubArg); //GDB only
            }

            fLoadBreakpoints();

            /*
             *
             * To enter non-stop mode, use this sequence of commands before you run or attach to your program:
             *
             # Enable the async interface.
             # set target-async 1
             #
             # If using the CLI, pagination breaks non-stop.
             # set pagination off
             #
             # Finally, turn it on!
             # set non-stop on
             #
             * */

            // oProcess.fSend("set target-async 1");
            //  oProcess.fSend("set pagination off");
            //  oProcess.fSend("set non-stop on");


            oProcess.fSend("cd " + Path.GetDirectoryName(_sExePath));

            oProcess.fSend("set width 0");
            oProcess.fSend("set filename-display absolute");
            oProcess.fSend("set breakpoint pending on");
            oProcess.fSend("break GDB_Func_Break");
            oProcess.fSend("break GDB_Func_ExecuteCmds");

            // oProcess.fSend("set output-radix 16");//All in hex?



            fSetAllGdbBreakpoint();


            //oProcess.fSend("set new-console on");



            // oProcess.fSend("tbreak main");

            //oProcess.fSend("break _start");  //Entry point: 0x4014a0
            //oProcess.fSend("set backtrace past-entry on");

            /*
             * oProcess.fSend("info files");  //Entry point: 0x4014a0
             * oProcess.fSend("break *0x4014a0");
             * oProcess.fSend("show backtrace past-entry");
             */

            oProcess.fSend("run");  bRunning = true;
            //    oProcess.bRedirectOutput = false;
            //   oProcess.processStartInfo.RedirectStandardInput = false;Ok

            Start();
        }