public bool UpdateManifestFile() { try { KeyValPair kvp = new KeyValPair(';', ':'); kvp.Add("next_visit", this.NextVisitGdp.ToString()); kvp.Add("stage", this.Stage.ToString()); kvp.Add("can_edit", this.CanEdit.ToString()); kvp.Add("last_modified", this.LastModifiedGdp.ToString()); kvp.Add("crc", this.Crc.ToString()); return(kvp.Save(this.ManifestAbsFileName)); } catch { return(false); } }
public string GetString(char ItemSeparator, char ElemntSeparator) { KeyValPair kvp = new KeyValPair(ItemSeparator, ElemntSeparator); int n = this.Count; for (int i = 0; i < n; i++) { kvp.Add(GetKey(i), GetVal(i)); } return(kvp.GetStr()); }
public static string CreateNewCard(string CardGroup) { try { string dir = GetExecutablePath(); dir += @"Cards\"; dir += CardGroup + @"\"; dir += "C" + GetDateTimeStamp() + @"\"; if (Directory.Exists(dir) == false) { Directory.CreateDirectory(dir); } string history = string.Format("[{0}] Created. Stage: 0", Globals.GetDateTimeStampSec()); File.WriteAllText(string.Format("{0}history.txt", dir), history); DateTime now = DateTime.Now; MultiCalendar mc = new MultiCalendar(); mc.SetGregDate(now.Year, now.Month, now.Day); mc.SetTime(now.Hour, now.Minute, now.Second); double gdp = mc.GetGdp(); KeyValPair kvp = new KeyValPair(';', ':'); kvp.Add("next_visit", (gdp + 1).ToString()); kvp.Add("next_visit_jal", mc.GetJalDate(DateSeparator: "") + "-" + mc.GetTime(TimeSeparator: "")); kvp.Add("next_visit_grg", mc.GetGregDate(DateSeparator: "") + "-" + mc.GetTime(TimeSeparator: "")); kvp.Add("stage", "0"); kvp.Add("can_edit", "1"); kvp.Add("last_modified", gdp.ToString()); kvp.Add("crc", "0"); string manifest_data = kvp.GetStrLines(); //manifest_data += string.Format("next_visit={0}\r\n", gdp); //manifest_data += string.Format("stage={0}\r\n", 0); //manifest_data += string.Format("can_edit={0}\r\n", 1); //manifest_data += string.Format("last_modified={0}\r\n", gdp); //manifest_data += string.Format("crc={0}\r\n", 0); File.WriteAllText(string.Format("{0}manifest.man", dir), manifest_data); return(dir); } catch { return(""); } }