Ejemplo n.º 1
0
    private string GetListOfMissingDependencies(PluginInfo pluginInfo)
    {
        List <PluginInfoBase> missingDeps = new List <PluginInfoBase>();

        foreach (var dep in pluginInfo.Dependencies)
        {
            var localPlugin = _pluginsLocal.GetPluginInfo(dep.Name);
            if (localPlugin?.Version == null || !localPlugin.Version.IsHigherOrEqualThan(dep.Version))
            {
                missingDeps.Add(dep);
            }
        }

        if (missingDeps.Count == 0)
        {
            return(null);
        }

        string depStr = "Please Install the next plugins first:\n";

        foreach (var dep in missingDeps)
        {
            depStr += string.Format("{0} : v{1}\n", dep.Name, dep.Version.ToString());
        }

        return(depStr);
    }
Ejemplo n.º 2
0
    private void GenerateCodeForStartFile()
    {
        var mainPlugin = _pluginsRemote.GetPluginInfo(CODE_GENERATION_PLUGIN);

        string insertString = string.Empty;

        for (int i = 0; i < _pluginsLocal.Plugins.Count; i++)
        {
            var plugin = _pluginsLocal.Plugins[i];
            if (plugin.Version == null || string.Equals(plugin.Name, CODE_GENERATION_PLUGIN))
            {
                continue;
            }

            insertString += plugin.Code;
            if (i != _pluginsLocal.Plugins.Count - 1)
            {
                insertString += "\n\t\t\t";
            }
        }

        const string replace = "{0}";

        string code = mainPlugin.Code.Replace(replace, insertString);

        Utils.CheckAndCreateDirectoryForFile(CODE_GENERATION_FILE);
        FileHelper.SaveToFilePath(CODE_GENERATION_FILE, code);
        AssetDatabase.Refresh();
    }