Esempio n. 1
0
    public static AndroidManifestEditor             ShowManifestEditorWindow()
    {
        AndroidManifestEditor editor = EditorWindow.GetWindow(typeof(AndroidManifestEditor),
                                                              true, "Android Manifest Editor") as AndroidManifestEditor;

        editor.initialize();
        editor.Show();
        return(editor);
    }
Esempio n. 2
0
    void initialize()
    {
        manifest = new Manifest();
        plugins  = new AgentDependency();
        if (System.IO.File.Exists(AgentDependency.AgentsFile))
        {
            plugins = AndroidAgentEditor.LoadAgentsFromFile(AgentDependency.AgentsFile);
            if (System.IO.File.Exists(Manifest.ManifestFile))
            {
                manifest = AndroidManifestEditor.LoadManifestFromFile(Manifest.ManifestFile);
            }
            else
            {
                manifest = new Manifest();
            }

            if (System.IO.File.Exists(ManifestResource.StringsFilename))
            {
                exist_strings = StringEditor.LoadResourcesFromFile(ManifestResource.StringsFilename);
            }
            else
            {
                exist_strings = new ManifestResource();
            }
            strings = new ManifestResource();
        }
        else
        {
            Debug.LogError("AgentDependencies.xml not found.");
        }

        PositiveButton.fixedWidth    = 30;
        PositiveButton.stretchWidth  = false;
        NegetiveButton.fixedWidth    = 30;
        NegetiveButton.stretchWidth  = false;
        BoldLabel.normal.textColor   = Color.white;
        BoldLabel.fontStyle          = FontStyle.Bold;
        SubBoldLabel.fontStyle       = FontStyle.Bold;
        RedLabel.normal.textColor    = new Color(0.8f, 0.1f, 0.1f, 1.0f);
        GreenLabel.normal.textColor  = new Color(0.1f, 0.8f, 0.1f, 1.0f);
        YellowLabel.normal.textColor = new Color(0.8f, 0.8f, 0.1f, 1.0f);

        if (System.IO.Directory.Exists(AgentVersion.VersionsPath))
        {
            Versions = GetVersionsFromPath(AgentVersion.VersionsPath, plugins);
        }
        else
        {
            Versions = new List <AgentSetVersion>();
        }

        guiVersions   = new UnityGUI_Versions(Versions, plugins, manifest);
        guiProperties = new UnityGUI_AgentVersion(manifest);
        guiVersions.SetStyles(PositiveButton, NegetiveButton, BoldLabel, GreenLabel, RedLabel, YellowLabel);
        guiProperties.SetStyles(PositiveButton, NegetiveButton, SubBoldLabel, GreenLabel, RedLabel, YellowLabel);
    }
Esempio n. 3
0
    void initialize()
    {
        if (System.IO.File.Exists(ManifestResource.StringsFilename))
        {
            strings = LoadResourcesFromFile(ManifestResource.StringsFilename);
        }
        else
        {
            strings = new ManifestResource();
        }
        if (System.IO.File.Exists(Manifest.ManifestFile))
        {
            manifest = AndroidManifestEditor.LoadManifestFromFile(Manifest.ManifestFile);
        }
        else
        {
            manifest = new Manifest();
        }
        FindManifestStrings(manifest, strings);

        BoldLabel.normal.textColor = Color.white;
        BoldLabel.fontStyle        = FontStyle.Bold;
    }
Esempio n. 4
0
    private void            ApplyVersion(AgentSetVersion v)
    {
        PlayerSettings.bundleVersion             = v.versionName;
        PlayerSettings.Android.bundleVersionCode = int.Parse(v.versionCode);
        PlayerSettings.bundleIdentifier          = v.bundleid;
        manifest.package     = v.bundleid;
        manifest.versionCode = v.versionCode;
        manifest.versionName = v.versionName;

        PreDefinitions = v.PreDefine.ToArray();
        SetPreDefinitions();

        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/");
        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/res");
        System.IO.Directory.CreateDirectory(Application.dataPath + "/Plugins/Android/libs");

        foreach (AgentManifest mans in plugins.Agents)
        {
            if (!v.hasPlugin(mans.filename))
            {
                SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), false);
                RemoveDependencies(mans);
            }
            else if (v.getVersionOfPlugin(mans.filename).status == false)
            {
                SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), false);
                RemoveDependencies(v.getVersionOfPlugin(mans.filename));
            }
        }
        foreach (AgentManifest mans in plugins.Agents)
        {
            if (v.hasPlugin(mans.filename))
            {
                AgentVersion plug = v.getVersionOfPlugin(mans.filename);
                if (plug.status)
                {
                    SetPluginDefinition(SearchPathForFilename(Application.dataPath, mans.filename), true);
                    AddPluginDependencies(plug);
                }
            }
        }
        AndroidManifestEditor.SaveManifestToFile(Manifest.ManifestFile, manifest);
        ManifestResource current_strings;

        if (System.IO.File.Exists(ManifestResource.StringsFilename))
        {
            current_strings = StringEditor.LoadResourcesFromFile(ManifestResource.StringsFilename);
        }
        else
        {
            current_strings = new ManifestResource();
        }
        for (int i = 0; i < strings.Count; i++)
        {
            if (current_strings.hasName(strings.strings[i].name))
            {
                current_strings.setValue(strings.strings[i].name, strings.strings[i]);
            }
            else
            {
                current_strings.addString(strings.strings[i].name, strings.strings[i]);
            }
        }
        StringEditor.SaveResourcesToFile(ManifestResource.StringsFilename, current_strings);
        Debug.Log("Done :)");
    }