private void recordFakeSkeleton_Click(object sender, RoutedEventArgs e) { Random rand = new Random(); SaveFileDialog openFileDialog1 = new SaveFileDialog(); openFileDialog1.InitialDirectory = "C:\\"; openFileDialog1.FileName = "Kosciec1.kosciec"; if (openFileDialog1.ShowDialog() != 0) { //Get the path of specified file if (openFileDialog1.FileName != "") { if (File.Exists(openFileDialog1.FileName)) { File.Delete(openFileDialog1.FileName); } recordingPath = openFileDialog1.FileName; } } for (int i = 0; i < 500; ++i) { SkeletonFrame skeletonToRecord = new SkeletonFrame(); skeletonToRecord.addPerson(0, new Dictionary <int, CustomJoint>()); skeletonToRecord.addJointToPerson(0, 0, 150, 150, 2); skeletonToRecord.addJointToPerson(0, 1, 150, 90, 1); skeletonToRecord.addJointToPerson(0, 2, 135, 30, 1); skeletonToRecord.addJointToPerson(0, 3, 125, 3, 1); skeletonToRecord.addJointToPerson(0, 4, 180, 60, 2); skeletonToRecord.addJointToPerson(0, 5, 195, 105, 2); skeletonToRecord.addJointToPerson(0, 6, 210, 150, 2); skeletonToRecord.addJointToPerson(0, 7, 215, 170, 2); skeletonToRecord.addJointToPerson(0, 8, 105, 60, 2); skeletonToRecord.addJointToPerson(0, 9, 90, 110, 2); skeletonToRecord.addJointToPerson(0, 10, 85, 175, 1); skeletonToRecord.addJointToPerson(0, 11, 80, 195, 2); skeletonToRecord.addJointToPerson(0, 12, 180, 165, 2); skeletonToRecord.addJointToPerson(0, 13, 170, 240, 2); skeletonToRecord.addJointToPerson(0, 14, 165, 315, 2); skeletonToRecord.addJointToPerson(0, 15, 180, 320, 2); skeletonToRecord.addJointToPerson(0, 16, 110, 165, 2); skeletonToRecord.addJointToPerson(0, 17, 110, 240, 2); skeletonToRecord.addJointToPerson(0, 18, 120, 315, 2); skeletonToRecord.addJointToPerson(0, 19, 127, 325, 2); skeletonToRecord.addJointToPerson(0, 20, 140, 45, 2); skeletonToRecord.addJointToPerson(0, 21, 225, 180, 2); skeletonToRecord.addJointToPerson(0, 22, 210, 180, 2); skeletonToRecord.addJointToPerson(0, 23, 90, 200, 2); skeletonToRecord.addJointToPerson(0, 24, 75, 200, 2); if (i > 250) { skeletonToRecord.addPerson(1, new Dictionary <int, CustomJoint>()); skeletonToRecord.addJointToPerson(1, 0, 160, 150, 2); skeletonToRecord.addJointToPerson(1, 1, 160, 90, 2); skeletonToRecord.addJointToPerson(1, 2, 145, 30, 2); skeletonToRecord.addJointToPerson(1, 3, 135, 3, 2); skeletonToRecord.addJointToPerson(1, 4, 190, 60, 2); skeletonToRecord.addJointToPerson(1, 5, 205, 105, 2); skeletonToRecord.addJointToPerson(1, 6, 220, 150, 2); skeletonToRecord.addJointToPerson(1, 7, 225, 170, 2); skeletonToRecord.addJointToPerson(1, 8, 115, 60, 2); skeletonToRecord.addJointToPerson(1, 9, 100, 110, 2); skeletonToRecord.addJointToPerson(1, 10, 95, 175, 2); skeletonToRecord.addJointToPerson(1, 11, 90, 195, 2); skeletonToRecord.addJointToPerson(1, 12, 190, 165, 2); skeletonToRecord.addJointToPerson(1, 13, 180, 240, 2); skeletonToRecord.addJointToPerson(1, 14, 175, 315, 2); skeletonToRecord.addJointToPerson(1, 15, 190, 320, 2); skeletonToRecord.addJointToPerson(1, 16, 120, 165, 2); skeletonToRecord.addJointToPerson(1, 17, 120, 240, 2); skeletonToRecord.addJointToPerson(1, 18, 130, 315, 2); skeletonToRecord.addJointToPerson(1, 19, 137, 325, 2); skeletonToRecord.addJointToPerson(1, 20, 150, 45, 2); skeletonToRecord.addJointToPerson(1, 21, 235, 180, 2); skeletonToRecord.addJointToPerson(1, 22, 220, 180, 2); skeletonToRecord.addJointToPerson(1, 23, 100, 200, 2); skeletonToRecord.addJointToPerson(1, 24, 85, 200, 2); } double temp1; double temp2; double temp3; double temp4; for (int bone = 0; bone < 25; ++bone) { if (bone == 5 || bone == 6 || bone == 9 || bone == 10) { temp1 = rand.Next(30) - 15; temp2 = rand.Next(30) - 15; temp3 = rand.Next(30) - 15; temp4 = rand.Next(30) - 15; } else { temp1 = rand.Next(10) - 5; temp2 = rand.Next(10) - 5; temp3 = rand.Next(30) - 15; temp4 = rand.Next(30) - 15; } skeletonToRecord.getJoint(0, bone).setX(skeletonToRecord.getJoint(0, bone).getX() + temp1); skeletonToRecord.getJoint(0, bone).setY(skeletonToRecord.getJoint(0, bone).getY() + temp2); if (i > 250) { skeletonToRecord.getJoint(1, bone).setX(skeletonToRecord.getJoint(1, bone).getX() + temp3); skeletonToRecord.getJoint(1, bone).setY(skeletonToRecord.getJoint(1, bone).getY() + temp4); } } RecordManager.WriteToBinaryFile <SkeletonFrame>(recordingPath, skeletonToRecord, true); } }