Exemple #1
0
    public void SendData(string title, bool neuromuscularProfileDo, bool translate,
                         bool cutByTriggers, TriggerList triggerList, EncoderGraphROptions.AnalysisModes analysisMode)
    {
        this.title = title;
        this.neuromuscularProfileDo = neuromuscularProfileDo;
        this.translate     = translate;
        this.cutByTriggers = cutByTriggers;
        this.triggerList   = triggerList;
        this.analysisMode  = analysisMode;

        CancelRScript = false;
    }
    public static EncoderGraphROptions PrepareEncoderGraphOptions(
        string title, EncoderStruct es, bool neuromuscularProfileDo, bool translate, bool debug, bool crossValidate,
        bool cutByTriggers, string triggerStr, bool separateSessionInDays, EncoderGraphROptions.AnalysisModes analysisMode)
    {
        string operatingSystem = OperatingSystemForRGraphs();

        title = Util.RemoveBackSlash(title);
        title = Util.RemoveChar(title, '\'');

        if (UtilAll.IsWindows())
        {
            //convert accents to Unicode in order to be plotted correctly on R windows
            title = Util.ConvertToUnicode(title);

            //On win32 R understands backlash as an escape character and
            //a file path uses Unix-like path separator '/'
            es.InputData   = es.InputData.Replace("\\", "/");
            es.OutputGraph = es.OutputGraph.Replace("\\", "/");
            es.OutputData1 = es.OutputData1.Replace("\\", "/");
            //es.OutputData2 = es.OutputData2.Replace("\\","/");
            //es.SpecialData = es.SpecialData.Replace("\\","/");
            es.EncoderTempPath = es.EncoderTempPath.Replace("\\", "/");
        }

        //if translators add ";", it will be converted to ','
        //if translators add a "\n", it will be converted to " "
        int    count = 0;
        string temp  = "";

        string [] encoderTranslatedWordsOK = new String [Constants.EncoderTranslatedWords.Length];

        //if ! translate, then just print the english words
        if (translate)
        {
            foreach (string etw in Constants.EncoderTranslatedWords)
            {
                temp = Util.ChangeChars(Catalog.GetString(etw), ";", ",");
                temp = Util.RemoveChar(temp, '\'');
                temp = Util.RemoveNewLine(temp, true);
                temp = Util.RemoveChar(temp, '#');                 //needed to distinguish comments '#' than normal lines like the EncoderTranslatedWords

                if (UtilAll.IsWindows())
                {
                    LogB.Debug(" (1) Unicoding:", temp);
                    temp = Util.ConvertToUnicode(temp);
                    LogB.Debug(" (2) Unicoded:", temp);
                }

                encoderTranslatedWordsOK[count++] = temp;
            }
        }
        else
        {
            encoderTranslatedWordsOK = Constants.EncoderEnglishWords;
        }

        return(new EncoderGraphROptions(
                   es.InputData, es.OutputGraph, es.OutputData1,
                   //es.OutputData2, es.SpecialData,
                   es.EncoderRPath, es.EncoderTempPath,
                   es.Ep,
                   title, operatingSystem,
                   Util.StringArrayToString(Constants.EncoderEnglishWords, ";"),
                   Util.StringArrayToString(encoderTranslatedWordsOK, ";"),
                   debug, crossValidate, cutByTriggers, triggerStr, separateSessionInDays, analysisMode
                   ));
    }