日期:2014-05-18 浏览次数:20865 次
private bool writeInResources() { IResourceWriter writer = null; try { writer = new ResourceWriter(@"myResources.resources"); writer.AddResource("day1", Constant.arrayMon); writer.AddResource("day6", Constant.arraySat); writer.AddResource("day7", Constant.arraySun); writer.AddResource("day5", Constant.arrayFri); writer.AddResource("day4", Constant.arrayThurs); writer.AddResource("day3", Constant.arrayWed); writer.AddResource("day2", Constant.arrayTues); } catch (Exception e) { MessageBox.Show(e.Message); return false; } finally { if(writer !=null) writer.Close(); } return true; }
private List<int> readOutResources() { ResourceManager rm = null; List<int> l = null; try { rm = ResourceManager.CreateFileBasedResourceManager("myResources", "/", null); if (rm == null) return null; l = rm.GetObject("day" + dayOfWeek.ToString()) as List<int>; } catch (Exception e) { return null; } return l;