Inheritance: MonoBehaviour
Beispiel #1
0
 public static void SaveEl_2(El_2 e, int objId, NPLabDbContext db)
 {
     Database.SetInitializer(new MigrateDatabaseToLatestVersion<NPLabDbContext, Configuration>());
     currObj = (from p in db.Object
                where p.Id == objId
                select p).FirstOrDefault();
     //e.Object = currObj;
     //.ObjectsId = currObj.Id;
     currObj.El_2.Add(e);
     db.Entry(e).State = System.Data.Entity.EntityState.Added;
     foreach (Sectors sec in e.ListOfSectors)
     {
         db.Entry(sec).State = System.Data.Entity.EntityState.Added;
         foreach (Floors f in sec.ListOfFloors)
         {
             db.Entry(f).State = System.Data.Entity.EntityState.Added;
             foreach (Rooms r in f.ListOfRooms)
             {
                 db.Entry(r).State = System.Data.Entity.EntityState.Added;
                 foreach (Installations inst in r.ListOfInstallations) db.Entry(inst).State = System.Data.Entity.EntityState.Added;
             }
         }
     }
     db.SaveChanges();
 }
        /// <summary>
        /// Main Method.
        /// </summary>
        public static void Main()
        {
            Objects obj1 = new Objects("gosho", 1);
            Console.WriteLine(obj1.ToString());

            // TODO : add == and != operator
        }
 public static bool Send(Objects.Client client, uint creatureId, SquareColor color)
 {
     CreatureSquarePacket p = new CreatureSquarePacket(client);
     p.CreatureId = creatureId;
     p.Color = color;
     return p.Send();
 }
Beispiel #4
0
    private bool checkDistance(Objects obj)
    {
        bool isInRange = true;

        Vector3 distanceToCheck;

        switch (obj)
        {
            case Objects.Start:
                distanceToCheck = startPosition;
                break;
            case Objects.End:
                distanceToCheck = endPosition;
                break;
            // This default block is just for the compiler. It shouldn't execute ever.
            default:
                distanceToCheck = startPosition;
                break;
        }

        // Check x and y distance to the object.

        float xDistance = 0, yDistance = 0;

        xDistance = sphere.transform.position.x - distanceToCheck.x;
        yDistance = sphere.transform.position.y - distanceToCheck.y;

        if (Mathf.Abs(xDistance) > distanceDelta || Mathf.Abs(yDistance) > distanceDelta)
        {
            isInRange = false;
        }

        return isInRange;
    }
 public static bool Send(Objects.Client client, byte slot, Objects.Item item)
 {
     InventorySetSlotPacket p = new InventorySetSlotPacket(client);
     p.Slot = slot;
     p.Item = item;
     return p.Send();
 }
Beispiel #6
0
        public MovePacket(Objects.Client c, Constants.Direction direction)
            : base(c)
        {
            Direction = direction;

            switch (direction)
            {
                case Tibia.Constants.Direction.Down:
                    Type = OutgoingPacketType.MoveDown;
                    break;
                case Tibia.Constants.Direction.Up:
                    Type = OutgoingPacketType.MoveUp;
                    break;
                case Tibia.Constants.Direction.Right:
                    Type = OutgoingPacketType.MoveRight;
                    break;
                case Tibia.Constants.Direction.Left:
                    Type = OutgoingPacketType.MoveLeft;
                    break;
                case Tibia.Constants.Direction.DownLeft:
                    Type = OutgoingPacketType.MoveDownLeft;
                    break;
                case Tibia.Constants.Direction.DownRight:
                    Type = OutgoingPacketType.MoveDownRight;
                    break;
                case Tibia.Constants.Direction.UpLeft:
                    Type = OutgoingPacketType.MoveUpLeft;
                    break;
                case Tibia.Constants.Direction.UpRight:
                    Type = OutgoingPacketType.MoveUpRight;
                    break;
            }

            Destination = PacketDestination.Server;
        }
 public static bool Send(Objects.Client client, ChatChannel channel, string name)
 {
     ChannelOpenPacket p = new ChannelOpenPacket(client);
     p.ChannelId = channel;
     p.ChannelName = name;
     return p.Send();
 }
 public static ObjectsCollection GetAll() {
     resourceSchema.Dal.Objects dbo = null;
     try {
         dbo = new resourceSchema.Dal.Objects();
         System.Data.DataSet ds = dbo.Objects_Select_All();
         ObjectsCollection collection = new ObjectsCollection();
         if (GlobalTools.IsSafeDataSet(ds)) {
             for (int i = 0; (i < ds.Tables[0].Rows.Count); i = (i + 1)) {
                 Objects obj = new Objects();
                 obj.Fill(ds.Tables[0].Rows[i]);
                 if ((obj != null)) {
                     collection.Add(obj);
                 }
             }
         }
         return collection;
     }
     catch (System.Exception ) {
         throw;
     }
     finally {
         if ((dbo != null)) {
             dbo.Dispose();
         }
     }
 }
Beispiel #9
0
 void LoadPanes()
 {
     IOptionPane general = new General();
     panes.Add(general);
     IOptionPane objects = new Objects();
     panes.Add(objects);
 }
 public static bool Send(Objects.Client client, uint creatureId, string creatureName)
 {
     RemoveCreatureTextPacket p = new RemoveCreatureTextPacket(client);
     p.CreatureId = creatureId;
     p.CreatureName = creatureName;
     return p.Send();
 }
