Beispiel #1
0
            public RecipeEntry(Recipe recipe, bool isProduction, Goods currentItem, bool atCurrentMilestones)
            {
                this.recipe = recipe;
                var amount = isProduction ? recipe.GetProduction(currentItem) : recipe.GetConsumption(currentItem);

                recipeFlow         = recipe.ApproximateFlow(atCurrentMilestones);
                flow               = recipeFlow * amount;
                specificEfficiency = isProduction ? recipe.Cost() / amount : 0f;
                if (!recipe.IsAccessible())
                {
                    entryStatus = EntryStatus.NotAccessible;
                }
                else if (!recipe.IsAccessibleWithCurrentMilestones())
                {
                    entryStatus = EntryStatus.NotAccessibleWithCurrentMilestones;
                }
                else
                {
                    var waste = recipe.RecipeWaste(atCurrentMilestones);
                    if (recipe.specialType != FactorioObjectSpecialType.Normal && recipeFlow <= 0.01f)
                    {
                        entryStatus = EntryStatus.Special;
                    }
                    else if (waste > 0f)
                    {
                        entryStatus = EntryStatus.Normal;
                    }
                    else
                    {
                        entryStatus = EntryStatus.Useful;
                    }
                }
            }
Beispiel #2
0
 private void ChangeShowStatus(EntryStatus status)
 {
     showRecipesRange = status;
     Rebuild();
     productionList.Rebuild();
     usageList.Rebuild();
 }
Beispiel #3
0
        /// <summary>
        /// Ctor: deserialize from binary stream.
        /// </summary>
        public CedictEntry(BinReader br)
        {
            pinyin         = br.ReadArray(brr => new PinyinSyllable(brr));
            ChSimpl        = br.ReadString();
            ChTrad         = br.ReadString();
            Freq           = br.ReadUShort();
            StableId       = br.ReadInt();
            Status         = (EntryStatus)br.ReadByte();
            senses         = br.ReadArray(brr => new CedictSense(brr));
            hanziPinyinMap = br.ReadArray(brr => brr.ReadShort());
            short cnt = br.ReadShort();

            if (cnt == 0)
            {
                zhoEmbeds = null;
            }
            else
            {
                zhoEmbeds = new ZhoEmbedding[cnt];
                for (int i = 0; i != cnt; ++i)
                {
                    zhoEmbeds[i] = new ZhoEmbedding(br);
                }
            }
        }
Beispiel #4
0
        public override void Prepare(UpdaterStatus status)
        {
            base.Prepare(status);

            foreach (var entry in _entries)
            {
                var repairStatus = new OperationStatus
                {
                    Weight = { Value = StatusWeightHelper.GetUnarchivePackageWeight(entry.Size.Value) }
                };
                status.RegisterOperation(repairStatus);

                var downloadStatus = new DownloadStatus
                {
                    Weight = { Value = StatusWeightHelper.GetDownloadWeight(entry.Size.Value) }
                };
                status.RegisterOperation(downloadStatus);

                _entryStatus[entry] = new EntryStatus
                {
                    RepairStatus   = repairStatus,
                    DownloadStatus = downloadStatus
                };
            }

            _localData.PrepareForWriting();
        }
            public RecipeEntry(Recipe recipe, bool isProduction, IRecipeItemFlowProvider provider, Goods currentItem)
            {
                this.recipe = recipe;
                var amount = isProduction ? recipe.GetProduction(currentItem) : recipe.GetConsumption(currentItem);

                recipeFlow         = provider.GetRecipeFlow(recipe);
                flow               = recipeFlow * amount;
                specificEfficiency = isProduction ? recipe.Cost() / amount : 0f;
                if (!recipe.IsAccessible())
                {
                    entryStatus = EntryStatus.NotAccessible;
                }
                else if (!recipe.IsAccessibleWithCurrentMilestones())
                {
                    entryStatus = EntryStatus.NotAccessibleWithCurrentMilestones;
                }
                else
                {
                    var waste = recipe.RecipeWaste();
                    if (waste > 0.95f)
                    {
                        entryStatus = EntryStatus.Wasteful;
                    }
                    else if (waste > 0f)
                    {
                        entryStatus = EntryStatus.Normal;
                    }
                    else
                    {
                        entryStatus = EntryStatus.Useful;
                    }
                }
            }
