Example #1
0
        /*  oma_buddylist (not explicitly used in RCS)
         *      -->rcs
         *      -->oma_pocbuddylist
         *      -->list-c
         *      -->list-d
         *  oma_grantedcontacts
         *      -->rcs
         *      -->oma_buddylist
         *  oma_blockedcontacts
         *      -->rcs_blockedcontacts
         *      -->rcs_revokedcontacts
         *  rcs
         *      -->me       (RCS 2)
         *      -->Default
         *      -->list-a
         *      -->list-b
         */
        private listType[] GetRCSLists()
        {
            listType[] rcsLists; // Do not cache

            rcsLists = new listType[3] {
                new listType(), new listType(), new listType()
            };

            /*==  rcs ==*/
            rcsLists[0].displayname       = new displaynameType();
            rcsLists[0].name              = SpecialNames.SHARED_RCS;
            rcsLists[0].displayname.Value = "All Contacts";
            rcsLists[0].ExternalTypes.Add(this.GetResourceListAnchorAsExternalType(SpecialNames.SHARED_DOUBANGO));
            /* rcs 2: The RCS presentity is always part of this list, refer to ยง 11.4 */
            entryType me = new entryType();

            me.uri = this.xcapStack.XUI;
            rcsLists[0].EntryTypes.Add(me);

            /*==  rcs_blockedcontacts ==*/
            rcsLists[1].displayname       = new displaynameType();
            rcsLists[1].name              = SpecialNames.SHARED_RCS_BLOCKEDCONTACTS;
            rcsLists[1].displayname.Value = "Blocked Contacts";

            /*==  rcs_revokedcontacts ==*/
            rcsLists[2].displayname       = new displaynameType();
            rcsLists[2].name              = SpecialNames.SHARED_RCS_REVOKEDCONTACTS;
            rcsLists[2].displayname.Value = "Revoked Contacts";


            return(rcsLists);
        }
Example #2
0
        public List <Entry> loadEntries()
        {
            TmxList <TmxObject> elist   = tmxmap.ObjectGroups["entry"].Objects;
            List <Entry>        entries = new List <Entry>();

            foreach (var entry_obj in elist)
            {
                if (!entry_obj.Points[0].Equals(null) && !entry_obj.Points[1].Equals(null))
                {
                    Vector2 evpoint1 = new Vector2((float)(entry_obj.X + entry_obj.Points[0].X), (float)(entry_obj.Y + entry_obj.Points[0].Y));
                    Vector2 evpoint2 = new Vector2((float)(entry_obj.X + entry_obj.Points[1].X), (float)(entry_obj.Y + entry_obj.Points[1].Y));
                    int     itype    = this.findEntryType(entry_obj.Type);
                    if (itype != 4)
                    {
                        entryType type = (entryType)itype;
                        Entry     entry;
                        if (evpoint1.X > evpoint2.X || evpoint1.Y > evpoint2.Y)
                        {
                            entry = new Entry(evpoint1, evpoint2, type);
                        }
                        else
                        {
                            entry = new Entry(evpoint2, evpoint1, type);
                        }
                        entries.Add(entry);
                    }
                    else
                    {
                        Debug.WriteLine("Type of entry [" + evpoint1.X + "/" + evpoint1.Y + "-" + evpoint2.X + "/" + evpoint2.Y + "] is undefined] => Fix it on Tiled");
                    }
                }
            }
            return(entries);
        }
Example #3
0
        public bool ContactAdd(Contact contact)
        {
            if (!this.hasResourceLists)
            {
                LOG.Warn("Contact connot be added as XDMS doesn't support 'resource-lists'");
                return(false);
            }

            entryType entry = this.ContactToEntry(contact);

            byte[] payload = this.Serialize(entry, true, true, this.GetSerializerNSFromAUID(XcapService.XCAP_AUID_IETF_RESOURCE_LISTS_ID));
            String url;

            lock (this.xcapSelector)
            {
                this.xcapSelector.reset();
                this.xcapSelector.setAUID(XcapService.XCAP_AUID_IETF_RESOURCE_LISTS_ID)
                .setAttribute("list", "name", contact.GroupName)
                .setAttribute("entry", "uri", contact.UriString);
                url = this.xcapSelector.getString();
            }

            MyXcapMessage xcapMessage = this.xcapStack.PutElement(url, payload, (uint)payload.Length);

            return(xcapMessage != null && XcapService.IsSuccessCode(xcapMessage.Code));
        }
