// Find the ArrayEntry for this column.
        // If create is true, create the ArrayEntry if it doesn't exist.
        private ArrayEntry FindColumn(ArrayEntry entry, int col, bool create)
        {
            // Find the entry before the required one.
            ArrayEntry before = FindColumnBefore(entry, col);

            // If we found it, return it.
            if ((before.NextEntry != null) && (before.NextEntry.ColumnNumber == col))
            {
                return(before.NextEntry);
            }

            // We didn't find it. See if we should create it.
            if (create)
            {
                // Create the new ArrayEntry.
                ArrayEntry newEntry = new ArrayEntry();
                newEntry.ColumnNumber = col;

                // Insert it in the row's column list.
                newEntry.NextEntry = before.NextEntry;
                before.NextEntry   = newEntry;

                // Return it.
                return(newEntry);
            }

            // We didn't find it and shouldn't create it. Return null.
            return(null);
        }
Beispiel #2
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                if (__isset.primitiveEntry)
                {
                    hashcode = (hashcode * 397) + PrimitiveEntry.GetHashCode();
                }
                if (__isset.arrayEntry)
                {
                    hashcode = (hashcode * 397) + ArrayEntry.GetHashCode();
                }
                if (__isset.mapEntry)
                {
                    hashcode = (hashcode * 397) + MapEntry.GetHashCode();
                }
                if (__isset.structEntry)
                {
                    hashcode = (hashcode * 397) + StructEntry.GetHashCode();
                }
                if (__isset.unionEntry)
                {
                    hashcode = (hashcode * 397) + UnionEntry.GetHashCode();
                }
                if (__isset.userDefinedTypeEntry)
                {
                    hashcode = (hashcode * 397) + UserDefinedTypeEntry.GetHashCode();
                }
            }
            return(hashcode);
        }
Beispiel #3
0
        public static ObjectInfo ParseObjectInfo(
            ArrayEntry objectEntry, Dictionary <long, ObjectInfo> objectInfosByReference,
            Dictionary <string, List <ObjectInfo> > infosByListName, string objListName)
        {
            ObjectInfo info = GetObjectInfo(ref objectEntry, null);

            infosByListName[objListName].Add(info);

            if (!objectInfosByReference.ContainsKey(objectEntry.Position))
            {
                objectInfosByReference.Add(objectEntry.Position, info);
            }

            foreach (DictionaryEntry link in info.LinkEntries.Values)
            {
                foreach (ArrayEntry linked in link.IterArray())
                {
                    if (!objectInfosByReference.ContainsKey(linked.Position))
                    {
                        ParseObjectInfo(linked, objectInfosByReference, infosByListName, str_Links);
                    }
                }
            }

            return(info);
        }
        // Get or set an array value.
        public T this[int row, int col]
        {
            get
            {
                // Find the entry.
                ArrayEntry entry = FindEntry(row, col, false);

                // If we didn't find it, return the default value.
                if (entry == null)
                {
                    return(DefaultValue);
                }

                // Return the entry's value.
                return(entry.Value);
            }
            set
            {
                // See if this is the default value.
                if (value.Equals(DefaultValue))
                {
                    // Remove the entry from the array.
                    DeleteEntry(row, col);
                }
                else
                {
                    // Save the new value.
                    // Find the entry, creating it if necessary.
                    ArrayEntry entry = FindEntry(row, col, true);

                    // Save the value.
                    entry.Value = value;
                }
            }
        }
        // Find the ArrayEntry for this column.
        private ArrayEntry FindColumnBefore(ArrayEntry entry, int col)
        {
            // Find the entry before the required one.
            while ((entry.NextEntry != null) && (entry.NextEntry.ColumnNumber < col))
            {
                entry = entry.NextEntry;
            }

            // Return the ArrayRow before the row or null.
            return(entry);
        }
Beispiel #6
0
        protected void ReleaseArrayImpl(T[] array)
        {
            ArrayEntry foundEntry = null;

            lock (this.ArrayEntries) {
                foundEntry = this.ArrayEntries.FirstOrDefault(ae => ae.Array == array);
                if (foundEntry != null)
                {
                    foundEntry.InUse = false;
                }
            }
        }
