Пример #1
0
        internal void AddGUID(Upset package, InstallSpecType kind, string guid)
        {
            InstalledPackage internalPackage;

            if (!SetupInternalPackage(package, out internalPackage))
            {
                return;
            }
            // Note: not catching in case of internalPackage not found
            // as it is valid error throwing condition

            // Check if guid doesn't exist and return if it does
            if (internalPackage.Install.Any(spec => spec is InstallSpecGUID && spec.Type == kind && (spec as InstallSpecGUID).Guid == guid))
            {
                return;
            }

            // Create new spec
            InstallSpec newSpec = new InstallSpecGUID {
                Type = kind, Guid = guid
            };


            InstallSpec[] newArray = new InstallSpec[internalPackage.Install.Length + 1];
            internalPackage.Install.CopyTo(newArray, 0);

            newArray[newArray.Length - 1] = newSpec;

            internalPackage.Install = newArray;
        }
Пример #2
0
        internal void AddLocation(Upset package, InstallSpecType kind, string path)
        {
            string           unixPath = Uplift.Common.FileSystemUtil.MakePathUnix(path);
            InstalledPackage internalPackage;

            if (!SetupInternalPackage(package, out internalPackage))
            {
                return;
            }
            // Note: not catching in case of internalPackage not found
            // as it is valid error throwing condition

            // Check if path doesn't exist and return if it does
            if (internalPackage.Install.Any(spec => spec is InstallSpecPath && spec.Type == kind && (spec as InstallSpecPath).Path == unixPath))
            {
                return;
            }

            // Create new spec
            InstallSpec newSpec = new InstallSpecPath {
                Type = kind, Path = unixPath
            };


            InstallSpec[] newArray = new InstallSpec[internalPackage.Install.Length + 1];
            internalPackage.Install.CopyTo(newArray, 0);

            newArray[newArray.Length - 1] = newSpec;

            internalPackage.Install = newArray;
        }
Пример #3
0
        public PathConfiguration GetDestinationFor(InstallSpec spec)
        {
            PathConfiguration PH;

            var specType = spec.Type;

            switch (specType)
            {
            case (InstallSpecType.Base):
                PH = Configuration.BaseInstallPath;
                break;

            case (InstallSpecType.Docs):
                PH = Configuration.DocsPath;
                break;

            case (InstallSpecType.EditorPlugin):
                PH = Configuration.EditorPluginPath;
                break;

            case (InstallSpecType.EditorDefaultResource):
                PH = Configuration.EditorDefaultResourcePath;
                break;

            case (InstallSpecType.Examples):
                PH = Configuration.ExamplesPath;
                break;

            case (InstallSpecType.Gizmo):
                PH = Configuration.GizmoPath;
                break;

            case (InstallSpecType.Media):
                PH = Configuration.MediaPath;
                break;

            case (InstallSpecType.Plugin):
                PH = Configuration.PluginPath;

                // Platform as string
                string platformAsString;

                switch (spec.Platform)
                {
                case (PlatformType.All):         // It means, that we just need to point to "Plugins" folder.
                    platformAsString = "";
                    break;

                case (PlatformType.iOS):
                    platformAsString = "ios";
                    break;

                default:
                    platformAsString = "UNKNOWN";
                    break;
                }
                PH.Location = Path.Combine(PH.Location, platformAsString);
                break;

            default:
                PH = Configuration.BaseInstallPath;
                break;
            }

            return(PH);
        }