Beispiel #11
0
        public static bool Send(Objects.Client client, uint iconId)
        {
            RemoveIconPacket p = new RemoveIconPacket(client);

            p.IconId = iconId;

            return p.Send();
        }
Beispiel #12
0
 public static bool Send(Objects.Client client, byte fightMode, byte chaseMode, byte safeMode)
 {
     FightModesPacket p = new FightModesPacket(client);
     p.FightMode = fightMode;
     p.ChaseMode = chaseMode;
     p.SafeMode = safeMode;
     return p.Send();
 }
Beispiel #13
0
        public static bool Send(Objects.Client client, uint skinId)
        {
            RemoveSkinPacket p = new RemoveSkinPacket(client);

            p.SkinId = skinId;

            return p.Send();
        }
 public static bool Send(Objects.Client client, string message, Objects.Location position, TextColor color)
 {
     AnimatedTextPacket p = new AnimatedTextPacket(client);
     p.Message = message;
     p.Location = position;
     p.Color = color;
     return p.Send();
 }
Beispiel #15
0
 public static bool Send(Objects.Client client, Objects.Location position, ushort spriteId, byte stackPosition)
 {
     LookAtPacket p = new LookAtPacket(client);
     p.Location = position;
     p.SpriteId = spriteId;
     p.StackPosition = stackPosition;
     return p.Send();
 }
Beispiel #16
0
        public static bool Send(Objects.Client client, Location location, Effect effect)
        {
            MagicEffectPacket p = new MagicEffectPacket(client);
            p.Location = location;
            p.Effect = effect;

            return p.Send();
        }
Beispiel #17
0
        public static bool Send(Objects.Client client, TextMessageColor color, string msg)
        {
            TextMessagePacket p = new TextMessagePacket(client);
            p.Color = color;
            p.Message = msg;

            return p.Send();
        }
Beispiel #18
0
 public static bool Send(Objects.Client client, Objects.Location fromLocation, Objects.Location toLocation, ProjectileType effect)
 {
     ProjectilePacket p = new ProjectilePacket(client);
     p.FromPosition = fromLocation;
     p.ToPosition = toLocation;
     p.Effect = effect;
     return p.Send();
 }
        public static bool Send(Objects.Client client, byte[] packet)
        {
            HookSendToServerPacket p = new HookSendToServerPacket(client);

            p.PacketToSend = packet;

            return p.Send();
        }
Beispiel #20
0
 public static bool Send(Objects.Client client, uint playerId, string playerName, byte state)
 {
     VipStatePacket p = new VipStatePacket(client);
     p.PlayerId = playerId;
     p.PlayerName = playerName;
     p.PlayerState = state;
     return p.Send();
 }
Beispiel #21
0
        public static bool Send(Objects.Client client, Objects.Location fromPosition, ushort spriteId, byte fromStack, byte index)
        {
            ItemUsePacket p = new ItemUsePacket(client);
            p.FromLocation = fromPosition;
            p.SpriteId = spriteId;
            p.FromStackPosition = fromStack;
            p.Index = index;

            return p.Send();
        }
Beispiel #22
0
        public static bool Send(Objects.Client client, Objects.Location location, ushort itemId, byte stackPosition)
        {
            ItemRotatePacket p = new ItemRotatePacket(client);

            p.Location = location;
            p.ItemId = itemId;
            p.StackPosition = stackPosition;

            return p.Send();
        }
Beispiel #23
0
        public static bool Send(Objects.Client client, ushort itemId, byte count, byte amount)
        {
            ShopSellPacket p = new ShopSellPacket(client);

            p.ItemId = itemId;
            p.Count = count;
            p.Amount = amount;

            return p.Send();
        }
        public static bool Send(Objects.Client client, Objects.Location fromLocation, ushort spriteId, byte fromStack, uint creatureId)
        {
            ItemUseBattlelistPacket p = new ItemUseBattlelistPacket(client);

            p.FromLocation = fromLocation;
            p.SpriteId = spriteId;
            p.FromStackPosition = fromStack;
            p.CreatureId = creatureId;

            return p.Send();
        }
        public static bool Send(Objects.Client client, SpeechType type, string receiver, string message, ChatChannel channel)
        {
            PlayerSpeechPacket p = new PlayerSpeechPacket(client);

            p.SpeechType = type;
            p.Receiver = receiver;
            p.Message = message;
            p.ChannelId = channel;

            return p.Send();
        }
Beispiel #26
0
 private void NewObject_Click(object sender, EventArgs e)
 {
     Database.SetInitializer(new MigrateDatabaseToLatestVersion<NPLabDbContext, Configuration>());
     //var db = new NPLabDbContext();
     Objects obj = new Objects();
     db.Object.Add(obj);
     db.SaveChanges();
     Main M = new Main(obj.Id, this);
     M.Show();
     M.Focus();
     this.Hide();
 }
Beispiel #27
0
        public static bool Send(Objects.Client client, uint creatureId)
        {
            AttackPacket p = new AttackPacket(client);
            p.CreatureId = creatureId;

            if (client.VersionNumber >= 860)
            {
                uint count = client.Player.AttackCount;
                p.Count = count;
            }
            return p.Send();
        }
