Example #1
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            var dte = GetGlobalService(typeof(DTE)) as DTE2;

            Host.Instance.DTE = dte;
            Host.Instance.SolutionOpendAction = () =>
            {
                var sln      = Host.Instance.Solution2;
                var projects = dte.GetSolutionProjects().ToList();
                var sp       = new SolutionProperties
                {
                    Projects         = projects,
                    ClassicProjects  = projects.Where(p => !string.IsNullOrWhiteSpace(p.FileName) && p.IsNetFrameworkProject()).ToList(),
                    SdkBasedProjects = projects.Where(p => !string.IsNullOrWhiteSpace(p.FileName) && p.IsSdkBased()).ToList()
                };
                SolutionDataCache.Instance.AddOrUpdate(sln.FileName, sp, (k, v) =>
                {
                    v = sp;
                    return(v);
                });
            };

            AddNuSpecCommand.Initialize(this);
            NuGetDeployCommand.Initialize(this);
            AssemblyInfoEditCommand.Initialize(this);
            AddDirectoryBuildPropsCommand.Initialize(this);

            //LoadCustomCommands();
        }
Example #2
0
 public EncodeHandler(SolutionProperties properties)
 {
     _javaFile           = CrcsSettings.Current.JavaFile;
     _apkToolFile        = properties.ApkToolFile;
     _verbose            = properties.ApkToolVerbose;
     _canDecodeAndEncode = properties.CanDecodeAndEncode;
 }
Example #3
0
 protected SmaliBaksmaliBase(SolutionProperties properties)
 {
     _javaFile            = CrcsSettings.Current.JavaFile;
     _baksmaliFile        = properties.BaksmaliFile;
     _canDecompile        = properties.CanDecompile;
     _smaliFile           = properties.SmaliFile;
     _useSmaliApiLevel    = GetSmaliVersion() == "1.3.0";
     _useBaksmaliApiLevel = GetBaksmaliVersion() == "1.3.0";
     _canRecompile        = properties.CanRecompile;
 }
Example #4
0
 public DeOdexHandler(SolutionProperties properties) : base(properties)
 {
 }
        public static IEnumerable <IFileHandler> CreateFileHandlers(ProcessingOptions processingOptions,
                                                                    SolutionProperties properties)
        {
            bool optimizePng     = (ProcessingOptions.OptimizePng & processingOptions) != 0;
            bool packageModified = false;

            var fileHandlers = new List <IFileHandler>();

            fileHandlers.Add(new BackupFilesHandler());

            if ((ProcessingOptions.DeOdex & processingOptions) != 0)
            {
                fileHandlers.Add(new DeOdexHandler(properties));
                packageModified = true;
                if (optimizePng)
                {
                    fileHandlers.Add(new UnPackHandler());
                    fileHandlers.Add(new OptiPngHandler(properties));
                    fileHandlers.Add(new RePackPngHandler());
                }
            }
            else
            {
                if ((ProcessingOptions.Decompile & processingOptions) != 0)
                {
                    fileHandlers.Add(new BaksmaliHandler(properties));
                }

                if ((ProcessingOptions.Decode & processingOptions) != 0)
                {
                    fileHandlers.Add(new DecodeHandler(properties));
                }
                else if (optimizePng)
                {
                    fileHandlers.Add(new UnPackHandler());
                }

                if ((ProcessingOptions.ProcessModifications & processingOptions) != 0)
                {
                    fileHandlers.Add(new ModPlugInHandler());
                }

                if (optimizePng)
                {
                    fileHandlers.Add(new OptiPngHandler(properties));
                }

                if ((ProcessingOptions.Encode & processingOptions) != 0)
                {
                    fileHandlers.Add(new EncodeHandler(properties));
                    packageModified = true;
                }
                else if (optimizePng)
                {
                    fileHandlers.Add(new RePackPngHandler());
                    packageModified = true;
                }

                if ((ProcessingOptions.Recompile & processingOptions) != 0)
                {
                    fileHandlers.Add(new SmaliHandler(properties));
                    packageModified = true;
                }

                if ((ProcessingOptions.ReSignApkFiles & processingOptions) != 0 && packageModified)
                {
                    fileHandlers.Add(new SignApkHandler(properties));
                }
            }
            if (packageModified)
            {
                fileHandlers.Add(new ZipAlignHandler(properties));
            }
            return(fileHandlers);
        }
 public OptiPngHandler(SolutionProperties properties)
 {
     _canOptimizePng = properties.CanOptimizePng;
     _optiPngFile    = properties.OptiPngFile;
 }
 public UpdateZipHandler(SolutionProperties properties)
 {
     _zipFileName = Path.Combine(properties.OutputUpdateZip);
     FileUtility.DeleteFile(_zipFileName);
     _zipFile = new ZipFile(_zipFileName);
 }