Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static InputModel GenerateRawInputModelFromContents(string contents, string type)
        {
            Type T = Type.GetType(type);

            InputModel model = (InputModel)Serialiser.Deserialise <InputModel>(contents, T, false);

            return(model);
        }
Пример #2
0
 internal static PlayerUiSettings Load()
 {
     if (File.Exists(GamesController.SavePath + "PlayerUiSettings.cfg"))
     {
         return((PlayerUiSettings)Serialiser.DeSerializeObject(GamesController.SavePath + "PlayerUiSettings.cfg"));
     }
     return(new PlayerUiSettings());
 }
Пример #3
0
 internal static PlayerUiSettings Load()
 {
     if (File.Exists(Application.persistentDataPath + "/PlayerUiSettings.cfg"))
     {
         return((PlayerUiSettings)Serialiser.DeSerializeObject(Application.persistentDataPath + "/PlayerUiSettings.cfg"));
     }
     return(new PlayerUiSettings());
 }
Пример #4
0
 public new static object Serialise(object o, Serialiser s)
 {
     if (s == null)
     {
         return((object)new EOF());
     }
     return(CSymbol.Serialise(o, s));
 }
        public bool UdpSendPacket(Packet packet)
        {
            byte[] buffer = Serialiser.Serialise(packet);

            int result = _udpClient.Send(buffer, buffer.Length);

            return(result > 0);
        }
Пример #6
0
        private MessagingResult SendMessages <TMessages>(TMessages messages)
        {
            var requestXml = Serialiser.Serialise(messages);

            RestResource resource = new MessageDispatcherResource(requestXml, EnsureMessageIdsInResult);

            return(MakeRequest <MessagingResult>(HttpMethod.POST, resource));
        }
Пример #7
0
        /// <summary>
        /// Comman line entry point.
        /// </summary>
        public static void Main()
        {
            var world = Parser.Parse(Console.In.ReadToEnd());

            world.Execute();

            Console.Write(Serialiser.Serialise(world));
        }
Пример #8
0
        public void Sample_data_is_correct(string input, string expected)
        {
            var world = Parser.Parse(input);

            world.Execute();
            var actual = Serialiser.Serialise(world);

            Assert.AreEqual(expected, actual);
        }
Пример #9
0
 static void Main(string[] arguments)
 {
     var serialiser = new Serialiser<ServerConfiguration>(ConfigurationPath);
     ServerConfiguration configuration = serialiser.Load();
     ServerHandler handler = new ServerHandler(configuration);
     handler.Run();
     ManualResetEvent resetEvent = new ManualResetEvent(false);
     resetEvent.WaitOne();
 }
Пример #10
0
        /// <summary>
        /// Creates a com.esendex.sdk.contacts.Contact instance and returns the new com.esendex.sdk.contacts.Contact instance.
        /// </summary>
        /// <param name="contact">A com.esendex.sdk.contacts.Contact instance that contains the contact.</param>
        /// <returns>A com.esendex.sdk.contacts.Contact instance that contains the contact with an Id assigned.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Net.WebException"></exception>
        public Contact CreateContact(Contact contact)
        {
            var requestXml = Serialiser.Serialise(contact);

            RestResource resource = new ContactsResource(requestXml);

            return(MakeRequest <ContactResponse>(HttpMethod.POST, resource)
                   .Contact);
        }
Пример #11
0
        /// <summary>
        /// Creates a com.esendex.sdk.groups.Group instance and returns the new com.esendex.sdk.groups.Group instance.
        /// </summary>
        /// <param name="group">A com.esendex.sdk.groups.Group instance that contains the group.</param>
        /// <returns>A com.esendex.sdk.groups.Group instance that contains the group with an Id assigned.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Net.WebException"></exception>
        public Group CreateGroup(Group group)
        {
            var requestXml = Serialiser.Serialise(group);

            RestResource resource = new GroupsResource(requestXml);

            return(MakeRequest <GroupResponse>(HttpMethod.POST, resource)
                   .Group);
        }
Пример #12
0
        public string Serialise()
        {
            var serialisedData = new Dictionary <string, string>
            {
                { SerialisedDataPeriodsKey, Serialiser.Serialise(_periods) }
            };

            return(Serialiser.Serialise(serialisedData));
        }
