public Writer.Page ToWriterObject(int pageNo, bool x2)
        {
            var page = new Writer.Page(pageNo);

            var selectedRes = (from b in Resources
                              where b.pageId == pageNo && b.x2 == false
                               select b);
            var selectedMeta = (from b in PageMeta
                                where b.pageId == pageNo && b.x2 == false
                                select b).Include(m => m.narr).Include(m => m.lines).Include(m => m.narr.subTexts).Include(m => m.lines.Select(l => l.subTexts)).First();
            var selectedLinks = (from b in Links
                                where b.pageId == pageNo
                                 select b).ToList();

            List < Parser.Link> lnks = new List < Parser.Link>();
            foreach (var l in selectedLinks)
                lnks.Add(new Parser.Link(l.originalText, l.linkTo));
            page.links = lnks.ToArray();

            List<Parser.Resource> res = new List<Parser.Resource>();
            foreach (var r in selectedRes)
            {
                var tmp = new Parser.Resource(r.data, r.originalFileName, r.titleText);
                tmp.isInPesterLog = r.isInPesterLog;
                res.Add(tmp);
            }
            page.resources = res.ToArray();

            page.meta = new Parser.Text();
            page.meta.altText = selectedMeta.altText;
            page.meta.lines = selectedMeta.GetScriptLines();
            if (selectedMeta.narr != null)
                page.meta.narr = selectedMeta.narr.ToParserObject();
            else if (page.meta.lines == null)
                page.meta.narr = new Parser.Text.ScriptLine("#000000", "", 0);
            page.meta.promptType = selectedMeta.promptType;
            page.meta.title = selectedMeta.title;

            if(x2){

                page.links2 = page.links;
                page.links = null;

                selectedRes = (from b in Resources
                              where b.pageId == pageNo && b.x2 == true
                               select b);

                selectedMeta = (from b in PageMeta
                                    where b.pageId == pageNo && b.x2 == true
                                select b).Include(m => m.narr).Include(m => m.lines).Include(m => m.narr.subTexts).Include(m => m.lines.Select(l => l.subTexts)).First();
                res.Clear();
                foreach (var r in selectedRes)
                {
                    var tmp = new Parser.Resource(r.data, r.originalFileName, r.titleText);
                    tmp.isInPesterLog = r.isInPesterLog;
                    res.Add(tmp);
                }
                page.resources2 = res.ToArray();

                page.meta2 = new Parser.Text();
                page.meta2.altText = selectedMeta.altText;
                page.meta2.lines = selectedMeta.GetScriptLines();
                if (selectedMeta.narr != null)
                    page.meta2.narr = selectedMeta.narr.ToParserObject();
                else if (page.meta2.lines == null)
                    page.meta2.narr = new Parser.Text.ScriptLine("#000000", "", 0);
                page.meta2.promptType = selectedMeta.promptType;
                page.meta2.title = selectedMeta.title;
            }

            return page;
        }
Beispiel #2
0
        void HandlePageSmash2(WrapBGW bgw, int progress)
        {
            if (bgw != null)
                bgw.ReportProgress(progress, "Now parsing Caliborn's second hissy fit.");
            Parser.Resource[] FUCKYOU = new Parser.Resource[1];
            FUCKYOU[0] = new Parser.Resource(Parser.DownloadFile("http://www.mspaintadventures.com/007680/05777_2.swf"), "05777_2.swf");

            var fileSize2 = FUCKYOU[0].data.Count();
            totalMegabytesDownloaded += (float)fileSize2 / (1024.0f * 1024.0f);
            if (bgw != null)
                bgw.ReportProgress(progress, FUCKYOU[0].originalFileName + ": " + fileSize2 / 1024 + "KB");

            Parser.Link[] lnk = new Parser.Link[1];
            lnk[0] = new Parser.Link("", (int)PagesOfImportance.CALIBORN_PAGE_SMASH2 + 1);
            Parser.Text asdf = new Parser.Text();
            asdf.narr = new Parser.Text.ScriptLine("#000000", "", 0);
            asdf.title = "[S] Cascade.";
            WritePageToDB(new Page((int)PagesOfImportance.CALIBORN_PAGE_SMASH2, asdf, FUCKYOU, lnk));
        }