Beispiel #28
0
        public static bool Send(Objects.Client client, Objects.Location fromLocation, ushort spriteId, byte fromStackPostion, Objects.Location toLocation, byte count)
        {
            ItemMovePacket p = new ItemMovePacket(client);

            p.FromLocation = fromLocation;
            p.SpriteId = spriteId;
            p.FromStackPosition = fromStackPostion;
            p.ToLocation = toLocation;
            p.Count = count;

            return p.Send();
        }
Beispiel #29
0
 private void button1_Click(object sender, EventArgs e)
 {
     string login = textBox1.Text.ToLower();
     string password = textBox2.Text;
     user tmp = new user(login, password);
     int lvl = tmp.isUser();
     if ((lvl > -1) && (lvl < 3)) {
         Objects objects = new Objects(lvl);
         objects.Show();
         this.Hide();
     }
     else    MessageBox.Show("Данного пользователя нет в системе");
 }
Beispiel #30
0
 /// <summary>
 /// Authenticates client to server
 /// </summary>
 /// <param name="nClientFlag"></param>
 /// <param name="strUsername"></param>
 /// <param name="strPassword"></param>
 public void authenticate(Objects.Client.ClientFlag nClientFlag, string strUsername, string strPassword)
 {
     routeToServer(new Objects.Packet()
     {
         Flag = Objects.Packet.PacketFlag.PACKETFLAG_REQUEST_HANDSHAKE,
         Data = new Objects.Handshake()
         {
             ClientFlag = nClientFlag,
             Username = strUsername,
             Password = strPassword
         }
     });
 }
Beispiel #31
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            LoadBalancingResult that = ( LoadBalancingResult )o;

            return(_timeToLiveMillis == that._timeToLiveMillis && Objects.Equals(_routeEndpoints, that._routeEndpoints) && Objects.Equals(_writeEndpoints, that._writeEndpoints) && Objects.Equals(_readEndpoints, that._readEndpoints));
        }
Beispiel #32
0
 public override int GetHashCode()
 {
     return(Objects.hash(_connectorUris));
 }
Beispiel #33
0
 private int calculateObjectsSize(NameSizeCalculator nameSizer)
 {
     return(4 + Objects.AsParallel().Sum(o => o.Size(nameSizer)));
 }
Beispiel #34
0
        /// <inheritdoc />
        /// <summary>
        /// Writes this class as json using <code>generator</code>.
        /// This method is valid only in an array context or in no context (see <see cref="M:Newtonsoft.Json.JsonTextWriter.WriteStartObject" />.
        /// Requires the current objects list to be correctly sorted, otherwise the written
        /// <see cref="T:SavegameToolkit.Types.ObjectReference" /> might be broken.
        /// </summary>
        /// <param name="writer"><see cref="T:Newtonsoft.Json.JsonTextWriter" /> to write with</param>
        /// <param name="writingOptions"></param>
        public void WriteJson(JsonTextWriter writer, WritingOptions writingOptions)
        {
            writer.WriteStartObject();

            writer.WriteField("saveVersion", SaveVersion);
            writer.WriteField("gameTime", GameTime);

            writer.WriteField("saveCount", SaveCount);

            if (!writingOptions.Compact && OldNameList != null && OldNameList.Any())
            {
                writer.WriteArrayFieldStart("preservedNames");

                foreach (string oldName in OldNameList)
                {
                    writer.WriteValue(oldName);
                }

                writer.WriteEndArray();
            }

            if (!writingOptions.Compact && DataFiles.Any())
            {
                writer.WriteArrayFieldStart("dataFiles");

                foreach (string dataFile in DataFiles)
                {
                    writer.WriteValue(dataFile);
                }

                writer.WriteEndArray();
            }

            if (!writingOptions.Compact && EmbeddedData.Any())
            {
                writer.WriteArrayFieldStart("embeddedData");

                foreach (EmbeddedData data in EmbeddedData)
                {
                    data.WriteJson(writer);
                }

                writer.WriteEndArray();
            }

            if (DataFilesObjectMap.Any())
            {
                writer.WriteObjectFieldStart("dataFilesObjectMap");

                foreach (KeyValuePair <int, List <string[]> > entry in DataFilesObjectMap)
                {
                    writer.WriteArrayFieldStart(entry.Key.ToString());
                    foreach (string[] namesList in entry.Value)
                    {
                        writer.WriteStartArray();
                        foreach (string name in namesList)
                        {
                            writer.WriteValue(name);
                        }

                        writer.WriteEndArray();
                    }

                    writer.WriteEndArray();
                }

                writer.WriteEndObject();
            }

            if (Objects.Any())
            {
                writer.WriteArrayFieldStart("objects");

                foreach (GameObject gameObject in Objects)
                {
                    gameObject.WriteJson(writer, writingOptions);
                }

                writer.WriteEndArray();
            }

            writer.WriteObjectFieldStart("hibernation");

            if (!writingOptions.Compact)
            {
                writer.WriteField("v8Unknown1", hibernationV8Unknown1);
                writer.WriteField("v8Unknown2", hibernationV8Unknown2);
                writer.WriteField("v8Unknown3", hibernationV8Unknown3);
                writer.WriteField("v8Unknown4", hibernationV8Unknown4);

                writer.WriteField("unknown1", hibernationUnknown1);
                writer.WriteField("unknown2", hibernationUnknown2);
            }

            if (!writingOptions.Compact && hibernationClasses.Any())
            {
                writer.WriteArrayFieldStart("classes");

                foreach (string hibernationClass in hibernationClasses)
                {
                    writer.WriteValue(hibernationClass);
                }

                writer.WriteEndArray();
            }

            if (!writingOptions.Compact && hibernationIndices.Any())
            {
                writer.WriteArrayFieldStart("indices");

                foreach (int hibernationIndex in hibernationIndices)
                {
                    writer.WriteValue(hibernationIndex);
                }

                writer.WriteEndArray();
            }

            if (HibernationEntries.Any())
            {
                writer.WriteArrayFieldStart("entries");

                foreach (HibernationEntry hibernationEntry in HibernationEntries)
                {
                    hibernationEntry.WriteJson(writer, writingOptions);
                }

                writer.WriteEndArray();
            }

            writer.WriteEndObject();

            writer.WriteEndObject();
        }
