Exemple #1
0
        internal static void fMainLoop()
        {
            if (!SysAPI.bIsLoadedFromAnotherCwcInstance)
            {
                if (Base.bAlive)
                {
                    // PipeInput.fConsoleExit(null);//Show >>
                    //     Data.oLaunchProject.fConsoleExit(null);//Show >>

                    while (Base.bAlive || Data.bForceTestNextCmd)
                    {
                        Data.bForceTestNextCmd = false;

                        switch (Data.sCmd)
                        {
                        case "StopBuild": Data.sCmd = "";
                            //  Debug.fTrace("****StopBuild!!");
                            Data.oLaunchProject.fCancel();
                            break;

                        case "StartBuild": Data.sCmd = "";
                            // Debug.fTrace("****StartBuild!!");
                            //  Console.WriteLine("start build");
                            Build.StartBuild();
                            break;

                        case "Delocalise": Data.sCmd = "";
                            //    Console.WriteLine("fDelocaliseCmd");
                            Delocalise.fDelocaliseCmd();

                            break;
                        }


                        //   Thread.Sleep(1);
                        //Thread.Sleep(1);
                        Thread.CurrentThread.Join(1);
                        if (Data.bConsoleMode && !Data.bNowBuilding)
                        {
                            Base.bAlive = false;
                        }
                    }
                }
            }
        }
Exemple #2
0
        public static void fDelocaliseCmd()
        {
            //Reset all -> Already clear in Data.fClearData()

            /*
             * Data.aVarGlobal.Clear();
             * Data.fSetDefaultVar();
             * if(Data.oGuiConsole != null) {
             *  Data.oGuiConsole.fLoadData();
             * }*/

            Output.TraceWarning("Launch " + sDelocaliseCmd);
            string _sText = Delocalise.fDelocalise(sDelocaliseCmd);

            Data.sArgExpand        = ArgProcess.fExpandAll(_sText);
            Data.sCmd              = "StartBuild";
            Data.bForceTestNextCmd = true;
        }
Exemple #3
0
        public void fCancel()
        {
            if (oCurLaunch != null)
            {
                oCurLaunch.fEnd();
                //   Build.fDisableBuild();
                //   oCurLaunch = null;
                //   Data.EndExecution();
            }
            else if (Data.bNowBuilding)
            {
                Build.StopBuild();
            }
            else
            {
                //    fResetList();
                //  Data.StartBuild();
                //  Data.sCmd = "StartBuild";

                //Start Last Launch
                Delocalise.fDelocaliseInMainThread(Config.sLastRecentPath);
            }
        }
Exemple #4
0
        public static void StartBuild(bool _bShowInfo = true)
        {
            Data.bIWantGoToEnd = true;
            // fDebug("-------------StartBUILDDDD");
            Data.fClearData();

//bNothingToBuild = true;//asss
            //fSetWorkingDir();
            if (!Data.bNowBuilding)
            {
                Interlocked.Exchange(ref CppCompiler.safeInstanceCount, 0); //Can be negative value, TODO try to kill thread controlling safe instance?

                Data.aAllInclude.Clear();
                Data.aAll_ArgumentManager.Clear();
                Data.aAll_ArgumentManager.Add(Data.oCompilerArg);

                Data.bToolchainDefined = false;
                Data.bModuleIsRequired = false;
                Data.bNonBuildCommand  = false;
                Data.aRequiredModule.Clear();
                Data.aBrowser.Clear();

                CppCompiler.nError = 0;
                Data.oArg          = new ArgumentManager();
                Data.oArg.ExtractMainArgument(Data.sArgExpand, true);

                if (Data.bUpdateMode)
                {
                    UpdateCwc.fUpdateFiles(Data.sUpdateModeSrc);
                    return;
                }


                //  bNothingToBuild = true;//aasss



                if (Data.bNothingToBuild || Data.bNonBuildCommand)
                {
                    //if(bNothingToBuild) {
                    Data.bNothingToBuild = false;



                    /*
                     * if(!Data.bConsoleMode){
                     *  GuiManager.fCreateGUI();
                     * }*/

                    if (Data.sToLaunch != "")
                    {
                        Delocalise.fDelocaliseInMainThread(Data.sToLaunch);
                    }
                    else
                    {
                        Msg.fShowIntroMessage();
                    }
                    return;
                }


                /*
                 *              //  if(bInConsole && oMainForm == null && bGUI) {
                 *                 if( Data.oMainForm == null && Data.bGUI && !Data.bUpdateMode) {
                 *                              if(Data.sArgExpand.IndexOf('|') != -1 || Data.sArgExpand.IndexOf('>') != -1) { //Auto GUI mode
                 *                                       GuiManager.fCreateGUI();
                 *                              }
                 *                      }*/



                Data.oArg.fCompleteExtractMainArgument();



                if (Data.bModeIDE)
                {
                    Data.bDontExecute = true;                             //TODO only one
                }

                // Debug.fTrace("-------------BegfLoadModules " );
                if (!Data.bModuleIsRequired)
                {
                    //  fDebug("------RUNN ");
                    Data.oArg.fExtract();

                    Data.oArg.fRun(null, Data.bDontExecute);
                }
                else
                {
                    //fDebug("--fLoadModules ");
                    //     Empty.fLoadModules();
                }


                if (Data.oGuiConsole != null)
                {
                    Data.oGuiConsole.fAddAllUsedDir();
                }
                //  fDebug("-------------AftfLoadModules");

                /*
                 *                  if(!bDontExecute ) {
                 *                           oArg.fRun();
                 *                  }*/



                if (Data.bModeIDE)
                {
                    Data.oModeIDE.fFinishExtractArg();
                }



                if (Data.bNowBuilding && !Data.bDontExecute)
                {
                    // CppCompiler.CheckAllThreadsHaveFinishedWorking(true);

                    Build.fDisableBuild();
                    if (CppCompiler.nError == 0)
                    {
                        Data.oLaunchProject.fBuildFinish();
                    }
                }
                else
                {
                    Build.fDisableBuild();
                }
                Data.bDontExecute = false;


                if (Data.bModuleIsRequired)
                {
                    Empty.fLoadModules();
                }
            }
        }
