Exemple #1
0
        public override void Render(StringBuilder sb)
        {
            AddProperty("name", Name);
            AddProperty("pageSize", PageSize);
            AddProperty("start", Vector3.ToString(Start));
            AddProperty("middle1", Vector3.ToString(Middle1));
            AddProperty("middle2", Vector3.ToString(Middle2));
            AddProperty("end", Vector3.ToString(End));
            AddProperty("startrot", Vector3.ToString(StartRot));
            AddProperty("middle1rot", Vector3.ToString(Middle1Rot));
            AddProperty("middle2rot", Vector3.ToString(Middle2Rot));
            AddProperty("endrot", Vector3.ToString(EndRot));
            AddProperty("navigationbuttonscale", Vector3.ToString(NavigationButtonScale));
            AddProperty("navigationbuttonposition", Vector3.ToString(NavigationButtonPosition));
            AddChild(NodePrefab);
            AddChild(NextButtonPrefab);
            AddChild(ResetButtonPrefab);
            if (ListType != ListType.standard)
            {
                AddProperty("listtype", ListType.ToString().ToLower());
            }
            foreach (var node in Nodes)
            {
                Children.Add(node);
            }

            base.Render(sb);
        }
Exemple #2
0
        private void GenerateList()
        {
            string lang   = "@Name";
            string xQuery = String.Format("Lists/List[@Key='{0}']/Item", ListType.ToString());

            string filePath = string.Format(ConfigManager.Current.pathForLists, Util.CurrentUserLang);

            foreach (XmlNode node in CachedDocumentManager.GetXmlNodeList(filePath, xQuery))
            {
                string  v = node.SelectSingleNode("@Value").InnerText;
                string  n;
                XmlNode nameNode = node.SelectSingleNode(lang);
                if (nameNode == null)
                {
                    nameNode = node.SelectSingleNode("@Name");
                }
                n = (nameNode == null) ? "Unknown" : nameNode.InnerText;

                this.Items.Add(new ListItem(n, v));
            }
            if (AddAllItem)
            {
                try
                {
                    this.Items.Insert(0, new ListItem(ResourceManager.GetResource("all"), ""));
                    this.SelectedIndex = 0;
                }
                catch {}
            }
        }
        public static void ShowArrayType(String key)
        {
            var bytes = System.Convert.FromBase64String(PlayerPrefs.GetString(key));

            if (bytes.Length > 0)
            {
                ListType arrayType = (ListType)bytes[0];
                Debug.Log(string.Format(GDMConstants.ErrorCorruptPrefFormat, key, arrayType.ToString()));
            }
        }
        public virtual int GetListId(ListType listType, SchoolCategory schoolCategory)
        {
            switch(schoolCategory)
            {
                case SchoolCategory.None:
                case SchoolCategory.Ungraded:
                    schoolCategory = SchoolCategory.HighSchool;
                    break;
            }

            return GetListId(listType.ToString(), schoolCategory);
        }
        private void InitProperties()
        {
            // restore list type if returning to window
            // loading parameter will be lost if loaded list items
            // or comments for a selected list
            TraktListType LastListType = ListType;

            // check if skin is using hyperlinkParameter
            if (!string.IsNullOrEmpty(_loadParameter))
            {
                if (_loadParameter.ToLowerInvariant() == "trending")
                {
                    ListType = TraktListType.Trending;
                }
                if (_loadParameter.ToLowerInvariant() == "popular")
                {
                    ListType = TraktListType.Popular;
                }
                if (_loadParameter.ToLowerInvariant() == "liked")
                {
                    ListType = TraktListType.Liked;
                }
            }
            else if (!ReturningFromListItemsOrComments)
            {
                // default to user lists
                ListType = TraktListType.User;
            }

            // if we're in a different list view since last time
            // then reset last selected index
            if (LastListType != ListType)
            {
                PreviousSelectedIndex = 0;
            }

            // set current user to logged in user if not set
            if (string.IsNullOrEmpty(CurrentUser))
            {
                CurrentUser = TraktSettings.Username;
            }

            if (ListType == TraktListType.Trending)
            {
                GUIUtils.SetProperty("#Trakt.List.LikesThisWeek", string.Empty);
                GUIUtils.SetProperty("#Trakt.List.CommentsThisWeek", string.Empty);
            }

            GUICommon.SetProperty("#Trakt.Lists.ListType", ListType.ToString());
            GUICommon.SetProperty("#Trakt.Lists.CurrentUser", CurrentUser);
        }
        private string ConvertType(ListType type)
        {
            switch (type)
            {
            case ListType.ToDo:
                return(ToDo);

            case ListType.Project:
                return(Project);

            default:
                throw new NotSupportedException(type.ToString());
            }
        }