Beispiel #35
0
 public void Refresh()
 {
     Objects.Clear();
     Load(null);
 }
Beispiel #36
0
 private void UpdateChildren(Time time)
 {
     Objects.Update(time);
 }
Beispiel #37
0
 public override int GetHashCode()
 {
     return(Objects.hash(_databaseDirectory, _storeLayout));
 }
Beispiel #38
0
 public override int GetHashCode()
 {
     return(Objects.hash(Scheme, SocketAddress));
 }
Beispiel #39
0
 public override IEnumerable <VmfObject> Flatten()
 {
     return(Objects.SelectMany(x => x.Flatten()).Union(new[] { this }));
 }
Beispiel #40
0
 public override int GetHashCode()
 {
     return(Objects.hash(_routers, _timeToLiveMillis));
 }
Beispiel #41
0
 public static String RegexReplace(this String input, string pattern, string replacements)
 {
     return(input.RegexReplace(Objects.Enumerate(pattern), Objects.Enumerate(replacements)));
 }
Beispiel #42
0
 public ClockContext(SystemNanoClock clock)
 {
     this._system = Objects.requireNonNull(clock, "system clock");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NpcData"/> class.
 /// </summary>
 /// <param name="Device">The device.</param>
 internal NpcData(Device Device, int ID, Objects Objects) : base(Device)
 {
     this.Identifier = 24133;
     this.ID         = ID;
     this.Objects    = Objects;
 }
Beispiel #44
0
        public Contracts.DTO_s.AKNService.dzgr GetPropertyList(string username, string password, string opstina, string katastarskaOpstina, string brImotenList)
        {
            if (String.IsNullOrEmpty(username))
            {
                var ex = new InteropFault
                {
                    Result       = false,
                    ErrorMessage = "Сервисот врати грешка.",
                    ErrorDetails = "Параметарот 'корисничко име' е задолжителен!"
                };
                throw new FaultException <InteropFault>(ex, ex.ErrorMessage + " " + ex.ErrorDetails);
            }
            if (String.IsNullOrEmpty(password))
            {
                var ex = new InteropFault
                {
                    Result       = false,
                    ErrorMessage = "Сервисот врати грешка.",
                    ErrorDetails = "Параметарот 'лозинка' е задолжителен!"
                };
                throw new FaultException <InteropFault>(ex, ex.ErrorMessage + " " + ex.ErrorDetails);
            }
            if (String.IsNullOrEmpty(opstina))
            {
                var ex = new InteropFault
                {
                    Result       = false,
                    ErrorMessage = "Сервисот врати грешка.",
                    ErrorDetails = "Параметарот 'општина' е задолжителен!"
                };
                throw new FaultException <InteropFault>(ex, ex.ErrorMessage + " " + ex.ErrorDetails);
            }
            if (String.IsNullOrEmpty(katastarskaOpstina))
            {
                var ex = new InteropFault
                {
                    Result       = false,
                    ErrorMessage = "Сервисот врати грешка.",
                    ErrorDetails = "Параметарот 'катастарска општина' е задолжителен!"
                };
                throw new FaultException <InteropFault>(ex, ex.ErrorMessage + " " + ex.ErrorDetails);
            }
            if (String.IsNullOrEmpty(brImotenList))
            {
                var ex = new InteropFault
                {
                    Result       = false,
                    ErrorMessage = "Сервисот врати грешка.",
                    ErrorDetails = "Параметарот 'број на имотен лист' е задолжителен!"
                };
                throw new FaultException <InteropFault>(ex, ex.ErrorMessage + " " + ex.ErrorDetails);
            }

            System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);//sertifikatot ne im e u red za toa go stavam ova za da go ignorira
            var aknClient = new Service_MACEDONIAN_CADASTRESoapClient();
            var output    = aknClient.ReturnImotenList_3(username, password, opstina, katastarskaOpstina, brImotenList);
            var _niztov   = new List <Loads>();

            if (output.niztov != null)
            {
                foreach (var tovar in output.niztov)
                {
                    var tov = new Loads {
                        text = tovar.text
                    };
                    _niztov.Add(tov);
                }
            }

            var _nizobj = new List <Objects>();

            if (output.nizobj != null)
            {
                foreach (var objekt in output.nizobj)
                {
                    var objectItem = new Objects
                    {
                        broj         = objekt.broj,
                        objekt       = objekt.objekt,
                        vlez         = objekt.vlez,
                        kat          = objekt.kat,
                        stan         = objekt.stan,
                        namena       = objekt.namena,
                        mesto        = objekt.mesto,
                        povrsina     = objekt.povrsina,
                        godinagradba = objekt.godinagradba,
                        osnov        = objekt.osnov,
                        pravo        = objekt.pravo
                    };
                    _nizobj.Add(objectItem);
                }
            }

            var _nizsop = new List <Owner>();

            if (output.nizsop != null)
            {
                foreach (var sopstvenik in output.nizsop)
                {
                    var owner = new Owner()
                    {
                        embg  = sopstvenik.embg,
                        ime   = sopstvenik.ime,
                        mesto = sopstvenik.mesto,
                        ulica = sopstvenik.ulica,
                        broj  = sopstvenik.broj,
                        del   = sopstvenik.del
                    };
                    _nizsop.Add(owner);
                }
            }

            var _nizpar = new List <Parcel>();

            if (output.nizpar != null)
            {
                foreach (var parcela in output.nizpar)
                {
                    var parcel = new Parcel
                    {
                        broj_del = parcela.broj_del,
                        objekt   = parcela.objekt,
                        mesto    = parcela.mesto,
                        kultura  = parcela.kultura,
                        klasa    = parcela.klasa,
                        povrsina = parcela.povrsina,
                        pravo    = parcela.pravo
                    };
                    _nizpar.Add(parcel);
                }
            }

            var propertyList = new Contracts.DTO_s.AKNService.dzgr
            {
                ops     = output.ops,
                kops    = output.kops,
                ilist   = output.ilist,
                niztov  = _niztov,
                nizobj  = _nizobj,
                nizsop  = _nizsop,
                nizpar  = _nizpar,
                data    = output.data,
                message = output.message,
            };

            return(propertyList);
        }