Example #4
0
        private Person EntryToContact(entryType entry, Group g)
        {
            string strDispName = (entry.displayname == null) ? null : entry.displayname.Value;
            string strUil      = UriUtils.GetValidSipUri(entry.uri);

            return(new Person(strDispName, strDispName, strUil, false, g));
        }
Example #5
0
 public Entry(DateTime date, entryType et, string message, string text)
 {
     Date          = date;
     LogType       = et;
     this.title    = message;
     this.logEntry = text;
 }
 public entry(entryType type, int level, int iSourceLine)
 {
     this.type        = type;
     this.level       = level;
     this.iSourceLine = iSourceLine;
     this.value       = 0;
 }
        private static void doUpdate(object paramArray)
        {
            object[] parameters = paramArray as object[];
            long     ownerCID   = 0;

            try
            {
                string newDisplayName = parameters[0].ToString();
                ownerCID = (long)parameters[1];
                string authToken = parameters[2].ToString();
                ConnectivitySettings connectivitySettings = (ConnectivitySettings)parameters[3];
                EventHandler <AtomRequestSucceedEventArgs> onSuccessHandler = parameters[4] as EventHandler <AtomRequestSucceedEventArgs>;

                entryType returnEntry = LiveAtomAPILight.UpdatePersonalStatus(newDisplayName, ownerCID, authToken, connectivitySettings);

                if (onSuccessHandler != null)
                {
                    onSuccessHandler(ownerCID, new AtomRequestSucceedEventArgs(returnEntry));
                }
            }
            catch (Exception ex)
            {
                EventHandler <ExceptionEventArgs> onErrorHandler = parameters[5] as EventHandler <ExceptionEventArgs>;

                if (onErrorHandler != null)
                {
                    onErrorHandler(ownerCID, new ExceptionEventArgs(ex));
                }
            }
        }
Example #8
0
        public Room findRandomRoomWithEntryType(entryType type)
        {
            List <String> roomsFilesSelected = null;

            if (type == entryType.top || type == entryType.bot)
            {
                roomsFilesSelected = roomFilesWithTopBotEntries;
            }
            else if (type == entryType.left || type == entryType.right)
            {
                roomsFilesSelected = roomFilesWithLeftRightEntries;
            }
            if (roomsFilesSelected != null)
            {
                int roomIndex = rand.Next(0, roomsFilesSelected.Count);
                // Debug.WriteLine(roomsFilesSelected[roomIndex]);
                Room room = rloader.load(roomsFilesSelected[roomIndex]);
                if (room == null)
                {
                    return(null);
                }
                Entry entry = room.findRandomEntryByType(rand, type);
                if (entry == null)
                {
                    return(null);
                }
                room.entrySelected = entry;
                return(room);
            }
            return(null);
        }
Example #9
0
        /// <summary>
        /// Add new entry to the log
        /// </summary>
        /// <param name="date">date of entry</param>
        /// <param name="logType">OK, Fail - display green or red bar to left</param>
        /// <param name="title">short title for log message</param>
        /// <param name="logEntry">long log entry</param>
        public void addEntry(DateTime date, entryType logType, String title, string logEntry)
        {
            Entry e = new Entry(date, logType, title, logEntry);

            entries.Add(e);
            listView.Items.Add(e.getListTitle(), e.getImageIndex());
        }
Example #10
0
 public Entry(entryType _entry, string text = "")
 {
     entry = _entry;
     if (entry == entryType.Plaintext)
     {
         plaintext = text;
     }
 }
Example #11
0
 public Entry(string _id, string _category, informationType _type, params string[] _values)
 {
     id       = _id;
     category = _category;
     type     = _type;
     values   = _values;
     entry    = entryType.Localization;
 }