Beispiel #6
0
        public static void RenderItem(StringBuilder sb, string currTrg, EntryStatus currStatus,
                                      ChangeItem change, string lang)
        {
            CedictParser parser = new CedictParser();

            histRenderChange(sb, change, false, lang, parser, "reloaded");
        }
 public void Reset()
 {
     _key           = 0;
     _dispatcherObj = null;
     _status        = EntryStatus.IDLE;
     _priority      = EntryPriority.NORMAL;
 }
Beispiel #8
0
 public void Reset()
 {
     _interval = 0;
     _elapsed  = 0;
     _handler  = null;
     _status   = EntryStatus.Idle;
 }
Beispiel #9
0
 public static void GetEntryById(int id, out string hw, out string trg, out EntryStatus status)
 {
     hw     = trg = null;
     status = EntryStatus.Neutral;
     using (MySqlConnection conn = DB.GetConn())
         using (MySqlCommand cmd = DB.GetCmd(conn, "SelEntryById"))
         {
             cmd.Parameters["@id"].Value = id;
             using (var rdr = cmd.ExecuteReader())
             {
                 while (rdr.Read())
                 {
                     hw  = rdr.GetString("hw");
                     trg = rdr.GetString("trg");
                     sbyte sx = rdr.GetSByte("status");
                     if (sx == 0)
                     {
                         status = EntryStatus.Neutral;
                     }
                     else if (sx == 2)
                     {
                         status = EntryStatus.Flagged;
                     }
                     else if (sx == 1)
                     {
                         status = EntryStatus.Approved;
                     }
                     else
                     {
                         throw new Exception("Invalid status in DB: " + sx);
                     }
                 }
             }
         }
 }