Beispiel #45
0
        //Розробити модель вибору способів сортування та пошуку
        //максимального / мінімального значення масиву числових об'єктів
        //Chain of responsibilily, iterator, command
        public static void Menu()
        {
            int      choise;
            Objects  objects;
            Receiver receiver = new Receiver();

            Handler_For_Sorts h_So1 = new Handler_Bubble();
            Handler_For_Sorts h_So2 = new Handler_Choise();
            Handler_For_Sorts h_So3 = new Handler_Insert();
            Handler_For_Sorts h_So4 = new Handler_Shell();
            Handler_For_Sorts h_So5 = new Handler_Quick();

            Handler_For_Search h_Se1 = new Handler_Lin();
            Handler_For_Search h_Se2 = new Handler_Bin();
            Handler_For_Search h_Se3 = new Handler_Inter();

            Console.WriteLine("Создание массива: ");
            Console.WriteLine("Введите размерность массива: ");
            int size = int.Parse(Console.ReadLine());

            objects = new Objects(size);
            Console.WriteLine("Создан пустой массив.");
            do
            {
                Console.WriteLine("1. Заполнить массив");
                Console.WriteLine("2. Очистить массив");
                Console.WriteLine("3. Отсортировать массив");
                Console.WriteLine("4. Найти максимальное/минимальное значение");
                Console.WriteLine("5. Печать массива");
                Console.WriteLine("0. Выйти");

                choise = int.Parse(Console.ReadLine());
                Console.WriteLine("------------------------");
                switch (choise)
                {
                case 1:
                    Console.WriteLine("Заполнение массива: ");
                    //for (int i = 0; i < size; i++)
                    //{
                    //    Console.WriteLine("Елемент[" + i +"] = ");
                    //    Objects.array[i] = int.Parse(Console.ReadLine());
                    //}
                    receiver.Run_Command_Add();
                    break;

                case 2:
                    Console.WriteLine("Очистка массива: ");
                    //for (int i=0;i<Objects.array.Length;i++)
                    //{
                    //    Objects.array[i] = 0;
                    //}
                    receiver.Run_Command_Del();
                    break;

                case 3:

                    h_So1.Successor = h_So2;
                    h_So2.Successor = h_So3;
                    h_So3.Successor = h_So4;
                    h_So4.Successor = h_So5;

                    do
                    {
                        Console.WriteLine("Выберите вид сортировки: ");
                        Console.WriteLine("1. Сортировка пузырьком");
                        Console.WriteLine("2. Сортировка выбором");
                        Console.WriteLine("3. Сортировка вставкой");
                        Console.WriteLine("4. Сортировка Шелла");
                        Console.WriteLine("5. Быстрая сортировка");
                        Console.WriteLine("6. Назад");

                        choise = int.Parse(Console.ReadLine());
                        Console.WriteLine("------------------------");
                        switch (choise)
                        {
                        case 1:
                            h_So1.HandleRequest(choise);
                            break;

                        case 2:
                            h_So1.HandleRequest(choise);
                            break;

                        case 3:
                            h_So1.HandleRequest(choise);
                            break;

                        case 4:
                            h_So1.HandleRequest(choise);
                            break;

                        case 5:
                            h_So1.HandleRequest(choise);
                            break;
                        }
                    }while (choise != 6);
                    break;

                case 4:
                    h_Se1.Successor = h_Se2;
                    h_Se2.Successor = h_Se3;

                    do
                    {
                        Console.WriteLine("Виберите вид поиска: ");
                        Console.WriteLine("1. Линейный поиск");
                        Console.WriteLine("2. Простой поиск");
                        Console.WriteLine("3. Встроенный поиск");
                        Console.WriteLine("4. Назад");

                        choise = int.Parse(Console.ReadLine());
                        Console.WriteLine("------------------------");

                        switch (choise)
                        {
                        case 1:
                            int choise_min_max = 0;
                            do
                            {
                                Console.WriteLine("1. Линейный поиск - мин.");
                                Console.WriteLine("2. Линейный поиск - макс.");
                                Console.WriteLine("3. Назад");

                                choise_min_max = int.Parse(Console.ReadLine());
                                Console.WriteLine("------------------------");

                                switch (choise_min_max)
                                {
                                case 1:
                                    h_Se1.HandleRequest(choise, choise_min_max);
                                    Console.WriteLine("Минимальный елемент = " + Objects.res_search);
                                    break;

                                case 2:
                                    h_Se1.HandleRequest(choise, choise_min_max);
                                    Console.WriteLine("Минимальный елемент = " + Objects.res_search);
                                    break;
                                }
                            } while (choise_min_max != 3);
                            break;

                        case 2:
                            choise_min_max = 0;
                            do
                            {
                                Console.WriteLine("1. Простой поиск - мин.");
                                Console.WriteLine("2. Простой поиск - макс.");
                                Console.WriteLine("3. Назад");

                                choise_min_max = int.Parse(Console.ReadLine());
                                Console.WriteLine("------------------------");

                                switch (choise_min_max)
                                {
                                case 1:
                                    h_Se1.HandleRequest(choise, choise_min_max);
                                    Console.WriteLine("Минимальный елемент = " + Objects.res_search);
                                    break;

                                case 2:
                                    h_Se1.HandleRequest(choise, choise_min_max);
                                    Console.WriteLine("Максимальный елемент = " + Objects.res_search);
                                    break;
                                }
                            } while (choise_min_max != 3);
                            break;

                        case 3:
                            choise_min_max = 0;
                            do
                            {
                                Console.WriteLine("1. Встроенный поиск - мин.");
                                Console.WriteLine("2. Встроенный поиск - макс.");
                                Console.WriteLine("3. Назад");

                                choise_min_max = int.Parse(Console.ReadLine());
                                Console.WriteLine("------------------------");

                                switch (choise_min_max)
                                {
                                case 1:
                                    h_Se1.HandleRequest(choise, choise_min_max);
                                    Console.WriteLine("Минимальный елемент = " + Objects.res_search);
                                    break;

                                case 2:
                                    h_Se1.HandleRequest(choise, choise_min_max);
                                    Console.WriteLine("Минимальный елемент = " + Objects.res_search);
                                    break;
                                }
                            } while (choise_min_max != 3);
                            break;
                        }
                    } while (choise != 4);


                    break;

                case 5:
                    for (Iterator iterator = objects.getIterator(); iterator.hasNext();)
                    {
                        int elem = iterator.next();
                        Console.WriteLine("Елемент: " + elem);
                    }
                    //for (int i=0;i<Objects.array.Length;i++)
                    //{
                    //    Console.WriteLine(Objects.array[i]+"");
                    //}
                    break;
                }
            } while (choise != 0);
        }
