public string GenerateLocalInformation(string servername, string executable, string serverpath, string httpsUser, string httpsPwd, string proxyUrl, string proxyHttpsPort, string proxyUser, string proxyPwd) { LocalInformation local = new LocalInformation { CurrentVersion = new VersionNumber("0.0.0.0"), ProductName = servername, ProgramExecutable = executable, Proxy = new ProxyInformation { Url = proxyUrl, HttpsPort = proxyHttpsPort, ProxyUser = new User { Name = proxyUser, Pwd = proxyPwd } }, ServerUser = new User { Name = httpsUser, Pwd = httpsPwd }, UpdateServerUrl = serverpath }; return(DeSerializer.SerializeToString(local)); }
public void SetValues() { LocalInformation.CurrentInformation.studentNum = StudentNumIn.GetComponent <InputField>().text; LocalInformation.CurrentInformation.studentMajor = MajorIn.GetComponent <InputField>().text; LocalInformation.CurrentInformation.password = PasswordIn.GetComponent <InputField>().text; switch (LocalInformation.StudentInfoCheck()) { case 2: Debug.Log("success entrance"); //输入正确,进入游戏界面 BS.InGaming(); break; case 1: Debug.Log("wrong info"); //输入信息错误,要求重新输入 ClearInputF(); WrongEntranceCheck.GetComponent <UITips>().onShow(); break; case 0: Debug.Log("no info"); //用户名不存在,若处于开发者模式则询问是否添加账户 ClearInputF(); NewUserCheck.GetComponent <UITips>().onShow(); break; default: break; } }
public void CreatNew() { NewInfoGetBase.GetComponent <UITips>().onOK(); WhiteBackground.SetActive(true); if (LocalInformation.StudentInfoAdd()) { SuccessAddInfo.GetComponent <UITips>().onShow(); } else { FailAddInfo.GetComponent <UITips>().onShow(); } }
/** * Gets local version information. */ public void GetLocalData() { SettingsManager.Instance.ContinueUpdate = false; SettingsManager.Instance.ErrorPosition = ErrorPosition.Localinformation; try { _localInformation = DeSerializer.Deserializer <LocalInformation>(Path.GetFullPath(Strings.FILE_LOCAL_INFORMATION)); if (LocalInformation.UpdateServerUrl != "" && LocalInformation.UpdateServerUrl != null) { _gotLocal = true; SettingsManager.Instance.ContinueUpdate = true; } } catch { } }
void Start() { WhiteBackground.SetActive(false);//关闭提示信息的背景白板 FileInfo file = new FileInfo(Application.dataPath + "/" + LocalInformation.InfoSaveName + ".txt"); if (file.Exists) { Infoget = mytxtIO.GetmyStringList(LocalInformation.InfoSaveName); for (int i = 0; i < Infoget.ToArray().Length; i++)//从文件中读取数据并存储 { LocalInformation.PubAllowAddInfo(); LocalInformation.CurrentInformation.studentNum = Infoget[i]; LocalInformation.CurrentInformation.studentMajor = Infoget[++i]; LocalInformation.CurrentInformation.password = Infoget[++i]; LocalInformation.StudentInfoAdd(); } LocalInformation.PubRefuseAddInfo(); file.Delete(); //销毁所读取的文件便于离开此界面时重新存储 } LocalInformation.SaveData(); //立即重建存储内容,防止程序意外退出 }
private void SaveCurrentInfo() { switch (SceneManager.GetActiveScene().name)//离开某个界面时,存储属于该界面的信息 { case "Start Menu": break; case "NewGame": LocalInformation.RebuildData(); //删除已存储的信息 LocalInformation.SaveData(); //重建本地文件进行存储 LocalInformation.ClearCurrents(); break; case "InGaming": GameObject.Find("DataSaving").GetComponent <DataSet>().SaveSituation(); //存储玩家位置 LearningSysInfo.SaveLinkOfStuLes(); //存储当前已学完的课程 LearningSysInfo.SetLocalClasses(); //存储所有课程信息并方便后续修改 break; default: break; } }
/// <summary> /// Seerialisiert in einen XML string. /// </summary> /// <param name="local"></param> /// <returns></returns> public static string SerializeToString(LocalInformation local) { throw new NotImplementedException(); }
private static void Main(string[] args) { #region Add logging log = LogManager.GetLogger(typeof(Program)); log.Debug("Starting updater update."); #endregion #region Wait for SoftwareUpdater.exe log.Info("Waiting for software updater process."); bool wait = true; while (wait) { foreach (Process clsProcess in Process.GetProcesses()) { wait = (clsProcess.ProcessName.Contains("SoftwareUpdater") || clsProcess.ProcessName.Contains("SoftwareUpdater.vshost")); if (wait) { break; } } Thread.Sleep(500); } #endregion #region Confirm args string filelist = "", downloads = "", backup = "", basepath = "", gui = ""; if (args.Length == 5) { if (!File.Exists(args[0])) { log.Info("Error within filelist path: " + args[0]); Exit(1); } filelist = args[0]; if (!Directory.Exists(args[1])) { log.Info("Error within download path: " + args[1]); Exit(1); } downloads = args[1]; if (!Directory.Exists(args[2])) { log.Info("Error within backup path: " + args[2]); Exit(1); } backup = args[2]; if (!Directory.Exists(args[3])) { log.Info("Error within basepath: " + args[3]); Exit(1); } basepath = args[3]; if (!args[4].Contains("gui")) { log.Info("Error within gui selector: " + args[4]); Exit(1); } gui = args[4]; } else { log.Info("Wrong args count."); foreach (string arg in args) { log.Info(arg); } Exit(1); } #endregion #region Copy files // get filelist List <UpdateFile> filestocopy = DeSerializer.Deserializer <List <UpdateFile> >(filelist); // copy file from download dir try { CopyDirectory(downloads, basepath, true); log.Info("Copy of new updater software successfully finished."); } catch (Exception ex) { CopyDirectory(backup, basepath, true); log.Info(ex.Message); Exit(2); } #endregion #region Get version information string versioninfpath = backup.Replace("\\Backup", ""); VersionInformation inf = DeSerializer.Deserializer <VersionInformation>(versioninfpath + Path.DirectorySeparatorChar + "info.xml"); #endregion #region Update local information LocalInformation local = DeSerializer.Deserializer <LocalInformation>(basepath + Path.DirectorySeparatorChar + "info.xml"); local.CurrentVersion = inf.ResultsInVersion; DeSerializer.Serialize(local, basepath + Path.DirectorySeparatorChar + "info.xml"); #endregion #region Delete filelist if (File.Exists(filelist)) { File.Delete(filelist); } #endregion #region Start software updater Process proc = new Process(); if (gui == "/nogui") { Process.Start( new StringBuilder().Append(basepath).Append(Path.DirectorySeparatorChar).Append("SoftwareUpdater.exe").ToString(), "/nogui"); } else { Process.Start( new StringBuilder().Append(basepath).Append(Path.DirectorySeparatorChar).Append("SoftwareUpdater.exe").ToString()); } #endregion // exit with 0 when succesfully finished Exit(0); }