Beispiel #10
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is EntryStatus)
            {
                EntryStatus v = (EntryStatus)value;

                switch (v)
                {
                case EntryStatus.INSTALLED:
                    return("Installed");

                case EntryStatus.UNINSTALLED:
                    return("Uninstalled");

                case EntryStatus.DOWNLOADING:
                    return("Downloading...");

                case EntryStatus.EXTRACTING:
                    return("Extracting...");

                case EntryStatus.EXTRACTED:
                    return("Extracted");

                case EntryStatus.INSTALLING:
                    return("Installing...");
                }
            }

            throw new NotImplementedException();
        }
 private void SetItem(Goods current)
 {
     recent.Remove(current);
     if (recent.Count > 18)
     {
         recent.RemoveAt(0);
     }
     if (this.current != null)
     {
         recent.Add(this.current);
     }
     this.current = current;
     currentFlow  = provider.GetGoodsFlow(current);
     productions.Clear();
     foreach (var recipe in current.production)
     {
         productions.Add(new RecipeEntry(recipe, true, provider, current));
     }
     productions.Sort(this);
     usages.Clear();
     foreach (var usage in current.usages)
     {
         usages.Add(new RecipeEntry(usage, false, provider, current));
     }
     usages.Sort(this);
     showRecipesRange = EntryStatus.Normal;
     if (productions.Count > 0 && productions[0].entryStatus < showRecipesRange)
     {
         showRecipesRange = productions[0].entryStatus;
     }
     Rebuild();
     productionList.Rebuild();
     usageList.Rebuild();
 }
        private void TestCanEdit(bool expected, EntryStatus entryStatus = EntryStatus.Finished, UserGroupId userGroup = UserGroupId.Regular)
        {
            _artist.Status = entryStatus;
            _user.GroupId  = userGroup;

            var result = EntryPermissionManager.CanEdit(new FakePermissionContext(_user), _artist);

            result.Should().Be(expected, "result");
        }
        private void TestCanDelete(bool expected, EntryStatus entryStatus = EntryStatus.Finished, UserGroupId userGroup = UserGroupId.Regular)
        {
            _artist.Status = entryStatus;
            _user.GroupId  = userGroup;

            var result = CanDelete(_user, _artist);

            result.Should().Be(expected, "result");
        }
        private void TestCanDelete(bool expected, EntryStatus entryStatus = EntryStatus.Finished, UserGroupId userGroup = UserGroupId.Regular)
        {
            artist.Status = entryStatus;
            user.GroupId  = userGroup;

            var result = CanDelete(user, artist);

            Assert.AreEqual(expected, result, "result");
        }
        private void TestCanEdit(bool expected, EntryStatus entryStatus = EntryStatus.Finished, UserGroupId userGroup = UserGroupId.Regular)
        {
            artist.Status = entryStatus;
            user.GroupId  = userGroup;

            var result = EntryPermissionManager.CanEdit(new FakePermissionContext(user), artist);

            Assert.AreEqual(expected, result, "result");
        }
        private string ConvertNormalizedStatus(EntryStatus status)
        {
            switch (listtype)
            {
            case EntryType.Anime:
            {
                switch (status)
                {
                case EntryStatus.current:
                    return("Watching");

                case EntryStatus.completed:
                    return("Completed");

                case EntryStatus.dropped:
                    return("Dropped");

                case EntryStatus.paused:
                    return("On-Hold");

                case EntryStatus.planning:
                    return("Plan to Watch");

                default:
                    return("");
                }
            }

            case EntryType.Manga:
            {
                switch (status)
                {
                case EntryStatus.current:
                    return("Reading");

                case EntryStatus.completed:
                    return("Completed");

                case EntryStatus.dropped:
                    return("Dropped");

                case EntryStatus.paused:
                    return("On-Hold");

                case EntryStatus.planning:
                    return("Plan to Read");

                default:
                    return("");
                }
            }

            default:
                return("");
            }
        }
        public ArchivedSongListVersion(SongList songList, SongListDiff diff, AgentLoginData author,
                                       EntryStatus status,
                                       EntryEditEvent commonEditEvent, string notes)
            : base(null, author, songList.Version, status, notes)
        {
            ParamIs.NotNull(() => diff);

            SongList        = songList;
            Diff            = diff;
            CommonEditEvent = commonEditEvent;
        }
        protected ArchivedObjectVersion(XDocument data, AgentLoginData author, int version, EntryStatus status, string notes)
            : this()
        {
            ParamIs.NotNull(() => author);

            Data = data;
            AgentName = author.Name;
            Author = author.User;
            Notes = notes;
            Status = status;
            Version = version;
        }
Beispiel #19
0
        protected ArchivedObjectVersion(XDocument data, AgentLoginData author, int version, EntryStatus status, string notes)
            : this()
        {
            ParamIs.NotNull(() => author);

            Data      = data;
            AgentName = author.Name;
            Author    = author.User;
            Notes     = notes;
            Status    = status;
            Version   = version;
        }
		private PartialFindResult<EntryForApiContract> CallGetList(
			string query = null, 
			string tag = null,
			EntryStatus? status = null,
			int start = 0, int maxResults = 10, bool getTotalCount = true,
			NameMatchMode nameMatchMode = NameMatchMode.Words,
			EntryOptionalFields fields = EntryOptionalFields.None,
			ContentLanguagePreference lang = ContentLanguagePreference.Default,
			bool ssl = false) {
			
			return queries.GetList(query, tag, status, start, maxResults, getTotalCount, nameMatchMode, fields, lang, ssl);

		}
