private static void HandleCreateOperatorCode(object sender, OperatorHints.CreateOperatorCodeEventArgs e) { if (!e.ShouldITryToCreate(nameof(Def_Power_Length_LinearPowerLoss))) { return; } e.Result.Comment = e.Input.DebugIs; var input = e.Input; var result = e.Result; if (input.Is <ValueA, ValueB, ValueC>("/")) { e.SetHandled(); result.SetComment(); result.Comment += " " + nameof(Def_Power_Length_LinearPowerLoss); result.WithResultUnit <UnitC>( $"{ValueA.FirstLower()}.Unit", $"{ValueB.FirstLower()}.Unit"); return; } if (input.Is <ValueC, ValueB, ValueA>("*")) { e.SetHandled(); result.SetComment(); result.Comment += " " + nameof(Def_Power_Length_LinearPowerLoss); result.AddVariable("tmp", $"{ValueC.FirstLower()}.Unit"); result.AddVariable("resultUnit", "tmp.CounterUnit"); result.AddVariable("lengthUnit", "tmp.DenominatorUnit"); result.ConvertRight("lengthUnit"); result.ResultUnit = "resultUnit"; } }