コード例 #1
0
ファイル: MainClass.cs プロジェクト: exelix11/Yata-online
        static void SaveTheme()
        {
            if (!Window.Confirm("Save theme ?\r\nThis might take up to a minute, don't close this page"))
            {
                return;
            }
            HTMLInputElement bgm = Document.GetElementById <HTMLInputElement>("EnableBGMchb");

            t.BGM = bgm.Checked;

            t.TopScreenFrameType = (uint)TopFrameType.SelectedIndex;
            t.BotScreenFrameType = (uint)BotFrameType.SelectedIndex;

            ApplyColorsToTheme();

            DoActionWithloading(() =>
            {
                byte[] themedata      = t.MakeTheme();
                Lz11Compression c     = new Lz11Compression();
                MemoryStream inData   = new MemoryStream(themedata);
                MemoryStream compData = new MemoryStream();

                if (Document.GetElementById <HTMLInputElement>("Fastbuild").Checked)
                {
                    c.ArchiveNoCompression(inData, compData);
                }
                else
                {
                    c.Compress(inData, compData);
                }

                Uint8Array dwn = new Uint8Array(compData.ToArray());
                Script.Write("downloadBlob(dwn,'Body_LZ.bin','application/octet-stream');");
            });
        }
コード例 #2
0
ファイル: MainClass.cs プロジェクト: exelix11/Yata-online
 static void LoadThemeFromByteArr(byte[] data)
 {
     DoActionWithloading(() =>
     {
         Lz11Compression c    = new Lz11Compression();
         MemoryStream inData  = new MemoryStream(data);
         MemoryStream decData = new MemoryStream();
         c.Decompress(inData, decData);
         decData.Position = 0;
         t = Theme.ReadTheme(decData);
         if (!(t.TopScreenDrawType == 3 && t.BotScreenDrawType == 3))
         {
             Window.Alert("Theme draw type not supported");
             t = null;
             return;
         }
         UpdateThemeDIV();
     });
 }