Пример #1
0
    //贴图记录工具
    public static void SetTextureDataToDB(string texture_path, string db_fullname)
    {
        print("<Color=#00ff00> db路径 :" + db_fullname + " </color>");
        List <string> list = new List <string>();

        list.AddRange(Vesal_DirFiles.GetAllDirInfoFromPath(texture_path));
        print("<Color=#00ff00> 贴图列表长度 :" + list.Count + "</color>");
        DbRepository <texture_mask> temp_db = new DbRepository <texture_mask>();

        // temp_db.DataService("StartStop.db");
        temp_db.CreateDb(db_fullname);
        temp_db.CreateTable();
        //db 原数据
        List <string> mask_name_list = new List <string>();
        var           tmpssp         = temp_db.Select <texture_mask>((ss_id) =>
        {
            if (ss_id != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        for (int i = 0; i < list.Count; i++)
        {
            texture_mask temp_mask = new texture_mask
            {
                id       = i + 1,
                name     = Vesal_DirFiles.get_file_name_from_full_path(list[i]),
                tex_data = File.ReadAllBytes(list[i]),// Vesal_DirFiles.Object2Bytes(new SceneModelState()),
            };
            bool has_record = false;
            foreach (texture_mask tmp in tmpssp)
            {
                if (temp_mask.name == tmp.name)
                {
                    temp_db.Update(temp_mask);
                    has_record = true;
                    print("update : " + temp_mask.name);
                }
            }
            if (has_record == false)
            {
                temp_db.Insert(temp_mask);
            }
        }

        Debug.Log("写入mask texture 数据成功");
        temp_db.Close();
    }
Пример #2
0
    public static void SplitByte()
    {
        PublicClass.InitStaticData();
        string        db_path  = PublicClass.filePath + "Mediacl/RA0901001_1/";
        List <string> namelist = new List <string>();

        namelist.AddRange(Vesal_DirFiles.GetAllDirInfoFromPath(db_path));
        Debug.Log(db_path);
        for (int i = 0; i < namelist.Count; i++)
        {
            Debug.Log(namelist[i]);
            Vesal_DirFiles.SaveAbfile(namelist[i], PublicClass.filePath + Vesal_DirFiles.get_file_name_from_full_path(namelist[i]), false, false);
        }
    }