Exemple #1
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 #2
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);
        }