public Service(Logger logger, FileMgr fileMgr, CsvToXml csvToXml, Validate validate) { this.logger = logger; this.fileMgr = fileMgr; this.csvToXml = csvToXml; this.validate = validate; }
public void WriteLocalData() { string text = ""; text = text + this.version.ToString() + "|"; text = text + this.NHpLower.ToString() + "|"; text = text + this.NMpLower.ToString() + "|"; text = text + 0.ToString() + "|"; text = text + this.BuyDrug.ToString() + "|"; text = text + this.PickEqp.ToString() + "|"; text = text + this.PickMat.ToString() + "|"; text = text + this.EqpProc.ToString() + "|"; text = text + this.PickEqp_cailiao.ToString() + "|"; text = text + this.PickPet_cailiao.ToString() + "|"; text = text + this.PickWing_cailiao.ToString() + "|"; text = text + this.PickSummon_cailiao.ToString() + "|"; text = text + this.PickDrugs.ToString() + "|"; text = text + this.PickGold.ToString() + "|"; text = text + this.PickOther.ToString() + "|"; text = text + this.EqpType.ToString() + "|"; text = text + this.Skills[0].ToString() + "|"; text = text + this.Skills[1].ToString() + "|"; text = text + this.Skills[2].ToString() + "|"; text = text + this.Skills[3].ToString() + "|"; text = text + 1.ToString() + "|"; text = text + this.Avoid.ToString() + "|"; text = text + this.AutoPK.ToString() + "|"; text = text + this.StoneRespawn.ToString() + "|"; text = text + this.GoldRespawn.ToString() + "|"; text = text + this.RespawnLimit.ToString() + "|"; text += this.RespawnUpBound.ToString(); FileMgr.saveString(FileMgr.TYPE_AUTO, "setting", text); }
void Load() { Action <string> onTableLoad = (text) => { string[] lines = text.Split(new string[] { "\r\n" }, System.StringSplitOptions.RemoveEmptyEntries); int count = lines.Length; if (count < 0) { return; } this.count = count; entities = new t_icon[count]; for (int i = 0; i < count; i++) { string line = lines[i]; if (string.IsNullOrEmpty(line)) { Debug.LogError("data error, line " + i + " is null"); } string[] vals = line.Split('\t'); entities[i] = new t_icon(); entities[i].Key = vals[0]; entities[i].Value = vals[1].Split('|'); keyIndexMap[entities[i].Key] = i; } }; string fileName = t_icon.FileName; FileMgr.ReadFile(fileName, onTableLoad); }
public Service(Logger logger, FileMgr fileMgr, XmlToCsv xmlToCsv, Validate validate) { this.logger = logger; this.fileMgr = fileMgr; this.xmlToCsv = xmlToCsv; this.validate = validate; }
void Load() { Action <string> onTableLoad = (text) => { string[] lines = text.Split(new string[] { "\r\n" }, System.StringSplitOptions.RemoveEmptyEntries); int count = lines.Length; if (count < 0) { return; } this.count = count; entities = new t_language[count]; for (int i = 0; i < count; i++) { string line = lines[i]; if (string.IsNullOrEmpty(line)) { Debug.LogError("data error, line " + i + " is null"); } string[] vals = line.Split('\t'); entities[i] = new t_language(); entities[i].ID = int.Parse(vals[0].Trim()); entities[i].EN = vals[1]; entities[i].IN = vals[2]; entities[i].CH = vals[3]; keyIndexMap[entities[i].ID] = i; } }; string fileName = t_language.FileName; FileMgr.ReadFile(fileName, onTableLoad); }
// 载入一个csv文件并解析 private static bool LoadCsv(string file, bool checkValid, out List <Dictionary <string, string> > records, out List <CsvField> fields, out string primaryKey) { return(ParseLines(FileMgr.ReadLines(file), checkValid, out records, out fields, out primaryKey)); }
private void SetExePath() { if (PlayerPrefs.HasKey(PlayerPrefabExeSavePathKey)) { m_sExePath = PlayerPrefs.GetString(PlayerPrefabExeSavePathKey); } if (IsExePath()) { PlayerPrefs.SetString(PlayerPrefabExeSavePathKey, m_sExePath); PlayerPrefs.Save(); if (m_fileMgr == null) { m_fileMgr = new FileMgr(m_writeLog.Report); } m_fileMgr.SetExePath(m_sExePath); Repaint(); m_bHasExePath = true; } else { if (GUILayout.Button("尋找 " + PaddingEXEName)) { m_sExePath = EditorUtility.OpenFilePanel("需要" + PaddingEXEName, Application.dataPath, "exe"); } } }
private void UpdateSidBidSeqNumbers_Click(object sender, EventArgs e) { string synfile = System.Configuration.ConfigurationManager.AppSettings["SyniverseSIDBIDSequenceFileToRead"]; FileMgr fm = new FileMgr(); fm.ParseTheFile(synfile); }
void Load() { Action <string> onTableLoad = (text) => { string[] lines = text.Split(new string[] { "\r\n" }, System.StringSplitOptions.RemoveEmptyEntries); int count = lines.Length; if (count < 0) { return; } this.count = count; entities = new t_fruitboom_bonus_item_icon[count]; for (int i = 0; i < count; i++) { string line = lines[i]; if (string.IsNullOrEmpty(line)) { Debug.LogError("data error, line " + i + " is null"); } string[] vals = line.Split('\t'); entities[i] = new t_fruitboom_bonus_item_icon(); entities[i].t_id = int.Parse(vals[0].Trim()); entities[i].subgame_id = int.Parse(vals[1].Trim()); entities[i].icon_id = int.Parse(vals[2].Trim()); entities[i].package_name = vals[3]; entities[i].res_name = vals[4]; entities[i].des = vals[5]; keyIndexMap[entities[i].t_id] = i; } }; string fileName = t_fruitboom_bonus_item_icon.FileName; FileMgr.ReadFile(fileName, onTableLoad); }
void Load() { Action <string> onTableLoad = (text) => { string[] lines = text.Split(new string[] { "\r\n" }, System.StringSplitOptions.RemoveEmptyEntries); int count = lines.Length; if (count < 0) { return; } this.count = count; entities = new t_subgame_award_lines[count]; for (int i = 0; i < count; i++) { string line = lines[i]; if (string.IsNullOrEmpty(line)) { Debug.LogError("data error, line " + i + " is null"); } string[] vals = line.Split('\t'); entities[i] = new t_subgame_award_lines(); entities[i].t_id = int.Parse(vals[0].Trim()); entities[i].subgame_id = int.Parse(vals[1].Trim()); entities[i].award_line_index = int.Parse(vals[2].Trim()); entities[i].coordinate_array = vals[3].Split('|').ToIntArray(); keyIndexMap[entities[i].t_id] = i; } }; string fileName = t_subgame_award_lines.FileName; FileMgr.ReadFile(fileName, onTableLoad); }
public void ReadLocalData() { string text = FileMgr.loadString(FileMgr.TYPE_AUTO, "setting"); bool flag = string.IsNullOrEmpty(text); if (flag) { this.SetDefault(); } else { try { string[] array = text.Split(new char[] { '|' }); int num = 0; int num2 = int.Parse(array[num++]); bool flag2 = num2 != this.version; if (flag2) { throw new Exception("Autoplay local data version is not match!"); } this.NHpLower = int.Parse(array[num++]); this.NMpLower = int.Parse(array[num++]); num++; this.BuyDrug = int.Parse(array[num++]); this.PickEqp = int.Parse(array[num++]); this.PickMat = int.Parse(array[num++]); this.EqpProc = int.Parse(array[num++]); this.PickEqp_cailiao = int.Parse(array[num++]); this.PickPet_cailiao = int.Parse(array[num++]); this.PickWing_cailiao = int.Parse(array[num++]); this.PickSummon_cailiao = int.Parse(array[num++]); this.PickDrugs = int.Parse(array[num++]); this.PickGold = int.Parse(array[num++]); this.PickOther = int.Parse(array[num++]); this.EqpType = int.Parse(array[num++]); this.Skills[0] = int.Parse(array[num++]); this.Skills[1] = int.Parse(array[num++]); this.Skills[2] = int.Parse(array[num++]); this.Skills[3] = int.Parse(array[num++]); num++; this.Avoid = int.Parse(array[num++]); this.AutoPK = int.Parse(array[num++]); this.StoneRespawn = int.Parse(array[num++]); this.GoldRespawn = int.Parse(array[num++]); this.RespawnLimit = int.Parse(array[num++]); this.RespawnUpBound = int.Parse(array[num++]); } catch (Exception ex) { Debug.Log(ex.Message); FileMgr.removeFile(FileMgr.TYPE_AUTO, "setting"); this.SetDefault(); } } }
private void OnClick_confirmButton() { Material mat = Resources.Load <Material>("PrintMat"); FileMgr.SaveRenderTextureToPNG(Printer.instance.GetTexture(), mat, pathInputField.text, fileNameInputfield.text); // FileMgr.DoPicture("C:/Hello.png", "C:/", Printer.instance.GetTexture()); uiMgr.ShowTipUI("保存成功"); }
public ReportRunner() { excelHelper = new ClientExcel(); mgrExcelHelper = new ManagerExcel(); paras = new RunnerParas(); fileMgr = new FileMgr(); clients = new List <Client>(); }
public static bool Save(Player player) { string sPath = string.Format(ConstantValue.FILE_NAME_PLAYER, player.PAccount.UserID); PlayerPrefs.SetInt(ConstantValue.PREFS_LAST_USER_ID, (int)player.PAccount.UserID); PlayerPrefs.Save(); return(FileMgr.Save(player, typeof(Player), sPath)); }
/// <summary> /// Loads all map data. /// </summary> public void LoadAllMapData() { _maps = (List <MapInfo>)FileMgr.Load(typeof(List <MapInfo>), ConstantValue.FILE_MAPDATA); if (null == _maps) { _maps = new List <MapInfo> (); } Debug.Log("Map size = " + _maps.Count); }
void parseXML(CommMessage msg) { fileMgr = new FileMgr(); fileMgr.loadXml(msg.XML); int testNum = Int32.Parse(msg.command); for (int i = 0; i < testNum; i++) { string test = "test" + i; string testdriver = fileMgr.parse(test, "testDriver"); string driverName_ = Path.GetFileNameWithoutExtension(testdriver); List <string> argslist = new List <string>(); foreach (string item in fileMgr.parseList(test, "tested")) { argslist.Add(item); } if (Build(testdriver, argslist)) { Console.Write("\n ==============Sending logs to repo ==================\n "); logToRepo(driverName_); } else { Console.Write("\n ==============Build files are missing==================\n "); } string dllname = driverName_ + ".dll"; string dllpath = Path.Combine(childstorage, dllname); if (File.Exists(dllpath)) { Console.Write("\n==============" + testdriver + " builds successfully=============="); sndr.createSendChannel(THAddress); Thread.Sleep(300); Console.Write("\n ==============Sending dll to testharness ==================\n "); if (sndr.postFile(dllname, childstorage, THStorage)) { Console.Write("\n================== Send files successfully================== \n "); CommMessage build = new CommMessage(CommMessage.MessageType.build); build.from = "# " + rcvrport_number + " child builder"; build.to = THAddress; build.command = dllname; sndr.postMessage(build); } else { Console.Write("\n ================== Send file failed. ==================\n "); } } else { Console.Write("\n==============" + testdriver + " build fails=============="); } } global = true; }
public void AddFile(FileObject fileObject) { Log.Debug("enter"); if (!CanInjest(fileObject.RelativeUri)) { Log.Warning($"file already ingested. skipping: {fileObject.RelativeUri}"); return; } ImportJson(FileMgr.Format(fileObject)); }
public void SetUp() { Mock <IStreamReader> mockStreamReader = new Mock <IStreamReader>(); byte[] fakeFileBytes = Encoding.UTF8.GetBytes("TestContent"); MemoryStream fakeMemoryStream = new MemoryStream(fakeFileBytes); mockStreamReader.Setup(fileManager => fileManager.GetReader(It.IsAny <string>())) .Returns(() => new StreamReader(fakeMemoryStream)); fileMgr = new FileMgr(mockStreamReader.Object); }
void Load() { Action <string> onTableLoad = (text) => { string[] lines = text.Split(new string[] { "\r\n" }, System.StringSplitOptions.RemoveEmptyEntries); int count = lines.Length; if (count < 0) { return; } this.count = count; entities = new t_trail[count]; for (int i = 0; i < count; i++) { string line = lines[i]; if (string.IsNullOrEmpty(line)) { Debug.LogError("data error, line " + i + " is null"); } string[] vals = line.Split('\t'); entities[i] = new t_trail(); entities[i].ID = int.Parse(vals[0].Trim()); entities[i].Name = int.Parse(vals[1].Trim()); entities[i].UnitType = int.Parse(vals[2].Trim()); entities[i].Speed = float.Parse(vals[3].Trim()); entities[i].Damage = float.Parse(vals[4].Trim()); entities[i].Defence = float.Parse(vals[5].Trim()); entities[i].CoinReward = float.Parse(vals[6].Trim()); entities[i].CoinPrice = float.Parse(vals[7].Trim()); entities[i].BulletID = int.Parse(vals[8].Trim()); entities[i].DefaultLv = int.Parse(vals[9].Trim()); entities[i].MaxLv = int.Parse(vals[10].Trim()); entities[i].UnlockType = int.Parse(vals[11].Trim()); entities[i].UnlockValue = int.Parse(vals[12].Trim()); entities[i].AtlasName = vals[13]; entities[i].SpriteName = vals[14]; entities[i].PrefabName = vals[15]; entities[i].LocalPos = new Vector3(float.Parse(vals[16].Trim().Split('|')[0]), float.Parse(vals[16].Trim().Split('|')[1]), float.Parse(vals[16].Trim().Split('|')[2])); entities[i].PropertyPlus = vals[17]; entities[i].BulletPrefabName = vals[18]; entities[i].BulletName = vals[19]; entities[i].SmoothDamp = bool.Parse(vals[20].Trim()); entities[i].HasShootAnim = bool.Parse(vals[21].Trim()); entities[i].ShootAudioName = vals[22]; keyIndexMap[entities[i].ID] = i; } }; string fileName = t_trail.FileName; FileMgr.ReadFile(fileName, onTableLoad); }
public MainWindow() { InitializeComponent(); SettingsHandler.InitializeNormalizationMethods(); if (!FileMgr.CheckCustomPath()) { MessageBox.Show("Could not write to given output path. Using own directory!", "Path"); } selectedFilesDataGrid.CellEditEnding += DataGrid_CellEditEnding; double locationLeft = Settings.Default.Main_Window_Location_Left; double locationTop = Settings.Default.Main_Window_Location_Top; if (locationLeft != 0 && locationTop != 0) { if (locationLeft < -1000 || locationLeft > 1000 || locationTop < -1000 || locationTop > 1000) { WindowStartupLocation = WindowStartupLocation.CenterScreen; } else { WindowStartupLocation = WindowStartupLocation.Manual; Left = Settings.Default.Main_Window_Location_Left; Top = Settings.Default.Main_Window_Location_Top; } } versionLabel.Text = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion; UpdateMenu.IsEnabled = Globals.ConnectionSuccessful ? true : false; if (!Globals.ConnectionSuccessful) { MessageBox.Show("There was a problem reaching the Remote Server\nUpdates will be disabled!\nCheck your internet and/or proxy settings!"); } if (Globals.UpdateAvailable) { if (MessageBox.Show("Updates available!\nDo you want to start the Update?", "Update", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { UpdateHandler.StartUpdate(); } } InitializeUIState(); ComboBoxColumn.ItemsSource = SettingsHandler.GetStringNormalizationMethods(); }
void Load() { Action <string> onTableLoad = (text) => { string[] lines = text.Split(new string[] { "\r\n" }, System.StringSplitOptions.RemoveEmptyEntries); int count = lines.Length; if (count < 0) { return; } this.count = count; entities = new t_subgame_normal[count]; for (int i = 0; i < count; i++) { string line = lines[i]; if (string.IsNullOrEmpty(line)) { Debug.LogError("data error, line " + i + " is null"); } string[] vals = line.Split('\t'); entities[i] = new t_subgame_normal(); entities[i].t_id = int.Parse(vals[0].Trim()); entities[i].subgame_id = int.Parse(vals[1].Trim()); entities[i].name = vals[2]; entities[i].shown_name = vals[3]; entities[i].ui_package_name = vals[4]; entities[i].window_name = vals[5]; entities[i].logic_lua_ab_name = vals[6]; entities[i].spin_order_name = vals[7]; entities[i].hall_room_slot_eff = int.Parse(vals[8].Trim()); entities[i].hall_room_slot_special_eff = int.Parse(vals[9].Trim()); entities[i].hall_room_slot_icon = vals[10]; entities[i].hall_room_slot_special_icon = vals[11]; entities[i].has_jackpot = bool.Parse(vals[12].Trim()); entities[i].jackpot_shown_icon = vals[13]; entities[i].jackpot_shown_special_icon = vals[14]; entities[i].showcase_icon = vals[15]; entities[i].axes_count = int.Parse(vals[16].Trim()); entities[i].is_updating = bool.Parse(vals[17].Trim()); entities[i].updating_progress = int.Parse(vals[18].Trim()); entities[i].des = vals[19]; keyIndexMap[entities[i].t_id] = i; } }; string fileName = t_subgame_normal.FileName; FileMgr.ReadFile(fileName, onTableLoad); }
public static Character Load(int uid, string sForceFilePath = "") { string sPath = ""; bool bForcePath = !string.IsNullOrEmpty(sForceFilePath); if (!bForcePath) { sPath = string.Format(ConstantValue.FILE_NAME_CHARACTER, uid); } else { sPath = sForceFilePath; } return(FileMgr.Load(typeof(Character), sPath, bForcePath) as Character); }
public static bool Save(Character character, string sForceFilePath = "") { string sPath = ""; bool bForcePath = !string.IsNullOrEmpty(sForceFilePath); if (!bForcePath) { sPath = string.Format(ConstantValue.FILE_NAME_CHARACTER, character.PInfoStats.UID); } else { sPath = sForceFilePath; } return(FileMgr.Save(character, typeof(Character), sPath, bForcePath)); }
private void OnClick_confirmButton() { string path = pathInputField.text + fileNameInputfield.text; Texture2D texture = null; try { texture = FileMgr.LoadPng(path); } catch (System.Exception) { uiMgr.ShowTipUI("文件不存在"); return; } Printer.instance.SetTexture(texture); uiMgr.ShowTipUI("加载成功"); }
void parseXML(CommMessage msg) { FileMgr fileMgr = new FileMgr(); fileMgr.loadXml(msg.XML); int testNum = Int32.Parse(msg.command); for (int i = 0; i < testNum; i++) { string test = "test" + i; templist.Add(fileMgr.parse(test, "testDriver")); foreach (string item in fileMgr.parseList(test, "tested")) { templist.Add(item); } } }
private void OnGUI() { EditorGUILayout.BeginVertical(); if (GUILayout.Button("圖片存檔位置:" + m_sSavePath, m_uisBox)) { m_sSavePath = EditorUtility.OpenFolderPanel("選擇要存檔位置", "D:\\", ""); if (string.IsNullOrEmpty(m_sSavePath)) { m_sSavePath = DefaultSavePath; } } m_bNeedRelease = EditorGUILayout.Toggle("是否需要Release", m_bNeedRelease); if (!m_bHasExePath) { SetExePath(); } if (m_bHasExePath) { if (m_fileMgr == null) { m_fileMgr = new FileMgr(m_writeLog.Report); m_fileMgr.SetExePath(m_sExePath); } if (GUILayout.Button("複製所有檔案的圖片")) { if (EditorUtility.DisplayDialog("複製所有其他語系檔案", "確定要複製所有檔案的圖片?\n會很久喔", "開始", "取消")) { m_sSearchPath = Application.dataPath; m_fileMgr.FindAndCopyNeedFiel(m_sSearchPath, m_bNeedRelease, m_sSavePath); m_writeLog.WriteLog(m_sSavePath); } } if (GUILayout.Button("複製選擇的資料夾裡的圖片")) { m_sSearchPath = EditorUtility.OpenFolderPanel("選擇要複製的資料夾", Application.dataPath, ""); if (!string.IsNullOrEmpty(m_sSearchPath)) { m_fileMgr.FindAndCopyNeedFiel(m_sSearchPath, m_bNeedRelease, m_sSavePath); m_writeLog.WriteLog(m_sSavePath); } } } EditorGUILayout.EndVertical(); }
void Load() { Action <string> onTableLoad = (text) => { string[] lines = text.Split(new string[] { "\r\n" }, System.StringSplitOptions.RemoveEmptyEntries); int count = lines.Length; if (count < 0) { return; } this.count = count; entities = new t_bullet[count]; for (int i = 0; i < count; i++) { string line = lines[i]; if (string.IsNullOrEmpty(line)) { Debug.LogError("data error, line " + i + " is null"); } string[] vals = line.Split('\t'); entities[i] = new t_bullet(); entities[i].Name = vals[0]; entities[i].MoveSpeed = float.Parse(vals[1].Trim()); entities[i].HitType = int.Parse(vals[2].Trim()); entities[i].Area = float.Parse(vals[3].Trim()); entities[i].AutoDestroyType = int.Parse(vals[4].Trim()); entities[i].LifeTime = float.Parse(vals[5].Trim()); entities[i].Ylength = float.Parse(vals[6].Trim()); entities[i].HarmInterval = float.Parse(vals[7].Trim()); entities[i].UniqueParams = vals[8].Split('|').ToFloatArray(); entities[i].RestrictPos = bool.Parse(vals[9].Trim()); entities[i].HasPrepareAnim = bool.Parse(vals[10].Trim()); entities[i].HasVanishAnim = bool.Parse(vals[11].Trim()); entities[i].HasHitEffect = bool.Parse(vals[12].Trim()); entities[i].HitEffectName = vals[13]; entities[i].BoomAudioName = vals[14]; keyIndexMap[entities[i].Name] = i; } }; string fileName = t_bullet.FileName; FileMgr.ReadFile(fileName, onTableLoad); }
public void AddFile(FileObject fileObject) { Log.Debug("enter"); if (!CanIngest(fileObject.RelativeUri)) { Log.Warning($"file already ingested. skipping: {fileObject.RelativeUri}"); return; } if (Config.KustoUseBlobAsSource) { IngestSingleFile(fileObject); } else { IngestMultipleFiles(FileMgr.ProcessFile(fileObject)); } }
static void Main(string[] args) { Logger logger = new Logger(); String fileName = "AppToCSV.dll.config"; logger.Initialize(fileName); logger.Info(fileName); FileMgr fileMgr = new FileMgr(); XmlToCsv xmlToCsv = new XmlToCsv(); Validate validate = new Validate(); Service service = new Service(logger, fileMgr, xmlToCsv, validate); service.Init(); service.Process(LevelType.Easy); service.Process(LevelType.Hard); Console.WriteLine("Hello World!"); }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="appendText"></param> /// <param name="eventId"></param> /// <param name="eventReference"></param> /// <param name="entryType"></param> /// <param name="enumPriority"></param> public void Write(string message, bool appendText, Int32 eventId, Int64 eventReference , EventLogEntryType entryType, enumEventPriority enumPriority) { DateTime now = DateTime.Now; string filename = string.Format("{0}_{1}{2}.txt" , _logFilePrefix , string.Format("{0:##}{1:##}", now.Month, now.Day) , now.ToString("HH")); int writeAttempts = 0; while (writeAttempts < MAX_EventLogWriteAttemptCount) { try { lock (_logFilePrefix) { // just in case there is an OS collision FileMgr.WriteTextToFile(filename , message + Environment.NewLine , appendText, true); return; } } catch { ++writeAttempts; // try a number of times } } if (enumPriority == enumEventPriority.Critical) { // now we must bail out to caller because we could not write throw new ExceptionEvent(enumExceptionEventCodes.EventLogFailoverFileWriteFailed , string.Format("Failed to write exception text to file: {0} after {1} attempts" + " Was attempting to write exception: {2}", filename , writeAttempts , message)); } // otherwise, the message is lost but it was not critical }