Beispiel #1
0
        public override void Run()
        {
            if (!_xap.isUnpacked)
            {
                _xap.ParseXAP();
            }
            if (_xap.StripDRM())
            {
                _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "DRM file was removed." + Environment.NewLine);
            }
            foreach (string item in _xap.dllFiles)
            {
                if (!_xap.IsTarget(item.Substring(item.LastIndexOf("\\") + 1)))
                {
                    _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Skipping excluded assembly: " + item + Environment.NewLine);
                    continue;
                }
                try
                {
                    System.Reflection.AssemblyName.GetAssemblyName(item);
                    _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Patching " + item + Environment.NewLine);
                    XAPAssembly asmTarget = new XAPAssembly(item);
                    asmTarget.InjectProlouge();
                }
                catch (System.BadImageFormatException)
                {
                    _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Skipping native dll file:" + item + Environment.NewLine);
                }
            }
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Finished patching target assebmlies." + Environment.NewLine);
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Signing dll files...");
            _xap.ReplaceSignature();
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "Creating new XAP file...");
            string tmp         = Directory.GetParent(_xap.GetPath()).ToString() + "\\" + _xap.appID;
            string zipfilename = tmp + ".zip";
            string newfilename = tmp + ".xap";

            System.IO.File.Delete(zipfilename);
            System.IO.File.Delete(newfilename);
            ZipFolder(_xap.GetPath(), zipfilename);
            System.Threading.Thread.Sleep(_config.zipWaitTime);    //wait for shell32.dll
            System.IO.File.Move(zipfilename, newfilename);
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "Connecting to emulator...");
            DatastoreManager dsmgr    = new DatastoreManager(1033);
            Platform         platform = dsmgr.GetPlatforms().Single(p => p.Name == "Windows Phone 7");
            Device           WP7emu   = platform.GetDevices().Single(d => d.Name == "Windows Phone 7 Emulator");

            WP7emu.Connect();

            Guid appGUID = new Guid(_xap.appID);
            RemoteApplication app;

            if (WP7emu.IsApplicationInstalled(appGUID))
            {
                _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "Uninstalling previous version...");
                app = WP7emu.GetApplication(appGUID);
                app.Uninstall();
            }
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "Deploying application....");
            app = WP7emu.InstallApplication(appGUID, appGUID, "NormalApp", _xap.iconPath, newfilename);
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "You can now launch the XDEMonitor from tools menu and then run the application on the phone." + Environment.NewLine);
            RunXDEMonitor();
            _mainfrm.BeginInvoke(_mainfrm.resetButtonDelegate, "run");
        }
Beispiel #2
0
        public override void Run()
        {
            if (!_xap.isUnpacked) _xap.ParseXAP();
            if (_xap.StripDRM())
            {
                _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "DRM file was removed." + Environment.NewLine);
            }
            foreach (string item in _xap.dllFiles)
            {
                if (!_xap.IsTarget(item.Substring(item.LastIndexOf("\\") + 1)))
                {
                    _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Skipping excluded assembly: " + item + Environment.NewLine);
                    continue;
                }
                try
                {
                    System.Reflection.AssemblyName.GetAssemblyName(item);
                    _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Patching " + item + Environment.NewLine);
                    XAPAssembly asmTarget = new XAPAssembly(item);
                    asmTarget.InjectProlouge();
                }
                catch (System.BadImageFormatException)
                {
                    _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Skipping native dll file:" + item + Environment.NewLine);
                }
            }
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Finished patching target assebmlies." + Environment.NewLine);
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "Signing dll files...");
            _xap.ReplaceSignature();
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "Creating new XAP file...");
            string tmp = Directory.GetParent(_xap.GetPath()).ToString() + "\\" + _xap.appID;
            string zipfilename = tmp + ".zip";
            string newfilename = tmp + ".xap";
            System.IO.File.Delete(zipfilename);
            System.IO.File.Delete(newfilename);
            ZipFolder(_xap.GetPath(), zipfilename);
            System.Threading.Thread.Sleep(_config.zipWaitTime);    //wait for shell32.dll
            System.IO.File.Move(zipfilename, newfilename);
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "Connecting to emulator...");
            DatastoreManager dsmgr = new DatastoreManager(1033);
            Platform platform = dsmgr.GetPlatforms().Single(p => p.Name == "Windows Phone 7");
            Device WP7emu = platform.GetDevices().Single(d => d.Name == "Windows Phone 7 Emulator");
            WP7emu.Connect();

            Guid appGUID = new Guid(_xap.appID);
            RemoteApplication app;

            if (WP7emu.IsApplicationInstalled(appGUID))
            {
                _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "Uninstalling previous version...");
                app = WP7emu.GetApplication(appGUID);
                app.Uninstall();
            }
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "Deploying application....");
            app = WP7emu.InstallApplication(appGUID, appGUID, "NormalApp", _xap.iconPath, newfilename);
            _mainfrm.BeginInvoke(_mainfrm.AddTextDelegate, "(Done)" + Environment.NewLine + "You can now launch the XDEMonitor from tools menu and then run the application on the phone."+Environment.NewLine);
            RunXDEMonitor();
            _mainfrm.BeginInvoke(_mainfrm.resetButtonDelegate, "run");
        }