Exemplo n.º 1
0
        protected virtual async void EditOnTryMudBlazor()
        {
            // We use a seperator that wont be in code so we can send 2 files later
            var codeFiles = "__Main.razor" + (char)31 + Snippets.GetCode(Code);

            // Add dialogs for dialog examples
            if (Code.StartsWith("Dialog"))
            {
                var regex          = new Regex(@"\Show<(Dialog.*?_Dialog)\>");
                var dialogCodeName = regex.Match(codeFiles).Groups[1].Value;
                if (dialogCodeName != string.Empty)
                {
                    var dialogCodeFile = dialogCodeName + ".razor" + (char)31 + Snippets.GetCode(dialogCodeName);
                    codeFiles = codeFiles + (char)31 + dialogCodeFile;
                }
            }

            // Add Element.cs model for webapi periodic table
            if (codeFiles.Contains("webapi/periodictable", StringComparison.InvariantCultureIgnoreCase))
            {
                var elementCodeFile = "Element.cs" + (char)31 + Snippets.GetCode("Element");
                codeFiles = codeFiles + (char)31 + elementCodeFile;
            }

            var codeFileEncoded = codeFiles.ToCompressedEncodedUrl();
            // var tryMudBlazorLocation = "https://localhost:5001/";
            var tryMudBlazorLocation = "https://try.mudblazor.com/";
            var url = $"{tryMudBlazorLocation}snippet/{codeFileEncoded}";
            await JsApiService.OpenInNewTabAsync(url);
        }
Exemplo n.º 2
0
 public async Task<object> GetMatchDetails(dynamic args, JsApiService.JsResponse progress, JsApiService.JsResponse result)
 {
     object obj;
     string str = (string)args.realmId;
     long num = (long)args.matchId;
     JObject jObjects = (JObject)args.fill;
     Match matchDetailsInternal = await this.GetMatchDetailsInternal(str, num, (string source) => progress(source));
     Match match = matchDetailsInternal;
     if (match != null)
     {
         if (jObjects != null)
         {
             JToken item = jObjects["mapId"];
             if (match.MapId <= 0 && item != null)
             {
                 match.MapId = (int)item;
             }
             string item1 = (string)jObjects["queue"];
             if (string.IsNullOrEmpty(match.Queue) && !string.IsNullOrEmpty(item1))
             {
                 match.Queue = item1;
             }
         }
         JObject jObjects1 = JObject.FromObject(match, SerializerSettings.JsonSerializer);
         dynamic obj1 = jObjects1;
         MatchService.GameRewards additionalData = match.AdditionalData as MatchService.GameRewards;
         if (additionalData != null)
         {
             obj1.rewards = JObject.FromObject(additionalData, SerializerSettings.JsonSerializer);
             jObjects1.Remove("additionalData");
         }
         double totalMinutes = match.Length.TotalMinutes;
         int length = (int)match.Teams.Length;
         for (int i = 0; i < length; i++)
         {
             dynamic obj2 = obj1.teams[i];
             obj2.index = i;
             foreach (dynamic obj3 in (IEnumerable)obj2.members)
             {
                 dynamic obj4 = obj3;
                 obj4.goldPerMinute = (double)obj3.gold / totalMinutes;
             }
         }
         obj = obj1;
     }
     else
     {
         obj = null;
     }
     return obj;
 }
Exemplo n.º 3
0
    protected virtual async void RunOnTryMudBlazor()
    {
        string firstFile = "";

        if (Codes != null)
        {
            firstFile = Codes.FirstOrDefault().code;
        }
        else
        {
            firstFile = Code;
        }

        // We use a separator that wont be in code so we can send 2 files later
        var codeFiles = "__Main.razor" + (char)31 + Snippets.GetCode(firstFile);

        // Add dialogs for dialog examples
        if (firstFile.StartsWith("Dialog"))
        {
            var regex          = new Regex(@"\Show<(Dialog.*?_Dialog)\>");
            var dialogCodeName = regex.Match(codeFiles).Groups[1].Value;
            if (dialogCodeName != string.Empty)
            {
                var dialogCodeFile = dialogCodeName + ".razor" + (char)31 + Snippets.GetCode(dialogCodeName);
                codeFiles = codeFiles + (char)31 + dialogCodeFile;
            }
        }

        // Data models
        if (codeFiles.Contains("MudBlazor.Examples.Data.Models"))
        {
            if (Regex.Match(codeFiles, @"\bElement\b").Success)
            {
                var elementCodeFile = "Element.cs" + (char)31 + Snippets.GetCode("Element");
                codeFiles = codeFiles + (char)31 + elementCodeFile;
            }

            if (Regex.Match(codeFiles, @"\bServer\b").Success)
            {
                var serverCodeFile = "Server.cs" + (char)31 + Snippets.GetCode("Server");
                codeFiles = codeFiles + (char)31 + serverCodeFile;
            }
        }

        var codeFileEncoded = codeFiles.ToCompressedEncodedUrl();
        // var tryMudBlazorLocation = "https://localhost:5001/";
        var tryMudBlazorLocation = "https://try.mudblazor.com/";
        var url = $"{tryMudBlazorLocation}snippet/{codeFileEncoded}";
        await JsApiService.OpenInNewTabAsync(url);
    }