Пример #13
0
        public void DeserialiseControlTest()
        {
            using FileStream fileStream = new FileStream("playground/topS4U.pau", FileMode.Open);
            fileStream.Seek(4, SeekOrigin.Begin);
            var obj = Deserialiser.Deserialise(new Imas.Binary(fileStream, true), typeof(Control));

            using FileStream memoryStream1 = new FileStream("playground/topS4Uout.pau", FileMode.Create);
            Serialiser.Serialise(new Imas.Binary(memoryStream1, true), obj);
        }
Пример #14
0
        static void Main(string[] arguments)
        {
            Configuration configuration;
            try
            {
                Serialiser<Configuration> serialiser = new Serialiser<Configuration>(ConfigurationFile);
                configuration = serialiser.Load();
            }
            catch (System.IO.FileNotFoundException)
            {
                Console.WriteLine("Unable to load configuration file \"" + ConfigurationFile + "\"");
                return;
            }
            catch (System.InvalidOperationException)
            {
                Console.WriteLine("Malformed configuration file");
                return;
            }

            if (arguments.Length != 3)
            {
                Console.WriteLine("Usage:");
                Console.WriteLine(Environment.GetCommandLineArgs()[0] + " <server> <user> <password>");
                Console.Write("Servers available:");
                foreach (ServerProfile profile in configuration.ServerProfiles)
                    Console.Write(" " + profile.Abbreviation);
                Console.WriteLine("");
                return;
            }

            string server = arguments[0];
            string user = arguments[1];
            string password = arguments[2];

            ServerProfile chosenProfile = null;
            foreach (ServerProfile profile in configuration.ServerProfiles)
            {
                if (profile.Abbreviation.ToLower() == server.ToLower())
                {
                    chosenProfile = profile;
                    break;
                }
            }

            if (chosenProfile == null)
            {
                Console.WriteLine("Unable to find server profile \"" + server + "\"");
                return;
            }

            RegionProfile regionData = new RegionProfile(chosenProfile.LoginQueueURL, chosenProfile.RPCURL);
            ConnectionProfile connectionData = new ConnectionProfile(configuration.Authentication, regionData, configuration.Proxy, user, password);

            LegendaryPrompt prompt = new LegendaryPrompt(configuration, connectionData);
            prompt.Run();
        }
        /// <summary>
        /// Adds a com.esendex.sdk.contacts.ContactCollection instance and returns true if the contacts were added successfully; otherwise, false.
        /// </summary>
        /// <param name="contacts">A com.esendex.sdk.contacts.ContactCollection instance.</param>
        /// <returns>true, if the contacts were added successfully; otherwise, false.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Net.WebException"></exception>
        public bool CreateContacts(ContactCollection contacts)
        {
            string requestXml = Serialiser.Serialise <ContactCollection>(contacts);

            RestResource resource = new ContactsResource(requestXml);

            RestResponse response = MakeRequest(HttpMethod.POST, resource);

            return(response != null);
        }
        /// <summary>
        /// Returns true if the contact was successfully updated; otherwise, false.
        /// </summary>
        /// <param name="contact">A com.esendex.sdk.contacts.Contact instance that contains the contact.</param>
        /// <returns>true, if the contact was successfully updated; otherwise, false.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Net.WebException"></exception>
        public bool UpdateContact(Contact contact)
        {
            string requestXml = Serialiser.Serialise <Contact>(contact);

            RestResource resource = new ContactsResource(contact.Id, requestXml);

            RestResponse response = MakeRequest(HttpMethod.PUT, resource);

            return(response != null);
        }
        public void Deserialisation_ShouldNotReturnNull()
        {
            var serialiser = new Serialiser();
            var json = GetJson();
            var memento = serialiser.Deserialise<OrderMemento>(json);
            var order = new Order(memento);

            Assert.That(order, Is.Not.Null);
            Assert.That(order.ServerId, Is.EqualTo("Neil"));
        }
Пример #18
0
        /// <summary>
        /// Returns true if the group was successfully updated; otherwise, false.
        /// </summary>
        /// <param name="group">A com.esendex.sdk.groups.Group instance that contains the group.</param>
        /// <returns>true, if the group was successfully updated; otherwise, false.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Net.WebException"></exception>
        public bool UpdateGroup(Group group)
        {
            var requestXml = Serialiser.Serialise(group);

            RestResource resource = new GroupsResource(group.Id, requestXml);

            var response = MakeRequest(HttpMethod.PUT, resource);

            return(response != null);
        }