Beispiel #21
0
            public BufferEntry(NetworkDevice nic, IPPacket packet)
            {
                this.NIC    = nic;
                this.Packet = packet;

                if (Packet.DestinationIP.IsBroadcastAddress())
                {
                    this.Status = EntryStatus.DHCP_REQUEST;
                }
                else
                {
                    this.Status = EntryStatus.ADDED;
                }
            }
        public PartialFindResult<EntryForApiContract> GetList(
            string query,
            string tag = null,
            EntryStatus? status = null,
            int start = 0, int maxResults = defaultMax, bool getTotalCount = false,
            NameMatchMode nameMatchMode = NameMatchMode.Exact,
            EntryOptionalFields fields = EntryOptionalFields.None,
            ContentLanguagePreference lang = ContentLanguagePreference.Default
            )
        {
            var ssl = WebHelper.IsSSL(Request);
            maxResults = GetMaxResults(maxResults);

            return queries.GetList(query, tag, status, start, maxResults, getTotalCount, nameMatchMode, fields, lang, ssl);
        }
Beispiel #23
0
        public static void RenderEntryChanges(StringBuilder sb,
                                              string currHead, string currTrg, EntryStatus currStatus,
                                              List <ChangeItem> changes, string lang)
        {
            sb.AppendLine("<div class='pastChanges'><div class='pastInner'>");
            CedictParser parser    = new CedictParser();
            string       headNow   = currHead;
            string       trgNow    = currTrg;
            EntryStatus  statusNow = currStatus;

            foreach (var ci in changes)
            {
                renderPastChange(sb, parser, ref headNow, ref trgNow, ref statusNow, ci, lang);
            }
            sb.AppendLine("</div></div>"); // <div class='pastChanges'><div class='pastInner'>
        }
Beispiel #24
0
 public ListEntry(int etitleid, String etitle, EntryStatus estatus, int eprogress, int eprogressvolumes)
 {
     // This constructor creates an manga entry
     this.titleId          = etitleid;
     this.type             = EntryType.Manga;
     this.title            = etitle;
     this.entryStatus      = estatus;
     this.progress         = eprogress;
     this.progressVolumes  = eprogressvolumes;
     this.repeating        = false;
     this.repeatCount      = 0;
     this.startDate        = "";
     this.endDate          = "";
     this.personalComments = "";
     this.rating           = 0;
 }
Beispiel #25
0
        public static CedictEntry GetEntryByHead(string hw)
        {
            int         entryId = -1;
            string      trg     = null;
            EntryStatus status  = EntryStatus.Neutral;

            using (MySqlConnection conn = DB.GetConn())
                using (MySqlCommand cmd = DB.GetCmd(conn, "SelEntryByHead"))
                {
                    cmd.Parameters["@hw"].Value = hw;
                    using (var rdr = cmd.ExecuteReader())
                    {
                        while (rdr.Read())
                        {
                            entryId = rdr.GetInt32("id");
                            trg     = rdr.GetString("trg");
                            sbyte sx = rdr.GetSByte("status");
                            if (sx == 0)
                            {
                                status = EntryStatus.Neutral;
                            }
                            else if (sx == 2)
                            {
                                status = EntryStatus.Flagged;
                            }
                            else if (sx == 1)
                            {
                                status = EntryStatus.Approved;
                            }
                            else
                            {
                                throw new Exception("Invalid status in DB: " + sx);
                            }
                        }
                    }
                }
            if (entryId == -1)
            {
                return(null);
            }
            CedictEntry entry = Utils.BuildEntry(hw, trg);

            entry.Status   = status;
            entry.StableId = entryId;
            return(entry);
        }
        public static void Add(ActivityType activityType,
                               EntryStatus entryStatus, Source sourceType, string username, string paramValue, string hostname)
        {
            initializeListActivityDescription();

            Activities activity = new Activities();

            activity.EventDescription  = string.Format(getDescription(activityType), paramValue);
            activity.ActivityTypeValue = activityType;
            activity.HostName          = hostname;
            activity.UserName          = username;
            activity.EntryType         = entryStatus;
            activity.SourceType        = sourceType;
            DataBase.DBService.ExecuteCommandString(string.Format(INSERT_QUERY,
                                                                  activity.EventDescription, activity.ActivityTypeValue,
                                                                  activity.HostName, activity.UserName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                                                  activity.EntryType, activity.SourceType), true);
        }
 private void DrawEntryList(ImGui gui, List <RecipeEntry> entries, bool production)
 {
     foreach (var entry in entries)
     {
         if (entry.entryStatus < showRecipesRange)
         {
             gui.BuildText(entry.entryStatus == EntryStatus.Wasteful ? "There are more recipes, but they are wasteful" :
                           entry.entryStatus == EntryStatus.NotAccessibleWithCurrentMilestones ? "There are more recipes, but they are locked based on current milestones" :
                           "There are more recipes but they are inaccessible", wrap: true);
             if (gui.BuildButton("Show more recipes"))
             {
                 showRecipesRange = entry.entryStatus;
                 Rebuild();
             }
             break;
         }
         DrawRecipeEntry(gui, entry, production);
     }
     CheckChanging();
 }