Beispiel #3
0
        void HandleYoutubeVideo(WrapBGW bgw, int progress, bool AIsCollide)
        {
            //do not under any circumstances let 2 videos download at once, it'll kill the memory
            lock (FVideoDownloadLock)
            {
                if (bgw != null)
                    bgw.ReportProgress(progress, "Now parsing " + (AIsCollide ? " Collide." : "the end...") + " This will take a while...", true);
                var VidObject = YouTube.Default.GetVideo(AIsCollide ? "https://www.youtube.com/watch?v=Y5wYN6rB_Rg" : "https://www.youtube.com/watch?v=FevMNMwvdPw");

                var DLTask = VidObject.GetBytesAsync();
                if (bgw != null)
                    do
                    {
                        Thread.Sleep(100);
                        if (bgw.bgw.Cancelled())
                        {
                            bgw.ReportProgress(progress, "Video download cancelled");
                            throw new Exception();
                        }
                    } while (!DLTask.IsCompleted);

                Parser.Resource[] TheVid = new Parser.Resource[1];
                TheVid[0] = new Parser.Resource(DLTask.Result, "video" + VidObject.FileExtension);

                var fileSize2 = TheVid[0].data.Count();
                totalMegabytesDownloaded += (float)fileSize2 / (1024.0f * 1024.0f);
                if (bgw != null)
                    bgw.ReportProgress(progress, TheVid[0].originalFileName + ": " + fileSize2 / 1024 + "KB");

                Parser.Text asdf = new Parser.Text();
                Parser.Link[] lnk = new Parser.Link[1];
                asdf.narr = new Parser.Text.ScriptLine("#000000", "", 0);
                if (AIsCollide)
                {
                    asdf.title = "[S] Collide";
                    lnk[0] = new Parser.Link("END OF ACT 6", (int)PagesOfImportance.COLLIDE + 1);
                }
                else
                {
                    asdf.narr = new Parser.Text.ScriptLine("#000000", "", 0);
                    asdf.title = "[S] ACT 7";
                    lnk[0] = new Parser.Link("==>", (int)PagesOfImportance.ACT7 + 1);
                }
                WritePageToDB(new Page(AIsCollide ? (int)PagesOfImportance.COLLIDE : (int)PagesOfImportance.ACT7, asdf, TheVid, new Parser.Link[0]));
                GC.Collect();
            }
        }
Beispiel #4
0
        void HandleJailbreakLast(WrapBGW bgw, int progress)
        {
            if (bgw != null)
                bgw.ReportProgress(progress, "Now parsing your victory.");
            Parser.Resource[] FUCKYOU = new Parser.Resource[1];
            FUCKYOU[0] = new Parser.Resource(Parser.DownloadFile("http://cdn.mspaintadventures.com/storyfiles/jb2/YOUWIN.gif"), "YOUWIN.gif");

            var fileSize2 = FUCKYOU[0].data.Count();
            totalMegabytesDownloaded += (float)fileSize2 / (1024.0f * 1024.0f);
            if (bgw != null)
                bgw.ReportProgress(progress, FUCKYOU[0].originalFileName + ": " + fileSize2 / 1024 + "KB");

            Parser.Text asdf = new Parser.Text();
            asdf.narr = new Parser.Text.ScriptLine("#000000", "Would you like to play again?", 0);
            asdf.title = "Enjoy restful slumber.";
            WritePageToDB(new Page((int)PagesOfImportance.JAILBREAK_LAST_PAGE, asdf, FUCKYOU, new Parser.Link[0]));
        }
Beispiel #5
0
        void HandleOvershine(WrapBGW bgw, int progress)
        {
            if (bgw != null)
                bgw.ReportProgress(progress, "Now parsing zap.");
            Parser.Resource[] FUCKYOU = new Parser.Resource[1];
            FUCKYOU[0] = new Parser.Resource(Parser.DownloadFile("http://cdn.mspaintadventures.com/storyfiles/hs2/07401.gif"), "07401.gif");

            var fileSize2 = FUCKYOU[0].data.Count();
            totalMegabytesDownloaded += (float)fileSize2 / (1024.0f * 1024.0f);
            if (bgw != null)
                bgw.ReportProgress(progress, FUCKYOU[0].originalFileName + ": " + fileSize2 / 1024 + "KB");

            Parser.Text asdf = new Parser.Text();
            asdf.narr = new Parser.Text.ScriptLine("#000000", "", 0);
            asdf.title = "";
            Parser.Link[] lnk = new Parser.Link[1];
            lnk[0] = new Parser.Link("[S][A6A6I4] ====>", (int)PagesOfImportance.OVERSHINE + 1);
            WritePageToDB(new Page((int)PagesOfImportance.OVERSHINE, asdf, FUCKYOU, lnk));
        }