Пример #19
0
        public void Deserialisation_ShouldNotReturnNull()
        {
            var    serialiser = new Serialiser();
            string json       = GetJson();
            var    memento    = serialiser.Deserialise <OrderMemento>(json);
            var    order      = new Order(memento);

            Assert.That(order, Is.Not.Null);
            Assert.That(order.ServerId, Is.EqualTo("Neil"));
        }
        public void Add(NotificationEvent notification)
        {
            var filename = MakeItemFilename(notification.Id);

            lock (LockObject)
            {
                Serialiser.ToJsonInFile(filename, notification);
            }
            Logger.Debug("Stored Notification ({0}): {1}", notification.EventType, filename);
        }
        /// <summary>
        /// Creates a com.esendex.sdk.contacts.Contact instance and returns the new com.esendex.sdk.contacts.Contact instance.
        /// </summary>
        /// <param name="contact">A com.esendex.sdk.contacts.Contact instance that contains the contact.</param>
        /// <returns>A com.esendex.sdk.contacts.Contact instance that contains the contact with an Id assigned.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Net.WebException"></exception>
        public Contact CreateContact(Contact contact)
        {
            ContactCollection contacts = new ContactCollection(contact);

            string requestXml = Serialiser.Serialise <ContactCollection>(contacts);

            RestResource resource = new ContactsResource(requestXml);

            return(MakeRequest <Contact>(HttpMethod.POST, resource));
        }
Пример #22
0
        public void RoundTripWithExtendedData()
        {
            var    serialiser  = new Serialiser();
            string initialJson = GetExtendedJson();
            var    memento     = serialiser.Deserialise <OrderMemento>(initialJson);
            var    order       = new Order(memento);

            string newJson = serialiser.Serialise(order.GetMemento());

            Assert.That(newJson, Is.EqualTo(initialJson));
        }
        public void RoundTripWithExtendedData()
        {
            var serialiser = new Serialiser();
            var initialJson = GetExtendedJson();
            var memento = serialiser.Deserialise<OrderMemento>(initialJson);
            var order = new Order(memento);

            var newJson = serialiser.Serialise(order.GetMemento());

            Assert.That(newJson, Is.EqualTo(initialJson));
        }
Пример #24
0
        /// <summary>
        /// Posts a com.esendex.sdk.contacts.Contact to a com.esendex.sdk.groups.Group.
        /// </summary>
        /// <param name="accountReference">The number of the page.</param>
        /// <param name="groupId">The number of items in the page.</param>
        /// <param name="contact"></param>
        /// <returns>A com.esendex.sdk.groups.PagedGroupCollection instance that contains the groups.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Net.WebException"></exception>
        public bool AddContactToGroup(string accountReference, string groupId, Contact contact)
        {
            var contactColletion = new ContactCollection();

            contactColletion.ItemsId.Add(contact.Id.ToString());

            RestResource resource = new GroupsResource(accountReference, groupId, Serialiser.Serialise(contactColletion));
            var          response = MakeRequest(HttpMethod.POST, resource);

            return(response != null);
        }
Пример #25
0
        public async Task GivenAMetricWhenSerialisedThenTheFormatValidatesSuccessfullyAgainstTheSchema(Metric metric)
        {
            var serialiser = new Serialiser(new SystemClock(), new MetricLoggerOptions());

            var format = serialiser.SerialiseMetric(metric);
            var schema = await JsonSchema.FromJsonAsync(_embeddedFormatSchema);

            var validator = new JsonSchemaValidator();

            validator.Validate(format, schema).Should().BeEmpty(" there were no validation errors");
        }
Пример #26
0
        internal TResult MakeRequest <TResult>(HttpMethod method, RestResource resource) where TResult : class
        {
            RestResponse response = MakeRequest(method, resource);

            if (response == null)
            {
                return(null);
            }

            return(Serialiser.Deserialise <TResult>(response.Content));
        }
Пример #27
0
        public IActionResult PostEntity([FromBody] World world)
        {
            if (world is null)
            {
                return(this.BadRequest());
            }

            world.Execute();
            var output = Serialiser.Serialise(world);

            return(this.Ok(output));
        }
Пример #28
0
        public override Task <Proto.GeoRoute> GetGeoRoute(Proto.RoutePackage request, ServerCallContext context)
        {
            LocalDistributor localWorker = new LocalDistributor();

            var route = localWorker.GetGeoRoute((Core.RoutePackage)Serialiser.Deserialise(request.Data));

            var result = new Proto.GeoRoute {
                Data = Serialiser.Serialise(route)
            };

            return(Task.FromResult(result));
        }
