Exemple #1
0
        static public bool SaveControlObjectFile(ControlObjectsInfo currentControlObjectInfo)
        {
            bool           retValue       = false;
            SettingsFileIO settingsFileIO = new SettingsFileIO();

            settingsFileIO.SetSettingsFilePath(currentControlObjectInfo.objectFilePath);
            try
            {
                //write file
                //Area control_object
                settingsFileIO.WriteValue(controlObjectSection, "object_id", currentControlObjectInfo.objectID.ToString());
                settingsFileIO.WriteValue(controlObjectSection, "object_name", currentControlObjectInfo.objectName.ToString());
                settingsFileIO.WriteValue(controlObjectSection, "object_describle", currentControlObjectInfo.objectDescribe.ToString());
                settingsFileIO.WriteValue(controlObjectSection, "object_set_enable", Convert.ToInt32(currentControlObjectInfo.objectSetEnable).ToString());
                settingsFileIO.WriteValue(controlObjectSection, "object_timer_attached", Convert.ToInt32(currentControlObjectInfo.objectTimerAttached).ToString());
                //Area object_io
                settingsFileIO.WriteValue(objectIOSection, "object_io_count", currentControlObjectInfo.objectIOCount.ToString());
                for (int i = 0; i < currentControlObjectInfo.objectIOCount; i++)
                {
                    settingsFileIO.WriteValue(objectIOSection, "object_io_" + i.ToString() + "_mode", Convert.ToInt32(currentControlObjectInfo.objectIOMode[i]).ToString());
                    settingsFileIO.WriteValue(objectIOSection, "object_io_" + i.ToString() + "_describe", currentControlObjectInfo.objectIODescrible[i]);
                }
                //Area object_data_attach
                settingsFileIO.WriteValue(objectDataSection, "object_data_count", currentControlObjectInfo.objectDataCount.ToString());
                for (int i = 0; i < currentControlObjectInfo.objectDataCount; i++)
                {
                    settingsFileIO.WriteValue(objectDataSection, "object_data_" + i.ToString(), currentControlObjectInfo.objectData[i]);
                }
                retValue = true;
            }
            catch (Exception) { };
            settingsFileIO.Dispose();
            return(retValue);
        }