Beispiel #7
0
        protected T[] GetArrayImpl(uint atLeastItemCount)
        {
            ArrayEntry foundEntry = null;

            lock (this.ArrayEntries) {
                foundEntry = this.ArrayEntries.FirstOrDefault(ae => ae.InUse == false && ae.Array.Length >= atLeastItemCount);
                if (foundEntry == null)
                {
                    foundEntry = new ArrayEntry()
                    {
                        Array = new T[atLeastItemCount],
                        InUse = true
                    };
                    this.ArrayEntries.Add(foundEntry);
                }
            }
            return(foundEntry.Array);
        }
Beispiel #8
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("TTypeEntry(");

            sb.Append("PrimitiveEntry: ");
            sb.Append(PrimitiveEntry == null ? "<null>" : PrimitiveEntry.ToString());
            sb.Append(",ArrayEntry: ");
            sb.Append(ArrayEntry == null ? "<null>" : ArrayEntry.ToString());
            sb.Append(",MapEntry: ");
            sb.Append(MapEntry == null ? "<null>" : MapEntry.ToString());
            sb.Append(",StructEntry: ");
            sb.Append(StructEntry == null ? "<null>" : StructEntry.ToString());
            sb.Append(",UnionEntry: ");
            sb.Append(UnionEntry == null ? "<null>" : UnionEntry.ToString());
            sb.Append(",UserDefinedTypeEntry: ");
            sb.Append(UserDefinedTypeEntry == null ? "<null>" : UserDefinedTypeEntry.ToString());
            sb.Append(")");
            return(sb.ToString());
        }
        // Iterator.
        public IEnumerator <ArrayValue <T> > GetEnumerator()
        {
            ArrayRow arrayRow = TopSentinel.NextRow;

            while (arrayRow != null)
            {
                ArrayEntry arrayEntry = arrayRow.RowSentinel.NextEntry;
                while (arrayEntry != null)
                {
                    yield return(new ArrayValue <T>
                    {
                        Row = arrayRow.RowNumber,
                        Column = arrayEntry.ColumnNumber,
                        Value = arrayEntry.Value
                    });

                    arrayEntry = arrayEntry.NextEntry;
                }
                arrayRow = arrayRow.NextRow;
            }
        }
Beispiel #10
0
        // Delete the indicated entry if it exists.
        public void DeleteEntry(int row, int col)
        {
            // Find the row before the entry's row.
            ArrayRow rowBefore = FindRowBefore(row);

            // If we didn't find the row, we're done.
            ArrayRow arrayRow = rowBefore.NextRow;

            if ((arrayRow == null) || (arrayRow.RowNumber != row))
            {
                return;
            }

            // Find the entry before this entry's entry.
            ArrayEntry entryBefore = FindColumnBefore(arrayRow.RowSentinel, col);
            ArrayEntry arrayEntry  = entryBefore.NextEntry;

            // If we didn't find the entry, we're done.
            if ((arrayEntry == null) || (arrayEntry.ColumnNumber != col))
            {
                return;
            }

            // Remove the entry from the row's list.
            entryBefore.NextEntry = arrayEntry.NextEntry;
            // arrayEntry.NextEntry = null;
            // free(arrayEntry);

            // If there are no more entries in the row, remove it.
            ArrayEntry arraySentinel = arrayRow.RowSentinel;

            if (arraySentinel.NextEntry == null)
            {
                rowBefore.NextRow = arrayRow.NextRow;
                // arrayRow.RowSentinel = null;
                // free(arraySentinel);
                // free(arrayRow);
            }
        }
