/// 11.) public async Task<String[]> GetSummonerNames(Double[] summonerIds) { int Id = Invoke("summonerService", "getSummonerNames", new object[] { summonerIds.Cast<object>().ToArray() }); while (!results.ContainsKey(Id)) await Task.Delay(10); String[] result = new String[results[Id].GetTO("data").GetArray("body").Length]; for (int i = 0; i < results[Id].GetTO("data").GetArray("body").Length; i++) { result[i] = (String)results[Id].GetTO("data").GetArray("body")[i]; } results.Remove(Id); return result; }
/// 16.) public async Task<String> GetSummonerIcons(Double[] summonerIds) { int Id = Invoke("summonerService", "getSummonerIcons", new object[] { summonerIds.Cast<object>().ToArray() }); while (!results.ContainsKey(Id)) await Task.Delay(10); String result = (String)results[Id].GetTO("data")["body"]; results.Remove(Id); return result; }
/// <summary> /// Converts array elements into pixel values (values normalized using maximum element) /// </summary> /// <param name="Matrix">Array</param> /// <returns>Greyscale image</returns> public Bitmap Matrix2ImageMax(Double[,] Matrix) { Bitmap img = new Bitmap(Matrix.GetLength(0), Matrix.GetLength(1)); Double max = Matrix.Cast<Double>().Max(); for (int i = 0; i < Matrix.GetLength(0); i++) { for (int j = 0; j < Matrix.GetLength(1); j++) { //Double a = 255 / Math.Log10(1 + max); //int value = (int)(a * Math.Log10(1 + Matrix[i, j])); int value = (int)(Matrix[i, j] / max); if (value > 255) value = 255; Color p = Color.FromArgb(255, value, value, value); img.SetPixel(i, j, p); } } return img; }