示例#1
0
            internal Badging(FileInfo source, string dump)
            {
                this._source = source;

                this._package     = new PackageInfo();
                this._application = new ApplicationInfo();
                this._activity    = new LaunchableActivity();

                this._sdkVersion       = "";
                this._targetSdkVersion = "";

                this._usesPermission = new List <string>();
                this._densities      = new List <int>();

                ProcessDump(dump);
            }
            internal Badging(FileInfo source, string dump)
            {
                this.source = source;

                this.package = new PackageInfo();
                this.application = new ApplicationInfo();
                this.activity = new LaunchableActivity();

                this.sdkVersion = "";
                this.targetSdkVersion = "";

                this.usesPermission = new List<string>();
                this.densities = new List<int>();

                ProcessDump(dump);
            }
示例#3
0
            internal Badging(FileInfo Source, string dump)
            {
                source = Source;

                package     = new PackageInfo();
                application = new ApplicationInfo();
                activity    = new LaunchableActivity();

                sdkVersion       = "";
                targetSdkVersion = "";

                usesPermission = new List <string>();
                densities      = new List <int>();

                ProcessDump(dump);
            }
示例#4
0
            private void ProcessDump(string dump)
            {
                using (var r = new StringReader(dump))
                {
                    string line;

                    while (r.Peek() != -1)
                    {
                        line = r.ReadLine();

                        if (line.StartsWith(PACKAGE))
                        {
                            //find name
                            var nameStart  = line.IndexOf(PackageName) + PackageName.Length;
                            var nameLength = line.IndexOf(Apostrophe, nameStart) - nameStart;
                            var name       = line.Substring(nameStart, nameLength);

                            //find versionCode
                            var versionCodeStart  = line.IndexOf(PackageVersionCode) + PackageVersionCode.Length;
                            var versionCodeLength = line.IndexOf(Apostrophe, versionCodeStart) - versionCodeStart;
                            var versionCode       = line.Substring(versionCodeStart, versionCodeLength);

                            //find versionName
                            var versionNameStart  = line.IndexOf(PackageVersionName) + PackageVersionName.Length;
                            var versionNameLength = line.IndexOf(Apostrophe, versionNameStart) - versionNameStart;
                            var versionName       = line.Substring(versionNameStart, versionNameLength);

                            this._package = new PackageInfo(name, versionCode, versionName);
                        }
                        else if (line.StartsWith(APPLICATION))
                        {
                            //find label
                            var labelStart  = line.IndexOf(ApplicationLabel) + ApplicationLabel.Length;
                            var labelLength = line.IndexOf(Apostrophe, labelStart) - labelStart;
                            var label       = line.Substring(labelStart, labelLength);

                            //find icon
                            var iconStart  = line.IndexOf(ApplicationIcon) + ApplicationIcon.Length;
                            var iconLength = line.IndexOf(Apostrophe, iconStart) - iconStart;
                            var icon       = line.Substring(iconStart, iconLength);

                            this._application = new ApplicationInfo(label, icon);
                        }
                        else if (line.StartsWith(ACTIVITY))
                        {
                            //find name
                            var nameStart  = line.IndexOf(ActivityName) + ActivityName.Length;
                            var nameLength = line.IndexOf(Apostrophe, nameStart) - nameStart;
                            var name       = line.Substring(nameStart, nameLength);

                            //find label
                            var labelStart  = line.IndexOf(ActivityLabel) + ActivityLabel.Length;
                            var labelLength = line.IndexOf(Apostrophe, labelStart) - labelStart;
                            var label       = line.Substring(labelStart, labelLength);

                            //find icon
                            var iconStart  = line.IndexOf(ActivityIcon) + ActivityIcon.Length;
                            var iconLength = line.IndexOf(Apostrophe, iconStart) - iconStart;
                            var icon       = line.Substring(iconStart, iconLength);

                            this._activity = new LaunchableActivity(name, label, icon);
                        }
                        else if (line.StartsWith(SDK_VERSION))
                        {
                            this._sdkVersion = line.Substring(SDK_VERSION.Length).Replace(Apostrophe, "");
                        }
                        else if (line.StartsWith(SdkTarget))
                        {
                            this._targetSdkVersion = line.Substring(SdkTarget.Length).Replace(Apostrophe, "");
                        }
                        else if (line.StartsWith(UsesPermission))
                        {
                            this._usesPermission.Add(line.Substring(UsesPermission.Length).Replace(Apostrophe, ""));
                        }
                        else if (line.StartsWith(Densities))
                        {
                            var densities = line.Substring(Densities.Length + 2).Split(new char[] { '\'', ' ' }, StringSplitOptions.RemoveEmptyEntries);

                            for (var i = 0; i < densities.Length; i++)
                            {
                                this._densities.Add(int.Parse(densities[i]));
                            }
                        }
                    }
                }
            }