Beispiel #28
0
        private static string getChangeTypeStr(ChangeType ct, int countB, EntryStatus entryStatus, string lang)
        {
            string changeMsg;

            if (ct == ChangeType.New)
            {
                changeMsg = TextProvider.Instance.GetString(lang, "history.changeNewEntry");
            }
            else if (ct == ChangeType.Edit)
            {
                changeMsg = TextProvider.Instance.GetString(lang, "history.changeEdited");
            }
            else if (ct == ChangeType.Note)
            {
                changeMsg = TextProvider.Instance.GetString(lang, "history.changeCommented");
            }
            else if (ct == ChangeType.BulkImport)
            {
                changeMsg = TextProvider.Instance.GetString(lang, "history.changeBulkImport");
            }
            else if (ct == ChangeType.StatusChange)
            {
                if (entryStatus == EntryStatus.Approved)
                {
                    changeMsg = TextProvider.Instance.GetString(lang, "history.changeApproved");
                }
                else if (entryStatus == EntryStatus.Flagged)
                {
                    changeMsg = TextProvider.Instance.GetString(lang, "history.changeFlagged");
                }
                else
                {
                    changeMsg = TextProvider.Instance.GetString(lang, "history.changeStatusNeutral");
                }
            }
            else
            {
                changeMsg = ct.ToString();
            }
            return(changeMsg);
        }
        private int getUpdateonimport(EntryStatus status)
        {
            switch (status)
            {
            case EntryStatus.current:
                return(this.updateonimportcurrent ? 1 : 0);

            case EntryStatus.completed:
                return(this.updateonimportcompleted ? 1 : 0);

            case EntryStatus.dropped:
                return(this.updateonimportdropped ? 1 : 0);

            case EntryStatus.paused:
                return(this.updateonimportonhold ? 1 : 0);

            case EntryStatus.planning:
                return(this.updateonimportplanned ? 1 : 0);

            default:
                return(0);
            }
        }
