private void button14_Click(object sender, EventArgs e) { XmlTextReader lezer = new XmlTextReader("bangarang.xml"); string title = ""; string file = ""; Int64 startingPoint = 0; int particleSystemLifetime = 0, directionOffset = 0, minLifetime = 0, maxLifetime = 0, minForce = 0, maxForce = 0, tickDelay = 0, tickAmount = 0; float x = 0.0f, y = 0.0f, z = 0.0f, minSizeStarting = 0.0f, maxSizeStarting = 0.0f, minSizeEnding = 0.0f, maxSizeEnding = 0.0f; Int64 movementTime = 0; float cameraStartPositionX = 0.0f, cameraStartPositionY = 0.0f, cameraStartPositionZ = 0.0f, cameraEndPositionX = 0.0f, cameraEndPositionY = 0.0f, cameraEndPositionZ = 0.0f, targetStartPositionX = 0.0f, targetStartPositionY = 0.0f, targetStartPositionZ = 0.0f, targetEndPositionX = 0.0f, targetEndPositionY = 0.0f, targetEndPositionZ = 0.0f; int[] dirArr = null ; Color color = Color.Black, color2 = Color.Black; Boolean color2enabled = false; int direction = 90;// Direction.North; ParticleType type = ParticleType.Triangle; Boolean isEffect = false; Boolean isCamera = false; while (lezer.Read()) { switch (lezer.NodeType) { case XmlNodeType.Element: // Het knooppunt is een element. if (lezer.Name == "Title") title = lezer.ReadString(); else if (lezer.Name == "File") file = lezer.ReadString(); else if (lezer.Name == "EffectQue") { isEffect = true; isCamera = false; } else if (lezer.Name == "CameraQue") { isCamera = true; isEffect = false; } //Console.Write("<" + lezer.Name); while (lezer.MoveToNextAttribute()) // Attributen lezen. { if (isEffect) { if (lezer.Name == "startingPoint") startingPoint = Convert.ToInt64(lezer.Value); else if (lezer.Name == "particleSystemLifetime") particleSystemLifetime = Convert.ToInt16(lezer.Value); else if (lezer.Name == "x") x = float.Parse(lezer.Value); else if (lezer.Name == "y") y = float.Parse(lezer.Value); else if (lezer.Name == "z") z = float.Parse(lezer.Value); else if (lezer.Name == "direction") { string sDir = lezer.Value; int dir = 90; if (sDir == "North") dir = 90;//Direction.North; else if (sDir == "NorthEast") dir = 135;//Direction.NorthEast; else if (sDir == "East") dir = 180;//Direction.East; else if (sDir == "SouthEast") dir = 225;//Direction.SouthEast; else if (sDir == "South") dir = 270;//Direction.South; else if (sDir == "SouthWest") dir = 315;//Direction.SouthWest; else if (sDir == "West") dir = 0;//Direction.West; else if (sDir == "NorthWest") dir = 45;// Direction.NorthWest; else if (sDir == "10,10") { dirArr = new int[] { 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180 }; } else if (sDir == "North2EastClockwise") { dirArr = new int[] { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180 }; } else if (sDir == "North2SouthClockwise") { dirArr = new int[] { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270 }; } else if (sDir == "North2WestClockwise") { dirArr = new int[] { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 0 }; } else if (sDir == "North2NorthClockwise") { dirArr = new int[] { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 }; } else if (sDir == "North2EastAntiClockwise") { dirArr = new int[] { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180 }; Array.Reverse(dirArr); } else if (sDir == "North2SouthAntiClockwise") { dirArr = new int[] { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270 }; Array.Reverse(dirArr); } else if (sDir == "North2WestAntiClockwise") { dirArr = new int[] { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 0 }; Array.Reverse(dirArr); } else if (sDir == "North2NorthAntiClockwise") { dirArr = new int[] { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 }; Array.Reverse(dirArr); } else if (sDir == "WobbleLeft") { dirArr = new int[] { 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}; int[] temp = dirArr; Array.Reverse(temp); int[] newdir = new int[dirArr.Length + temp.Length]; int i = 0; for (i = 0; i < dirArr.Length; i++) { newdir[i] = dirArr[i]; } for (int xx = 0; xx < temp.Length; xx++) { newdir[i] = temp[xx]; i++; } dirArr = newdir; } //else if (sDir == "North2East") // { // dirArr = new int[] { }; // } // else if (sDir == "North2East") // { // dirArr = new int[] { }; // } else dir = Int16.Parse(sDir); direction = dir; } else if (lezer.Name == "directionOffset") directionOffset = Convert.ToInt16(lezer.Value); else if (lezer.Name == "type") { string sType = lezer.Value; type = ParticleType.Triangle; if (sType == "Square") type = ParticleType.Square; else if (sType == "Round") type = ParticleType.Round; else if (sType == "Skrillex") type = ParticleType.Skrillex; else if (sType == "Bass") type = ParticleType.Bass; } else if (lezer.Name == "color") color = Color.FromName(lezer.Value); else if (lezer.Name == "color2") { color2enabled = true; color2 = Color.FromName(lezer.Value); } else if (lezer.Name == "minSizeStarting") minSizeStarting = float.Parse(lezer.Value); else if (lezer.Name == "maxSizeStarting") maxSizeStarting = float.Parse(lezer.Value); else if (lezer.Name == "minSizeEnding") minSizeEnding = float.Parse(lezer.Value); else if (lezer.Name == "maxSizeEnding") maxSizeEnding = float.Parse(lezer.Value); else if (lezer.Name == "minLifetime") minLifetime = Convert.ToInt16(lezer.Value); else if (lezer.Name == "maxLifetime") maxLifetime = Convert.ToInt16(lezer.Value); else if (lezer.Name == "minForce") minForce = Convert.ToInt16(lezer.Value); else if (lezer.Name == "maxForce") maxForce = Convert.ToInt16(lezer.Value); else if (lezer.Name == "tickDelay") tickDelay = Convert.ToInt16(lezer.Value); else if (lezer.Name == "tickAmount") { tickAmount = Convert.ToInt16(lezer.Value); //CreateParticleSystem(x, y, z, direction, directionOffset, type, color, minSizeStarting, maxSizeStarting, minSizeEnding, maxSizeEnding, minLifetime, maxLifetime, minForce, maxForce, tickDelay, tickAmount, particleSystemLifetime); Effect ee = new Effect(startingPoint, particleSystemLifetime, directionOffset, minLifetime, maxLifetime, minForce, maxForce, tickDelay, tickAmount, x, y, z, minSizeStarting, maxSizeStarting, minSizeEnding, maxSizeEnding, color, direction, type); if (color2enabled) ee.setExtraColor(color2); if (dirArr != null) { ee.setDirectionArray(dirArr); } PlaylistEffect.Add(ee); } } else if (isCamera) { if (lezer.Name == "startingPoint") startingPoint = Convert.ToInt64(lezer.Value); else if (lezer.Name == "cameraStartPositionX") cameraStartPositionX = float.Parse(lezer.Value); else if (lezer.Name == "cameraStartPositionY") cameraStartPositionY = float.Parse(lezer.Value); else if (lezer.Name == "cameraStartPositionZ") cameraStartPositionZ = float.Parse(lezer.Value); else if (lezer.Name == "cameraEndPositionX") cameraEndPositionX = float.Parse(lezer.Value); else if (lezer.Name == "cameraEndPositionY") cameraEndPositionY = float.Parse(lezer.Value); else if (lezer.Name == "cameraEndPositionZ") cameraEndPositionZ = float.Parse(lezer.Value); else if (lezer.Name == "targetStartPositionX") targetStartPositionX = float.Parse(lezer.Value); else if (lezer.Name == "targetStartPositionY") targetStartPositionY = float.Parse(lezer.Value); else if (lezer.Name == "targetStartPositionZ") targetStartPositionZ = float.Parse(lezer.Value); else if (lezer.Name == "targetEndPositionX") targetEndPositionX = float.Parse(lezer.Value); else if (lezer.Name == "targetEndPositionY") targetEndPositionY = float.Parse(lezer.Value); else if (lezer.Name == "targetEndPositionZ") targetEndPositionZ = float.Parse(lezer.Value); else if (lezer.Name == "movementTime") { movementTime = Convert.ToInt64(lezer.Value); PlaylistCamera.Add(new Camera(startingPoint, cameraStartPositionX, cameraStartPositionY, cameraStartPositionZ, cameraEndPositionX, cameraEndPositionY, cameraEndPositionZ, targetStartPositionX, targetStartPositionY, targetStartPositionZ, targetEndPositionX, targetEndPositionY, targetEndPositionZ, movementTime)); } } } //Console.WriteLine(">"); break; case XmlNodeType.Text: //De tekst in elk element weergeven. //Console.WriteLine(lezer.Value); break; case XmlNodeType.EndElement: //Het einde van het element weergeven. //Console.Write("</" + lezer.Name); //Console.WriteLine(">"); break; } } PlaySound(file); this.Name = title; sw2.Start(); tmrUpdateSystems.Start(); }