示例#5
0
            private void ProcessDump(string dump)
            {
                using (StringReader r = new StringReader(dump))
                {
                    string line;

                    while (r.Peek() != -1)
                    {
                        line = r.ReadLine();

                        if (line.StartsWith(PACKAGE))
                        {
                            //find name
                            int    nameStart  = line.IndexOf(PACKAGE_NAME) + PACKAGE_NAME.Length;
                            int    nameLength = line.IndexOf(APOSTROPHE, nameStart) - nameStart;
                            string name       = line.Substring(nameStart, nameLength);

                            //find versionCode
                            int    versionCodeStart  = line.IndexOf(PACKAGE_VERSION_CODE) + PACKAGE_VERSION_CODE.Length;
                            int    versionCodeLength = line.IndexOf(APOSTROPHE, versionCodeStart) - versionCodeStart;
                            string versionCode       = line.Substring(versionCodeStart, versionCodeLength);

                            //find versionName
                            int    versionNameStart  = line.IndexOf(PACKAGE_VERSION_NAME) + PACKAGE_VERSION_NAME.Length;
                            int    versionNameLength = line.IndexOf(APOSTROPHE, versionNameStart) - versionNameStart;
                            string versionName       = line.Substring(versionNameStart, versionNameLength);

                            this.package = new PackageInfo(name, versionCode, versionName);
                        }
                        else if (line.StartsWith(APPLICATION))
                        {
                            //find label
                            int    labelStart  = line.IndexOf(APPLICATION_LABEL) + APPLICATION_LABEL.Length;
                            int    labelLength = line.IndexOf(APOSTROPHE, labelStart) - labelStart;
                            string label       = line.Substring(labelStart, labelLength);

                            //find icon
                            int    iconStart  = line.IndexOf(APPLICATION_ICON) + APPLICATION_ICON.Length;
                            int    iconLength = line.IndexOf(APOSTROPHE, iconStart) - iconStart;
                            string icon       = line.Substring(iconStart, iconLength);

                            this.application = new ApplicationInfo(label, icon);
                        }
                        else if (line.StartsWith(ACTIVITY))
                        {
                            //find name
                            int    nameStart  = line.IndexOf(ACTIVITY_NAME) + ACTIVITY_NAME.Length;
                            int    nameLength = line.IndexOf(APOSTROPHE, nameStart) - nameStart;
                            string name       = line.Substring(nameStart, nameLength);

                            //find label
                            int    labelStart  = line.IndexOf(ACTIVITY_LABEL) + ACTIVITY_LABEL.Length;
                            int    labelLength = line.IndexOf(APOSTROPHE, labelStart) - labelStart;
                            string label       = line.Substring(labelStart, labelLength);

                            //find icon
                            int    iconStart  = line.IndexOf(ACTIVITY_ICON) + ACTIVITY_ICON.Length;
                            int    iconLength = line.IndexOf(APOSTROPHE, iconStart) - iconStart;
                            string icon       = line.Substring(iconStart, iconLength);

                            this.activity = new LaunchableActivity(name, label, icon);
                        }
                        else if (line.StartsWith(SDK_VERSION))
                        {
                            this.sdkVersion = line.Substring(SDK_VERSION.Length).Replace(APOSTROPHE, "");
                        }
                        else if (line.StartsWith(SDK_TARGET))
                        {
                            this.targetSdkVersion = line.Substring(SDK_TARGET.Length).Replace(APOSTROPHE, "");
                        }
                        else if (line.StartsWith(USES_PERMISSION))
                        {
                            this.usesPermission.Add(line.Substring(USES_PERMISSION.Length).Replace(APOSTROPHE, ""));
                        }
                        else if (line.StartsWith(DENSITIES))
                        {
                            string[] densities = line.Substring(DENSITIES.Length + 2).Split(new char[] { '\'', ' ' }, StringSplitOptions.RemoveEmptyEntries);

                            for (int i = 0; i < densities.Length; i++)
                            {
                                this.densities.Add(int.Parse(densities[i]));
                            }
                        }
                    }
                }
            }
            private void ProcessDump(string dump)
            {
                using (StringReader r = new StringReader(dump))
                {
                    string line;

                    while (r.Peek() != -1)
                    {
                        line = r.ReadLine();

                        if (line.StartsWith(PACKAGE))
                        {
                            //find name
                            int nameStart = line.IndexOf(PACKAGE_NAME) + PACKAGE_NAME.Length;
                            int nameLength = line.IndexOf(APOSTROPHE, nameStart) - nameStart;
                            string name = line.Substring(nameStart, nameLength);

                            //find versionCode
                            int versionCodeStart = line.IndexOf(PACKAGE_VERSION_CODE) + PACKAGE_VERSION_CODE.Length;
                            int versionCodeLength = line.IndexOf(APOSTROPHE, versionCodeStart) - versionCodeStart;
                            string versionCode = line.Substring(versionCodeStart, versionCodeLength);

                            //find versionName
                            int versionNameStart = line.IndexOf(PACKAGE_VERSION_NAME) + PACKAGE_VERSION_NAME.Length;
                            int versionNameLength = line.IndexOf(APOSTROPHE, versionNameStart) - versionNameStart;
                            string versionName = line.Substring(versionNameStart, versionNameLength);

                            this.package = new PackageInfo(name, versionCode, versionName);
                        }
                        else if (line.StartsWith(APPLICATION))
                        {
                            //find label
                            int labelStart = line.IndexOf(APPLICATION_LABEL) + APPLICATION_LABEL.Length;
                            int labelLength = line.IndexOf(APOSTROPHE, labelStart) - labelStart;
                            string label = line.Substring(labelStart, labelLength);

                            //find icon
                            int iconStart = line.IndexOf(APPLICATION_ICON) + APPLICATION_ICON.Length;
                            int iconLength = line.IndexOf(APOSTROPHE, iconStart) - iconStart;
                            string icon = line.Substring(iconStart, iconLength);

                            this.application = new ApplicationInfo(label, icon);
                        }
                        else if (line.StartsWith(ACTIVITY))
                        {
                            //find name
                            int nameStart = line.IndexOf(ACTIVITY_NAME) + ACTIVITY_NAME.Length;
                            int nameLength = line.IndexOf(APOSTROPHE, nameStart) - nameStart;
                            string name = line.Substring(nameStart, nameLength);

                            //find label
                            int labelStart = line.IndexOf(ACTIVITY_LABEL) + ACTIVITY_LABEL.Length;
                            int labelLength = line.IndexOf(APOSTROPHE, labelStart) - labelStart;
                            string label = line.Substring(labelStart, labelLength);

                            //find icon
                            int iconStart = line.IndexOf(ACTIVITY_ICON) + ACTIVITY_ICON.Length;
                            int iconLength = line.IndexOf(APOSTROPHE, iconStart) - iconStart;
                            string icon = line.Substring(iconStart, iconLength);

                            this.activity = new LaunchableActivity(name, label, icon);
                        }
                        else if (line.StartsWith(SDK_VERSION))
                        {
                            this.sdkVersion = line.Substring(SDK_VERSION.Length).Replace(APOSTROPHE, "");
                        }
                        else if (line.StartsWith(SDK_TARGET))
                        {
                            this.targetSdkVersion = line.Substring(SDK_TARGET.Length).Replace(APOSTROPHE, "");
                        }
                        else if (line.StartsWith(USES_PERMISSION))
                        {
                            this.usesPermission.Add(line.Substring(USES_PERMISSION.Length).Replace(APOSTROPHE, ""));
                        }
                        else if (line.StartsWith(DENSITIES))
                        {
                            string[] densities = line.Substring(DENSITIES.Length + 2).Split(new char[] { '\'', ' ' }, StringSplitOptions.RemoveEmptyEntries);

                            for (int i = 0; i < densities.Length; i++)
                                this.densities.Add(int.Parse(densities[i]));
                        }
                    }
                }
            }