Beispiel #30
0
        public bool WriteLog(string Message, LogType lt, string Functional, string ClassMethod, string SystemName, EntryStatus Entry)
        {
            string ThreadId = "";

            if (Functional == null) Functional = "";
            if (ClassMethod == null) ClassMethod = "";
            if (SystemName == null) SystemName = "";

            StackTrace st = new StackTrace(true);

            if (st.FrameCount > 0)
            {
                StackFrame sf = st.GetFrame(1);
                Functional = sf.GetMethod().Name;
                ClassMethod = sf.GetMethod().ReflectedType.Name;
                SystemName = this.GetType().Namespace;
            }
            if (!this.IsEnabled) return false;

            _LogFileName = GetLogFileName();

            if (ThreadId == string.Empty) ThreadId = System.Convert.ToString(System.Threading.Thread.CurrentThread.ManagedThreadId);

            string msg = "";
            switch (lt)
            {
                case LogType.Error:
                    msg = msg + GetESC(ThreadId);
                    msg = msg + GetESC(System.Convert.ToString(LogLevel.ERR));
                    msg = msg + GetESC(Functional);
                    msg = msg + GetESC(ClassMethod);
                    msg = msg + GetESC(Message);
                    break;

                case LogType.Performance:
                    msg = msg + GetESC(ThreadId);
                    msg = msg + GetESC(System.Convert.ToString(LogLevel.PER));
                    msg = msg + GetESC(Functional);
                    msg = msg + GetESC(ClassMethod);
                    msg = msg + GetESC(SystemName);
                    msg = msg + GetESC(System.Convert.ToString(Entry));
                    break;

                case LogType.Trace:
                    msg = msg + GetESC(ThreadId);
                    msg = msg + GetESC(System.Convert.ToString(LogLevel.TRA));
                    msg = msg + GetESC(Functional);
                    msg = msg + GetESC(ClassMethod);
                    msg = msg + GetESC(Message);
                    break;

                default:
                    msg = msg + GetESC(Err_Log_Type);
                    break;
            }

            msg = GetESC(System.Convert.ToString(lt)) + msg;
            msg = GetMessage(msg);
            return WriteFile(msg);
        }
        public PartialFindResult<ArtistForApiContract> GetList(
            string query = "",
            ArtistTypes artistTypes = ArtistTypes.Nothing,
            string tag = null,
            int? followedByUserId = null,
            EntryStatus? status = null,
            int start = 0, int maxResults = defaultMax, bool getTotalCount = false,
            ArtistSortRule sort = ArtistSortRule.Name,
            NameMatchMode nameMatchMode = NameMatchMode.Exact,
            ArtistOptionalFields fields = ArtistOptionalFields.None,
            ContentLanguagePreference lang = ContentLanguagePreference.Default)
        {
            query = FindHelpers.GetMatchModeAndQueryForSearch(query, ref nameMatchMode);
            var types = ArtistHelper.GetArtistTypesFromFlags(artistTypes);

            var param = new ArtistQueryParams(query, types, start, Math.Min(maxResults, absoluteMax), false, getTotalCount, nameMatchMode, sort, false) {
                Tag = tag,
                UserFollowerId = followedByUserId ?? 0
            };
            param.Common.EntryStatus = status;

            var ssl = WebHelper.IsSSL(Request);
            var artists = service.FindArtists(s => new ArtistForApiContract(s, lang, thumbPersister, ssl, fields), param);

            return artists;
        }
Beispiel #32
0
        public ArchivedArtistVersion(Artist artist, XDocument data, ArtistDiff diff, AgentLoginData author, int version, EntryStatus status,
                                     ArtistArchiveReason reason, string notes)
            : base(data, author, version, status, notes)
        {
            ParamIs.NotNull(() => data);

            Artist = artist;
            Diff   = diff;
            Reason = reason;

            if (diff.IncludePicture)
            {
                Picture     = artist.Picture;
                PictureMime = artist.PictureMime;
            }
        }
Beispiel #33
0
 public HashTableEntry(TEntryKey key, TEntryValue value, EntryStatus status = EntryStatus.Occupied)
 {
     Key    = key;
     Value  = value;
     Status = status;
 }
Beispiel #34
0
 public void Value(int expected, EntryStatus actual)
 {
     ((int)actual).Should().Be(expected);
 }