Exemple #2
0
        static public bool LoadGraphicOptionsFile(string optionsFilePath)
        {
            bool retValue = false;

            try
            {
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                settingsFileIO.SetSettingsFilePath(optionsFilePath);
                if (settingsFileIO.GetFileType() != SettingsContent.FileType.SETTINGS)
                {
                    return(retValue);
                }

                graphicOptionsValue.optionsFilePath   = optionsFilePath;
                graphicOptionsValue.enableVSync       = Convert.ToBoolean(Int32.Parse(settingsFileIO.ReadValue(settingsSection, "vsync")));
                graphicOptionsValue.enableFullScreen  = Convert.ToBoolean(Int32.Parse(settingsFileIO.ReadValue(settingsSection, "fullscreen")));
                graphicOptionsValue.enableMotionBlur  = Convert.ToBoolean(Int32.Parse(settingsFileIO.ReadValue(settingsSection, "motionblur")));
                graphicOptionsValue.simulatorWidth    = Int32.Parse(settingsFileIO.ReadValue(settingsSection, "simulatorwidth"));
                graphicOptionsValue.simulatorHeight   = Int32.Parse(settingsFileIO.ReadValue(settingsSection, "simulatorheight"));
                graphicOptionsValue.antiAliasingLevel = Int32.Parse(settingsFileIO.ReadValue(settingsSection, "antialiasinglevel"));
                graphicOptionsValue.transparencyLevel = Int32.Parse(settingsFileIO.ReadValue(settingsSection, "transparencylevel"));
                graphicOptionsValue.viewingDistance   = Int32.Parse(settingsFileIO.ReadValue(settingsSection, "viewingdistance"));
                graphicOptionsValue.optionsFileLoaded = true;
                settingsFileIO.Dispose();
                retValue = true;
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #3
0
        static public bool SaveGraphicOptionsFile(GraphicOptionsValue currentGraphicOptionsFile)
        {
            bool retValue = false;

            try
            {
                if (!currentGraphicOptionsFile.optionsFileLoaded)
                {
                    return(retValue);
                }

                SettingsFileIO settingsFileIO = new SettingsFileIO();
                settingsFileIO.SetSettingsFilePath(currentGraphicOptionsFile.optionsFilePath);
                settingsFileIO.WriteValue(settingsSection, "fullscreen", currentGraphicOptionsFile.enableFullScreen == true ? "1" : "0");
                settingsFileIO.WriteValue(settingsSection, "vsync", currentGraphicOptionsFile.enableVSync == true ? "1" : "0");
                settingsFileIO.WriteValue(settingsSection, "motionblur", currentGraphicOptionsFile.enableMotionBlur == true ? "1" : "0");
                settingsFileIO.WriteValue(settingsSection, "simulatorwidth", currentGraphicOptionsFile.simulatorWidth.ToString());
                settingsFileIO.WriteValue(settingsSection, "simulatorheight", currentGraphicOptionsFile.simulatorHeight.ToString());
                settingsFileIO.WriteValue(settingsSection, "antialiasinglevel", currentGraphicOptionsFile.antiAliasingLevel.ToString());
                settingsFileIO.WriteValue(settingsSection, "transparencylevel", currentGraphicOptionsFile.transparencyLevel.ToString());
                settingsFileIO.WriteValue(settingsSection, "viewingdistance", currentGraphicOptionsFile.viewingDistance.ToString());
                settingsFileIO.Dispose();
                retValue = true;
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #4
0
        static public void UpdateControlObjectsItem()
        {
            try
            {
                controlObjectFilesCount = 0;
                SettingsContent.UpdateSettingsPath();
                DirectoryInfo  objectPath     = new DirectoryInfo(SettingsContent.controlObjectPath);
                FileInfo[]     objectFiles    = objectPath.GetFiles();
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                foreach (FileInfo fileName in objectFiles)
                {
                    if (fileName.Extension == SettingsContent.universalFileExtName)
                    {
                        try
                        {
                            settingsFileIO.SetSettingsFilePath(fileName.FullName);
                            if (settingsFileIO.GetFileType() == SettingsContent.FileType.OBJECT)
                            {
                                int objectID = Int32.Parse(settingsFileIO.ReadValue(controlObjectSection, "object_id"));
                                controlObjectFilesCount++;
                                if (objectID > controlObjectsCount)
                                {
                                    continue;
                                }

                                controlObjectsInfo[objectID].objectIOMode.Clear();
                                controlObjectsInfo[objectID].objectIODescrible.Clear();
                                controlObjectsInfo[objectID].objectData.Clear();
                                controlObjectsInfo[objectID].objectFilePath = fileName.FullName;
                                //Area control_object
                                controlObjectsInfo[objectID].objectID            = objectID;
                                controlObjectsInfo[objectID].objectName          = settingsFileIO.ReadValue(controlObjectSection, "object_name");
                                controlObjectsInfo[objectID].objectDescribe      = settingsFileIO.ReadValue(controlObjectSection, "object_describle");
                                controlObjectsInfo[objectID].objectSetEnable     = Convert.ToBoolean(Int32.Parse(settingsFileIO.ReadValue(controlObjectSection, "object_set_enable")));
                                controlObjectsInfo[objectID].objectTimerAttached = Convert.ToBoolean(Int32.Parse(settingsFileIO.ReadValue(controlObjectSection, "object_timer_attached")));
                                //Area object_io
                                controlObjectsInfo[objectID].objectIOCount = Int32.Parse(settingsFileIO.ReadValue(objectIOSection, "object_io_count"));
                                for (int i = 0; i < controlObjectsInfo[objectID].objectIOCount; i++)
                                {
                                    controlObjectsInfo[objectID].objectIOMode.Add(
                                        (DevicesManager.DevicesIOMode)Int32.Parse(settingsFileIO.ReadValue(objectIOSection, "object_io_" + i.ToString() + "_mode")));
                                    controlObjectsInfo[objectID].objectIODescrible.Add(settingsFileIO.ReadValue(objectIOSection, "object_io_" + i.ToString() + "_describe"));
                                }
                                //Area object_data_attach
                                controlObjectsInfo[objectID].objectDataCount = Int32.Parse(settingsFileIO.ReadValue(objectDataSection, "object_data_count"));
                                for (int i = 0; i < controlObjectsInfo[objectID].objectDataCount; i++)
                                {
                                    controlObjectsInfo[objectID].objectData.Add(settingsFileIO.ReadValue(objectDataSection, "object_data_" + i.ToString()));
                                }
                            }
                        }
                        catch (Exception) { };
                        settingsFileIO.Dispose();
                    }
                }
            }
            catch (Exception) { };
        }
Exemple #5
0
        static public bool SaveBoardFile(BoardInfo currentBoardInfo)
        {
            bool retValue = false;

            try
            {
                if (!currentBoardInfo.boardFileLoaded)
                {
                    return(retValue);
                }

                SettingsFileIO settingsFileIO = new SettingsFileIO();
                settingsFileIO.SetSettingsFilePath(currentBoardInfo.boardFilePath);
                //Load data
                settingsFileIO.WriteValue(boardInfoSection, "board_id", currentBoardInfo.boardID.ToString());
                settingsFileIO.WriteValue(boardInfoSection, "board_name", currentBoardInfo.boardName.ToString());
                settingsFileIO.WriteValue(boardInfoSection, "board_supplier", currentBoardInfo.boardSupplier.ToString());
                settingsFileIO.WriteValue(boardInfoSection, "board_describe", currentBoardInfo.boardDescribe.ToString());
                settingsFileIO.WriteValue(boardInfoSection, "board_website", currentBoardInfo.boardWebsite.ToString());
                settingsFileIO.WriteValue(boardInfoSection, "board_support_version", currentBoardInfo.boardSupprtVersion.ToString());
                settingsFileIO.WriteValue(boardInfoSection, "board_io_count", currentBoardInfo.boardIOCount.ToString());
                settingsFileIO.WriteVectorValue(boardInfoSection, "board_analog_input", currentBoardInfo.boardAnalogInput);
                settingsFileIO.WriteVectorValue(boardInfoSection, "board_analog_output", currentBoardInfo.boardAnalogOutput);
                settingsFileIO.WriteVectorValue(boardInfoSection, "board_digital_io", currentBoardInfo.boardDigitalIO);
                //Load board init
                settingsFileIO.WriteValue(boardInitSection, "DEVICE_WITHOUT_INIT", currentBoardInfo.DEVICE_WITHOUT_INIT.ToString());
                settingsFileIO.WriteValue(boardInitSection, "DEVICE_BUTTON_AUTOLOCK", currentBoardInfo.DEVICE_BUTTON_AUTOLOCK.ToString());
                settingsFileIO.WriteValue(boardInitSection, "DEVICE_BUTTON_AUTORESET", currentBoardInfo.DEVICE_BUTTON_AUTORESET.ToString());
                settingsFileIO.WriteValue(boardInitSection, "DEVICE_DIGITAL_INPUT", currentBoardInfo.DEVICE_DIGITAL_INPUT.ToString());
                settingsFileIO.WriteValue(boardInitSection, "DEVICE_DIGITAL_OUTPUT", currentBoardInfo.DEVICE_DIGITAL_OUTPUT.ToString());
                settingsFileIO.WriteValue(boardInitSection, "DEVICE_ANALOG_INPUT", currentBoardInfo.DEVICE_ANALOG_INPUT.ToString());
                settingsFileIO.WriteValue(boardInitSection, "DEVICE_ANALOG_OUTPUT", currentBoardInfo.DEVICE_ANALOG_OUTPUT.ToString());
                //Load communication
                settingsFileIO.WriteValue(boardCommunicationSection, "board_baud", currentBoardInfo.boardBaud.ToString());
                //Load procotol
                settingsFileIO.WriteValue(boardProtocol, "COMM_START_SYMBOL", currentBoardInfo.COMM_START_SYMBOL.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_SPEC_SYMBOL", currentBoardInfo.COMM_SPEC_SYMBOL.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_SET_SYMBOL", currentBoardInfo.COMM_SET_SYMBOL.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_END_SYMBOL", currentBoardInfo.COMM_END_SYMBOL.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_RESET_SPEC_NUM", currentBoardInfo.COMM_RESET_SPEC_NUM.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_CONNECT_SPEC_NUM", currentBoardInfo.COMM_CONNECT_SPEC_NUM.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_TRANSEND_SPEC_NUM", currentBoardInfo.COMM_TRANSEND_SPEC_NUM.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_CONTINUE_SPEC_NUM", currentBoardInfo.COMM_CONTINUE_SPEC_NUM.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_CLEAR_DEVICES_STATE_NUM", currentBoardInfo.COMM_CLEAR_DEVICES_STATE_NUM.ToString());
                settingsFileIO.WriteValue(boardProtocol, "COMM_PACK_MAX_SIZE", currentBoardInfo.COMM_PACK_MAX_SIZE.ToString());
                settingsFileIO.Dispose();
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #6
0
        static public ControlObjectsInfo CreateNewControlObjectFile(string filePath, string fileName)
        {
            ControlObjectsInfo retValue = new ControlObjectsInfo();

            try
            {
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                if (settingsFileIO.CreateNewFile(SettingsContent.FileType.OBJECT, filePath + "\\" + fileName))
                {
                    retValue.objectFilePath = Path.GetFullPath(filePath + "\\" + fileName + SettingsContent.universalFileExtName);
                }
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #7
0
        static public BoardInfo ReadBoardFileInfo(string boardFilePath)
        {
            BoardInfo boardFileInfo = new BoardInfo();

            try
            {
                boardFileInfo.boardFileLoaded = true;
                boardFileInfo.boardFilePath   = boardFilePath;
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                settingsFileIO.SetSettingsFilePath(boardFilePath);
                //Load data
                boardFileInfo.boardID            = Int32.Parse(settingsFileIO.ReadValue(boardInfoSection, "board_id"));
                boardFileInfo.boardName          = settingsFileIO.ReadValue(boardInfoSection, "board_name");
                boardFileInfo.boardSupplier      = settingsFileIO.ReadValue(boardInfoSection, "board_supplier");
                boardFileInfo.boardDescribe      = settingsFileIO.ReadValue(boardInfoSection, "board_describe");
                boardFileInfo.boardWebsite       = settingsFileIO.ReadValue(boardInfoSection, "board_website");
                boardFileInfo.boardSupprtVersion = new Version(settingsFileIO.ReadValue(boardInfoSection, "board_support_version"));
                boardFileInfo.boardIOCount       = Int32.Parse(settingsFileIO.ReadValue(boardInfoSection, "board_io_count"));
                boardFileInfo.boardAnalogInput   = settingsFileIO.ReadVectorValue(boardInfoSection, "board_analog_input");
                boardFileInfo.boardAnalogOutput  = settingsFileIO.ReadVectorValue(boardInfoSection, "board_analog_output");
                boardFileInfo.boardDigitalIO     = settingsFileIO.ReadVectorValue(boardInfoSection, "board_digital_io");
                //Load board init
                boardFileInfo.DEVICE_WITHOUT_INIT     = Int32.Parse(settingsFileIO.ReadValue(boardInitSection, "DEVICE_WITHOUT_INIT"));
                boardFileInfo.DEVICE_BUTTON_AUTOLOCK  = Int32.Parse(settingsFileIO.ReadValue(boardInitSection, "DEVICE_BUTTON_AUTOLOCK"));
                boardFileInfo.DEVICE_BUTTON_AUTORESET = Int32.Parse(settingsFileIO.ReadValue(boardInitSection, "DEVICE_BUTTON_AUTORESET"));
                boardFileInfo.DEVICE_DIGITAL_INPUT    = Int32.Parse(settingsFileIO.ReadValue(boardInitSection, "DEVICE_DIGITAL_INPUT"));
                boardFileInfo.DEVICE_DIGITAL_OUTPUT   = Int32.Parse(settingsFileIO.ReadValue(boardInitSection, "DEVICE_DIGITAL_OUTPUT"));
                boardFileInfo.DEVICE_ANALOG_INPUT     = Int32.Parse(settingsFileIO.ReadValue(boardInitSection, "DEVICE_ANALOG_INPUT"));
                boardFileInfo.DEVICE_ANALOG_OUTPUT    = Int32.Parse(settingsFileIO.ReadValue(boardInitSection, "DEVICE_ANALOG_OUTPUT"));
                //Load communication
                boardFileInfo.boardBaud = Int32.Parse(settingsFileIO.ReadValue(boardCommunicationSection, "board_baud"));
                //Load procotol
                boardFileInfo.COMM_START_SYMBOL            = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_START_SYMBOL"));
                boardFileInfo.COMM_SPEC_SYMBOL             = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_SPEC_SYMBOL"));
                boardFileInfo.COMM_SET_SYMBOL              = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_SET_SYMBOL"));
                boardFileInfo.COMM_END_SYMBOL              = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_END_SYMBOL"));
                boardFileInfo.COMM_RESET_SPEC_NUM          = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_RESET_SPEC_NUM"));
                boardFileInfo.COMM_CONNECT_SPEC_NUM        = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_CONNECT_SPEC_NUM"));
                boardFileInfo.COMM_TRANSEND_SPEC_NUM       = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_TRANSEND_SPEC_NUM"));
                boardFileInfo.COMM_CONTINUE_SPEC_NUM       = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_CONTINUE_SPEC_NUM"));
                boardFileInfo.COMM_CLEAR_DEVICES_STATE_NUM = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_CLEAR_DEVICES_STATE_NUM"));
                boardFileInfo.COMM_PACK_MAX_SIZE           = Int32.Parse(settingsFileIO.ReadValue(boardProtocol, "COMM_PACK_MAX_SIZE"));
                //Close file
                settingsFileIO.Dispose();
            }
            catch (Exception) { };
            return(boardFileInfo);
        }
Exemple #8
0
        static public BoardInfo CreateNewBoardFile(string filePath, string fileName)
        {
            BoardInfo retValue = new BoardInfo();

            try
            {
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                if (settingsFileIO.CreateNewFile(SettingsContent.FileType.BOARD, filePath + "\\" + fileName))
                {
                    retValue.boardFileLoaded = true;
                    retValue.boardFilePath   = Path.GetFullPath(filePath + "\\" + fileName + SettingsContent.universalFileExtName);
                }
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #9
0
 static public void GetSimulatorPlatformDefine()
 {
     try
     {
         SettingsFileIO settingsFileIO = new SettingsFileIO();
         settingsFileIO.SetSettingsFilePath(simulatorPlatformDefineFilePath);
         string versionStr = settingsFileIO.ReadValue("platform_define", "platform_version");
         simulatorVersion        = new Version(versionStr);
         simulatorUIMode         = settingsFileIO.ReadValue("platform_define", "ui_mode_args");
         simualatorCompilerMode  = settingsFileIO.ReadValue("platform_define", "compile_mode_args");
         simulatorExcuteFileName = settingsFileIO.ReadValue("platform_define", "complier_excute");
         simulatorVerification   = settingsFileIO.ReadValue("platform_define", "platform_verification");
         settingsFileIO.Dispose();
     }
     catch (Exception) { };
 }
Exemple #10
0
        static public GraphicOptionsValue CreateNewGraphicOptionsFile(string filePath, string fileName)
        {
            GraphicOptionsValue retValue = new GraphicOptionsValue();

            try
            {
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                if (settingsFileIO.CreateNewFile(SettingsContent.FileType.SETTINGS, filePath + "\\" + fileName))
                {
                    retValue.optionsFileLoaded = true;
                    retValue.optionsFilePath   = Path.GetFullPath(filePath + "\\" + fileName + SettingsContent.universalFileExtName);
                    settingsFileIO.Dispose();
                }
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #11
0
        static public PackageInfo ReadPackageInfo(string packageFilePath)
        {
            PackageInfo retValue = new PackageInfo();

            try
            {
                if (!File.Exists(packageFilePath))
                {
                    return(retValue);
                }

                string         packagePath    = Path.GetDirectoryName(packageFilePath);
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                settingsFileIO.SetSettingsFilePath(packageFilePath);
                if (settingsFileIO.GetFileType() != SettingsContent.FileType.RESPACK)
                {
                    return(retValue);
                }
                //Load package
                retValue.packageName        = settingsFileIO.ReadValue(packageInfoSection, "name");
                retValue.packageVersion     = settingsFileIO.ReadValue(packageInfoSection, "version");
                retValue.packageGUID        = settingsFileIO.ReadValue(packageInfoSection, "packageguid");
                retValue.packageDescription = settingsFileIO.ReadValue(packageInfoSection, "description");
                //Load dir
                retValue.packageRouteRelateDir = settingsFileIO.ReadValue(packageDirSection, "route_file");
                retValue.packageRouteDir       = Path.GetFullPath(packagePath + "\\" + retValue.packageRouteRelateDir);
                retValue.packageTrainRelateDir = settingsFileIO.ReadValue(packageDirSection, "train_file");
                retValue.packageTrainDir       = Path.GetFullPath(packagePath + "\\" + retValue.packageTrainRelateDir);
                try
                {
                    retValue.packageRouteImageRelateDir = settingsFileIO.ReadValue(packageDirSection, "route_image");
                    retValue.packageRouteImage          = Image.FromFile(Path.GetFullPath(packagePath) + "\\" + retValue.packageTrainImageRelateDir);
                    retValue.packageTrainRelateDir      = settingsFileIO.ReadValue(packageDirSection, "train_image");
                    retValue.packageTrainImage          = Image.FromFile(Path.GetFullPath(packagePath) + "\\" + retValue.packageTrainRelateDir);
                }
                catch (Exception) { };
                settingsFileIO.Dispose();
                retValue.packageFileLoaded     = true;
                retValue.routeDetailInfoLoaded = false;
                retValue.trainDetailInfoLoaded = false;
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #12
0
        static public void UpdateSettingsPath()
        {
            SettingsFileIO settingsFileIO = new SettingsFileIO();

            platformPath = Application.StartupPath;
            settingsFileIO.SetSettingsFilePath(platformPath + "\\Path.ini");
            packagePath                     = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "package_path"));
            boardPath                       = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "board_path"));
            controlObjectPath               = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "control_object_path"));
            projectLibPath                  = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "project_lib_path"));
            settingsPath                    = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "settings_path"));
            tempFilePath                    = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "temp_file_path"));
            recorderPath                    = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "recorder_path"));
            simulatorDefaultSettingsPath    = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "settings_path"));
            simulatorPlatformDefineFilePath = Path.GetFullPath(platformPath + "\\" + settingsFileIO.ReadValue("path", "platform_define"));
            settingsFileIO.Dispose();
            GetSimulatorPlatformDefine();
            return;
        }
