private void Subscribe(string id, long timestamp, IFileSource file_source) { string text = file_source.Read("mod.yaml"); Header header = (!string.IsNullOrEmpty(text)) ? YamlIO.Parse <Header>(text, file_source.GetRoot() + "\\mod.yaml", null, null) : null; if (header == null) { Header header2 = new Header(); header2.title = id; header2.description = id; header = header2; } Label label = default(Label); label.id = id; label.distribution_platform = distribution_platform; label.version = id.GetHashCode(); label.title = header.title; Label label2 = label; Mod mod = new Mod(label2, header.description, file_source, UI.FRONTEND.MODS.TOOLTIPS.MANAGE_LOCAL_MOD, delegate { Application.OpenURL("file://" + file_source.GetRoot()); }); if (file_source.GetType() == typeof(Directory)) { mod.status = Mod.Status.Installed; } Global.Instance.modManager.Subscribe(mod, this); }
public IList <Person> GetList(string path) { IList <Person> personList = new List <Person>(); try { string[] stringArr = fileSource.Read(path); foreach (var v in stringArr) { personList.Add(new Person { FullName = v }); } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(personList); }
public void Read_ShouldReturnExpectedResult(List <string> expectedResult) { var result = fileSource.Read(path); Assert.AreEqual(expectedResult.ToArray(), result); }
public byte[] LoadExternalFile(string fileKey) { var fileName = GetFileName(fileKey); return(externalFileSource.Read(fileName)); }