Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="param">ControllingData的Json</param>
        /// <returns></returns>
        protected override int OnSet(string param)
        {
            ControllingData cd         = ControllingData.CreateControllingDataFromJSON(param);
            int             returnCode = ReturnCode.SUCCESS;

            if (cd.Status)
            {
                if (selectedDevice.VideoAddress == "" || selectedDevice.VideoAddress == null)
                {
                    returnCode = cap.Start(0);
                }
                else
                {
                    returnCode = cap.Start(selectedDevice.VideoAddress);
                }
            }
            else
            {
                cap.Stop();
            }


            if (ReturnCode.SUCCESS == returnCode)
            {
                return(ReturnSuccessMessage());
            }

            return(ReturnFailMessage());
        }
    public void LoadActionData()
    {
        string filePath = Path.Combine(Application.dataPath, actionSourceFileName);

        if (File.Exists(filePath))
        {
            string          jsonData   = File.ReadAllText(filePath);
            ControllingData loadedData = JsonUtility.FromJson <ControllingData>(jsonData);
            actions = loadedData.actions;
        }
        else
        {
            Debug.Log("ERROR: File " + filePath + " not found (loading Clonecontroldata)");
        }
    }
Пример #3
0
    public void SaveActions(string fileName)
    {
        string          filePath = Path.Combine(Application.dataPath, fileName);
        ControllingData data     = new ControllingData();

        data.actions = actions;
        string jsonData = JsonUtility.ToJson(data);

        if (!File.Exists(filePath))
        {
            File.Create(filePath).Dispose();
        }
        File.WriteAllText(filePath, jsonData);

        if (File.Exists(filePath))
        {
            ControllingData loadedData = JsonUtility.FromJson <ControllingData>(jsonData);
            actions = loadedData.actions;
        }
        else
        {
            Debug.Log("ERROR: File " + filePath + " not found (loading Clonecontroldata)");
        }
    }