Example #1
0
 public note_item(note_ctrl self, string unique_id, string line_id, bool deleted, DateTime utc_added) {
     this.self = self;
     note_id = unique_id;
     this.line_id = line_id;
     reply_id = "";
     this.deleted = deleted;
     the_note = null;
     this.utc_last_edited = utc_added;
 }
Example #2
0
        private static Tuple<Dictionary<string, line>, List<note_item>> load_settings_file(note_ctrl self, string file_name) {
            Dictionary<string, line> lines = new Dictionary<string, line>();
            List<note_item> notes = new List<note_item>();

            settings_file sett = new settings_file(file_name);
            // first, load lines
            int line_count = int.Parse(sett.get("line_count", "0"));
            for (int idx = 0; idx < line_count; ++idx) {
                string prefix = "line." + idx + ".";
                line l = new line();
                l.idx = int.Parse(sett.get(prefix + "index", "0"));
                l.view_name = sett.get(prefix + "view_name");
                l.msg = sett.get(prefix + "msg");
                var id = sett.get(prefix + "id", "");
                lines.Add(id, l);
            }

            // load notes
            // if author name = ourselves -> made_by_current_user = true
            int note_count = int.Parse(sett.get("note_count", "0"));
            for (int idx = 0; idx < note_count; ++idx) {
                string prefix = "note." + idx + ".";
                note n = null;
                string author_name = sett.get(prefix + "author_name");
                if (author_name != "") {
                    n = new note() {author_name = author_name};
                    n.author_initials = sett.get(prefix + "author_initials");
                    n.author_color = util.str_to_color(sett.get(prefix + "author_color"));
                    n.note_text = sett.get(prefix + "note_text");
                }
                bool deleted = sett.get(prefix + "deleted", "0") != "0";
                var note_id = sett.get(prefix + "note_id", "");
                var reply_id = sett.get(prefix + "reply_id", "");
                var line_id = sett.get(prefix + "line_id", "");
                long ticks = long.Parse(sett.get(prefix + "added_at", "0"));
                note_item note;
                if (n != null)
                    note = new note_item(self, n, note_id, reply_id, line_id, deleted, new DateTime(ticks));
                else
                    note = new note_item(self, note_id, line_id, deleted, new DateTime(ticks));
                notes.Add(note);
            }
            return new Tuple<Dictionary<string, line>, List<note_item>>(lines, notes);
        }