Beispiel #46
0
 internal void Add(ObjectTagBuilder tag)
 {
     Objects.Add(tag.ObjectID, new StaticItem(tag.Type));
 }
Beispiel #47
0
 public override string ToString()
 {
     return(Objects.ToStringHelper(this).Add("info", info).Add("value", Value()).ToString
                ());
 }
Beispiel #48
0
 public override int GetHashCode()
 {
     return(Objects.Hash(id, e));
 }
Beispiel #49
0
 public override int GetHashCode()
 {
     return(Objects.HashCode(info, Value()));
 }
Beispiel #50
0
 public override int GetHashCode()
 {
     return(Objects.Hash(errors));
 }
 public ObjectContainer()
 {
     objects = new Objects();
 }
Beispiel #52
0
 /// <summary>
 /// After UpdateObjects call objects can be read using Objects property.
 /// </summary>
 public void UpdateObjects()
 {
     try
     {
         GXDLMSObjectCollection objs = Comm.GetObjects();
         objs.Tag = this;
         int pos = 0;
         foreach (GXDLMSObject it in objs)
         {
             ++pos;
             NotifyProgress(this, "Creating object " + it.LogicalName, pos, objs.Count);
             Objects.Add(it);
         }
         GXLogWriter.WriteLog("--- Created " + Objects.Count.ToString() + " objects. ---");
         //Read registers units and scalers.
         int cnt = Objects.Count;
         GXLogWriter.WriteLog("--- Reading scalers and units. ---");
         for (pos = 0; pos != cnt; ++pos)
         {
             GXDLMSObject it = Objects[pos];
             this.OnProgress(this, "Reading scalers and units.", cnt + pos + 1, 3 * cnt);
             if (it is GXDLMSRegister)
             {
                 //Read scaler first.
                 try
                 {
                     Comm.ReadValue(it, 3);
                 }
                 catch (Exception ex)
                 {
                     GXLogWriter.WriteLog(ex.Message);
                     it.SetAccess(3, AccessMode.NoAccess);
                     if (ex is GXDLMSException)
                     {
                         continue;
                     }
                     throw ex;
                 }
             }
             if (it is GXDLMSDemandRegister)
             {
                 //Read scaler first.
                 try
                 {
                     Comm.ReadValue(it, 4);
                 }
                 catch (Exception ex)
                 {
                     GXLogWriter.WriteLog(ex.Message);
                     UpdateError(it, 4, ex);
                     if (ex is GXDLMSException)
                     {
                         continue;
                     }
                     throw ex;
                 }
                 //Read Period
                 try
                 {
                     Comm.ReadValue(it, 8);
                 }
                 catch (Exception ex)
                 {
                     GXLogWriter.WriteLog(ex.Message);
                     UpdateError(it, 8, ex);
                     if (ex is GXDLMSException)
                     {
                         continue;
                     }
                     throw ex;
                 }
                 //Read number of periods
                 try
                 {
                     Comm.ReadValue(it, 9);
                 }
                 catch (Exception ex)
                 {
                     GXLogWriter.WriteLog(ex.Message);
                     UpdateError(it, 9, ex);
                     if (ex is GXDLMSException)
                     {
                         continue;
                     }
                     throw ex;
                 }
             }
         }
         GXLogWriter.WriteLog("--- Reading scalers and units end. ---");
         if (!UseLogicalNameReferencing)
         {
             GXLogWriter.WriteLog("--- Reading Access rights. ---");
             try
             {
                 foreach (GXDLMSAssociationShortName sn in Objects.GetObjects(ObjectType.AssociationShortName))
                 {
                     Comm.ReadValue(sn, 3);
                 }
             }
             catch (Exception ex)
             {
                 GXLogWriter.WriteLog(ex.Message);
             }
             GXLogWriter.WriteLog("--- Reading Access rights end. ---");
         }
         this.OnProgress(this, "Reading profile generic columns.", cnt, cnt);
         foreach (Gurux.DLMS.Objects.GXDLMSProfileGeneric it in objs.GetObjects(ObjectType.ProfileGeneric))
         {
             ++pos;
             //Read Profile Generic Columns.
             try
             {
                 NotifyProgress(this, "Get profile generic columns", (2 * cnt) + pos, 3 * objs.Count);
                 UpdateColumns(it, Manufacturers.FindByIdentification(Manufacturer));
                 if (it.CaptureObjects == null || it.CaptureObjects.Count == 0)
                 {
                     continue;
                 }
             }
             catch
             {
                 GXLogWriter.WriteLog(string.Format("Failed to read Profile Generic {0} columns.", it.LogicalName));
                 continue;
             }
         }
     }
     finally
     {
         NotifyProgress(this, "", 0, 0);
     }
 }
