//public static string GetCurrentUserDataFile() { // return m_newuserlibfile; //} private static void InitUserData() { //m_newuserlibfile = string.Empty; //if (IRQ_GameNet.UserService.CurrentUser.Id == 0) { m_CurrentUserDataDir = Path.Combine("Users", "0"); IRobotQ.PackerDisk.DiskReadZip_FilePacker.CheckDirectory(m_CurrentUserDataDir); try { m_userData = IRQ_Packer.OpenPacker(m_CurrentUserDataDir); } catch (Exception ee) { //DebugLog.Log("打开游客数据失败", ee, true); Console.WriteLine(ee.ToString()); } //} UserRobotLib = m_userData.GetFileTable("Robot"); if (UserRobotLib == null) { UserRobotLib = m_userData.AddFileTable("Robot"); } UserSceneLib = m_userData.GetFileTable("Scene"); if (UserSceneLib == null) { UserSceneLib = m_userData.AddFileTable("Scene"); } UserCtrlLib = m_userData.GetFileTable("VPL"); if (UserCtrlLib == null) { UserCtrlLib = m_userData.AddFileTable("VPL"); } QuickLanchLib = m_userData.GetFileTable("Quick"); if (QuickLanchLib == null) { QuickLanchLib = m_userData.AddFileTable("Quick"); } FullSimpackLib = m_userData.GetFileTable("FullQuick"); if (FullSimpackLib == null) { FullSimpackLib = m_userData.AddFileTable("FullQuick"); } TemplateSceneLib = m_userData.GetFileTable("TemplateScene"); if (TemplateSceneLib == null) { TemplateSceneLib = m_userData.AddFileTable("TemplateScene"); } TemplateRobotLib = m_userData.GetFileTable("TemplateRobot"); if (TemplateRobotLib == null) { TemplateRobotLib = m_userData.AddFileTable("TemplateRobot"); } TemplateVPLLib = m_userData.GetFileTable("TemplateVPL"); if (TemplateVPLLib == null) { TemplateVPLLib = m_userData.AddFileTable("TemplateVPL"); } UserSettingLib = m_userData.GetFileTable("Setting"); if (UserSettingLib == null) { UserSettingLib = m_userData.AddFileTable("Setting"); } }
//public static string GetCurrentUserDataFile() { // return m_newuserlibfile; //} private static void InitUserData() { //m_newuserlibfile = string.Empty; //if (IRQ_GameNet.UserService.CurrentUser.Id == 0) { m_CurrentUserDataDir = Path.Combine("Users", "0"); IRobotQ.PackerDisk.DiskReadZip_FilePacker.CheckDirectory(m_CurrentUserDataDir); try { m_userData = IRQ_Packer.OpenPacker(m_CurrentUserDataDir); } catch (Exception ee) { //DebugLog.Log("打开游客数据失败", ee, true); Console.WriteLine(ee.ToString()); } //} UserRobotLib = m_userData.GetFileTable("Robot"); if (UserRobotLib == null) { UserRobotLib = m_userData.AddFileTable("Robot"); } UserSceneLib = m_userData.GetFileTable("Scene"); if (UserSceneLib == null) { UserSceneLib = m_userData.AddFileTable("Scene"); } UserCtrlLib = m_userData.GetFileTable("VPL"); if (UserCtrlLib == null) { UserCtrlLib = m_userData.AddFileTable("VPL"); } QuickLanchLib = m_userData.GetFileTable("Quick"); if (QuickLanchLib == null) { QuickLanchLib = m_userData.AddFileTable("Quick"); } FullSimpackLib = m_userData.GetFileTable("FullQuick"); if (FullSimpackLib == null) { FullSimpackLib = m_userData.AddFileTable("FullQuick"); } TemplateSceneLib = m_userData.GetFileTable("TemplateScene"); if (TemplateSceneLib == null) { TemplateSceneLib = m_userData.AddFileTable("TemplateScene"); } TemplateRobotLib = m_userData.GetFileTable("TemplateRobot"); if (TemplateRobotLib == null) { TemplateRobotLib = m_userData.AddFileTable("TemplateRobot"); } TemplateVPLLib = m_userData.GetFileTable("TemplateVPL"); if (TemplateVPLLib == null) { TemplateVPLLib = m_userData.AddFileTable("TemplateVPL"); } UserSettingLib = m_userData.GetFileTable("Setting"); if (UserSettingLib == null) { UserSettingLib = m_userData.AddFileTable("Setting"); } }
public static void Init() { //把静态构造函数中的初始化操作放到这里 try { #if !机房版 //if (IRQ_GameNet.UserService.CurrentUser.Id == 0) { // DebugLog.RaiseErrorReport(ErrorLevel.Dead, "尚未登录,ResourceService须在登录后才能正常初始化。"); // return; //} #endif if (!System.IO.Directory.Exists("Data")) { System.IO.Directory.CreateDirectory("Data"); } if (!System.IO.Directory.Exists("Users")) { System.IO.Directory.CreateDirectory("Users"); } #if PACK //--用户数据 InitUserData(); //在线数据 m_OnlineScene = IRQ_Packer.OpenPacker("Data\\DataD2_dat"); OnLineSceneLib = m_OnlineScene.GetFileTable("OnlineScene"); if (OnLineSceneLib == null) { OnLineSceneLib = m_OnlineScene.AddFileTable("OnlineScene"); } //---官方数据 m_sysData = IRQ_Packer.OpenPacker("Data\\DataD_dat"); OfflineSceneLib = m_sysData.GetFileTable("OfflineScene"); if (OfflineSceneLib == null) { OfflineSceneLib = m_sysData.AddFileTable("OfflineScene"); } //自带机器人、程序 m_sysData_RobotVPL = IRQ_Packer.OpenPacker("Data\\DataD1_dat"); SystemRobotLib = m_sysData_RobotVPL.GetFileTable("SystemRobot"); if (SystemRobotLib == null) { SystemRobotLib = m_sysData_RobotVPL.AddFileTable("SystemRobot"); } SystemCtrlLib = m_sysData_RobotVPL.GetFileTable("SystemVPL"); if (SystemCtrlLib == null) { SystemCtrlLib = m_sysData_RobotVPL.AddFileTable("SystemVPL"); } SystemQuickSimPackLib = m_sysData_RobotVPL.GetFileTable("SystemQuick"); if (SystemQuickSimPackLib == null) { SystemQuickSimPackLib = m_sysData_RobotVPL.AddFileTable("SystemQuick"); } //--缓存数据 m_tempData = IRQ_Packer.OpenPacker("Data\\DataE_dat"); TempUserCtrlLib = m_tempData.GetFileTable("TempVPL"); if (TempUserCtrlLib == null) { TempUserCtrlLib = m_tempData.AddFileTable("TempVPL"); } TempUserRobotLib = m_tempData.GetFileTable("TempRobot"); if (TempUserRobotLib == null) { TempUserRobotLib = m_tempData.AddFileTable("TempRobot"); } TempLeadInResLib = m_tempData.GetFileTable("TempLeadInRes"); if (TempLeadInResLib == null) { TempLeadInResLib = m_tempData.AddFileTable("TempLeadInRes"); } #else m_CurrentUserDataDir = Path.Combine("Users", IRQ_GameNet.UserService.CurrentUser.Id.ToString()); IRQ_Utility.CheckDirectory(m_CurrentUserDataDir); UserRobotLib = new FilesSystemPackerStrategy(); UserRobotLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\Robot"; if (!Directory.Exists(UserRobotLib.Name)) { Directory.CreateDirectory(UserRobotLib.Name); } UserSceneLib = new FilesSystemPackerStrategy(); UserSceneLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\Scene"; if (!Directory.Exists(UserSceneLib.Name)) { Directory.CreateDirectory(UserSceneLib.Name); } UserCtrlLib = new FilesSystemPackerStrategy(); UserCtrlLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\VPL"; if (!Directory.Exists(UserCtrlLib.Name)) { Directory.CreateDirectory(UserCtrlLib.Name); } QuickLanchLib = new FilesSystemPackerStrategy(); QuickLanchLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\Quick"; if (!Directory.Exists(QuickLanchLib.Name)) { Directory.CreateDirectory(QuickLanchLib.Name); } FullSimpackLib = new FilesSystemPackerStrategy(); FullSimpackLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\FullQuick"; if (!Directory.Exists(FullSimpackLib.Name)) { Directory.CreateDirectory(FullSimpackLib.Name); } TemplateSceneLib = new FilesSystemPackerStrategy(); TemplateSceneLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\TemplateScene"; if (!Directory.Exists(TemplateSceneLib.Name)) { Directory.CreateDirectory(TemplateSceneLib.Name); } TemplateRobotLib = new FilesSystemPackerStrategy(); TemplateRobotLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\TemplateRobot"; if (!Directory.Exists(TemplateRobotLib.Name)) { Directory.CreateDirectory(TemplateRobotLib.Name); } TemplateVPLLib = new FilesSystemPackerStrategy(); TemplateVPLLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\TemplateVPL"; if (!Directory.Exists(TemplateVPLLib.Name)) { Directory.CreateDirectory(TemplateVPLLib.Name); } UserSettingLib = new FilesSystemPackerStrategy(); UserSettingLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\Setting"; if (!Directory.Exists(UserSettingLib.Name)) { Directory.CreateDirectory(UserSettingLib.Name); } OnLineSceneLib = new FilesSystemPackerStrategy(); OnLineSceneLib.Name = "Data\\DataD2\\OnlineScene"; if (!Directory.Exists(OnLineSceneLib.Name)) { Directory.CreateDirectory(OnLineSceneLib.Name); } OfflineSceneLib = new FilesSystemPackerStrategy(); OfflineSceneLib.Name = "Data\\DataD\\OfflineScene"; if (!Directory.Exists(OfflineSceneLib.Name)) { Directory.CreateDirectory(OfflineSceneLib.Name); } //特殊处理的 SystemRobotLib = new FilesSystemPackerStrategy(); SystemRobotLib.Name = "Data\\DataD1\\SystemRobot"; if (!Directory.Exists(SystemRobotLib.Name)) { Directory.CreateDirectory(SystemRobotLib.Name); } SystemCtrlLib = new FilesSystemPackerStrategy(); SystemCtrlLib.Name = "Data\\DataD1\\SystemVPL"; if (!Directory.Exists(SystemCtrlLib.Name)) { Directory.CreateDirectory(SystemCtrlLib.Name); } SystemQuickSimPackLib = new FilesSystemPackerStrategy(); SystemQuickSimPackLib.Name = "Data\\DataD1\\SystemQuick"; if (!Directory.Exists(SystemQuickSimPackLib.Name)) { Directory.CreateDirectory(SystemQuickSimPackLib.Name); } TempUserRobotLib = new FilesSystemPackerStrategy(); TempUserRobotLib.Name = "Data\\DataE\\TempRobot"; if (!Directory.Exists(TempUserRobotLib.Name)) { Directory.CreateDirectory(TempUserRobotLib.Name); } TempUserCtrlLib = new FilesSystemPackerStrategy(); TempUserCtrlLib.Name = "Data\\DataE\\TempVPL"; if (!Directory.Exists(TempUserCtrlLib.Name)) { Directory.CreateDirectory(TempUserCtrlLib.Name); } TempLeadInResLib = new FilesSystemPackerStrategy(); TempLeadInResLib.Name = "Data\\DataE\\TempLeadInRes"; if (!Directory.Exists(TempLeadInResLib.Name)) { Directory.CreateDirectory(TempLeadInResLib.Name); } #endif RegistorAllLibs(); } catch (Exception ee) { Console.WriteLine(ee.ToString()); } }
public static void Init() { //把静态构造函数中的初始化操作放到这里 try { #if !机房版 //if (IRQ_GameNet.UserService.CurrentUser.Id == 0) { // DebugLog.RaiseErrorReport(ErrorLevel.Dead, "尚未登录,ResourceService须在登录后才能正常初始化。"); // return; //} #endif if (!System.IO.Directory.Exists("Data")) { System.IO.Directory.CreateDirectory("Data"); } if (!System.IO.Directory.Exists("Users")) { System.IO.Directory.CreateDirectory("Users"); } #if PACK //--用户数据 InitUserData(); //在线数据 m_OnlineScene = IRQ_Packer.OpenPacker("Data\\DataD2_dat"); OnLineSceneLib = m_OnlineScene.GetFileTable("OnlineScene"); if (OnLineSceneLib == null) { OnLineSceneLib = m_OnlineScene.AddFileTable("OnlineScene"); } //---官方数据 m_sysData = IRQ_Packer.OpenPacker("Data\\DataD_dat"); OfflineSceneLib = m_sysData.GetFileTable("OfflineScene"); if (OfflineSceneLib == null) { OfflineSceneLib = m_sysData.AddFileTable("OfflineScene"); } //自带机器人、程序 m_sysData_RobotVPL = IRQ_Packer.OpenPacker("Data\\DataD1_dat"); SystemRobotLib = m_sysData_RobotVPL.GetFileTable("SystemRobot"); if (SystemRobotLib == null) { SystemRobotLib = m_sysData_RobotVPL.AddFileTable("SystemRobot"); } SystemCtrlLib = m_sysData_RobotVPL.GetFileTable("SystemVPL"); if (SystemCtrlLib == null) { SystemCtrlLib = m_sysData_RobotVPL.AddFileTable("SystemVPL"); } SystemQuickSimPackLib = m_sysData_RobotVPL.GetFileTable("SystemQuick"); if (SystemQuickSimPackLib == null) { SystemQuickSimPackLib = m_sysData_RobotVPL.AddFileTable("SystemQuick"); } //--缓存数据 m_tempData = IRQ_Packer.OpenPacker("Data\\DataE_dat"); TempUserCtrlLib = m_tempData.GetFileTable("TempVPL"); if (TempUserCtrlLib == null) { TempUserCtrlLib = m_tempData.AddFileTable("TempVPL"); } TempUserRobotLib = m_tempData.GetFileTable("TempRobot"); if (TempUserRobotLib == null) { TempUserRobotLib = m_tempData.AddFileTable("TempRobot"); } TempLeadInResLib = m_tempData.GetFileTable("TempLeadInRes"); if (TempLeadInResLib == null) { TempLeadInResLib = m_tempData.AddFileTable("TempLeadInRes"); } #else m_CurrentUserDataDir = Path.Combine("Users", IRQ_GameNet.UserService.CurrentUser.Id.ToString()); IRQ_Utility.CheckDirectory(m_CurrentUserDataDir); UserRobotLib = new FilesSystemPackerStrategy(); UserRobotLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\Robot"; if (!Directory.Exists(UserRobotLib.Name)) { Directory.CreateDirectory(UserRobotLib.Name); } UserSceneLib = new FilesSystemPackerStrategy(); UserSceneLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\Scene"; if (!Directory.Exists(UserSceneLib.Name)) { Directory.CreateDirectory(UserSceneLib.Name); } UserCtrlLib = new FilesSystemPackerStrategy(); UserCtrlLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\VPL"; if (!Directory.Exists(UserCtrlLib.Name)) { Directory.CreateDirectory(UserCtrlLib.Name); } QuickLanchLib = new FilesSystemPackerStrategy(); QuickLanchLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\Quick"; if (!Directory.Exists(QuickLanchLib.Name)) { Directory.CreateDirectory(QuickLanchLib.Name); } FullSimpackLib = new FilesSystemPackerStrategy(); FullSimpackLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\FullQuick"; if (!Directory.Exists(FullSimpackLib.Name)) { Directory.CreateDirectory(FullSimpackLib.Name); } TemplateSceneLib = new FilesSystemPackerStrategy(); TemplateSceneLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\TemplateScene"; if (!Directory.Exists(TemplateSceneLib.Name)) { Directory.CreateDirectory(TemplateSceneLib.Name); } TemplateRobotLib = new FilesSystemPackerStrategy(); TemplateRobotLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\TemplateRobot"; if (!Directory.Exists(TemplateRobotLib.Name)) { Directory.CreateDirectory(TemplateRobotLib.Name); } TemplateVPLLib = new FilesSystemPackerStrategy(); TemplateVPLLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\TemplateVPL"; if (!Directory.Exists(TemplateVPLLib.Name)) { Directory.CreateDirectory(TemplateVPLLib.Name); } UserSettingLib = new FilesSystemPackerStrategy(); UserSettingLib.Name = "Users\\" + IRQ_GameNet.UserService.CurrentUser.Id.ToString() + "\\Setting"; if (!Directory.Exists(UserSettingLib.Name)) { Directory.CreateDirectory(UserSettingLib.Name); } OnLineSceneLib = new FilesSystemPackerStrategy(); OnLineSceneLib.Name = "Data\\DataD2\\OnlineScene"; if (!Directory.Exists(OnLineSceneLib.Name)) { Directory.CreateDirectory(OnLineSceneLib.Name); } OfflineSceneLib = new FilesSystemPackerStrategy(); OfflineSceneLib.Name = "Data\\DataD\\OfflineScene"; if (!Directory.Exists(OfflineSceneLib.Name)) { Directory.CreateDirectory(OfflineSceneLib.Name); } //特殊处理的 SystemRobotLib = new FilesSystemPackerStrategy(); SystemRobotLib.Name = "Data\\DataD1\\SystemRobot"; if (!Directory.Exists(SystemRobotLib.Name)) { Directory.CreateDirectory(SystemRobotLib.Name); } SystemCtrlLib = new FilesSystemPackerStrategy(); SystemCtrlLib.Name = "Data\\DataD1\\SystemVPL"; if (!Directory.Exists(SystemCtrlLib.Name)) { Directory.CreateDirectory(SystemCtrlLib.Name); } SystemQuickSimPackLib = new FilesSystemPackerStrategy(); SystemQuickSimPackLib.Name = "Data\\DataD1\\SystemQuick"; if (!Directory.Exists(SystemQuickSimPackLib.Name)) { Directory.CreateDirectory(SystemQuickSimPackLib.Name); } TempUserRobotLib = new FilesSystemPackerStrategy(); TempUserRobotLib.Name = "Data\\DataE\\TempRobot"; if (!Directory.Exists(TempUserRobotLib.Name)) { Directory.CreateDirectory(TempUserRobotLib.Name); } TempUserCtrlLib = new FilesSystemPackerStrategy(); TempUserCtrlLib.Name = "Data\\DataE\\TempVPL"; if (!Directory.Exists(TempUserCtrlLib.Name)) { Directory.CreateDirectory(TempUserCtrlLib.Name); } TempLeadInResLib = new FilesSystemPackerStrategy(); TempLeadInResLib.Name = "Data\\DataE\\TempLeadInRes"; if (!Directory.Exists(TempLeadInResLib.Name)) { Directory.CreateDirectory(TempLeadInResLib.Name); } #endif RegistorAllLibs(); } catch (Exception ee) { Console.WriteLine(ee.ToString()); } }