Eliminate last LINQ usage

This commit is contained in:
UnknownShadow200 2017-09-20 15:49:48 +10:00
parent 0b7fb5899c
commit 7c57f76280
3 changed files with 5 additions and 5 deletions

View File

@ -16,8 +16,6 @@
permissions and limitations under the Licenses.
*/
using MCGalaxy.Network;
using Newtonsoft.Json;
using System.IO;
namespace MCGalaxy.Commands.Chatting {
public sealed class CmdClear : Command {

View File

@ -21,12 +21,13 @@ using System.IO;
namespace MCGalaxy {
public delegate void LineProcessor<T>(string key, string value, ref T state);
public delegate void SimpleLineProcessor(string key, string value);
/// <summary> Handles text files that have multiple key-value lines in the format 'key=value'.
/// Also supports # for commented lines. </summary>
public static class PropertiesFile {
public static bool Read(string path, Action<string, string> processor,
public static bool Read(string path, SimpleLineProcessor processor,
char separator = '=', bool trimValue = true) {
object obj = null;
LineProcessor<object> del = (string key, string value, ref object state) => { processor(key, value); };

View File

@ -1,6 +1,5 @@
// Part of fCraft | Copyright 2009-2015 Matvei Stefarov <me@matvei.org> | BSD-3 | See LICENSE.txt
using System;
using System.Linq;
using MCGalaxy.Commands;
namespace MCGalaxy.Generator {
@ -98,7 +97,9 @@ namespace MCGalaxy.Generator {
float midpoint = (args.MidPoint * args.Bias);
// shuffle corners
corners = corners.OrderBy( r => rand.Next() ).ToArray();
int[] keys = new int[corners.Length];
for (int i = 0; i < corners.Length; i++) { keys[i] = rand.Next(); }
Array.Sort(keys, corners);
// overlay the bias
Noise.ApplyBias( heightmap, corners[0], corners[1], corners[2], corners[3], midpoint );