Пример #29
0
        public static PACSAMKeyFile Load(string path, bool ignoreHash = false)
        {
            PACSAMKeyFile instance = Serialiser <PACSAMKeyFile> .Load(path);

            // Verify the hashes
            if (!ignoreHash && !instance.VerifyHash())
            {
                throw new InvalidDataException("Hash verification failed.");
            }

            return(instance);
        }
        public override ICollection <T> GetAll()
        {
            var results = new List <T>();

            foreach (var data in Store.Values)
            {
                var item = Serialiser.DeserializeObject <T>(data);
                results.Add(item);
            }

            return(results);
        }
Пример #31
0
        public static object Serialise(object o, Serialiser s)
        {
            ParserEntry parserEntry = (ParserEntry)o;

            if (s.Encode)
            {
                s.Serialise((object)parserEntry.m_action);
                return((object)null);
            }
            parserEntry.m_action = (ParserAction)s.Deserialise();
            return((object)parserEntry);
        }
Пример #32
0
        public static string GenerateContentsFromRawInputModel(InputModel model, string type)
        {
            Type T = Type.GetType(type);

            string elementName = inputModelMap.FirstOrDefault(x => x.Value == T).Key;

            XDocument xml = new XDocument(new XElement(elementName));

            xml.Root.Add(new XDocument(Serialiser.Serialise <InputModel>(model)));

            return(xml.ToString());
        }
Пример #33
0
 /// <summary>
 /// Save the application state to disk (or other location)
 /// </summary>
 /// <param name="state">Current application state</param>
 /// <param name="location">Platform-specific identifier of where to store the state to (path, key, etc.)</param>
 public void Save(PersistableApplicationState state, string location)
 {
     using (var filestream = new FileStream(location, FileMode.Create, FileAccess.Write))
     {
         using (var memorystream = new MemoryStream())
         {
             Serialiser.Serialise(state, memorystream);
             memorystream.Position = 0;
             memorystream.CopyTo(filestream);
         }
     }
 }
Пример #34
0
 public void SetUp()
 {
     _productDispenser = new ProductDispenser(new ProductFactory(), new ProductValidator());
     _mockCola         = Serialiser.SerializeObjectJson(new Product {
         Code = "A03", Name = "cola", Price = 1.00M, Stock = 2
     });
     _mockChips = Serialiser.SerializeObjectJson(new Product {
         Code = "B13", Name = "chips", Price = 0.5M, Stock = 10
     });
     _mockCandy = Serialiser.SerializeObjectJson(new Product {
         Code = "E07", Name = "candy", Price = 0.65M, Stock = 20
     });
 }
Пример #35
0
        static void RunTest()
        {
            Serialiser<Configuration> serialiser = new Serialiser<Configuration>(ConfigurationPath);
            Configuration configuration = new Configuration();

            UnitCard unit = new UnitCard();
            unit.Name = "Name";
            unit.InternalName = "FactionName";
            unit.Resources = 1;
            unit.Damage = 1;
            unit.Life = 1;
            UnitFlag flag1 = new UnitFlag(UnitFlagType.Regenerate, 1);
            unit.Flags.Add(flag1);
            configuration.Units.Add(unit);

            AbilityCard ability = new AbilityCard();
            ability.Name = "Name";
            ability.InternalName = "FactionName";
            ability.Resources = 1;
            ability.Target = AbilityTarget.Global;
            AbilityEffect effect = new AbilityEffect(AbilityEffectType.DamageUnit, 1);
            ability.Effects.Add(effect);
            configuration.Abilities.Add(ability);

            AttachmentCard attachment = new AttachmentCard();
            attachment.Name = "Name";
            attachment.InternalName = "FactionName";
            attachment.Resources = 1;
            attachment.Type = AttachmentCardType.Friendly;
            UnitFlag flag2 = new UnitFlag(UnitFlagType.Strong, 1);
            attachment.Flags.Add(flag2);
            configuration.Attachments.Add(attachment);

            StateCard state = new StateCard();
            state.Name = "Name";
            state.InternalName = "FactionName";
            state.Resources = 1;
            state.Scope = StateScope.Global;
            state.UnitTarget = StateUnitTarget.Friendly;
            state.UnitFlags.Add(flag2);
            state.Trigger = StateTrigger.OnAttack;
            state.TriggerEffects.Add(effect);

            configuration.States.Add(state);

            serialiser.Store(configuration);

            configuration = serialiser.Load();
            Console.WriteLine("Limit: {0}", configuration.Units[0].Limit);
        }
