Exemplo n.º 1
0
        public static async Task <Response> AssembleMFunctionAndSaveToMinecraft(HowToHandleMismatch howToHandleMismatch, string saveName)
        {
            return(await Task.Run(() =>
            {
                Response response;
                var mBlocksGluer = new MBlocksGluer();
                var mFunctionComposer = new MFunctionComposer();
                var saveMFunctionToMinecraft = new SaveMFunctionToMinecraft();

                response = mBlocksGluer.Process(_data.CoordsNormalizerOutput, _data.BlockInfosTranslatorOutput);
                if (response.IsError)
                {
                    return response;
                }
                _data.MBlocksGluerOutput = mBlocksGluer.Output;

                response = mFunctionComposer.Process(_data.MBlocksGluerOutput, howToHandleMismatch, _data.ExtractBuildingNameOutput);
                if (response.IsError)
                {
                    return response;
                }
                _data.MFunctionComposerOutput = mFunctionComposer.Output;

                response = saveMFunctionToMinecraft.Save(_data.MFunctionComposerOutput, _data.LoadUserConfigOutput.MinecraftPath, saveName);
                if (response.IsError)
                {
                    return response;
                }

                return new Response(false, "");
            }));
        }
Exemplo n.º 2
0
        public static async Task <Response> AssembleMFunctionAndSave(HowToHandleMismatch howToHandleMismatch)
        {
            return(await Task.Run(() =>
            {
                Response response;
                var mBlocksGluer = new MBlocksGluer();
                var mFunctionComposer = new MFunctionComposer();
                var saveMFunction = new SaveMFunction();

                response = mBlocksGluer.Process(_data.CoordsNormalizerOutput, _data.BlockInfosTranslatorOutput);
                if (response.IsError)
                {
                    return response;
                }
                _data.MBlocksGluerOutput = mBlocksGluer.Output;

                response = mFunctionComposer.Process(_data.MBlocksGluerOutput, howToHandleMismatch, _data.ExtractBuildingNameOutput);
                if (response.IsError)
                {
                    return response;
                }
                _data.MFunctionComposerOutput = mFunctionComposer.Output;

                response = saveMFunction.Save(_data.MFunctionComposerOutput);
                if (response.IsError)
                {
                    return response;
                }

                if (response.IsError == false && response.ErrorMsg == "user canceled")
                {
                    return response;
                }

                return new Response(false, "");
            }));
        }