Exemple #7
0
        private void ExecuteDeleteListViewCommand(object obj)
        {
            if (MessageBox.Show("Are you Sure You want to Delete this List?", "Delete List",
                                MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) == MessageBoxResult.Yes)
            {
                SelectedList.Enabled = false;
                var stat = _listService.Disable(SelectedList);

                if (string.IsNullOrEmpty(stat))
                {
                    Lists.Remove(SelectedList);
                }
                else
                {
                    MessageBox.Show("Can't delete " + ListType.ToString() + ", may be the " + stat, "Can't Delete",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Exemple #8
0
		/// <summary>
		/// Open a list tag
		/// </summary>
		/// <remarks>Sets the active tag to a new "list" tag. May only be called when
		/// one of the following tags are active: "section", "paragraph", "list", "description".
		/// <see cref="EndList"/> must be called to close this tag</remarks>
		/// <param name="type">The type of list</param>
		public void BeginList(ListType type)
		{
			ValidateCurrentNode("section", "paragraph", "list", "description");
			_currentNode = _currentNode.AppendChild(_usage.CreateElement("list"));
			_currentNode.Attributes.Append(_usage.CreateAttribute("type")).Value = type.ToString().ToLower();
		}
Exemple #9
0
        private async Task SendChartAsync(ListType ListType, int limit, string span = "", string username = "")
        {
            if (!await Preconditions.Preconditions.InChartposting(Context))
            {
                return;
            }

            if (username == string.Empty)
            {
                var user = await FindUserAsync();

                if (user.LastFm != null)
                {
                    username = user.LastFm;
                }
                else
                {
                    await Error("You haven't linked your last.fm account.");

                    return;
                }
            }

            var response = await lastFm.GetTopAsync(ListType, limit, span, username);

            if (response == null)
            {
                await Error("No scrobbled albums.");

                return;
            }

            var list = "";
            var i    = 1;

            switch (ListType)
            {
            case ListType.Albums:
                foreach (var album in response.topalbums.album)
                {
                    list += $"{i}. {album.artist.name} - *{album.name}* " +
                            $"[{String.Format("{0:n0}", (int) album.playcount)} scrobbles]\n";
                    i++;
                }
                break;

            case ListType.Artists:
                foreach (var artist in response.topartists.artist)
                {
                    list += $"{i}. {artist.name} [{String.Format("{0:n0}", (int) artist.playcount)} " +
                            "scrobbles]\n";
                    i++;
                }
                break;

            case ListType.Tracks:
                foreach (var track in response.toptracks.track)
                {
                    list += $"{i}. {track.artist.name} - *{track.name}* " +
                            $"[{String.Format("{0:n0}", (int) track.playcount)} scrobbles]\n";
                    i++;
                }
                break;
            }
            var embed = await BuildTopAsync(list, username, ListType.ToString().ToLowerInvariant(), span);

            await ReplyAsync("", embed : embed.Build());
        }
 public ObjectList(string _name, ListType _type)
 {
     name = _name;
     type = _type.ToString().ToLower();
     list = new List<object>();
 }
Exemple #11
0
        private void GenerateList()
        {
            string lang   = "@Name";
            string xQuery = String.Format("Lists/List[@Key='{0}']/Item", ListType.ToString());

            ListItem liChoose = null;

            SortedList slItems = null;

            if (SortByText == true)
            {
                slItems = new SortedList();
            }

            string filePath = string.Format(ConfigManager.Current.pathForLists, Util.CurrentUserLang);

            foreach (XmlNode node in CachedDocumentManager.GetXmlNodeList(filePath, xQuery))
            {
                string  v = node.SelectSingleNode("@Value").InnerText;
                string  n;
                XmlNode nameNode = node.SelectSingleNode(lang);
                if (nameNode == null)
                {
                    nameNode = node.SelectSingleNode("@Name");
                }
                n = (nameNode == null) ? "Unknown" : nameNode.InnerText;

                if (!(ShowChooseItem == false && (n.StartsWith("Seçiniz") || n.StartsWith("Please select"))))
                {
                    if (SortByText == true)
                    {
                        if (!slItems.ContainsKey(n))
                        {
                            slItems.Add(n, v);
                        }
                    }
                    else
                    {
                        this.Items.Add(new ListItem(n, v));
                    }
                }
            }
            if (SortByText == true)     //Added for Sorting.
            {
                this.DataSource     = slItems;
                this.DataTextField  = "Key";
                this.DataValueField = "Value";
                this.DataBind();

                if (this.ShowChooseItem == true)
                {
                    liChoose = this.Items.FindByText(ResourceManager.GetResource("seciniz"));

                    if (liChoose != null)
                    {
                        this.Items.Remove(liChoose);
                        this.Items.Insert(0, liChoose);
                    }
                }
            }
        }
Exemple #12
0
 /// <summary>
 /// Open a list tag
 /// </summary>
 /// <remarks>Sets the active tag to a new "list" tag. May only be called when
 /// one of the following tags are active: "section", "paragraph", "list", "description".
 /// <see cref="EndList"/> must be called to close this tag</remarks>
 /// <param name="type">The type of list</param>
 public void BeginList(ListType type)
 {
     ValidateCurrentNode("section", "paragraph", "list", "description");
     _currentNode = _currentNode.AppendChild(_usage.CreateElement("list"));
     _currentNode.Attributes.Append(_usage.CreateAttribute("type")).Value = type.ToString().ToLower();
 }
Exemple #13
0
 /// <summary>
 /// Returns a list of random, newest, highest rated etc. albums. Similar to the album lists on the home page of the Subsonic web interface.
 /// </summary>
 /// <param name="type">The list type. Must be one of the following: random, newest, highest, frequent, recent,alphabeticalByName,alphabeticalByArtist,starred</param>
 /// <param name="size">The number of albums to return. Max 500.</param>
 /// <param name="offset">The list offset. Useful if you for example want to page through the list of newest albums.</param>
 /// <param name="musicFolderId">Only return albums in the music folder with the given ID. See getMusicFolders.</param>
 public GetAlbumList(ListType type,string size = "10",string offset = "0",string musicFolderId = null)
     : base(nameof(type), type.ToString(),
          nameof(offset),offset,
          nameof(musicFolderId),musicFolderId)
 {
 }
Exemple #14
0
        static void GetValue <T>(string key, T list, ListType arrayType, int vectorNumber, Action <T, byte[]> convert) where T : IList
        {
            if (PlayerPrefs.HasKey(key))
            {
                var bytes = System.Convert.FromBase64String(PlayerPrefs.GetString(key));
                if ((bytes.Length - 1) % (vectorNumber * 4) != 0)
                {
                    Debug.LogError(string.Format(GDMConstants.ErrorCorruptPrefFormat, key));
                    return;
                }
                if ((ListType)bytes[0] != arrayType)
                {
                    Debug.LogError(string.Format(GDMConstants.ErrorNotArrayFormat, key, arrayType.ToString()));
                    return;
                }
                Initialize();

                var end = (bytes.Length - 1) / (vectorNumber * 4);
                for (var i = 0; i < end; i++)
                {
                    convert(list, bytes);
                }
            }
        }
Exemple #15
0
 public ObjectList(string _name, ListType _type)
 {
     name = _name;
     type = _type.ToString().ToLower();
     list = new List <object>();
 }
Exemple #16
0
        static void Get2DValue <T>(string key, T list, ListType arrayType, int vectorNumber, Action <IList, byte[]> convert) where T : IList
        {
            if (PlayerPrefs.HasKey(key))
            {
                var bytes = System.Convert.FromBase64String(PlayerPrefs.GetString(key));

                // Make sure the min header length is intact
                if (bytes.Length < 5)
                {
                    Debug.LogError(string.Format(GDMConstants.ErrorCorruptPrefFormat, key));
                    return;
                }

                int    listCount   = BitConverter.ToInt32(bytes, 1);
                byte[] headerBytes = new byte[listCount * 4 + 5];
                Array.Copy(bytes, 0, headerBytes, 0, headerBytes.Length);

                List <byte> allBytes = new List <byte>(bytes);
                allBytes.RemoveRange(1, headerBytes.Length - 1);
                bytes = allBytes.ToArray();

                if ((bytes.Length - 1) % (vectorNumber * 4) != 0)
                {
                    Debug.LogError(string.Format(GDMConstants.ErrorCorruptPrefFormat, key));
                    return;
                }

                if ((ListType)bytes[0] != arrayType)
                {
                    Debug.LogError(string.Format(GDMConstants.ErrorCorruptPrefFormat, key, arrayType.ToString()));
                    return;
                }
                Initialize();

                IList masterList;
                GetNewListForType(arrayType, out masterList);

                var end = (bytes.Length - 1) / (vectorNumber * 4);
                for (int i = 0; i < end; i++)
                {
                    convert(masterList, bytes);
                }

                // Construct the sublists
                int   currentListCount = 0;
                int   itr         = 0;
                int   headerIndex = 5;
                IList subList;
                for (int x = 0; x < listCount; x++)
                {
                    currentListCount = BitConverter.ToInt32(headerBytes, headerIndex);
                    headerIndex     += 4;

                    GetNewListForType(arrayType, out subList);
                    for (int y = 0; y < currentListCount; y++)
                    {
                        subList.Add(masterList[itr++]);
                    }

                    list.Add(subList);
                }
            }
        }
Exemple #17
0
 public ObjectList(string _name, ListType _type, long _size)
 {
     name = _name;
     type = _type.ToString().ToLower();
     size = _size;
 }