Пример #36
0
 static void Main(string[] arguments)
 {
     ClientConfiguration configuration;
     try
     {
         Serialiser<ClientConfiguration> serialiser = new Serialiser<ClientConfiguration>("Configuration.xml");
         configuration = serialiser.Load();
     }
     catch (Exception exception)
     {
         Console.WriteLine("Configuration error: {0}", exception.Message);
         return;
     }
     Client client = new Client(configuration);
     client.Run();
 }
Пример #37
0
        static void Main(string[] args)
        {
            // Set disconnect to false, to enable connection
            forceDC = false;

            //Database db;
            Configuration configuration;
            try
            {
                Serialiser<Configuration> serialiser = new Serialiser<Configuration>(ConfigurationFile);
                configuration = serialiser.Load();
            }
            catch (System.IO.FileNotFoundException)
            {
                Console.WriteLine("Unable to load configuration file \"" + ConfigurationFile + "\"");
                return;
            }
            catch (System.InvalidOperationException)
            {
                Console.WriteLine("Malformed configuration file");
                return;
            }

            // Check argument for program mode
            if (args.Length != 0)
            {
                switch (args[0])
                {
                    case "crawl":
                        crawlPvpnet(configuration);
                    break;

                    case "creatematch":
                        createMatch(configuration);
                    break;
                    case "addsummonerids":
                        addSummonerIDs(configuration);
                    break;
                    case "test":
                        test(configuration);
                    break;

                    case "test2":
                        RiotConnect pvpnet = new RiotConnect(configuration, "endwesa005", "baylife13");

                        while (!pvpnet.Connected) ;

                        List<long> fellows = new List<long>();
                        List<string> fellowNames = new List<string>();
                        RecentGames game = pvpnet.RPC.GetRecentGames(34022924);

                        for (int i = 0; i < game.gameStatistics.Count; i++)
                        {
                            if (game.gameStatistics.ElementAt(i).gameId == 675775152)
                            {
                                for (int j = 0; j < game.gameStatistics.ElementAt(i).fellowPlayers.Count; j++)
                                {
                                    fellows.Add(game.gameStatistics.ElementAt(i).fellowPlayers.ElementAt(j).summonerId);
                                }
                                break;
                            }
                        }

                        fellowNames = pvpnet.RPC.GetSummonerNames(fellows);
                        PublicSummoner summoner;
                        RecentGames gameStats;

                        for (int n = 0; n < fellowNames.Count; n++)
                        {
                            summoner = pvpnet.RPC.GetSummonerByName(fellowNames.ElementAt(n));
                            gameStats = pvpnet.RPC.GetRecentGames(summoner.acctId);

                            if (gameStats == null)
                                Console.WriteLine(summoner.internalName + " PROBLEM = NULL");
                            else
                                Console.WriteLine(summoner.internalName + " recent Games successful");
                        }

                        while (1 == 1) ;

                    break;

                }
            }
        }
        /// <summary>
        /// Parse an incoming string from an incoming packet and return a specialised NetworkEventArgs.
        /// </summary>
        /// <param name="item">The packet to parse.</param>
        /// <returns>Specialised NetworkEventArgs.</returns>
        public NetworkEventArgs ParsePacket(NetworkPacket packet)
        {
            //Split the message into maximum 6 parts so we can extract it's data. The format is as follows:
            //networkid:collectionChangedAction:startingIndexForNewItems:startingIndexForOldItems:ListOfItemsRemovedOrAdded
            string[] data = packet.Message.Split(new char[] { ':' }, 6);

            //Make sure the maximum length was archieved.
            if (data.Length == 6)
            {
                //Get the data handler.
                INetworkDataHandler dataHandler = ObjectFactory.GetInstance<INetworkDataHandler>();

                //Make sure we have the item whose collection was changed.
                if (dataHandler.RegisteredObjects.ContainsKey(data[0]))
                {
                    //Create the holder for our results.
                    NetworkEventArgs result = new NetworkEventArgs(packet);

                    //Assign the relevant values.
                    result.NetworkDataId = data[0];
                    IList itemList;
                    int newIndex, oldIndex, oldCount, intAction;
                    try
                    {
                        //Deserialise and convert the data to it's correct form.
                        itemList = new Serialiser().Deserialise(data[5]) as IList;
                        intAction = Convert.ToInt32(data[1]);
                        newIndex = Convert.ToInt32(data[2]);
                        oldIndex = Convert.ToInt32(data[3]);
                        oldCount = Convert.ToInt32(data[4]);
                    }
                    catch (Exception e)
                    {
                        if (OnWarningOccured != null)
                            OnWarningOccured(packet, new Warning("An unknown error occured while deserialising a collection changed packet that was received. Message received: " + e.Message, e));
                        return null;
                    }

                    NotifyCollectionChangedAction action = (NotifyCollectionChangedAction)intAction;

                    //Create a new instance of notify collection changed that contains the relevant
                    //information about the changes in the collection.
                    switch (action)
                    {
                        case NotifyCollectionChangedAction.Add:
                            result.Data = new NotifyCollectionChangedEventArgs(action, itemList, newIndex);
                            break;
                        case NotifyCollectionChangedAction.Move:
                            result.Data = new NotifyCollectionChangedEventArgs(action, itemList, newIndex, oldIndex);
                            break;
                        case NotifyCollectionChangedAction.Remove:
                            result.Data = new NotifyCollectionChangedEventArgs(action, itemList, oldIndex);
                            break;
                        case NotifyCollectionChangedAction.Replace:
                            result.Data = new NotifyCollectionChangedEventArgs(action, itemList, new bool[oldCount], newIndex);
                            break;
                        case NotifyCollectionChangedAction.Reset:
                            result.Data = new NotifyCollectionChangedEventArgs(action);
                            break;
                    }

                    //Return our results.
                    return result;
                }
                else if (OnNotificationOccured != null)
                    OnNotificationOccured(packet, string.Format("Collection changed parser was called but the network id of '{0}' was not found in the registered objects.", data[0]));

            }
            else if (OnNotificationOccured != null)
                OnNotificationOccured(packet, "Collection changed packet was not in a correct format. Acepting a message in format of 'name:newstartindex:oldstartindex:value'");

            //If we ever get here it means we encountered an error. We therefore return a null value.
            return null;
        }