Example #12
0
        private Contact EntryToContact(entryType entry, String groupName)
        {
            Contact contact = new Contact();

            contact.DisplayName = entry.displayname == null ? null : entry.displayname.Value;
            contact.UriString   = entry.uri;
            contact.GroupName   = groupName;
            return(contact);
        }
Example #13
0
        private entryType ContactToEntry(Contact contact)
        {
            entryType entry = new entryType();

            entry.uri               = contact.UriString;
            entry.displayname       = new entryTypeDisplayname();
            entry.displayname.Value = contact.DisplayName;

            return(entry);
        }
        private static entryType[] GetEntryTypes(JobDataMap jobDataMap)
        {
            List <entryType> entries = new List <entryType>();

            foreach (var item in jobDataMap)
            {
                entryType entry = new entryType();
                entry.key   = item.Key;
                entry.value = item.Value.ToString();

                entries.Add(entry);
            }
            return(entries.ToArray());
        }
Example #15
0
        public Entry findRandomEntryByType(Random rand, entryType type)
        {
            List <Entry> entriesFound = new List <Entry>();

            foreach (Entry entry in entryList)
            {
                if (entry.type == type)
                {
                    entriesFound.Add(entry);
                }
            }
            if (entriesFound.Count == 0)
            {
                return(null);
            }
            int entryIndex = rand.Next(0, entriesFound.Count);

            return(entriesFound[entryIndex]);
        }
Example #16
0
        public void addRandomRoom()
        {
            Room      lastRoom    = rooms[rooms.Count - 1];
            int       entryIndex  = rand.Next(0, lastRoom.entryList.Count);
            entryType opEntryType = entryType.undefined;

            if (rooms.Count > 1)
            {
                lastRoom.selectRandomExit(rand);
            }
            opEntryType = lastRoom.exitSelected.findOppositeEntryType();
            Room newRoom = findRandomRoomWithEntryType(opEntryType);

            if (newRoom == null)
            {
                return;
            }
            this.positionAndAddNewRoom(newRoom, lastRoom);
        }
Example #17
0
        internal static entryType UpdatePersonalStatus(string newDisplayName, long ownerCID, string authToken, ConnectivitySettings connectivitySettings)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(liveAPIBaseURL + "/Users({0})/Status".Replace("{0}", ownerCID.ToString()));

            if (connectivitySettings != null)
            {
                connectivitySettings.SetupWebRequest(request);
            }
            request.Method      = "POST";
            request.Accept      = @"application/atom+xml; type=entry";
            request.ContentType = @"application/atom+xml";
            request.Headers.Add(HttpRequestHeader.Authorization, "WLID1.0 " + authToken);
            request.Headers.Add("AppId", appID);

            entryType entry = new entryType();

            if (!string.IsNullOrEmpty(newDisplayName))
            {
                entry.title       = new entryTypeTitle();
                entry.title.Value = newDisplayName;
            }

            XmlSerializer ser       = new XmlSerializer(typeof(entryType));
            MemoryStream  memStream = new MemoryStream();

            ser.Serialize(memStream, entry);
            string xmlString = Encoding.UTF8.GetString(memStream.ToArray());
            int    xmlLength = Encoding.UTF8.GetByteCount(xmlString);

            request.ContentLength = xmlLength;
            request.GetRequestStream().Write(Encoding.UTF8.GetBytes(xmlString), 0, xmlLength);

            XmlReaderSettings readerSettings = new XmlReaderSettings();

            readerSettings.CloseInput = true;

            using (XmlReader xmlReader = XmlReader.Create(request.GetResponse().GetResponseStream(), readerSettings))
            {
                return((entryType)ser.Deserialize(xmlReader));
            }
        }
