Exemplo n.º 1
0
    public void convertAll()
    {
        inputFileName  = PostureDataHandler.instance.filePath + "ComfortEvaluationData" + UserStudyData.instance.fileEnding;
        outputFileName = PostureDataHandler.instance.filePath + "ComfortEvaluationCompressed" + UserStudyData.instance.fileEnding;
        read           = new StreamReader(inputFileName);
        string oldHeader = read.ReadLine();

        string[] endlArr = { ", " };
        first  = System.Array.IndexOf(oldHeader.Split(endlArr, System.StringSplitOptions.RemoveEmptyEntries), "RandomHandThumbIP");
        rating = System.Array.IndexOf(oldHeader.Split(endlArr, System.StringSplitOptions.RemoveEmptyEntries), "Rating");
        int currentRating;

        if (File.Exists(outputFileName))
        {
            File.Delete(outputFileName);
        }

        string endl       = ", ";
        string fileHeader =
            "Rating" + endl +
            Discomfort.getInterFingerCSVHeader(endl) +
            Discomfort.getAbductionCSVHeader(endl) +
            Discomfort.getHyperExtensionCSVHeader(endl) +
            Comfort.getRRPCSVHeader(endl);

        File.AppendAllText(outputFileName, fileHeader + System.Environment.NewLine);


        while (!read.EndOfStream)
        {
            string   dataLine = read.ReadLine();
            string[] input    = dataLine.Split(endlArr, System.StringSplitOptions.RemoveEmptyEntries);
            currentRating = int.Parse(input[rating]);
            handNew.parseCSV(input, first);

            File.AppendAllText(
                outputFileName,
                currentRating + endl +
                Discomfort.getInterFingerCSV(handNew, endl) +
                Discomfort.getAbductionCSV(handNew, endl) +
                Discomfort.getHyperExtensionCSV(handNew, endl) +
                Comfort.getRRPCSV(handNew, endl) +
                System.Environment.NewLine
                );
        }
        Debug.Log("Done!");
        read.Close();
    }
    void saveResults()
    {
        File.AppendAllText(
            fileName,

            UserStudyData.instance.Name + endl +
            slider.value + endl +
            Discomfort.getDiscomfortAngled(targethand) + endl +
            Comfort.getRRPComponent(targethand) + endl +
            Discomfort.getInterFingerComponent(targethand) + endl +
            Discomfort.getAbductionComponent(targethand) + endl +
            Discomfort.getHyperExtensionComponent(targethand) + endl +
            Discomfort.getInterFingerCSV(targethand, endl) +
            Discomfort.getAbductionCSV(targethand, endl) +
            Discomfort.getHyperExtensionCSV(targethand, endl) +
            Comfort.getRRPCSV(targethand, endl) +
            targethand.ToCSVString(endl) + Environment.NewLine
            );
    }
    void saveResults()
    {
        File.AppendAllText(
            fileNameEnd,

            UserStudyData.instance.Name + endl +
            UserStudyData.instance.ComfortEvaluation + endl +
            timer + endl +
            timerTracking + endl +
            Discomfort.getDiscomfortAngled(UserStudyData.instance.targetHand) + endl +
            Comfort.getRRPComponent(UserStudyData.instance.targetHand) + endl +
            Discomfort.getInterFingerComponent(UserStudyData.instance.targetHand) + endl +
            Discomfort.getAbductionComponent(UserStudyData.instance.targetHand) + endl +
            Discomfort.getHyperExtensionComponent(UserStudyData.instance.targetHand) + endl +
            Discomfort.getInterFingerCSV(UserStudyData.instance.targetHand, endl) +
            Discomfort.getAbductionCSV(UserStudyData.instance.targetHand, endl) +
            Discomfort.getHyperExtensionCSV(UserStudyData.instance.targetHand, endl) +
            Comfort.getRRPCSV(UserStudyData.instance.targetHand, endl) +
            UserStudyData.instance.targetHand.ToCSVString(endl) + Environment.NewLine
            );
    }