Beispiel #6
0
        void HandleDota(WrapBGW bgw, int progress)
        {
            if (bgw != null)
                bgw.ReportProgress(progress, "Now parsing Hussie's rekage.");
            Parser.Resource[] FUCKYOU = new Parser.Resource[1];
            FUCKYOU[0] = new Parser.Resource(Parser.DownloadFile("http://cdn.mspaintadventures.com/DOTA/04812.swf"), "04812.swf");

            var fileSize2 = FUCKYOU[0].data.Count();
            totalMegabytesDownloaded += (float)fileSize2 / (1024.0f * 1024.0f);
            if (bgw != null)
                bgw.ReportProgress(progress, FUCKYOU[0].originalFileName + ": " + fileSize2 / 1024 + "KB");

            Parser.Text asdf = new Parser.Text();
            asdf.narr = new Parser.Text.ScriptLine("#000000", "", 0);
            asdf.title = "";
            Parser.Link[] lnk = new Parser.Link[1];
            lnk[0] = new Parser.Link("", (int)PagesOfImportance.DOTA + 1);
            WritePageToDB(new Page((int)PagesOfImportance.DOTA, asdf, FUCKYOU, lnk));
        }
Beispiel #7
0
        void HandleCascade(WrapBGW bgw, int progress)
        {
            //cascade is hosted on newgrounds
            //also its split into a loader and 5 segments
            /*
             * Thank you based /u/Niklink
            http://uploads.ungrounded.net/userassets/3591000/3591093/cascade_loaderExt.swf
            http://uploads.ungrounded.net/userassets/3591000/3591093/cascade_segment1.swf
            http://uploads.ungrounded.net/userassets/3591000/3591093/cascade_segment2.swf
            http://uploads.ungrounded.net/userassets/3591000/3591093/cascade_segment3.swf
            http://uploads.ungrounded.net/userassets/3591000/3591093/cascade_segment4.swf
            http://uploads.ungrounded.net/userassets/3591000/3591093/cascade_segment5.swf
             *
             * They are actually also availiable on the www and cdn, so we can try those too
             */
            if (bgw != null)
                bgw.ReportProgress(progress, "Now parsing Cascade", true);
            Parser.Resource[] cascadeSegments = new Parser.Resource[7];
            Parser.Link[] next = new Parser.Link[1];
            next[0] = new Parser.Link("END OF ACT 5", (int)PagesOfImportance.CASCADE + 1);
            try
            {
                cascadeSegments[0] = new Parser.Resource(Parser.DownloadFile("http://uploads.ungrounded.net/userassets/3591000/3591093/cascade_loaderExt.swf"), "cascade_loaderExt.swf");
            }
            catch
            {
                cascadeSegments[0] = new Parser.Resource(Parser.DownloadFile("http://cdn.mspaintadventures.com/cascade/cascade_loaderExt.swf"), "cascade_loaderExt.swf");
            }
            var fileSize = cascadeSegments[0].data.Count();
            totalMegabytesDownloaded += (float)fileSize / (1024.0f * 1024.0f);
            if (bgw != null)
            {
                bgw.ReportProgress(progress, cascadeSegments[0].originalFileName + ": " + fileSize / 1024 + "KB");
                if (bgw.bgw.Cancelled())
                {
                    bgw.ReportProgress(progress, "Cascade download cancelled");
                    throw new Exception();
                }
            }
            for (int i = 1; i <= 5; ++i){

                try
                {
                    cascadeSegments[i] = new Parser.Resource(Parser.DownloadFile("http://uploads.ungrounded.net/userassets/3591000/3591093/cascade_segment" + i + ".swf"), "cascade_segment" + i + ".swf");
                }
                catch
                {
                    cascadeSegments[i] = new Parser.Resource(Parser.DownloadFile("http://cdn.mspaintadventures.com/cascade/cascade_segment" + i + ".swf"), "cascade_segment" + i + ".swf");
                }
                var fileSize2 = cascadeSegments[i].data.Count();
                totalMegabytesDownloaded += (float)fileSize2 / (1024.0f * 1024.0f);
                if (bgw != null)
                {
                    bgw.ReportProgress(progress, cascadeSegments[i].originalFileName + ": " + fileSize2 / 1024 + "KB");
                    if (bgw.bgw.Cancelled())
                    {
                        bgw.ReportProgress(progress, "Cascade download cancelled");
                        throw new Exception();
                    }
                }
            }

            cascadeSegments[6] = new Parser.Resource(Parser.DownloadFile("http://www.mspaintadventures.com/images/header_cascade.gif"), "header_cascade.gif");

            Parser.Text asdf = new Parser.Text();
            asdf.narr = new Parser.Text.ScriptLine("#000000", "", 0);
            asdf.title = "[S] Cascade.";

            WritePageToDB(new Page((int)PagesOfImportance.CASCADE, asdf, cascadeSegments, next));

            if (bgw != null)
                bgw.ReportProgress(progress, "Cascade committed!");
        }
