Exemplo n.º 1
0
        public AstoriaR(DroidApp app)
        {
            runningApp = app;
            edw        = new EnhancedDexWriter();

            foreach (Class c in app.dex.GetClasses())
            {
                if (c.Name.StartsWith(app.metadata.packageName + ".R") && c.Name.Contains("$"))
                {
                    string[] name = c.Name.Split('$');
                    try
                    {
                        switch (name[1])
                        {
                        case "color":
                            SetSubClass(color, c);
                            break;

                        case "layout":
                            SetSubClass(layout, c);
                            break;
                        }
                    }
                    catch { }
                }
            }
        }
Exemplo n.º 2
0
        public static async Task <AstoriaResources> CreateAsync(DroidApp da)
        {
            AstoriaResources temp = new AstoriaResources(da);
            await temp.EnumFiles();

            return(temp);
        }
Exemplo n.º 3
0
 public AstoriaContext(DroidApp da, AstoriaResources res)
 {
     runningApp = da;
     RClass     = new AstoriaR(runningApp);
     resObj     = res;
     da.context = this;
 }
Exemplo n.º 4
0
        public DalvikCPU(Dex d, string pName, EmuPage hostPg)
        {
            dex         = d;
            packageName = pName;
            hostPage    = hostPg;
            da          = hostPage.RunningApp;
            da.cpu      = this;

            hostPage.setPreloadStatusText("Setting up app environment...");
        }
Exemplo n.º 5
0
        public AstoriaContext(DroidApp da)
        {
            runningApp = da;
            RClass     = new AstoriaR(runningApp);
            //resObj = new AstoriaResources(runningApp);

            //Inflate manifest, inflate RClass using dex.net

            /*string layoutAbsoluteUri = runningApp.localAppRoot.Path + "\\AndroidManifest.xml";
             *
             * IAsyncOperation<StorageFile> task1 = StorageFile.GetFileFromPathAsync(layoutAbsoluteUri);
             * StorageFile sf = task1.GetResults();
             *
             * Task<byte[]> task = DalvikUWPCSharp.Disassembly.Util.ReadFile(sf);
             * byte[] xmlfile = task.Result;
             *
             * using (MemoryStream ms = new MemoryStream(xmlfile))
             * {
             *  AndroidXmlReader man = new AndroidXmlReader(ms);
             *  man.MoveToContent();
             *  XDocument LINQData = new XDocument(man);
             *
             *  foreach (XElement xe in LINQData.Elements(XName.Get("activity")))
             *  {
             *      AstoriaActivity a = new AstoriaActivity(this);
             *
             *      foreach (XElement xe2 in xe.Descendants())
             *      {
             *          if (xe2.Name.Equals("intent-filter"))
             *          {
             *              Intent i = new Intent();
             *
             *              foreach (XElement xe3 in xe2.Descendants())
             *              {
             *                  if (xe3.Name.Equals("action"))
             *                  {
             *                      string act = xe3.Attribute(XName.Get("{http://schemas.android.com/apk/res/android}name")).Value;
             *                      i.setAction(act);
             *                  }
             *
             *                  if (xe3.Name.Equals("category"))
             *                  {
             *                      string cat = xe3.Attribute(XName.Get("{http://schemas.android.com/apk/res/android}name")).Value;
             *                      i.addCategory(cat);
             *                  }
             *              }
             *
             *              a.setIntent(i);
             *          }
             *      }
             *
             *      Activities.Add(a);
             *  }
             * }*/
        }
Exemplo n.º 6
0
        public static async Task LoadAPK(FileActivatedEventArgs e)
        {
            StorageFile sf = (StorageFile)e.Files[0];

            //Debug.WriteLine("When do I get called?");
            //var appsRoot = await localFolder.CreateFolderAsync("Apps", CreationCollisionOption.OpenIfExists);
            //StorageFile copiedFile = await sf.CopyAsync(appsRoot, sf.Name, NameCollisionOption.GenerateUniqueName);

            //ApkParser parser = await ApkParser.CreateAsync(copiedFile);
            //ApkMeta meta = await parser.getApkMeta();
            //apkpage.SetDisplayName(meta.getName());
            apkpage.SetDisplayName(sf.DisplayName);
            CurrentApp = await DroidApp.CreateAsync(sf);

            apkpage.appletLoaded(CurrentApp, EventArgs.Empty);
            //Debug.WriteLine($"cf is null: {CurrentFile == null}");
        }
Exemplo n.º 7
0
        private async void AppListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems[0] is string)
            {
                bgGrid.Children.Add(new DroidAppLoadingPopup());

                var appsRoot = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Apps", CreationCollisionOption.OpenIfExists);

                string   lbi = (string)e.AddedItems[0];
                DroidApp da  = await DroidApp.CreateAsync(await appsRoot.GetFolderAsync(lbi));

                da.Run(Frame);
            }

            else
            {
                Frame.Navigate(typeof(SettingsPage));
            }
        }
Exemplo n.º 8
0
        /*private void Current_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
         * {
         *  UserControl appView = (UserControl)RenderTargetBox.Child;
         *  appView.Width = (this.ActualWidth) * (40/37);
         *  appView.Height = (this.ActualHeight - 48) * (40 / 37);
         * }*/

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            //base.OnNavigatedTo(e);
            if (e.Parameter.GetType().Equals(typeof(DroidApp)))
            {
                RunningApp      = (DroidApp)e.Parameter;
                appImage.Source = RunningApp.appIcon;
                //UIRenderer = new Renderer((DroidApp)e.Parameter);
                //cpu = new DalvikCPU(((DroidApp)e.Parameter).dex, ((DroidApp)e.Parameter).metadata.packageName, this);
                //cpu.Start();
                //await Render();
            }

            else if (e.Parameter.GetType().Equals(typeof(StorageFolder)))
            {
                setPreloadStatusText("Setting up app environment");
                RunningApp = await DroidApp.CreateAsync((StorageFolder)e.Parameter);
            }
        }
Exemplo n.º 9
0
 private AstoriaResources(DroidApp infoWars) : base()
 {
     currentApp = infoWars;
 }
Exemplo n.º 10
0
 public PreloadedDroidApp(DroidApp da)
 {
     runningApp     = da;
     currentContext = new AstoriaContext(runningApp);
     currentRes     = new AstoriaR(da);
 }
Exemplo n.º 11
0
 public Renderer(DroidApp da)
 {
     CurrentApp = da;
 }