Example #18
0
        public bool ContactUpdate(Contact contact, String prevGroupName)
        {
            if (!this.hasResourceLists)
            {
                LOG.Warn("Contact connot be updated as XDMS doesn't support 'resource-lists'");
                return(false);
            }

            // 1. Add contact
            entryType entry = this.ContactToEntry(contact);

            byte[] payload = this.Serialize(entry, true, true, this.GetSerializerNSFromAUID(XcapService.XCAP_AUID_IETF_RESOURCE_LISTS_ID));
            String url;

            lock (this.xcapSelector)
            {
                this.xcapSelector.reset();
                this.xcapSelector.setAUID(XcapService.XCAP_AUID_IETF_RESOURCE_LISTS_ID)
                .setAttribute("list", "name", contact.GroupName)
                .setAttribute("entry", "uri", contact.UriString);
                url = this.xcapSelector.getString();
            }

            MyXcapMessage xcapMessage = this.xcapStack.PutElement(url, payload, (uint)payload.Length);
            bool          ok          = (xcapMessage != null && XcapService.IsSuccessCode(xcapMessage.Code));

            // 2. Remove from old group
            if (ok && !String.Equals(contact.GroupName, prevGroupName))
            {
                Contact clone = new Contact();
                clone.UriString = contact.UriString;
                clone.GroupName = prevGroupName;
                ok &= this.ContactDelete(clone);
            }

            return(ok);
        }
Example #19
0
 public Entry(Vector2 ptA, Vector2 ptB, entryType type)
 {
     this.ptA  = ptA;
     this.ptB  = ptB;
     this.type = type;
 }
Example #20
0
 public AtomRequestSucceedEventArgs(entryType entry)
 {
     Entry = entry;
 }
Example #21
0
 public void addEntry(entryType logType, String title, string logEntry)
 {
     addEntry(DateTime.Now, logType, title, logEntry);
 }
Example #22
0
 public Entry(DateTime date, entryType et, string message, string text)
 {
     Date = date;
     LogType = et;
     this.title = message;
     this.logEntry = text;
 }
Example #23
0
 /// <summary>
 /// Add new entry to the log
 /// </summary>
 /// <param name="date">date of entry</param>
 /// <param name="logType">OK, Fail - display green or red bar to left</param>
 /// <param name="title">short title for log message</param>
 /// <param name="logEntry">long log entry</param>
 public void addEntry(DateTime date, entryType logType, String title, string logEntry)
 {
     Entry e = new Entry(date, logType, title, logEntry);
     entries.Add(e);
     listView.Items.Add(e.getListTitle(), e.getImageIndex());
 }
Example #24
0
 public void addEntry(entryType logType, String title, string logEntry)
 {
     addEntry(DateTime.Now, logType, title, logEntry);
 }
Example #25
0
        /// <summary>
        /// Casts the imported value into the proper type.
        /// </summary>
        /// <param name="myVal">Value being imported</param>
        /// <param name="myErrors">Error Log</param>
        /// <param name="expectedHeader">Header Name</param>
        /// <param name="row">Current Row</param>
        /// <param name="myField">Row Field </param>
        /// <param name="myType">Data Type for Value</param>
        /// <returns>Casted Value</returns>
        public static object myImportEntry(List <object> myVal, List <string> myErrors, List <string> expectedHeader, int row, entryType myType, IDbConnection myConnection)
        {
            object myField = null;
            object val     = myVal[0];

            try
            {
                switch (myType)
                {
                case entryType.String:
                    myField = Convert.ToString(val);
                    break;

                case entryType.Decimal:
                    myField = Convert.ToDecimal(val);
                    break;

                case entryType.Bool:
                    myField = Convert.ToBoolean(val);
                    break;

                case entryType.Int:
                    myField = Convert.ToInt32(val);
                    break;

                case entryType.dateTime:
                    myField = Convert.ToDateTime(val);
                    break;

                case entryType.oneValJoin:
                    myField = oneValJoin(myConnection, myErrors, row, expectedHeader[0], val);
                    break;

                case entryType.multiValJoin:
                    myField = multiValJoin(myConnection, myErrors, row, expectedHeader, myVal);
                    break;

                default:
                    myField = null;
                    break;
                }
                return(myField);
            }
            catch (Exception e)
            {
                foreach (string exh in expectedHeader)
                {
                    myErrors.Add(exh + " on row " + row + " had a Exception : " + e.Message);
                }

                return(myField);
            }
        }