45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
/*
|
|
* Copyright (c) 2025 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using Aurora;
|
|
using Aurora.Api;
|
|
using System;
|
|
using System.Windows;
|
|
|
|
namespace VisionCommon {
|
|
public static class RecipeFileManager {
|
|
private static Logger _Logger = new Logger("RecipeFileManager");
|
|
|
|
public static void SaveVisionRecipe() {
|
|
var visionSetting = VisionSettingManager.VisionSetting;
|
|
if (visionSetting.RecipeModelType == eRecipeModelType.AuroraModel) {
|
|
var currentModelName = VisionEnv.AuroraEnv.RecipeManager.ActivatedModelName();
|
|
if (currentModelName != null) {
|
|
VisionEnv.AuroraEnv.ModelManager.SaveModelItem(
|
|
currentModelName,
|
|
VisionKeys.VisionRecipeKey,
|
|
VisionEnv.AuroraEnv.ModelManager.ModelItem(currentModelName, VisionKeys.VisionRecipeKey));
|
|
}
|
|
else {
|
|
_Logger.FuncE("currentModelName is null.");
|
|
}
|
|
}
|
|
else if (visionSetting.RecipeModelType == eRecipeModelType.AuroraIngredient) {
|
|
var vsIngredient = VisionEnv.AuroraEnv.IngredientsManager.Ingredient(VisionKeys.VisionRecipeKey);
|
|
string activatedItemName = vsIngredient.ActivatedItemName();
|
|
if (activatedItemName != null) {
|
|
var ingredientItem = vsIngredient.IngredientItem(activatedItemName);
|
|
vsIngredient.SaveIngredient(VisionKeys.VisionRecipeKey, ingredientItem);
|
|
}
|
|
else {
|
|
_Logger.FuncE("activatedItemName is null.");
|
|
}
|
|
}
|
|
else {
|
|
var activatedRecipe = VisionEnv.AuroraEnv.RecipeManager.ActivatedRecipe();
|
|
VisionEnv.AuroraEnv.RecipeManager.SaveRecipeItem(VisionKeys.VisionRecipeKey);
|
|
}
|
|
}
|
|
}
|
|
} |