Esempio n. 1
0
        public static WaveObject MakeFromString(string typeKey)
        {
            WaveObject resultObj = new WaveObject();

            resultObj.Type = ObjectTypeStrings.GetFromString(typeKey);
            if (resultObj.Type == ObjectType.StartPoint)
            {
                // Wave alg init
                resultObj.Value = 0;
            }
            return(resultObj);
        }
Esempio n. 2
0
        public static WaveObject[,] ConvertToWaveObjectsArray(string[,] array)
        {
            int arrayHeight = array.GetUpperBound(1) + 1;

            if (arrayHeight > 0 && array.Length > 0)
            {
                int arrayWidth  = array.Length / arrayHeight;
                var waveObjects = new WaveObject[arrayWidth, arrayHeight];
                for (int y = 0; y < arrayHeight; y++)
                {
                    for (int x = 0; x < arrayWidth; x++)
                    {
                        waveObjects[x, y] = MakeFromString(array[x, y]);
                    }
                }
                return(waveObjects);
            }
            else
            {
                throw new ArgumentException("Array length = 0");
            }
        }