static internal Vector3d GetDirection(this ToolApplication toolApplication) { switch (toolApplication.Orientation) { case Orientation.XPos: return(new Vector3d(1.0, 0.0, 0.0)); case Orientation.XNeg: return(new Vector3d(-1.0, 0.0, 0.0)); case Orientation.YPos: return(new Vector3d(0.0, 1.0, 0.0)); case Orientation.YNeg: return(new Vector3d(0.0, -1.0, 0.0)); case Orientation.ZPos: return(new Vector3d(0.0, 0.0, 1.0)); case Orientation.ZNeg: return(new Vector3d(0.0, 0.0, -1.0)); default: throw new ArgumentOutOfRangeException(); } }
static internal AxisAlignedBox3d GetBound(this ToolApplication toolApplication) { return(ToolHelper.GetBound(toolApplication.Position, toolApplication.Radius, toolApplication.Length, toolApplication.Orientation)); }
static void Main(string[] args) { var assetDB = BuilderAssetDB.Instance; ToolApplication.StartApplication(); ToolDebug.Log(AppConfig.GetValueString("ModuleDirectory")); var context = new AssetBuildContext(); context.Parameters = AppConfig.Clone(); context.Target = new BuildTarget(AppConfig.GetValue <BuildPlatform>("TARGET_PLATFORM"), AppConfig.GetValue <BuildConfiguration>("BUILD_CONFIGURATION")); context.AssetDB = assetDB; var output = AppConfig.GetValue <string>("out"); if (output == null) { ToolDebug.Error("Failed to find output"); return; } var outputAsset = assetDB.AddOrGetAsset(output); if (outputAsset == null) { ToolDebug.Error("Failed to find output asset for {0}", output); return; } context.OutputAsset = outputAsset; // Compile argument manually // We need order of argument var valueSet = AppConfig.GetValueSet("in"); if (valueSet != null) { foreach (var value in valueSet) { RegisterSourceAsset(context, value.Key); } } else { var value = AppConfig.GetValue <string>("in"); if (value != null) { RegisterSourceAsset(context, value); } else { ToolDebug.Error("No input files"); return; } } //var objPath = AppConfig.GetValue<string>("OBJ_PATH"); //objPath = PathTool.NormalizePathToProjectBase(objPath); //context.Parameters.SetValue("OBJ_PATH", objPath); // setup intermediate path for current builds foreach (var input in context.SourceAssets) { CreateAssetBuildPath(context, input); } Build(context, context.OutputAsset); }
static int Main(string[] args) { ToolApplication.StartApplication(); string outDir = AppConfig.GetValueString("out"); string outDirSharp = AppConfig.GetValueString("outSharp"); var inputPath = AppConfig.GetValueSet("in"); string facilitiyPath = AppConfig.GetValueString("facility"); if (inputPath == null) { Console.WriteLine("Empty input parameter:"); return(-1); } if (string.IsNullOrEmpty(outDir) && string.IsNullOrEmpty(outDirSharp)) { Console.WriteLine("Empty outDir and outDirSharp parameter: at least one need to be specified"); return(-1); } if (string.IsNullOrEmpty(facilitiyPath)) { Console.WriteLine("Empty facilities parameter:"); return(-1); } var resultCodeProcessor = new ResultCodeProcessor(); try { resultCodeProcessor.LoadFacility(facilitiyPath); foreach (var input in inputPath) { resultCodeProcessor.LoadCodes(input.Key); string inputName = Path.GetFileNameWithoutExtension(input.Key); resultCodeProcessor.UpdateResultCode(); MemoryStream memoryStream; string outPath; string headerFileName = string.Format("SF{0}.h", inputName); if (!string.IsNullOrEmpty(outDir)) { memoryStream = new MemoryStream(); resultCodeProcessor.GenerateCPPHeaders(memoryStream); outPath = Path.Combine(outDir, headerFileName); FileUtil.WriteIfChanged(outPath, memoryStream.GetBuffer(), memoryStream.Length); } if (!string.IsNullOrEmpty(outDir)) { memoryStream = new MemoryStream(); resultCodeProcessor.GenerateCPPImplementation(memoryStream, headerFileName); outPath = Path.Combine(outDir, string.Format("SF{0}.cpp", inputName)); FileUtil.WriteIfChanged(outPath, memoryStream.GetBuffer(), memoryStream.Length); } if (!string.IsNullOrEmpty(outDirSharp)) { memoryStream = new MemoryStream(); resultCodeProcessor.GenerateSharp(memoryStream); outPath = Path.Combine(outDirSharp, string.Format("SF{0}.cs", inputName)); FileUtil.WriteIfChanged(outPath, memoryStream.GetBuffer(), memoryStream.Length); } } } catch (Exception exp) { Console.WriteLine("ERROR: Exception:{0}, at {1}", exp.Message, exp.StackTrace.ToString()); } return(0); }