static public void vesal_write_log(String logcontent) { try { _log_path = PublicClass.tempPath + "unity.log"; FileStream fs; if (!File.Exists(_log_path)) { Vesal_DirFiles.CreateDir(PublicClass.tempPath); fs = new FileStream(_log_path, System.IO.FileMode.CreateNew); } else { fs = new FileStream(_log_path, System.IO.FileMode.Append); } String time_now = DateTime.Now.ToString(); // FileStream fs = new FileStream("D:\\vesal.log", System.IO.FileMode.Append, FileAccess.Read, FileShare.ReadWrite); //获得字节数组 byte[] data = System.Text.Encoding.UTF8.GetBytes(time_now + " : [" + _pid + "] " + logcontent + "\r\n\r\n"); //开始写入 fs.Write(data, 0, data.Length); //清空缓冲区、关闭流 fs.Flush(); fs.Close(); } catch (Exception e) { UnityEngine.Debug.Log(e.Message); } }
public static void InitDirFiles() { Vesal_DirFiles.CreateDir(PublicClass.filePath); Vesal_DirFiles.CreateDir(PublicClass.tempPath); Vesal_DirFiles.CreateDir(PublicClass.vesal_db_path); Vesal_DirFiles.CreateDir(PublicClass.sign_texture_path); Vesal_DirFiles.CreateDir(PublicClass.UpdatePath); Vesal_DirFiles.CreateDir(PublicClass.SignPath); Vesal_DirFiles.CreateDir(PublicClass.ModelPath); Vesal_DirFiles.CreateDir(PublicClass.MedicalPath); Vesal_DirFiles.CreateDir(PublicClass.xluaPath); Vesal_DirFiles.CreateDir(PublicClass.Anim_TimelinePath); Vesal_DirFiles.CreateDir(PublicClass.Video_path); Vesal_DirFiles.CreateDir(PublicClass.WeiKePlayer_path); // DebugLog.DebugLogInfo("---------------设备内存-------------------" + mem); Vesal_DirFiles.CreateDir(PublicClass.BookMarkPath); }
void Create_assets_path() { model_path = PublicClass.filePath + "model/"; sign_path = PublicClass.filePath + "sign/"; sign_ssp_path = PublicClass.filePath + "sign_ssp_path/"; acu_path = PublicClass.filePath + "acu_path/"; WeiKePlayer_path = PublicClass.filePath + "microlesson/"; game_path = PublicClass.filePath + "game/"; QA_path = PublicClass.filePath + "qa/"; //生成资源文件夹 Vesal_DirFiles.CreateDir(QA_path); Vesal_DirFiles.CreateDir(model_path); Vesal_DirFiles.CreateDir(sign_ssp_path); Vesal_DirFiles.CreateDir(sign_path); Vesal_DirFiles.CreateDir(WeiKePlayer_path); Vesal_DirFiles.CreateDir(game_path); Vesal_DirFiles.CreateDir(acu_path); }
/// <summary> /// 录制文件导出协程 /// </summary> /// <returns></returns> public IEnumerator exportRecord() { saveWaitPanelText.text = "正在导出录制文件"; exportButton.interactable = false; yield return(null); try { List <Slide> tempslides = new List <Slide>(); SlideDoc tmpDoc = PublicTools.DeepCopy(PPTResourcePool.slideDoc); string xmlpath; foreach (Slide tempSlide in tmpDoc.slides) { int tempPageNum = tempSlide.pageNum; xmlpath = PPTGlobal.PPTPath + tempPageNum + "/control_" + tempPageNum + ".xml"; if (File.Exists(xmlpath)) { try { SlideDoc tempPageDoc = PublicTools.Deserialize <SlideDoc>(xmlpath); tempslides.Add(tempPageDoc.slides[0]); } catch { Debug.Log("格式转换失败" + xmlpath); } } else { //如果此页没有录制,默认保存PPT导出记录 tempslides.Add(tempSlide); } } xmlpath = PPTGlobal.PPTPath + "control.xml"; if (File.Exists(xmlpath)) { File.Delete(xmlpath); } tmpDoc.slides = tempslides; PublicTools.SaveObject(xmlpath, tmpDoc); string sourcePath = PPTGlobal.PPTPath.Replace("\\", "/"); if (sourcePath.EndsWith("/")) { sourcePath = sourcePath.Substring(0, sourcePath.Length - 1); } string DirectName = sourcePath.Substring(sourcePath.LastIndexOf("/") + 1); Debug.Log(@"EXPORT:" + PPTGlobal.PPTPath); if (!Directory.Exists(exportPath)) { Vesal_DirFiles.CreateDir(exportPath); } Vesal_DirFiles.ZipDirectory(PPTGlobal.PPTPath.Substring(0, PPTGlobal.PPTPath.Length - 1), @"" + exportPath + DirectName + ".vsl"); //Debug.LogError("压缩文件"); Debug.Log(@"EXPORT:" + exportPath + DirectName + ".vsl"); //打开文件夹 OpenWeiKePlayer(exportPath, DirectName); //打开播放器加载资源 } catch (Exception e) { Debug.Log(e.Message); Debug.Log(e.StackTrace); } yield return(null); exportButton.interactable = true; saveWaitPanelText.text = "导出完成!"; //saveWaitPanel.SetActive(false); //quitCanvas.SetActive(false); }
IEnumerator update_process(int index, Action count_load = null) { string fix_file = PublicClass.filePath + Vesal_DirFiles.get_file_name_from_full_path(update_list[index].name); if (Directory.Exists(PublicClass.UpdatePath)) { Vesal_DirFiles.CreateDir(PublicClass.UpdatePath); } try { Vesal_DirFiles.UnZip(fix_file, PublicClass.UpdatePath, true); Vesal_DirFiles.DelFile(fix_file); } catch (System.Exception e) { Debug.Log(e.Message); Debug.Log(e.StackTrace); } yield return(null); //打开数据库进行更新 string[] files = Directory.GetFiles(PublicClass.UpdatePath); List <string> fix_tab_list = new List <string>(); foreach (string tagetfile in files) { string target = Vesal_DirFiles.get_file_name_from_full_path(tagetfile); if (target == "vesali.db") { File.Copy(tagetfile, PublicClass.vesal_db_path + "temp.db", true); fix_tab_list = PublicTools.get_table_list("temp.db"); int tab_count = 0; if (fix_tab_list.Count != 0) { foreach (string tab_name in fix_tab_list) { switch (tab_name) { case "GetSubModel": PublicTools.update_GetSubModel_db("temp.db"); break; case "GetStructList": PublicTools.update_GetStructList_db("temp.db"); break; case "GetStructAbList": PublicTools.update_GetStructAbList_db("temp.db"); break; case "LayserSubModel": PublicTools.update_LayserSubModel_db("temp.db"); break; case "ModelRelationModel": PublicTools.update_ModelRelationModel_db("temp.db"); break; case "RightMenuLayerModel": PublicTools.update_RightMenuLayerModel_db("temp.db"); break; case "RightMenuModel": PublicTools.update_RightMenuModel_db("temp.db"); break; case "SignNewInfo": PublicTools.update_SignNewInfo_db("temp.db"); break; case "GetTextureModelList": PublicTools.update_GetTextureModelList_db("temp.db"); break; case "noun_no_info": PublicTools.update_noun_no_info_db("temp.db"); break; case "AbInfo": PublicTools.update_ab_info_db("temp.db"); break; } tab_count++; showProgress.current_progress = (float)index / update_list.Count + (float)tab_count / fix_tab_list.Count / update_list.Count; yield return(null); } } else { PublicTools.update_GetSubModel_db("temp.db"); showProgress.current_progress = (float)index / update_list.Count + 0.1f / update_list.Count; PublicTools.update_GetStructList_db("temp.db"); showProgress.current_progress = (float)index / update_list.Count + 0.3f / update_list.Count; yield return(null); PublicTools.update_GetStructAbList_db("temp.db"); PublicTools.update_LayserSubModel_db("temp.db"); showProgress.current_progress = (float)index / update_list.Count + 0.5f / update_list.Count; yield return(null); PublicTools.update_ModelRelationModel_db("temp.db"); PublicTools.update_RightMenuLayerModel_db("temp.db"); showProgress.current_progress = (float)index / update_list.Count + 0.65f / update_list.Count; yield return(null); PublicTools.update_RightMenuModel_db("temp.db"); PublicTools.update_SignNewInfo_db("temp.db"); showProgress.current_progress = (float)index / update_list.Count + 0.8f / update_list.Count; yield return(null); PublicTools.update_GetTextureModelList_db("temp.db"); PublicTools.update_noun_no_info_db("temp.db"); PublicTools.update_ab_info_db("temp.db"); showProgress.current_progress = (float)index / update_list.Count + 0.99f / update_list.Count; yield return(null); } } //拷贝文件 } string[] dirs = Directory.GetDirectories(PublicClass.UpdatePath); foreach (string targetdir in dirs) { string subdir = Vesal_DirFiles.get_file_name_from_full_path(targetdir); if (subdir.ToUpper() == "ANDROID_SIGN") { Vesal_DirFiles.Vesal_DirCopy(targetdir, PublicClass.SignPath); } if (subdir.ToUpper() == "MODEL") { Vesal_DirFiles.Vesal_DirCopy(targetdir, PublicClass.ModelPath); } } yield return(null); //删除update数据 try { Directory.Delete(PublicClass.UpdatePath, true); Vesal_DirFiles.DelFile(PublicClass.vesal_db_path + "temp.db"); } catch (System.Exception e) { Debug.Log(e.Message); Debug.Log(e.StackTrace); } yield return(null); if (count_load != null) { count_load(); } }