Beispiel #35
0
 private static TooltipContent LogBookControllerOnGetPickupTooltipContent(On.RoR2.UI.LogBook.LogBookController.orig_GetPickupTooltipContent orig, UserProfile userProfile, Entry entry, EntryStatus status)
 {
     if (IsCustomItemOrEquipment((PickupIndex)entry.extraData))
     {
         UnlockableDef  unlockableDef = UnlockableCatalog.GetUnlockableDef(((PickupIndex)entry.extraData).GetUnlockableName());
         TooltipContent result        = default;
         result.titleToken = entry.nameToken;
         result.titleColor = entry.color;
         if (unlockableDef != null)
         {
             result.overrideBodyText = unlockableDef.getUnlockedString();
         }
         result.bodyToken = "LOGBOOK_CATEGORY_ITEM";
         result.bodyColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Unlockable);
         return(result);
     }
     return(orig(userProfile, entry, status));
 }
        public PartialFindResult<AlbumForApiContract> GetList(
            string query = "",
            DiscType discTypes = DiscType.Unknown,
            string tag = null,
            int? artistId = null,
            ArtistAlbumParticipationStatus artistParticipationStatus = ArtistAlbumParticipationStatus.Everything,
            bool childVoicebanks = false,
            string barcode = null,
            EntryStatus? status = null,
            int start = 0,
            int maxResults = defaultMax,
            bool getTotalCount = false,
            AlbumSortRule? sort = null,
            NameMatchMode nameMatchMode = NameMatchMode.Exact,
            AlbumOptionalFields fields = AlbumOptionalFields.None,
            ContentLanguagePreference lang = ContentLanguagePreference.Default)
        {
            query = FindHelpers.GetMatchModeAndQueryForSearch(query, ref nameMatchMode);

            var queryParams = new AlbumQueryParams(query, discTypes, start, Math.Min(maxResults, absoluteMax), false, getTotalCount, nameMatchMode, sort ?? AlbumSortRule.Name) {
                Tag = tag,
                ArtistId = artistId ?? 0,
                ArtistParticipationStatus = artistParticipationStatus,
                ChildVoicebanks = childVoicebanks,
                Barcode = barcode
            };
            queryParams.Common.EntryStatus = status;

            var ssl = WebHelper.IsSSL(Request);

            var entries = service.Find(a => new AlbumForApiContract(a, null, lang, thumbPersister, ssl, fields), queryParams);

            return entries;
        }
Beispiel #37
0
 public BufferEntry(HW.Network.NetworkDevice nic, IPPacket packet)
 {
     this.NIC = nic;
     this.Packet = packet;
     this.Status = EntryStatus.ADDED;
 }
        public PartialFindResult<SongForApiContract> GetList(
            string query = "",
            SongType songTypes = SongType.Unspecified,
            string tag = null,
            int? artistId = null,
            ArtistAlbumParticipationStatus artistParticipationStatus = ArtistAlbumParticipationStatus.Everything,
            bool childVoicebanks = false,
            bool onlyWithPvs = false,
            int? since = null,
            [FromUri] ContentLanguageSelections? lyrics = null,
            int? userCollectionId = null,
            EntryStatus? status = null,
            int start = 0, int maxResults = defaultMax, bool getTotalCount = false,
            SongSortRule sort = SongSortRule.Name,
            NameMatchMode nameMatchMode = NameMatchMode.Exact,
            SongOptionalFields fields = SongOptionalFields.None,
            ContentLanguagePreference lang = ContentLanguagePreference.Default)
        {
            query = FindHelpers.GetMatchModeAndQueryForSearch(query, ref nameMatchMode);
            var types = songTypes != SongType.Unspecified ? new[] { songTypes } : new SongType[0];

            var param = new SongQueryParams(query, types, start, Math.Min(maxResults, absoluteMax), false, getTotalCount, nameMatchMode, sort, false, false, null) {
                Tag = tag,
                OnlyWithPVs = onlyWithPvs,
                ArtistId = artistId ?? 0,
                ArtistParticipationStatus = artistParticipationStatus,
                ChildVoicebanks = childVoicebanks,
                TimeFilter = since.HasValue ? TimeSpan.FromHours(since.Value) : TimeSpan.Zero,
                LyricsLanguages = lyrics != null ? lyrics.Value.ToIndividualSelections().ToArray() : null,
                UserCollectionId = userCollectionId ?? 0
            };
            param.Common.EntryStatus = status;

            var artists = service.Find(s => new SongForApiContract(s, null, lang, fields), param);

            return artists;
        }