Exemplo n.º 4
0
 private async Task CopyTextToClipboard()
 {
     await JsApiService.CopyToClipboardAsync(Snippets.GetCode(Code));
 }
Exemplo n.º 5
0
 private async Task CopyTextToClipboard()
 {
     await JsApiService.CopyToClipboardAsync(IconCodeOutput);
 }
 public async Task GetOverview(object args, JsApiService.JsResponse onProgress, JsApiService.JsResponse onResult)
 {
   // ISSUE: reference to a compiler-generated field
   if (ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site65 == null)
   {
     // ISSUE: reference to a compiler-generated field
     ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site65 = CallSite<Func<CallSite, object, string>>.Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof (string), typeof (ProfileService)));
   }
   // ISSUE: reference to a compiler-generated field
   Func<CallSite, object, string> func1 = ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site65.Target;
   // ISSUE: reference to a compiler-generated field
   CallSite<Func<CallSite, object, string>> callSite1 = ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site65;
   // ISSUE: reference to a compiler-generated field
   if (ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site66 == null)
   {
     // ISSUE: reference to a compiler-generated field
     ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site66 = CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, "realm", typeof (ProfileService), (IEnumerable<CSharpArgumentInfo>) new CSharpArgumentInfo[1]
     {
       CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string) null)
     }));
   }
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   object obj1 = ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site66.Target((CallSite) ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site66, args);
   string realm = func1((CallSite) callSite1, obj1);
   // ISSUE: reference to a compiler-generated field
   if (ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site67 == null)
   {
     // ISSUE: reference to a compiler-generated field
     ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site67 = CallSite<Func<CallSite, object, string>>.Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof (string), typeof (ProfileService)));
   }
   // ISSUE: reference to a compiler-generated field
   Func<CallSite, object, string> func2 = ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site67.Target;
   // ISSUE: reference to a compiler-generated field
   CallSite<Func<CallSite, object, string>> callSite2 = ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site67;
   // ISSUE: reference to a compiler-generated field
   if (ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site68 == null)
   {
     // ISSUE: reference to a compiler-generated field
     ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site68 = CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, "summonerName", typeof (ProfileService), (IEnumerable<CSharpArgumentInfo>) new CSharpArgumentInfo[1]
     {
       CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string) null)
     }));
   }
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   object obj2 = ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site68.Target((CallSite) ProfileService.\u003CGetOverview\u003Eo__SiteContainer64.\u003C\u003Ep__Site68, args);
   string summonerName = func2((CallSite) callSite2, obj2);
   ConcurrentDictionary<string, object> dictionary = new ConcurrentDictionary<string, object>();
   Action publish = (Action) (() => onProgress((object) dictionary));
   dictionary["summonerName"] = (object) summonerName;
   publish();
   PublicSummoner summoner = await JsApiService.GetSummoner(realm, summonerName);
   if (summoner == null)
     throw new JsApiException("summoner-not-found");
   dictionary["summonerName"] = (object) summoner.Name;
   dictionary["summonerId"] = (object) summoner.SummonerId;
   dictionary["accountId"] = (object) summoner.AccountId;
   dictionary["level"] = (object) summoner.SummonerLevel;
   dictionary["iconId"] = (object) summoner.ProfileIconId;
   publish();
   await Task.WhenAll(this.GetPreviousRatings(realm, summoner.AccountId).ContinueWith(JsApiService.CreatePublisher<object>(dictionary, onProgress, "pastRatings")), this.GetLeagueSummary(realm, summoner.SummonerId).ContinueWith((Action<Task<ProfileService.JsLeague[]>>) (task =>
   {
     if (task.Status != TaskStatus.RanToCompletion)
       return;
     ProfileService.JsLeague[] result = task.Result;
     dictionary["currentRating"] = (object) (Enumerable.FirstOrDefault<ProfileService.JsLeague>((IEnumerable<ProfileService.JsLeague>) result, (Func<ProfileService.JsLeague, bool>) (x => x.Queue == "RANKED_SOLO_5x5")) ?? ProfileService.JsLeague.Unranked);
     dictionary["otherRatings"] = (object) Enumerable.Where<ProfileService.JsLeague>((IEnumerable<ProfileService.JsLeague>) result, (Func<ProfileService.JsLeague, bool>) (x => x.Queue != "RANKED_SOLO_5x5"));
     publish();
   })), this.GetMatchHistory(realm, summoner.AccountId).ContinueWith(JsApiService.CreatePublisher<object>(dictionary, onProgress, "games")), ProfileService.GetRankedChampions(realm, summoner.AccountId, "CLASSIC", "CURRENT").ContinueWith(JsApiService.CreatePublisher<object[]>(dictionary, onProgress, "champions")));
 }
 public async Task<AccountSetupService.SetupSummary> Setup(dynamic args, JsApiService.JsResponse progress, JsApiService.JsResponse result)
 {
     //Temp hack
     var func = "";
     var func1 = "";
     var func2 = "";
     func = null;
     func1 = null;
     func2 = null;
     int num = (int)args.handle;
     RiotAccount riotAccount = JsApiService.AccountBag.Get(num);
     Dictionary<string, Task> strs1 = new Dictionary<string, Task>()
     {
         { "runes", Task.FromResult<bool>(true) },
         { "masteries", this.ImportMasteries(riotAccount) },
         { "key-bindings", this.ImportKeyBindings() },
         { "game-settings", this.ImportGameSettings() }
     };
     Dictionary<string, Task> strs2 = strs1;
     Func<AccountSetupService.SetupSummary> func3 = () => {
         AccountSetupService.SetupSummary setupSummary = new AccountSetupService.SetupSummary();
         AccountSetupService.SetupSummary array = setupSummary;
         Dictionary<string, Task> strs = strs2;
         if (func == null)
         {
             func = (KeyValuePair<string, Task> item) => new { item = item, name = item.Key };
         }
         var collection = strs.Select(func);
         if (func1 == null)
         {
             func1 = (argument0) => new { <>h__TransparentIdentifier0 = argument0, task = argument0.item.Value };
         }
Exemplo n.º 8
0
 public async Task GetOverview(dynamic args, JsApiService.JsResponse onProgress, JsApiService.JsResponse onResult)
 {
     Func<ProfileService.JsLeague, bool> func = null;
     Func<ProfileService.JsLeague, bool> func1 = null;
     string str = (string)args.realm;
     string str1 = (string)args.summonerName;
     ConcurrentDictionary<string, object> name = new ConcurrentDictionary<string, object>();
     Action action = () => onProgress(name);
     name["summonerName"] = str1;
     action();
     PublicSummoner summoner = await JsApiService.GetSummoner(str, str1);
     if (summoner == null)
     {
         throw new JsApiException("summoner-not-found");
     }
     name["summonerName"] = summoner.Name;
     name["summonerId"] = summoner.SummonerId;
     name["accountId"] = summoner.AccountId;
     name["level"] = summoner.SummonerLevel;
     name["iconId"] = summoner.ProfileIconId;
     action();
     Task[] taskArray = new Task[] { this.GetPreviousRatings(str, summoner.AccountId).ContinueWith(JsApiService.CreatePublisher<object>(name, onProgress, "pastRatings")), this.GetLeagueSummary(str, summoner.SummonerId).ContinueWith((Task<ProfileService.JsLeague[]> task) => {
         if (task.Status != TaskStatus.RanToCompletion)
         {
             return;
         }
         ProfileService.JsLeague[] result = task.Result;
         ConcurrentDictionary<string, object> strs = name;
         ProfileService.JsLeague[] jsLeagueArray = result;
         if (func == null)
         {
             func = (ProfileService.JsLeague x) => x.Queue == "RANKED_SOLO_5x5";
         }
         strs["currentRating"] = ((IEnumerable<ProfileService.JsLeague>)jsLeagueArray).FirstOrDefault<ProfileService.JsLeague>(func) ?? ProfileService.JsLeague.Unranked;
         ConcurrentDictionary<string, object> strs1 = name;
         ProfileService.JsLeague[] jsLeagueArray1 = result;
         if (func1 == null)
         {
             func1 = (ProfileService.JsLeague x) => x.Queue != "RANKED_SOLO_5x5";
         }
         strs1["otherRatings"] = ((IEnumerable<ProfileService.JsLeague>)jsLeagueArray1).Where<ProfileService.JsLeague>(func1);
         action();
     }), this.GetMatchHistory(str, summoner.AccountId).ContinueWith(JsApiService.CreatePublisher<object>(name, onProgress, "games")), ProfileService.GetRankedChampions(str, summoner.AccountId, "CLASSIC", "CURRENT").ContinueWith(JsApiService.CreatePublisher<object[]>(name, onProgress, "champions")) };
     await Task.WhenAll(taskArray);
 }
 public async Task<AccountSetupService.SetupSummary> Setup(object args, JsApiService.JsResponse progress, JsApiService.JsResponse result)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AccountSetupService.\u003C\u003Ec__DisplayClasse cDisplayClasse = new AccountSetupService.\u003C\u003Ec__DisplayClasse();
   // ISSUE: reference to a compiler-generated field
   cDisplayClasse.progress = progress;
   // ISSUE: reference to a compiler-generated field
   if (AccountSetupService.\u003CSetup\u003Eo__SiteContainer5.\u003C\u003Ep__Site6 == null)
   {
     // ISSUE: reference to a compiler-generated field
     AccountSetupService.\u003CSetup\u003Eo__SiteContainer5.\u003C\u003Ep__Site6 = CallSite<Func<CallSite, object, int>>.Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof (int), typeof (AccountSetupService)));
   }
   // ISSUE: reference to a compiler-generated field
   Func<CallSite, object, int> func = AccountSetupService.\u003CSetup\u003Eo__SiteContainer5.\u003C\u003Ep__Site6.Target;
   // ISSUE: reference to a compiler-generated field
   CallSite<Func<CallSite, object, int>> callSite = AccountSetupService.\u003CSetup\u003Eo__SiteContainer5.\u003C\u003Ep__Site6;
   // ISSUE: reference to a compiler-generated field
   if (AccountSetupService.\u003CSetup\u003Eo__SiteContainer5.\u003C\u003Ep__Site7 == null)
   {
     // ISSUE: reference to a compiler-generated field
     AccountSetupService.\u003CSetup\u003Eo__SiteContainer5.\u003C\u003Ep__Site7 = CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, "handle", typeof (AccountSetupService), (IEnumerable<CSharpArgumentInfo>) new CSharpArgumentInfo[1]
     {
       CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string) null)
     }));
   }
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   object obj = AccountSetupService.\u003CSetup\u003Eo__SiteContainer5.\u003C\u003Ep__Site7.Target((CallSite) AccountSetupService.\u003CSetup\u003Eo__SiteContainer5.\u003C\u003Ep__Site7, args);
   int handle = func((CallSite) callSite, obj);
   RiotAccount account = JsApiService.AccountBag.Get(handle);
   // ISSUE: reference to a compiler-generated field
   cDisplayClasse.items = new Dictionary<string, Task>()
   {
     {
       "runes",
       (Task) Task.FromResult<bool>(true)
     },
     {
       "masteries",
       this.ImportMasteries(account)
     },
     {
       "key-bindings",
       this.ImportKeyBindings()
     },
     {
       "game-settings",
       this.ImportGameSettings()
     }
   };
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   cDisplayClasse.getSetupSummary = new Func<AccountSetupService.SetupSummary>(cDisplayClasse.\u003CSetup\u003Eb__8);
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   cDisplayClasse.publishStatus = new Action<Task>(cDisplayClasse.\u003CSetup\u003Eb__c);
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   IEnumerable<Task> async = Enumerable.Select<Task, Task>((IEnumerable<Task>) cDisplayClasse.items.Values, new Func<Task, Task>(cDisplayClasse.\u003CSetup\u003Eb__d));
   try
   {
     await Task.WhenAll(async);
   }
   catch
   {
   }
   await JsApiService.Client.Invoke("mess.flags.firstRun.set");
   // ISSUE: reference to a compiler-generated field
   return cDisplayClasse.getSetupSummary();
 }