Наследование: System.Web.UI.Page
Пример #1
0
        /// <summary>
        /// Retrieves device entry.
        /// </summary>
        /// <param name="deviceID"></param>
        /// <returns></returns>
        public Device GetDevice(int deviceID)
        {
            communication com   = new communication();
            Request       req   = new Request();
            object        obj   = null;
            Device        entry = null;
            CosmosObject  co    = new CosmosObject();
            string        qName = com.generateID(8);

            req.entryID = deviceID.ToString();
            req.isLocal = true;
            req.nType   = 0;

            co.SourceIPAddress     = com.knowLocalIp().ToString();
            co.DestinationIPAdress = com.knowLocalIp().ToString();
            co.SourceQueue         = qName;
            co.DestinationQueue    = "cosmos";
            co.CommandType         = 2;
            co.Payload             = (object)req;

            com.send(co);
            do
            {
                obj = com.startListen(qName);
            }while(obj == null);
            co    = (CosmosObject)obj;
            entry = (Device)co.Payload;

            return(entry);
        }
Пример #2
0
        public List <Component> getComponentList()
        {
            communication    com = new communication();
            CosmosObject     co  = new CosmosObject();
            Request          req = new Request();
            List <Component> lComp;
            string           qName = com.generateID(8);
            object           obj;

            req.isLocal = false;
            req.nType   = 3;

            co.SourceIPAddress     = com.knowLocalIp().ToString();
            co.DestinationIPAdress = com.knowLocalIp().ToString();
            co.SourceQueue         = qName;
            co.DestinationQueue    = "cosmos";
            co.CommandType         = 3;
            co.Payload             = (object)req;

            com.send(co);
            do
            {
                obj = com.startListen(qName);
            }while (obj == null);

            co    = (CosmosObject)obj;
            lComp = (List <Component>)co.Payload;
            return(lComp);
        }
Пример #3
0
        /// <summary>
        /// Retrieves component entry.
        /// </summary>
        /// <param name="componentID">string</param>
        /// <returns>Component object.</returns>
        public Component GetComponent()
        {
            communication com = new communication();
            Request       req = new Request();
            object        obj;
            Component     comp  = new Component();
            CosmosObject  co    = new CosmosObject();
            string        qName = com.generateID(8);

            req.isLocal = true;
            req.nType   = 3;

            co.SourceIPAddress     = com.knowLocalIp().ToString();
            co.DestinationIPAdress = com.knowLocalIp().ToString();
            co.SourceQueue         = qName;
            co.DestinationQueue    = "cosmos";
            co.CommandType         = 2;
            co.Payload             = (object)req;

            com.send(co);
            do
            {
                obj = com.startListen(qName);
            }while(obj == null);

            co   = (CosmosObject)obj;
            comp = (Component)co.Payload;
            //com.purge(qName, com.Session1);
            return(comp);
        }
Пример #4
0
        public object GetEntryList(int nType, Component comp)
        {
            communication com   = new communication();
            CosmosObject  co    = new CosmosObject();
            Request       req   = new Request();
            string        qName = com.generateID(8);
            object        obj;

            req.isLocal = true;
            req.nType   = nType;

            co.SourceIPAddress     = com.knowLocalIp().ToString();
            co.DestinationIPAdress = comp.Address;
            co.SourceQueue         = qName;
            co.DestinationQueue    = "cosmos";
            co.CommandType         = 3;
            co.Payload             = (object)req;

            com.send(co);
            do
            {
                obj = com.startListen(qName);
            }while (obj == null);

            co  = (CosmosObject)obj;
            obj = co.Payload;
            return(obj);
        }
Пример #5
0
 void Connection_ChatMessageReceived(object sender, communication.MinecraftClientChatEventArgs args)
 {
     if (!args.User.Equals(Connection.Username))
     {
         if (args.Message.Trim() == "start")
         {
             if (capture != null)
             {
                 Connection.SendChat("You cannot start a capture with one already running");
                 return;
             }
             currentindex = 0;
             history.Clear();
             capture = (communication.Entities.NamedEntityType)Connection.GetServer().Entities.Entities.Where(e => (e.GetType() == typeof(communication.Entities.NamedEntityType)) && (((communication.Entities.NamedEntityType)e).Name == args.User)).First();
             Connection.SendChat("Starting capture on: " + args.User);
             start = DateTime.Now;
             stopwatch.Start();
         }
         if (args.Message.Trim() == "stop")
         {
             stopwatch.Stop();
             capture = null;
             Connection.SendChat("Stopping capture");
         }
         if (args.Message.Trim() == "replay")
         {
             Connection.SendChat("Replaying movements");
             currentindex = 0;
             positionTimer.Interval = 1;
             positionTimer.Start();
         }
     }
 }