Пример #39
0
 static ServerConfiguration LoadConfiguration(string path)
 {
     var serialiser = new Serialiser<ServerConfiguration>(path);
     return serialiser.Load();
 }
        /// <summary>
        /// Parse a property changed data to a special string that will be the source of a network packet message.
        /// </summary>
        /// <param name="item">The item that had it's property changed..</param>
        /// <param name="arguments">Argument containing the name of the property in a string form.</param>
        /// <returns>The object parsed.</returns>
        public string ParseObject(object item, object[] arguments)
        {
            //Preliminary checks, checking if the arguments are there, of correct type
            //if the property exists and so on.

            //Check to see if we have enough arguments.
            if (arguments.Length < 1)
            {
                RunExceptionOccured(new Exception("Property changed parser was called with incomplete arguments. Expected mininum 1 argument, received " + arguments.Length));
                return null;
            }
            //Check to see if the argument is of correct type.
            if (!(arguments[0] is string))
            {
                RunExceptionOccured(new Exception("Property changed parser was called with unknown argument. Expected an argument of System.String type, received " + arguments[0].GetType().FullName));
                return null;
            }
            //Check to see if we are working with network data object. Propert changed works only
            //on INetorkData objects.
            if (!(item is INetworkData))
            {
                RunExceptionOccured(new Exception("Property changed parser was called with an object that was not of INetworkData type. The object that did not implement INetworkData was of type " + item.GetType().FullName));
                return null;
            }

            //Grab the property name from the argument
            string propertyName = arguments[0] as string;

            //Check whether the property actually exist. Sometimes a grammar error
            //or a simple mistake can lead to the property name being misspelled.
            if (item.GetType().GetProperty(propertyName) == null)
            {
                if (OnWarningOccured != null)
                    OnWarningOccured(item, new Warning(string.Format("The property '{0}' was not found in the object of type '{1}'", propertyName, item.GetType().FullName)));
                return null;
            }

            //Preliminary checks complete. Time to parse the property

            //Create a local value of the new value from the property.
            object newValue = item.GetType().GetProperty(propertyName).GetValue(item, null);

            //The format of a property changed is the following: "NAMEOFOBJECT:NAMEOFPROPERTY:NEWVALUE"
            //The new value is retrieved using the Serialiser.
            string message = string.Format("{0}:{1}:", (item as INetworkData).NetworkId, propertyName);

            try
            {
                //Serialise the new value
                message += new Serialiser().Serialise(newValue);
            }
            catch (Exception error)
            {
                RunExceptionOccured(new Exception(string.Format("Error while preparing a network packet of PropertyChanged. {0}", error.Message), error));
                return null;
            }
            return message;
        }