Exemple #13
0
        static public bool UpdatePackageList()
        {
            bool retValue = false;

            try
            {
                //Clear package list
                packageList.packageCount = 0;
                packageList.packageDefineFilePath.Clear();
                packageList.packageGUID.Clear();
                packageList.packageName.Clear();
                //Update
                SettingsContent.UpdateSettingsPath();
                DirectoryInfo  boardPath      = new DirectoryInfo(SettingsContent.packagePath);
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                foreach (DirectoryInfo subDirectory in boardPath.GetDirectories())
                {
                    FileInfo[] packageDefinieFiles = subDirectory.GetFiles();
                    foreach (FileInfo fileName in packageDefinieFiles)
                    {
                        if (fileName.Extension == SettingsContent.universalFileExtName)
                        {
                            string packageDefineFilePath = fileName.FullName;
                            settingsFileIO.SetSettingsFilePath(packageDefineFilePath);
                            if (settingsFileIO.GetFileType() == SettingsContent.FileType.RESPACK)
                            {
                                //MessageBox.Show(packageDefineFilePath);
                                packageList.packageCount++;
                                packageList.packageDefineFilePath.Add(packageDefineFilePath);
                                packageList.packageGUID.Add(settingsFileIO.ReadValue(packageInfoSection, "packageguid"));
                                packageList.packageName.Add(settingsFileIO.ReadValue(packageInfoSection, "name"));
                            }
                            settingsFileIO.Dispose();
                        }
                    }
                }
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #14
0
        static public bool UpdateProjectItem()
        {
            bool retValue = false;

            try
            {
                //Clear project list
                projectList.projectCount = 0;
                projectList.projectFilePath.Clear();
                projectList.projectID.Clear();
                projectList.projectName.Clear();
                projectList.projectDescribe.Clear();
                projectList.projectDebug.Clear();
                //Update
                SettingsContent.UpdateSettingsPath();
                DirectoryInfo projectPath = new DirectoryInfo(SettingsContent.projectLibPath);
                foreach (DirectoryInfo subDirectory in projectPath.GetDirectories())
                {
                    FileInfo[]     projectFiles   = subDirectory.GetFiles();
                    SettingsFileIO settingsFileIO = new SettingsFileIO();
                    foreach (FileInfo fileName in projectFiles)
                    {
                        if (fileName.Extension == SettingsContent.projectFileExtName)
                        {
                            settingsFileIO.SetSettingsFilePath(fileName.FullName);
                            projectList.projectCount++;
                            projectList.projectFilePath.Add(fileName.FullName);
                            projectList.projectID.Add(settingsFileIO.ReadValue(projectSection, "project_id"));
                            projectList.projectName.Add(settingsFileIO.ReadValue(projectSection, "project_name"));
                            projectList.projectDescribe.Add(settingsFileIO.ReadValue(projectSection, "project_describle"));
                            projectList.projectDebug.Add(Convert.ToBoolean(Int32.Parse(settingsFileIO.ReadValue(projectSection, "project_debug"))));
                            settingsFileIO.Dispose();
                        }
                    }
                }
                retValue = true;
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #15
0
        static public bool UpdateBoardItems()
        {
            bool retValue = false;

            try
            {
                //Clear boardList
                boardList.boardCount = 0;
                boardList.boardFilePath.Clear();
                boardList.boardID.Clear();
                boardList.boardName.Clear();
                //Update
                SettingsContent.UpdateSettingsPath();
                DirectoryInfo  boardPath      = new DirectoryInfo(SettingsContent.boardPath);
                FileInfo[]     boardFiles     = boardPath.GetFiles();
                SettingsFileIO settingsFileIO = new SettingsFileIO();
                foreach (FileInfo fileName in boardFiles)
                {
                    if (fileName.Extension == SettingsContent.universalFileExtName)
                    {
                        settingsFileIO.SetSettingsFilePath(fileName.FullName);
                        if (settingsFileIO.GetFileType() == SettingsContent.FileType.BOARD)
                        {
                            boardList.boardCount++;
                            boardList.boardFilePath.Add(fileName.FullName);
                            boardList.boardID.Add(Int32.Parse(settingsFileIO.ReadValue(boardInfoSection, "board_id")));
                            boardList.boardName.Add(settingsFileIO.ReadValue(boardInfoSection, "board_name"));
                        }
                        settingsFileIO.Dispose();
                    }
                }
                retValue = true;
            }
            catch (Exception) { };
            return(retValue);
        }
Exemple #16
0
        static public ProjectInfo ReadProjectInfo(string projectFilePath)
        {
            ProjectInfo    retValue       = new ProjectInfo();
            SettingsFileIO settingsFileIO = new SettingsFileIO();

            try
            {
                retValue.controlObjectID.Clear();
                retValue.controlObjectPara.Clear();
                retValue.controlObjectSerialBaudRate.Clear();
                settingsFileIO.SetSettingsFilePath(projectFilePath);
                //Load project
                retValue.projectName     = settingsFileIO.ReadValue(projectSection, "project_name");
                retValue.projectID       = settingsFileIO.ReadValue(projectSection, "project_id");
                retValue.projectDescribe = settingsFileIO.ReadValue(projectSection, "project_describle");
                retValue.projectVersion  = new Version(settingsFileIO.ReadValue(projectSection, "project_version"));
                retValue.projectSimulatorSupportVersion = new Version(settingsFileIO.ReadValue(projectSection, "project_simulator_support_version"));
                retValue.projectAuthor        = settingsFileIO.ReadValue(projectSection, "project_author");
                retValue.projectAuthorWebsite = settingsFileIO.ReadValue(projectSection, "project_author_website");
                retValue.projectPlatform      = settingsFileIO.ReadValue(projectSection, "project_platform");
                retValue.projectDebug         = Convert.ToBoolean(Int32.Parse(settingsFileIO.ReadValue(projectSection, "project_debug")));
                retValue.projectDataServer    = settingsFileIO.ReadValue(projectSection, "project_data_server");
                //Load board
                retValue.boardID         = Int32.Parse(settingsFileIO.ReadValue(boardSection, "board_id"));
                retValue.boardPort       = settingsFileIO.ReadValue(boardSection, "board_port");
                retValue.deviceUsedCount = Int32.Parse(settingsFileIO.ReadValue(boardSection, "devices_used"));
                //Load package
                retValue.packageGUID = settingsFileIO.ReadValue(packageSection, "package_id");
                //Load simulator_options
                string projectDir = Path.GetDirectoryName(projectFilePath);
                retValue.simulatorOptionsFilePath = Path.GetFullPath(projectDir + "\\" + settingsFileIO.ReadValue(simulatorOptionsSection, "option_file"));
                //Load record
                retValue.recorderFilePath = Path.GetFullPath(projectDir + "\\" + settingsFileIO.ReadValue(recordSection, "recorder"));
                retValue.recordDir        = Path.GetFullPath(projectDir + "\\" + settingsFileIO.ReadValue(recordSection, "record_dir"));
                try
                {
                    //Load Q&A
                    retValue.QAData = new SAGATManager.QAManagerData();
                    retValue.QAData.Clear();
                    retValue.QAData.questionAnswerEnable = Convert.ToBoolean(Int32.Parse(settingsFileIO.ReadValue(questionAnswerSection, "question_answer_enable")));
                    if (retValue.QAData.questionAnswerEnable)
                    {
                        retValue.QAData.questionAnswerCount    = Int32.Parse(settingsFileIO.ReadValue(questionAnswerSection, "question_answer_count"));
                        retValue.QAData.questionAnswerSavePath = Path.GetFullPath(projectDir + "\\" + settingsFileIO.ReadValue(questionAnswerSection, "question_answer_save_path"));
                        retValue.QAData.questionAnswers.Clear();
                        for (int i = 0; i < retValue.QAData.questionAnswerCount; i++)
                        {
                            string sectionName = questionAnswerListSction + i.ToString();
                            SAGATManager.QAManagerData.QuestionAnswer questionAnswer = new SAGATManager.QAManagerData.QuestionAnswer();
                            questionAnswer.pauseDistance = Double.Parse(settingsFileIO.ReadValue(sectionName, "pause_distance"));
                            questionAnswer.questionCount = Int32.Parse(settingsFileIO.ReadValue(sectionName, "question_count"));
                            questionAnswer.questionAnswerItems.Clear();
                            for (int j = 0; j < questionAnswer.questionCount; j++)
                            {
                                SAGATManager.QAManagerData.QuestionAnswer.QuestionAnswerItem questionAnswerItem = new SAGATManager.QAManagerData.QuestionAnswer.QuestionAnswerItem();
                                questionAnswerItem.questionTimer = Int32.Parse(settingsFileIO.ReadValue(sectionName, "question" + j.ToString() + "_timer"));
                                questionAnswerItem.questionTitle = settingsFileIO.ReadValue(sectionName, "question" + j.ToString() + "_title");
                                questionAnswerItem.questionDesc  = settingsFileIO.ReadValue(sectionName, "question" + j.ToString() + "_describle");
                                questionAnswerItem.questionMode  = (SAGATManager.QAManagerData.QuestionMode)Int32.Parse(settingsFileIO.ReadValue(sectionName, "answer" + j.ToString() + "_mode"));
                                questionAnswerItem.selectionText.Clear();
                                if (questionAnswerItem.questionMode == SAGATManager.QAManagerData.QuestionMode.TEXT_INPUT)
                                {
                                    questionAnswerItem.textboxType = (SAGATManager.QAManagerData.TextboxType)Int32.Parse(settingsFileIO.ReadValue(sectionName, "answer" + j.ToString() + "_textbox_type"));
                                }
                                else if (questionAnswerItem.questionMode == SAGATManager.QAManagerData.QuestionMode.SELECT)
                                {
                                    questionAnswerItem.selectionCount = Int32.Parse(settingsFileIO.ReadValue(sectionName, "answer" + j.ToString() + "_selection_count"));
                                    for (int k = 0; k < questionAnswerItem.selectionCount; k++)
                                    {
                                        questionAnswerItem.selectionText.Add(settingsFileIO.ReadValue(sectionName, "answer" + j.ToString() + "_selection" + k.ToString() + "_text"));
                                    }
                                }
                                questionAnswerItem.submitButtonText = settingsFileIO.ReadValue(sectionName, "answer" + j.ToString() + "_submit_button_text");
                                questionAnswerItem.correctValue     = settingsFileIO.ReadValue(sectionName, "answer" + j.ToString() + "_correct_value");
                                questionAnswer.questionAnswerItems.Add(questionAnswerItem);
                            }
                            retValue.QAData.questionAnswers.Add(questionAnswer);
                        }
                    }
                }
                catch (Exception) { };
                //Load control_objects
                retValue.controlObjectsUsed = Int32.Parse(settingsFileIO.ReadValue(controlObjectsSection, "control_objects_used"));
                retValue.controlObjectID.Clear();
                retValue.controlObjectPara.Clear();
                retValue.controlObjectSerialBaudRate.Clear();
                //Load object setup
                for (int i = 0; i < retValue.controlObjectsUsed; i++)
                {
                    retValue.controlObjectID.Add(Int32.Parse(settingsFileIO.ReadValue(objectProtocolSection + i.ToString(), "object_id")));
                    if (ControlObjects.controlObjectsInfo[retValue.controlObjectID[i]].objectIOMode[0] == DevicesManager.DevicesIOMode.DEVICE_SERIAL)
                    {
                        retValue.controlObjectPara.Add(settingsFileIO.ReadValue(objectProtocolSection + i.ToString(), "object_device_para"));
                        retValue.controlObjectSerialBaudRate.Add(Int32.Parse(settingsFileIO.ReadValue(objectProtocolSection + i.ToString(), "object_baudrate")));
                    }
                    else
                    {
                        List <object> tempPara = new List <object>();
                        tempPara = settingsFileIO.ReadVectorValue(objectProtocolSection + i.ToString(), "object_device_para").ConvertAll <object>(x => (object)x);
                        retValue.controlObjectPara.Add(tempPara);
                        retValue.controlObjectSerialBaudRate.Add(-1);
                    }
                }
                settingsFileIO.Dispose();
            }
            catch (Exception) { };
            settingsFileIO.Dispose();
            return(retValue);
        }