예제 #1
0
        void IClassifyObjectProcessor.AfterDeserialize()
        {
            if (SortKey == null || SortKey == "")
            {
                SortKey = Regex.Replace(Name, @"^The |[^a-zA-Z0-9]", "", RegexOptions.IgnoreCase).ToUpperInvariant();
            }

            if (Type == KtaneModuleType.Regular || Type == KtaneModuleType.Needy || Type == KtaneModuleType.Holdable)
            {
                DefuserDifficulty ??= KtaneModuleDifficulty.Easy;
                ExpertDifficulty ??= KtaneModuleDifficulty.Easy;
            }
            else
            {
                DefuserDifficulty = null;
                ExpertDifficulty  = null;
                RuleSeedSupport   = KtaneSupport.NotSupported;
            }

            if (TutorialVideos != null && TutorialVideos.Length == 0)
            {
                TutorialVideos = null;
            }

            if (Type != KtaneModuleType.Regular)
            {
                Souvenir = new KtaneSouvenirInfo {
                    Status = KtaneModuleSouvenir.NotACandidate
                }
            }
            ;
            else if (Souvenir != null && Souvenir.Status == KtaneModuleSouvenir.Unexamined)
            {
                Souvenir = null;
            }
            else if (Souvenir != null && Souvenir.Status != KtaneModuleSouvenir.Considered)
            {
                Souvenir.Explanation = null;
            }

            if (Ignore != null && Ignore.Length == 0)
            {
                Ignore = null;
            }

            if (Symbol != null && Symbol.Length > 0)
            {
                Symbol = Symbol.Substring(0, 1).ToUpperInvariant() + Symbol.Substring(1).ToLowerInvariant();
            }

            if (SourceUrl != null)
            {
                License = KtaneModuleLicense.OpenSource;
            }
        }
예제 #2
0
        void IClassifyObjectProcessor.AfterDeserialize()
        {
            if (SortKey == null || SortKey == "")
            {
                SortKey = Regex.Replace(Name, @"^The |[^a-zA-Z0-9]", "", RegexOptions.IgnoreCase).ToUpperInvariant();
            }

            if (Type == KtaneModuleType.Regular || Type == KtaneModuleType.Needy)
            {
                DefuserDifficulty = DefuserDifficulty ?? KtaneModuleDifficulty.Easy;
                ExpertDifficulty  = ExpertDifficulty ?? KtaneModuleDifficulty.Easy;
            }
            else
            {
                DefuserDifficulty = null;
                ExpertDifficulty  = null;
                TwitchPlays       = null;
                RuleSeedSupport   = KtaneSupport.NotSupported;
            }

            if (TutorialVideoUrl == "")
            {
                TutorialVideoUrl = null;
            }

            if (Souvenir != null && Souvenir.Status == KtaneModuleSouvenir.Unexamined)
            {
                Souvenir = null;
            }
            else if (Souvenir != null && Souvenir.Status != KtaneModuleSouvenir.Considered)
            {
                Souvenir.Explanation = null;
            }

            if (TwitchPlays != null)
            {
                TwitchPlays.NeedyScoring = Type == KtaneModuleType.Needy ? (TwitchPlays.NeedyScoring ?? KtaneTwitchPlaysNeedyScoring.Solves).Nullable() : null;
            }

            if (Ignore != null && Ignore.Length == 0)
            {
                Ignore = null;
            }

            if (Symbol != null && Symbol.Length > 0)
            {
                Symbol = Symbol.Substring(0, 1).ToUpperInvariant() + Symbol.Substring(1).ToLowerInvariant();
            }

            if (SourceUrl != null)
            {
                License = KtaneModuleLicense.OpenSource;
            }
        }
예제 #3
0
        void IClassifyObjectProcessor.AfterDeserialize()
        {
            if (SortKey == null || SortKey == "")
            {
                SortKey = Regex.Replace(Name, @"^The |[^a-zA-Z0-9]", "", RegexOptions.IgnoreCase).ToUpperInvariant();
            }

            if (Type == KtaneModuleType.Regular || Type == KtaneModuleType.Needy)
            {
                DefuserDifficulty = DefuserDifficulty ?? KtaneModuleDifficulty.Easy;
                ExpertDifficulty  = ExpertDifficulty ?? KtaneModuleDifficulty.Easy;
            }
            else
            {
                DefuserDifficulty = null;
                ExpertDifficulty  = null;
                TwitchPlays       = null;
                RuleSeedSupport   = KtaneSupport.NotSupported;
            }

            if (TutorialVideoUrl == "")
            {
                TutorialVideoUrl = null;
            }

            if (Souvenir != null && Souvenir.Status == KtaneModuleSouvenir.Unexamined)
            {
                Souvenir = null;
            }
            else if (Souvenir != null && Souvenir.Status != KtaneModuleSouvenir.Considered)
            {
                Souvenir.Explanation = null;
            }

            if (Ignore != null)
            {
                Array.Sort(Ignore, StringComparer.InvariantCultureIgnoreCase);
            }

            if (TwitchPlays != null)
            {
                TwitchPlays.NeedyScoring = Type == KtaneModuleType.Needy ? (TwitchPlays.NeedyScoring ?? KtaneTwitchPlaysNeedyScoring.Solves).Nullable() : null;
            }

            if (Ignore != null)
            {
                Ignore = Ignore.Where(s => !string.IsNullOrWhiteSpace(s)).ToArray();
                if (Ignore.Length == 0)
                {
                    Ignore = null;
                }
            }
        }