Beispiel #8
0
        void FailToHandleVriska(WrapBGW bgw, int progress)
        {
            if (bgw != null)
                bgw.ReportProgress(progress, "Now parsing the huge 8itch.");
            Parser.Resource[] FUCKYOU = new Parser.Resource[1];
            FUCKYOU[0] = new Parser.Resource(Parser.DownloadFile("http://www.mspaintadventures.com/shes8ack/07402.swf"), "07402.swf");

            var fileSize2 = FUCKYOU[0].data.Count();
            totalMegabytesDownloaded += (float)fileSize2 / (1024.0f * 1024.0f);
            if (bgw != null)
                bgw.ReportProgress(progress, FUCKYOU[0].originalFileName + ": " + fileSize2 / 1024 + "KB");

            Parser.Text asdf = new Parser.Text();
            asdf.narr = new Parser.Text.ScriptLine("#000000", "", 0);
            asdf.title = "";
            Parser.Link[] lnk = new Parser.Link[1];
            lnk[0] = new Parser.Link("", (int)PagesOfImportance.SHES8ACK + 1);
            WritePageToDB(new Page((int)PagesOfImportance.SHES8ACK, asdf, FUCKYOU, lnk));
        }
Beispiel #9
0
        void FailMiserably(WrapBGW bgw, int progress)
        {
            if (bgw != null)
                bgw.ReportProgress(progress, "Now parsing death.");
            Parser.Resource[] FUCKYOU = new Parser.Resource[1];
            FUCKYOU[0] = new Parser.Resource(Parser.DownloadFile("http://cdn.mspaintadventures.com/storyfiles/hs2/GAMEOVER/06898.swf"), "06898.swf");

            var fileSize2 = FUCKYOU[0].data.Count();
            totalMegabytesDownloaded += (float)fileSize2 / (1024.0f * 1024.0f);
            if (bgw != null)
                bgw.ReportProgress(progress, FUCKYOU[0].originalFileName + ": " + fileSize2 / 1024 + "KB");

            Parser.Text asdf = new Parser.Text();
            asdf.narr = new Parser.Text.ScriptLine("#000000", "", 0);
            asdf.title = "";
            Parser.Link[] lnk = new Parser.Link[1];
            lnk[0] = new Parser.Link("", (int)PagesOfImportance.GAMEOVER + 1);
            WritePageToDB(new Page((int)PagesOfImportance.GAMEOVER, asdf, FUCKYOU, lnk));
        }
Beispiel #10
0
 void InitOpenbound()
 {
     SetFlashDimensions();
     string sburbpath = null;
     for (int I = 0; I < page.resources.Length; ++I)
     {
         var ofn = page.resources[I].originalFileName;
         var p = WriteTempResource(ref page.resources[I], true);
         if (p != null)
             sburbpath = ofn;
     }
     flash.WebBrowserShortcutsEnabled = false;
     var htmlstring = "<!DOCTYPE html><html><style>* { padding:0; margin:0; overflow:hidden; }</style><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /><script type=\"text/javascript\" src=\"" + sburbpath + "\"></script></head><body class=\"padding: 0; margin: 0;\" id=\"JterniaDeploy\" onload=\"Sburb.initialize('JterniaDeploy','" + page.meta.altText + "',false);\"></body></html>";
     byte[] bytes = Encoding.UTF8.GetBytes(htmlstring);
     var tmpres = new Parser.Resource(bytes, "openbound.html");
     string pageLoc = WriteTempResource(ref tmpres);
     openbound = new OpenboundServer(pageLoc);
     flash.Navigate(openbound.GetTargetPage());
 }