Beispiel #53
0
 private int calculateObjectPropertiesSize(NameSizeCalculator nameSizer)
 {
     return(Objects.AsParallel().Sum(o => o.PropertiesSize(nameSizer)));
 }
Beispiel #54
0
 public override int GetHashCode()
 {
     return(Objects.hash(_routeEndpoints, _writeEndpoints, _readEndpoints, _timeToLiveMillis));
 }
Beispiel #55
0
 public IEnumerable <RootPuttySessionsNodeInfo> GetRootPuttyNodes()
 {
     return(Objects.OfType <RootPuttySessionsNodeInfo>());
 }
Beispiel #56
0
 private void Awake()
 {
     this.Bind();
     _button.onClick.AddListener(() => Objects.StartCoroutine(_Screenshot()));
 }
Beispiel #57
0
        public HallsNorth(Game game, Torch.Object parent, byte[] data)
            : base(game, data)
        {
            Name         = "Coliseum Halls North";
            SandbagImage = "Zones/Coliseum/Halls/north-sb";
            Sandbag      = Grid.FromBitmap(Game.Services, SandbagImage);
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/Halls/north"));
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/pillar")
            {
                X = 393, Y = 190, DrawOrder = 248
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/pillar")
            {
                X = 393, Y = 390, DrawOrder = 448
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/pillar")
            {
                X = 393, Y = 590, DrawOrder = 648
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/pillar")
            {
                X = 593, Y = 190, DrawOrder = 248
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/pillar")
            {
                X = 593, Y = 390, DrawOrder = 448
            });
            ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/pillar")
            {
                X = 593, Y = 590, DrawOrder = 648
            });

            Doors.Add(new Door {
                Location = new Rectangle(500, 715, 50, 35), Name = "halls-south", Orientation = Direction.Up
            });
            Doors.Add(new Door {
                Location = new Rectangle(455, 100, 140, 35), Name = "village", Orientation = Direction.Up
            });

            Objects.Add(new InteractiveObject {
                Interact = SimpleDoor("coliseum/halls-south", "halls-north"), Location = new Rectangle(500, 740, 50, 15)
            });
            Objects.Add(new InteractiveObject {
                Interact = SimpleDoor("village/village", "coliseum"), Location = new Rectangle(455, 90, 140, 15)
            });

            Objects.Add(new InteractiveObject {
                Interact = TestBattle("coliseum/halls"), Location = new Rectangle(400, 200, 50, 50)
            });
            Objects.Add(new InteractiveObject {
                Interact = TestBattle("coliseum/halls"), Location = new Rectangle(400, 400, 50, 50)
            });
            Objects.Add(new InteractiveObject {
                Interact = TestBattle("coliseum/halls"), Location = new Rectangle(400, 600, 50, 50)
            });
            Objects.Add(new InteractiveObject {
                Interact = TestBattle("coliseum/halls"), Location = new Rectangle(600, 200, 50, 50)
            });
            Objects.Add(new InteractiveObject {
                Interact = TestBattle("coliseum/halls"), Location = new Rectangle(600, 400, 50, 50)
            });
            Objects.Add(new InteractiveObject {
                Interact = TestBattle("coliseum/halls"), Location = new Rectangle(600, 600, 50, 50)
            });
        }
Beispiel #58
0
        public VSContext(DbContextOptions options) : base(options)
        {
            Database.EnsureCreated();

            //инициализация стартовыми данными
            if (Schools.Count() == 0)
            {
                Object math = new Object()
                {
                    ObjectName = "Математика"
                };
                Object russ = new Object()
                {
                    ObjectName = "Русский язык"
                };
                Object info = new Object()
                {
                    ObjectName = "Информатика"
                };
                Object physic = new Object()
                {
                    ObjectName = "Физика"
                };
                Object window = new Object()
                {
                    ObjectName = "Окно"
                };

                Role student = new Role()
                {
                    RoleName = "student"
                };
                Role admin = new Role()
                {
                    RoleName = "admin"
                };

                School school = new School()
                {
                    SchoolNumber = 9,
                };

                Class _class = new Class()
                {
                    ClassChar   = "А",
                    ClassNumber = 10,
                    School      = school,
                };

                Schools.Add(school);
                Classes.Add(_class);

                Objects.Add(info);
                Objects.Add(window);
                Objects.Add(physic);
                Objects.Add(math);
                Objects.Add(russ);

                Roles.Add(student);
                Roles.Add(admin);
                SaveChanges();
            }
        }
Beispiel #59
0
 public override int GetHashCode()
 {
     return(Objects.hash(_address, _role));
 }
Beispiel #60
0
        /// <summary>
        /// Method triggered by the TreeListViewDragDropBehavior Class. Takes care of moving on item in the tree, which can be from
        /// any level to any level
        /// </summary>
        /// <param name="destination"></param>
        public void MoveSelection(TreeListViewRow destination) // Collection<ObjectModel> selectedItems, ObjectModel destination )
        {
            if (destination != null)
            {
                ObjectModel destinationItem = (destination.DataContext) as ObjectModel;
                try
                {
                    // Setup a private collection with the selected items only. This is because the SelectedItems that are part of the view model collection
                    // will change as soon as we start removing and adding objects
                    TD.ObservableItemCollection <ObjectModel> selectedItems = new TD.ObservableItemCollection <ObjectModel>();
                    foreach (ObjectModel item in SelectedItems)
                    {
                        selectedItems.Add(item);
                    }

                    foreach (ObjectModel item in selectedItems)
                    {
                        // find the original parent of the object that's moved
                        ObjectModel parentSourceItem = GetObject(item.Parent_ID);

                        // If the parent is in the root level
                        if (parentSourceItem == null)
                        {
                            // Remove the item in the root level
                            Objects.Remove(item);
                        }
                        else
                        {
                            // Otherwise remove the item from the child collection
                            parentSourceItem.ChildObjects.Remove(item);
                        }

                        TreeListViewDropPosition relativeDropPosition = (TreeListViewDropPosition)destination.GetValue(RadTreeListView.DropPositionProperty);
                        destination.UpdateLayout();
                        // If put on top of destination
                        if (relativeDropPosition == TreeListViewDropPosition.Inside)
                        {
                            // the Parent_ID of the item will become the ID of the destination
                            item.Parent_ID = destinationItem.ID;
                            destinationItem.ChildObjects.Add(item);
                        }
                        // If put before or after the destination
                        else
                        {
                            // if the desitination is in the root collection
                            if (destinationItem.Parent_ID == null)
                            {
                                // The parent_ID of the item will also be null
                                item.Parent_ID = null;
                                Objects.Insert(Objects.IndexOf(destinationItem), item);
                            }
                            else
                            {
                                // otherwise the Parent_ID of the item will be the same as that of the destination item
                                item.Parent_ID = destinationItem.Parent_ID;
                                // find the Parent of the destination item
                                parentSourceItem = GetObject(destinationItem.Parent_ID);
                                // Insert the item before or after the destination item in the ChildObject collection of the parent of the destination
                                if (relativeDropPosition == TreeListViewDropPosition.Before)
                                {
                                    parentSourceItem.ChildObjects.Insert(parentSourceItem.ChildObjects.IndexOf(destinationItem), item);
                                }
                                else
                                {
                                    parentSourceItem.ChildObjects.Insert(parentSourceItem.ChildObjects.IndexOf(destinationItem) + 1, item);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    RadWindow.Alert(new DialogParameters()
                    {
                        Header  = "Error",
                        Content = "Error while moving object\n" + ex.Message
                    });
                }
            }
        }