Пример #1
0
        public static void LoadCamera2Scene()
        {
            var           a             = enumScenes.Where(x => x.ToString() == currentlyScenesSelected);
            SceneTypes    s             = enumScenes.ElementAtOrDefault(enumScenes.ToList().IndexOf(a.First()));
            Camera2Scenes camera2Scenes = JsonConvert.DeserializeObject <Camera2Scenes>(File.ReadAllText(Path.Combine(cam2Path, "Scenes.json")));
            List <string> cameraList    = camera2Scenes.scenes[s];

            if (cameraList.Count > 0)
            {
                string ProfileName = CameraUtilities.GetNextProfileName(s.ToString());
                if (ProfileName == string.Empty)
                {
                    Logger.log.Error("No ProfileName in LoadCamera2Scene");
                    return;
                }
                CameraUtilities.DirectoryCreate(Path.Combine(CameraUtilities.profilePath, ProfileName));
                for (int i = 0; i < cameraList.Count; i++)
                {
                    Camera2ConfigLoader(Path.Combine(cam2Path, "Cameras", $"{cameraList[i]}.json"), ProfileName);
                }
            }
            else
            {
                Logger.log.Error("No Camera Data from Camera2 Scene");
            }
        }
Пример #2
0
        public static void ExportCamera2Scene()
        {
            Camera2Scenes camera2Scenes = JsonConvert.DeserializeObject <Camera2Scenes>(File.ReadAllText(Path.Combine(cam2Path, "Scenes.json")));

            var        cameraList        = Camera2CameraExporter(CameraUtilities.currentlySelected);
            SceneTypes selectedSceneType = enumScenes.Find(x => x.ToString() == currentlyScenesSelected);

            camera2Scenes.scenes[selectedSceneType] = cameraList;

            File.WriteAllText(Path.Combine(cam2Path, "Scenes.json"), JsonConvert.SerializeObject(camera2Scenes, Formatting.Indented));
        }