Exemple #5
0
        public static string fExpand(string _sFullArg, int _nIndex)
        {
//	Debug.fTrace("---fExpand!!!!! " + _sFullArg);
            //List<string> _sList = new List<string> ();

            string _sResult    = "";
            int    _nSartIndex = 0;
            int    _nEndIndex  = 0;
            int    _nIndexOfA  = _nIndex;

            ///////////////////////////////// Begin with @
            while (_nIndexOfA != -1)
            {
                _sResult  += _sFullArg.Substring(_nSartIndex, _nIndexOfA - _nSartIndex);
                _nEndIndex = fGetEndFile(_sFullArg, _nIndexOfA + 1);


                string _sFile = _sFullArg.Substring(_nIndexOfA + 1, _nEndIndex - (_nIndexOfA + 1));

                //Debug.fTrace("-****************************!!!fExpand  " + _sFile);
                if (_sFile == "wDeloc")                  //Special deloc command to quit
                //Debug.fTrace("!!!---DELOCATISE!!!!!");
                {
                    _sFullArg = _sFullArg.Replace("@wDeloc", "");                     //remove all wDeloc
                    Console.Error.WriteLine("wOut|" + _sFullArg);                     //Use special stream to resend args
                    SysAPI.fQuit(true);
                }


                string _sPath;
                if (_sFile.Length > 2 && _sFile[1] == ':')                 //Absolute path
                {
                    _sPath = _sFile;
                }
                else
                {
                    _sPath = PathHelper.ExeWorkDir + _sFile;                     //Relative path
                }

                string _sText = "";

                string _sExt = Path.GetExtension(_sPath).ToLower();



                try {
                    switch (_sExt)
                    {
                    case ".bat":
                    case ".exe":
                        _sText = Delocalise.fDelocalise(_sPath);
                        break;

                    default:
                        _sText = File.ReadAllText(_sPath);

                        break;
                    }
                }catch (Exception Ex) {
                    Output.TraceError("Error Expand File: " + Ex.Message + " : " + _sPath);
                };

                _sResult   += _sText;
                _nSartIndex = _nEndIndex;

                //   _nSartIndex = _nEndIndex;
                _nIndexOfA = _sFullArg.IndexOf('@', _nEndIndex);
            }

            _sResult += _sFullArg.Substring(_nEndIndex, _sFullArg.Length - _nEndIndex);



            /*
             * string[] _aFiles =   _sFullArg.Split('@');
             * foreach(string _sFileArg in _aFiles) {
             *
             *  int _nIndex = _sFileArg.IndexOf(' ');
             *  if(_nIndex == -1) {
             *      _nIndex = _sFileArg.IndexOf('\t');  //TODO make "OR" combinaison
             *  }
             *  if(_nIndex == -1) {
             *      _nIndex = _sFileArg.IndexOf('\n');
             *  }
             *  if(_nIndex == -1) {
             *      _nIndex = _sFileArg.IndexOf('|');
             *  }
             *  if(_nIndex == -1) {
             *      _nIndex = _sFileArg.IndexOf('>');
             *  }
             *   if(_nIndex == -1) {
             *      _nIndex = _sFileArg.Length;
             *  }
             *
             *   string _sFile = _sFileArg.Substring(0, _nIndex);
             *
             *   string _sPath = PathHelper.GetCurrentDirectory() + _sFile;
             *   string _sText = "";
             *  try {
             *      _sText = File.ReadAllText(_sPath);
             *  }catch(Exception Ex) {};
             *
             *   string _sArg =  _sFileArg.Substring(_nIndex);
             *  _sResult += _sText + _sArg;
             *
             *
             * }     */

            //   return _sResult.Replace('\n', ' ');
            //  return _sResult.Replace('\n', ' ').Replace('\r', ' ');
            return(_sResult);
        }