示例#1
0
        Pfm(string command)
        {
            if (command.Contains("v"))
            {
                Verbose = true;
                command = command.Replace("v", "");
            }
            switch (command)
            {
            case "c":
                action = CreatePack;
                break;

            case "x":
                action = ExtractPack;
                break;

            case "t":
                action = ListPack;
                break;

            case "u":
                action = UpdatePackReplace;
                break;

            case "a":
                action = UpdatePackAddOnly;
                break;

            case "m":
                action = ExportToModToolXml;
                break;
            }
        }
示例#2
0
        public string PackUnPackText(PackAction action, bool show)
        {
            int capacity = text.Length * 2;

            if (action == PackAction.UnPack)
            {
                capacity = text.Length * 4;
            }

            StringBuilder sb = new StringBuilder(text, capacity);

            SortedList <string, string> pairs = dicPack;

            for (int i = 0; i < pairs.Keys.Count; i++)
            {
                if (action == PackAction.Pack)
                {
                    sb.Replace(pairs.Keys[i], pairs[pairs.Keys[i]]);
                }
                else
                {
                    sb.Replace(pairs[pairs.Keys[i]], pairs.Keys[i]);
                }

                if (show)
                {
                    Console.Write($"Processed pairs: {i + 1}\r");
                }
            }

            #region old variant
            //int count = 0;
            //foreach (var k in pairs.Keys)
            //{
            //    if (action == PackAction.Pack)
            //    {
            //        sb.Replace(k, pairs[k]);
            //    }
            //    else
            //    {
            //        sb.Replace(pairs[k], k);
            //    }

            //    count++;

            //    if (show) { Console.Write($"Processed pairs: {count}\r"); }
            //}
            #endregion

            if (show)
            {
                Console.WriteLine();
            }

            return(sb.ToString());
        }
示例#3
0
        private static void InternalListIncludedFiles(GitIgnoreParser ignoreParser)
        {
            if (ignoreParser == null)
            {
                ColoredConsole.Error.WriteLine("No .funcignore file");
                return;
            }

            foreach (var file in PackAction.GetLocalFiles(Environment.CurrentDirectory))
            {
                ColoredConsole.WriteLine(file);
            }
        }
示例#4
0
        private async Task InternalPublishFunctionApp(GitIgnoreParser ignoreParser)
        {
            ColoredConsole.WriteLine("Getting site publishing info...");
            var functionApp = await _armManager.GetFunctionAppAsync(FunctionAppName);

            var functionAppRoot = ScriptHostHelpers.GetFunctionAppRootDirectory(Environment.CurrentDirectory);

            if (functionApp.IsLinux && !functionApp.IsDynamic && RunFromZipDeploy)
            {
                ColoredConsole
                .WriteLine(ErrorColor("--zip is not supported with dedicated linux apps."));
                return;
            }

            var workerRuntime     = _secretsManager.GetSecrets().FirstOrDefault(s => s.Key.Equals(Constants.FunctionsWorkerRuntime, StringComparison.OrdinalIgnoreCase)).Value;
            var workerRuntimeEnum = string.IsNullOrEmpty(workerRuntime) ? WorkerRuntime.None : WorkerRuntimeLanguageHelper.NormalizeWorkerRuntime(workerRuntime);

            if (workerRuntimeEnum == WorkerRuntime.python && !functionApp.IsLinux)
            {
                throw new CliException("Publishing Python functions is only supported for Linux FunctionApps");
            }

            var zipStream = await PackAction.GetAppZipFile(workerRuntimeEnum, functionAppRoot, ignoreParser);

            // if consumption Linux, or --zip, run from zip
            if ((functionApp.IsLinux && functionApp.IsDynamic) || RunFromZipDeploy)
            {
                await PublishRunFromZip(functionApp, zipStream);
            }
            else
            {
                await PublishZipDeploy(functionApp, zipStream);
            }

            await SyncTriggers(functionApp);

            if (PublishLocalSettings)
            {
                await PublishAppSettings(functionApp);
            }
        }
示例#5
0
 public static void PackActionAndExecute(GameState state, Delegate action, int[] args = null)
 {
     PackAction(state, action, args)(state);
 }
示例#6
0
 public static void PackActionAndExecute(GameState state, ActionType type, int[] args = null)
 {
     PackAction(state, Actions[type], args)(state);
 }