Пример #6
0
        /// <summary>
        /// Registers entry in the network.
        /// </summary>
        /// <param name="entry"></param>
        /// <param name="nType"></param>
        /// <returns></returns>
        public bool Register(object entry, int nType)
        {
            communication com   = new communication();
            Request       req   = new Request();
            object        obj   = null;
            CosmosObject  co    = new CosmosObject();
            string        qName = com.generateID(8);

            req.isLocal = true;
            req.nType   = nType;
            req.data    = entry;

            co.SourceIPAddress     = com.knowLocalIp().ToString();
            co.DestinationIPAdress = com.knowLocalIp().ToString();
            co.SourceQueue         = qName;
            co.DestinationQueue    = "cosmos";
            co.CommandType         = 4;
            co.Payload             = (object)req;

            com.send(co);
            do
            {
                obj = com.startListen(qName);
            }while (obj == null);

            co = (CosmosObject)obj;
            if (co.Payload is bool)
            {
                bool value = (bool)co.Payload;
                return(value);
            }
            return(false);
        }
 public bool SaveCommunication(CommunicationModel obj)
 {
     try
     {
         communication oComm = new communication();
         oComm.SentTo                = obj.SentTo;
         oComm.WhenToSend            = obj.WhenToSend;
         oComm.SentTime              = DateTime.Now;
         oComm.Subject               = obj.Subject;
         oComm.AlertTypeID           = 1;
         oComm.CommunicationStatusID = 3;
         oComm.Contents              = obj.Contents;
         oComm.CreatedDate           = DateTime.Now;
         oDB.Communication.Add(oComm);
         oDB.SaveChanges();
         oDB.Dispose();
         oDB = null;
         return(true);
     }
     catch (Exception ex)
     {
         throw;
     }
     return(false);
 }
