Esempio n. 1
0
 public static void UploadSZS(Uint8Array arr)         //called from js
 {
     DoActionWithloading(() =>
     {
         byte[] sarc = ManagedYaz0.Decompress(arr.ToArray());
         CommonSzs   = SARCExt.SARC.UnpackRamN(sarc);
         sarc        = null;
         while (LayoutsComboBox.LastChild.TextContent != "Don't patch")
         {
             LayoutsComboBox.RemoveChild(LayoutsComboBox.LastChild);
         }
         targetPatch = SwitchThemesCommon.DetectSarc(CommonSzs, DefaultTemplates.templates);
         if (targetPatch == null)
         {
             Window.Alert("This is not a valid theme file, if it's from a newer firmware it's not compatible with this tool yet");
             CommonSzs               = null;
             targetPatch             = null;
             lblDetected.TextContent = "";
             return;
         }
         lblDetected.TextContent = "Detected " + targetPatch.TemplateName + " " + targetPatch.FirmName;
         for (int i = 0; i < layoutPatches.Length; i++)
         {
             if (layoutPatches[i] != null && layoutPatches[i].IsCompatible(CommonSzs))
             {
                 LayoutsComboBox.Add(new HTMLOptionElement()
                 {
                     TextContent = layoutPatches[i].ToString(), Value = i.ToString()
                 });
             }
         }
     });
 }
Esempio n. 2
0
        public static void HomePartBoxOnChange()
        {
            if (HomePartBox_NX.SelectedIndex <= 0)
            {
                return;
            }

            while (LayoutsComboBox_NX.LastChild.TextContent != "Don't patch")
            {
                LayoutsComboBox_NX.RemoveChild(LayoutsComboBox_NX.LastChild);
            }
            for (int i = 0; i < layoutPatches.Length; i++)
            {
                if (layoutPatches[i] != null && (layoutPatches[i].TargetName == null ||
                                                 layoutPatches[i].TargetName.Contains(SwitchThemesCommon.PartToFileName[HomePartBox_NX.Value])))
                {
                    LayoutsComboBox_NX.Add(new HTMLOptionElement()
                    {
                        TextContent = layoutPatches[i].ToString(), Value = i.ToString()
                    });
                }
            }
        }