Exemple #1
0
        //保存工程
        public void saveProject()
        {
            SVUniqueID idObj = SVUniqueID.instance();

            idObj.saveFile();

            //写入xml文件
            linqSaveFile(SVProData.FullProPath);
        }
Exemple #2
0
        public static SVUniqueID instance()
        {
            if (_obj == null)
            {
                _obj = new SVUniqueID();
            }

            return(_obj);
        }
Exemple #3
0
        //通过文件名来打开一个工程
        public Boolean openProject(String path, String name)
        {
            String vPath    = Path.Combine(path, name);
            String fileName = Path.Combine(vPath, name + ".svduproj");

            if (!File.Exists(fileName))
            {
                return(false);
            }

            //获取绝对路径
            vPath    = Path.GetFullPath(vPath);
            fileName = Path.GetFullPath(fileName);

            SVProData.FullProPath  = fileName;
            SVProData.ProPath      = vPath;
            SVProData.ProName      = Path.GetFileNameWithoutExtension(fileName);
            SVProData.TemplatePath = Path.Combine(vPath, "Template");
            SVProData.IconPath     = Path.Combine(vPath, "Icon");
            SVProData.LogPath      = Path.Combine(vPath, "Log");
            SVProData.version      = "1.1.7";

            SVUniqueID idObj = SVUniqueID.instance();

            idObj.UniqueFile = Path.Combine(SVProData.ProPath, "config");
            idObj.loadFile();

            ///初始化日志
            SVTextTraceListenter textListener = new SVTextTraceListenter(SVProData.LogPath);

            SVLog.TextLog.Listeners().Add(textListener);
            SVLog.WinLog.Listeners().Add(textListener);

            _sqlDataBase.connect(SVProData.dbIp, SVProData.ProName, SVProData.user, SVProData.passwd);
            //_sqlDataBase.connect(SVProData.dbIp, "tmp", SVProData.user, SVProData.passwd);
            //SVProData.DownLoadFile = _sqlDataBase.getProPath();
            ///先不从数据库中获取下装文件生成的路径
            SVProData.DownLoadFile = Path.Combine(SVProData.ProPath, "Download");
            if (String.IsNullOrEmpty(SVProData.DownLoadFile))
            {
                SVLog.WinLog.Warning("获取工程路径出错");
            }

            //从工程文件中加载信息
            linqFromFile(fileName);

            SVConfig.instance().addRectFilesItem(fileName);

            return(true);
        }
Exemple #4
0
        //通过路径和工程名称来创建一个工程
        public void createProject(String path, String name)
        {
            //根据名称创建工程目录
            String vPath    = Path.Combine(path, name);
            String fileName = Path.Combine(vPath, name + ".svduproj");

            Directory.CreateDirectory(vPath);

            //创建模板目录
            String vTempPath = Path.Combine(vPath, "Template");

            Directory.CreateDirectory(vTempPath);

            //创建图标管理目录
            String vIconPath = Path.Combine(vPath, "Icon");

            Directory.CreateDirectory(vIconPath);

            //创建日志目录
            String vLogPath = Path.Combine(vPath, "Log");

            Directory.CreateDirectory(vLogPath);

            ///创建下装目录
            String vDownLoadPath = Path.Combine(vPath, "DownLoad");

            Directory.CreateDirectory(vDownLoadPath);

            //写工程xml文件
            linqSaveFile(fileName);

            SVProData.ProName      = name;
            SVProData.ProPath      = vPath;
            SVProData.FullProPath  = fileName;
            SVProData.TemplatePath = vTempPath;
            SVProData.IconPath     = vIconPath;
            SVProData.LogPath      = vLogPath;

            //配置文件
            SVUniqueID idObj = SVUniqueID.instance();

            idObj.UniqueFile = Path.Combine(vPath, "config");
            idObj.initUniqueID();
            idObj.saveFile();

            //打开工程
            openProject(path, name);
        }