Пример #8
0
        /// <summary>
        /// Create and starts a topic for the device.
        /// </summary>
        public bool start()
        {
            com  = new communication();
            cObj = new CosmosObject();
            string qName = com.generateID(8);
            object obj   = null;

            cObj.DestinationIPAdress = device.Component.Address;
            cObj.DestinationQueue    = "cosmos";
            cObj.SourceIPAddress     = com.knowLocalIp().ToString();
            cObj.SourceQueue         = qName;
            cObj.CommandType         = 10;
            cObj.Payload             = this.device;

            com.send(cObj);

            do
            {
                obj = com.startListen(qName);
            }while(obj == null);

            if (obj == null)
            {
                Console.WriteLine("exception to");
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #9
0
    IEnumerator communicate(WWW login)
    {
        yield return(login);

        if (login.error == null)
        {
            Debug.Log("WWW Ok!: " + login.text);
            communication wwwData = JsonUtility.FromJson <communication>(login.text);
            if (wwwData.succes.Equals("1"))
            {
                PlayerPrefs.SetString("name", name.text);
                PlayerPrefs.SetString("password", password.text);
                PlayerPrefs.SetInt("id", int.Parse(wwwData.message));
                PlayerPrefs.SetInt("coins", 0);
                PlayerPrefs.SetInt("dungeonLevel", 1);

                GameManager.Instance.SetDungeonLevel(1);
                GameManager.Instance.data.ResetData();
                GameManager.Instance.dungeonStartCanvas.buttons.Clear();
                GameManager.Instance.SetUpDungeonStartCanvas();
                HomeScreenProgress.Instance.UpdateProgress(GameManager.Instance.data.maxAchievedDungeonLevel);

                error.GetComponentInChildren <Text>().text = "Account succesfully created. \n Now please log in with your new account.";
            }
            else
            {
                StartCoroutine(showError(wwwData.message));
            }
        }
        else
        {
            Debug.Log("WWW Error: " + login.error);
        }
    }
Пример #10
0
        public MainPage()
        {
            InitializeComponent();
            Common.Start(5);
            communication cm = new communication();

            cm.Connect(string.Empty);
            Common.Add(ref cm);
            DispCom.ViewChanged += MainPage_PageChange;

            DispCom.CurrentView = new StartPage();
        }
Пример #11
0
        public void SendFile(Models.File file, Component comp)
        {
            communication com = new communication();
            CosmosObject  cos = new CosmosObject();

            cos.CommandType         = 9;
            cos.DestinationIPAdress = comp.Address;
            cos.DestinationQueue    = "cosmos";
            cos.SourceQueue         = com.generateID(8);
            cos.SourceIPAddress     = com.knowLocalIp().ToString();
            cos.Payload             = (object)file;
            com.send(cos);
        }
Пример #12
0
 void Connection_ChatMessageReceived(object sender, communication.MinecraftClientChatEventArgs args)
 {
     if (!args.User.Equals(Connection.Username))
     {
         if (args.Message.Trim().Equals("mcb-time"))
         {
             Connection.SendPacket(new mcsharpbot.communication.Packets.Types.Chat { Message = Connection.GetServer().GetFriendlyTime() });
         }
         else
         {
             OnFeedbackReceived(this, new BotFeedbackEventArgs(args.User + ": " + args.Message));
             Connection.SendPacket(new mcsharpbot.communication.Packets.Types.Chat { Message = args.User + " said " + args.Message });
         }
     }
 }
Пример #13
0
        public bool start()
        {
            bool          success  = false;
            communication com      = new communication();
            string        uri      = "tcp://" + device.Component.Address + ":61616";
            string        clientID = com.generateID(10);

            try
            {
                topic = new SimpleTopicSubscriber(device.DeviceQueue, uri, clientID, clientID);
            }
            catch (Exception e)
            {
            }
            return(success);
        }
Пример #14
0
 void Connection_EntityChange(communication.Entities.EntityType entity)
 {
     if (capture != null)
     {
         //Debug.Info(String.Format("Pitch: {0}, Yaw:{1}", entity.Pitch, entity.Yaw));
         history.Add(new TimePositionLook()
         {
             time = stopwatch.ElapsedMilliseconds,
             X = entity.X,
             Y = entity.Y,
             Z = entity.Z,
             ServerX = entity.ServerX,
             ServerY = entity.ServerY,
             ServerZ = entity.ServerZ,
             Pitch = entity.Pitch,
             Yaw = entity.Yaw
         });
         stopwatch.Restart();
     }
 }
Пример #15
0
        private static void Main(string[] args)
        {
            LogException newlog = new LogException();

            newlog.write_log();

            Console.WriteLine("Данные о танке:");
            body status1 = new body();

            status1.bodyOutput();
            track status2 = new track();

            status2.trackOutput();
            tower status3 = new tower();

            status3.towerOutput();
            engine status4 = new engine();

            status4.engineOutput();
            transmission status5 = new transmission();

            status5.transmissionOutput();
            weaponary status6 = new weaponary();

            status6.weaponaryOutput();
            communication status7 = new communication();

            status7.communicationOutput();
            surveillance status8 = new surveillance();

            status8.surveillanceOutput();
            Weapons status9 = new Weapons();

            status9.crewOutput();
            status9.weaponsNumber();

            aboutTank   ui           = new aboutTank();
            Read_config _Read_config = new Read_config();

            _Read_config.read_file();

            ui.crewNum = 5;
            Console.WriteLine("Экипаж");
            Console.WriteLine(ui.crewNum);
            Console.WriteLine("Название танка");
            Console.WriteLine(ui.Name);

            // ____________________________________________________________________Serialization XML JSON Binary
            try
            {
                interface_ISerializer ISerialize = new interface_ISerializer();
                ISerialize.Serialize();
                ISerialize.Deserialize();
            }
            catch (Exception)
            {
                Console.WriteLine("Не сработала сериализация");
                Console.ReadLine();
            }
            // ____________________________________________________________________Serialization XML JSON Binary


            Console.ReadLine();
        }
Пример #16
0
    IEnumerator communicate(WWW login)
    {
        yield return(login);

        if (login.error == null)
        {
            Debug.Log("WWW Ok!: " + login.text);
            communication wwwData = JsonUtility.FromJson <communication>(login.text);
            if (wwwData.succes.Equals("1"))
            {
                PlayerPrefs.SetString("name", name.text);
                PlayerPrefs.SetString("password", password.text);
                PlayerPrefs.SetInt("id", int.Parse(wwwData.message));
                PlayerPrefs.SetInt("coins", wwwData.coins);
                PlayerPrefs.SetInt("dungeonLevel", wwwData.level);


                Debug.Log("---LOADSTRING---");
                Debug.Log(wwwData.items_owned);
                Debug.Log(wwwData.items_equiped);
                Debug.Log(wwwData.achievements);

                char[] itemsOwned   = wwwData.items_owned.ToCharArray();
                char[] itemsEquiped = wwwData.items_equiped.ToCharArray();
                char[] achievements = wwwData.achievements.ToCharArray();
                for (int i = 0; i < itemsOwned.Length; i++)
                {
                    string strOwned = "shopItem" + i;
                    PlayerPrefs.SetInt(strOwned, charToInt(itemsOwned[i]));
                    string strEquipped = "shopItemEquipped" + i;
                    PlayerPrefs.SetInt(strEquipped, charToInt(itemsEquiped[i]));
                }

                for (int i = 0; i < achievements.Length; i++)
                {
                    string strAch = "achievement" + i;
                    PlayerPrefs.SetInt(strAch, charToInt(achievements[i]));
                }

                GameManager.Instance.SetDungeonLevel(wwwData.level);
                GameManager.Instance.data.maxAchievedDungeonLevel = wwwData.level;
                GameManager.Instance.dungeonStartCanvas.buttons.Clear();
                GameManager.Instance.SetUpDungeonStartCanvas();
                HomeScreenProgress.Instance.UpdateProgress(GameManager.Instance.data.maxAchievedDungeonLevel);

                Time.timeScale = 1;
                GameManager.Instance.data.Load();
                transform.parent.gameObject.SetActive(false);
                GameManager.Instance.SetTextFieldEnabled(false);
                GameManager.Instance.homeScreenMovement.enabled = true;
            }
            else
            {
                StartCoroutine(showError(wwwData.message));
            }
        }
        else
        {
            Debug.Log("WWW Error: " + login.error);
        }
    }