Beispiel #11
0
        public ObjectCamera(ArrayEntry bymlEntry, out string objID)
        {
            objID = string.Empty;

            foreach (var parameter in bymlEntry.IterDictionary())
            {
                if (parameter.Key == "Id")
                {
                    string id = parameter.Parse();

                    string[] idParts = id.Split('_');

                    if (idParts.Length > 1)
                    {
                        idSuffix = idParts[1];
                    }

                    objID = idParts[0];
                }
                else
                {
                    dynamic data = parameter.Parse();

                    if (data is Dictionary <string, dynamic> dict && dict.Count == 3 && dict.ContainsKey("X") && dict.ContainsKey("Y") && dict.ContainsKey("Z"))
                    {
                        data = new Vector3(
                            dict["X"] / 100,
                            dict["Y"] / 100,
                            dict["Z"] / 100
                            );
                    }

                    properties.Add(parameter.Key, data);
                }
            }
        }
Beispiel #12
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("TTypeEntry");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                if (PrimitiveEntry != null && __isset.primitiveEntry)
                {
                    field.Name = "primitiveEntry";
                    field.Type = TType.Struct;
                    field.ID   = 1;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await PrimitiveEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (ArrayEntry != null && __isset.arrayEntry)
                {
                    field.Name = "arrayEntry";
                    field.Type = TType.Struct;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await ArrayEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (MapEntry != null && __isset.mapEntry)
                {
                    field.Name = "mapEntry";
                    field.Type = TType.Struct;
                    field.ID   = 3;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await MapEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (StructEntry != null && __isset.structEntry)
                {
                    field.Name = "structEntry";
                    field.Type = TType.Struct;
                    field.ID   = 4;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await StructEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (UnionEntry != null && __isset.unionEntry)
                {
                    field.Name = "unionEntry";
                    field.Type = TType.Struct;
                    field.ID   = 5;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await UnionEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (UserDefinedTypeEntry != null && __isset.userDefinedTypeEntry)
                {
                    field.Name = "userDefinedTypeEntry";
                    field.Type = TType.Struct;
                    field.ID   = 6;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await UserDefinedTypeEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Beispiel #13
0
        public void Write(TProtocol oprot)
        {
            TStruct struc = new TStruct("TTypeEntry");

            oprot.WriteStructBegin(struc);
            TField field = new TField();

            if (PrimitiveEntry != null && __isset.primitiveEntry)
            {
                field.Name = "primitiveEntry";
                field.Type = TType.Struct;
                field.ID   = 1;
                oprot.WriteFieldBegin(field);
                PrimitiveEntry.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (ArrayEntry != null && __isset.arrayEntry)
            {
                field.Name = "arrayEntry";
                field.Type = TType.Struct;
                field.ID   = 2;
                oprot.WriteFieldBegin(field);
                ArrayEntry.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (MapEntry != null && __isset.mapEntry)
            {
                field.Name = "mapEntry";
                field.Type = TType.Struct;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                MapEntry.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (StructEntry != null && __isset.structEntry)
            {
                field.Name = "structEntry";
                field.Type = TType.Struct;
                field.ID   = 4;
                oprot.WriteFieldBegin(field);
                StructEntry.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (UnionEntry != null && __isset.unionEntry)
            {
                field.Name = "unionEntry";
                field.Type = TType.Struct;
                field.ID   = 5;
                oprot.WriteFieldBegin(field);
                UnionEntry.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (UserDefinedTypeEntry != null && __isset.userDefinedTypeEntry)
            {
                field.Name = "userDefinedTypeEntry";
                field.Type = TType.Struct;
                field.ID   = 6;
                oprot.WriteFieldBegin(field);
                UserDefinedTypeEntry.Write(oprot);
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Beispiel #14
0
        /// <summary>
        /// Parses a 3d World from an ArrayEntry
        /// </summary>
        /// <param name="objectEntry"></param>
        /// <param name="zone"></param>
        /// <param name="objectsByReference"></param>
        /// <returns></returns>
        public static I3dWorldObject ParseObject(ArrayEntry objectEntry, SM3DWorldZone zone, Dictionary <long, I3dWorldObject> objectsByReference, out bool alreadyInLinks, Dictionary <string, I3dWorldObject> linkedObjsByID, bool isLinked = false)
        {
            ObjectInfo info = GetObjectInfo(ref objectEntry, zone);

            I3dWorldObject obj;
            bool           loadLinks;

            if ((info.ClassName == "Area") || info.ObjectName.Contains("Area") && AreaModelNames.Contains(info.ModelName))
            {
                obj = new AreaObject(in info, zone, out loadLinks);
            }
            else if (info.PropertyEntries.TryGetValue("RailPoints", out DictionaryEntry railPointEntry) && railPointEntry.NodeType == ByamlFile.ByamlNodeType.Array) //at this point we can be sure it's a rail
            {
                obj = new Rail(in info, zone, out loadLinks);
            }
            else
            {
                obj = new General3dWorldObject(in info, zone, out loadLinks);
            }

            if (isLinked && linkedObjsByID != null)
            {
                if (!linkedObjsByID.ContainsKey(info.ID))
                {
                    linkedObjsByID.Add(info.ID, obj);
                }
                else
                {
                    alreadyInLinks = true;

                    obj = linkedObjsByID[info.ID];

                    if (!isLinked)
                    {
                        alreadyInLinks = !zone.LinkedObjects.Remove(obj);
                    }

                    //in case this object was already read in another file
                    if (!objectsByReference.ContainsKey(objectEntry.Position))
                    {
                        objectsByReference.Add(objectEntry.Position, obj);
                    }

                    return(obj);
                }
            }

            alreadyInLinks = false;

            if (!objectsByReference.ContainsKey(objectEntry.Position))
            {
                objectsByReference.Add(objectEntry.Position, obj);
            }
            else if (!isLinked)
            {
                obj = objectsByReference[objectEntry.Position];
                zone.LinkedObjects.Remove(obj);
                return(obj);
            }

            if (loadLinks)
            {
                var links = new Dictionary <string, List <I3dWorldObject> >();
                foreach (DictionaryEntry link in info.LinkEntries.Values)
                {
                    links.Add(link.Key, new List <I3dWorldObject>());
                    foreach (ArrayEntry linked in link.IterArray())
                    {
                        if (objectsByReference.ContainsKey(linked.Position))
                        {
                            links[link.Key].Add(objectsByReference[linked.Position]);
                            objectsByReference[linked.Position].AddLinkDestination(link.Key, obj);
                        }
                        else
                        {
                            I3dWorldObject _obj = ParseObject(linked, zone, objectsByReference, out bool linkedAlreadyReferenced, linkedObjsByID, true);
                            _obj.AddLinkDestination(link.Key, obj);
                            links[link.Key].Add(_obj);
                            if (zone != null && !linkedAlreadyReferenced)
                            {
                                zone.LinkedObjects.Add(_obj);
                            }
                        }
                    }
                }
                if (links.Count > 0)
                {
                    obj.Links = links;
                }
            }

            return(obj);
        }
Beispiel #15
0
        private static ObjectInfo GetObjectInfo(ref ArrayEntry objectEntry, SM3DWorldZone zone)
        {
            Dictionary <string, DictionaryEntry> properties = new Dictionary <string, DictionaryEntry>();
            Dictionary <string, DictionaryEntry> links      = new Dictionary <string, DictionaryEntry>();

            ObjectInfo info = new ObjectInfo();

            foreach (DictionaryEntry entry in objectEntry.IterDictionary())
            {
                switch (entry.Key)
                {
                case "Comment":
                case "IsLinkDest":
                case "LayerConfigName":
#if ODYSSEY
                case "SrcUnitLayerList":
                case "PlacementFileName":
                case "comment":
#endif
                    break;     //ignore these

                case "Id":
                    info.ID = entry.Parse();
                    break;

                case "Links":
                    foreach (DictionaryEntry linkEntry in entry.IterDictionary())
                    {
                        links.Add(linkEntry.Key, linkEntry);
                    }
                    break;

                case "ModelName":
                    info.ModelName = entry.Parse() ?? "";
                    break;

                case "Rotate":
                    dynamic _data = entry.Parse();
                    info.Rotation = new Vector3(
                        _data["X"],
                        _data["Y"],
                        _data["Z"]
                        );
                    break;

                case "Scale":
                    _data      = entry.Parse();
                    info.Scale = new Vector3(
                        _data["X"],
                        _data["Y"],
                        _data["Z"]
                        );
                    break;

                case "Translate":
                    _data         = entry.Parse();
                    info.Position = new Vector3(
                        _data["X"] / 100f,
                        _data["Y"] / 100f,
                        _data["Z"] / 100f
                        );
                    break;

                case "UnitConfigName":
                    info.ObjectName = entry.Parse();
                    break;

                case "UnitConfig":
                    _data = entry.Parse();

                    info.DisplayTranslation = new Vector3(
                        _data["DisplayTranslate"]["X"] / 100f,
                        _data["DisplayTranslate"]["Y"] / 100f,
                        _data["DisplayTranslate"]["Z"] / 100f
                        );
                    info.DisplayRotation = new Vector3(
                        _data["DisplayRotate"]["X"],
                        _data["DisplayRotate"]["Y"],
                        _data["DisplayRotate"]["Z"]
                        );
                    info.DisplayScale = new Vector3(
                        _data["DisplayScale"]["X"],
                        _data["DisplayScale"]["Y"],
                        _data["DisplayScale"]["Z"]
                        );
                    info.ClassName = _data["ParameterConfigName"];
                    break;

                default:
                    if (!properties.ContainsKey(entry.Key))
                    {
                        properties.Add(entry.Key, entry);
                    }
                    break;
                }
            }

            info.PropertyEntries = properties;
            info.LinkEntries     = links;
            return(info);
        }
Beispiel #16
0
        public override string ToString()
        {
            var  sb      = new StringBuilder("TTypeEntry(");
            bool __first = true;

            if (PrimitiveEntry != null && __isset.primitiveEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("PrimitiveEntry: ");
                sb.Append(PrimitiveEntry == null ? "<null>" : PrimitiveEntry.ToString());
            }
            if (ArrayEntry != null && __isset.arrayEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("ArrayEntry: ");
                sb.Append(ArrayEntry == null ? "<null>" : ArrayEntry.ToString());
            }
            if (MapEntry != null && __isset.mapEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("MapEntry: ");
                sb.Append(MapEntry == null ? "<null>" : MapEntry.ToString());
            }
            if (StructEntry != null && __isset.structEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("StructEntry: ");
                sb.Append(StructEntry == null ? "<null>" : StructEntry.ToString());
            }
            if (UnionEntry != null && __isset.unionEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("UnionEntry: ");
                sb.Append(UnionEntry == null ? "<null>" : UnionEntry.ToString());
            }
            if (UserDefinedTypeEntry != null && __isset.userDefinedTypeEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("UserDefinedTypeEntry: ");
                sb.Append(UserDefinedTypeEntry == null ? "<null>" : UserDefinedTypeEntry.ToString());
            }
            sb.Append(")");
            return(sb.ToString());
        }
Beispiel #17
0
        /// <summary>
        /// Parses a 3d World from an ArrayEntry
        /// </summary>
        /// <param name="objectEntry"></param>
        /// <param name="zone"></param>
        /// <param name="objectsByReference"></param>
        /// <returns></returns>
        public static I3dWorldObject ParseObject(ArrayEntry objectEntry, SM3DWorldZone zone, Dictionary <long, I3dWorldObject> objectsByReference, out bool alreadyInLinks, Dictionary <string, I3dWorldObject> linkedObjsByID, bool isLinked = false)
        {
            ObjectInfo info = GetObjectInfo(ref objectEntry, zone);

            I3dWorldObject obj;
            bool           loadLinks;

            if (Enum.GetNames(typeof(Rail.RailObjType)).Contains(info.ClassName))
            {
                obj = new Rail(info, zone, out loadLinks);
            }
            else
            {
                obj = new General3dWorldObject(info, zone, out loadLinks);
            }

            if (linkedObjsByID != null && isLinked)
            {
                if (!linkedObjsByID.ContainsKey(info.ID))
                {
                    linkedObjsByID.Add(info.ID, obj);
                }
                else
                {
                    alreadyInLinks = true;

                    obj = linkedObjsByID[info.ID];

                    if (!isLinked)
                    {
                        alreadyInLinks = !zone.LinkedObjects.Remove(obj);
                    }

                    //in case this object was already read in another file
                    if (!objectsByReference.ContainsKey(objectEntry.Position))
                    {
                        objectsByReference.Add(objectEntry.Position, obj);
                    }

                    return(obj);
                }
            }

            alreadyInLinks = false;

            if (!objectsByReference.ContainsKey(objectEntry.Position))
            {
                objectsByReference.Add(objectEntry.Position, obj);
            }
            else if (!isLinked)
            {
                obj = objectsByReference[objectEntry.Position];
                zone.LinkedObjects.Remove(obj);
                return(obj);
            }

            if (loadLinks)
            {
                obj.Links = new Dictionary <string, List <I3dWorldObject> >();
                foreach (DictionaryEntry link in info.LinkEntries.Values)
                {
                    obj.Links.Add(link.Key, new List <I3dWorldObject>());
                    foreach (ArrayEntry linked in link.IterArray())
                    {
                        if (objectsByReference.ContainsKey(linked.Position))
                        {
                            obj.Links[link.Key].Add(objectsByReference[linked.Position]);
                            objectsByReference[linked.Position].AddLinkDestination(link.Key, obj);
                        }
                        else
                        {
                            I3dWorldObject _obj = ParseObject(linked, zone, objectsByReference, out bool linkedAlreadyReferenced, linkedObjsByID, true);
                            _obj.AddLinkDestination(link.Key, obj);
                            obj.Links[link.Key].Add(_obj);
                            if (zone != null && !linkedAlreadyReferenced)
                            {
                                zone.LinkedObjects.Add(_obj);
                            }
                        }
                    }
                }
                if (obj.Links.Count == 0)
                {
                    obj.Links = null;
                }
            }

            return(obj);
        }
Beispiel #18
0
        private static void oneDimensionalArrayWork()
        {
            Console.WriteLine("\nHow would you like to fill the Array? \nFillFromConsole -- 1 \nFillFromFile -- 2");
            switch (Int32.Parse(Console.ReadLine()))
            {
            case 1:
                fillFromConsole();
                break;

            case 2:
                fillFromFile("");
                break;

            default:
                Console.WriteLine("Wrong Input");
                return;
            }
            Console.WriteLine("\nChoose the way of implementation: \nHand-Made -- 1 \nWithSystem.Array -- 2");
            OneDimensionalArrayWorkerStrategy worker;

            switch (Int32.Parse(Console.ReadLine()))
            {
            case 1:
                worker = new HandMadeOneDimensionalArrayWorkerStrategy();
                break;

            case 2:
                worker = new SystemOneDimensionalArrayWorkerStrategy();
                break;

            default:
                Console.WriteLine("Wrong Input");
                return;
            }
            while (true)
            {
                Console.WriteLine("\nChoose the method: \nPrint -- 1 \nSortAhead -- 2 \nSortConversely -- 3 \nGetEvenNumbers -- 4 \nGetMax -- 5 \nGetMin -- 6");
                switch (Int32.Parse(Console.ReadLine()))
                {
                case 1:
                    worker.printArray(arr);
                    break;

                case 2:
                    Console.WriteLine("Sorted Array:");
                    worker.printArray(worker.sortAhead(arr));
                    break;

                case 3:
                    Console.WriteLine("Sorted Array:");
                    worker.printArray(worker.sortConversely(arr));
                    break;

                case 4:
                    Console.WriteLine("EvenNumbers from Array:");
                    worker.printArray(worker.evenNumbers(arr));
                    break;

                case 5:

                    ArrayEntry max = worker.maxArray(arr);
                    Console.WriteLine("Index of Max:" + max.key);
                    Console.WriteLine("Value of Max:" + max.value);
                    break;

                case 6:
                    ArrayEntry min = worker.maxArray(arr);
                    Console.WriteLine("Index of Min:", min.key);
                    Console.WriteLine("Value of Min:", min.value);
                    break;

                default:
                    Console.WriteLine("Wrong Input");
                    return;
                }
            }
        }