コード例 #1
0
    public static bool GetUnityPackage(string directoryPath, out Utility_PackageJson package)
    {
        package = null;
        string filePath = GetPackagePath(directoryPath);

        if (File.Exists(filePath))
        {
            package = Utility_PackageJson.CreateFromFile(filePath);
        }
        return(package != null);
    }
コード例 #2
0
    public void OnValidate()
    {
        RefreshInfo();
        string path = GetProjectPathInUnity() + "/package.json";

        if (File.Exists(path))
        {
            Utility_PackageJson pack = UnityPackageUtility.GetPackageInfo(path);
            if (pack != null)
            {
                m_namespaceId = pack.GetNamespaceID();
            }
        }
    }
    public static Utility_PackageJson CreateFromJson(string json)
    {
        Utility_PackageJson value = null;

        try
        {
            value = JsonUtility.FromJson <Utility_PackageJson>(json);
        }
        catch (Exception)
        {
            //  UnityEngine.Debug.LogWarning(e);
        }
        value.dependencies = DependencyJson.GetDependeciesFromText(json);


        return(value);
    }
コード例 #4
0
    public static string CreateBasicDefaultOnFrom(Utility_PackageJson packageInfo, GitLinkOnDisk gitLink)
    {
        string text = "# Welcome to: " + packageInfo.displayName + "  \n";

        text += "Never used a package before ?  \n";
        text += "You don't understand how to use this git repository ?  \n";
        text += "May be you should stop now and learn the basic:  \n";
        text += "https://eloistree.page.link/hellopackage  \n";
        text += "  \n";
        text += "You know how the music work ?  \n";
        text += "Here is the copy past link of this project:  \n";
        text += "`\"" + packageInfo.GetNamespaceID() + "\":\"" + gitLink.GetUrl() + "\"`  \n";
        text += "  \n";
        text += "In hope that this code help you.  \n";
        text += "Kind regards,  \n";
        text += Application.companyName;
        return(text);
    }
コード例 #5
0
 public static void SetPackageInFolder(string packageFolderPath, Utility_PackageJson package)
 {
     File.WriteAllText(GetPackagePath(packageFolderPath), package.ToJson());
 }
コード例 #6
0
 public static Utility_PackageJson GetPackageInfo(string packagePath)
 {
     return(Utility_PackageJson.CreateFromFile(packagePath));
 }
コード例 #7
0
 public static void SetPackageFile(string packageFilePath, Utility_PackageJson package)
 {
     File.Delete(packageFilePath);
     File.WriteAllText(packageFilePath, package.ToJson());
 }