Example #1
0
File: Util.cs Project: MrJoe/lat
        public static void getChildren(Connection conn, string name, StringBuilder sb)
        {
            LdapEntry[] children = conn.Data.GetEntryChildren(name);

            if (children == null)
            {
                return;
            }

            foreach (LdapEntry cle in children)
            {
                LDIF cldif = new LDIF(cle);
                sb.AppendFormat("{0}\n", cldif.Export());

                getChildren(conn, cle.DN, sb);
            }
        }
Example #2
0
File: Util.cs Project: MrJoe/lat
        static string export(Connection conn, string dn)
        {
            StringBuilder data = new StringBuilder();

            LdapEntry le    = (LdapEntry)conn.Data.GetEntry(dn);
            LDIF      _ldif = new LDIF(le);

            data.AppendFormat("{0}\n", _ldif.Export());

            LdapEntry[] children = conn.Data.GetEntryChildren(dn);

            foreach (LdapEntry cle in children)
            {
                LDIF cldif = new LDIF(cle);
                data.AppendFormat("{0}\n", cldif.Export());

                getChildren(conn, cle.DN, data);
            }

            return(data.ToString());
        }
Example #3
0
File: Util.cs Project: MrJoe/lat
        public static void ImportData(Connection conn, Gtk.Window parent, string data)
        {
            int    numImported = 0;
            string msg         = null;

            LDIF ldif = new LDIF(conn);

            numImported = ldif.Import(data);

            msg = String.Format(
                Mono.Unix.Catalog.GetString("Imported {0} entries."),
                numImported);

            if (numImported > 0)
            {
                HIGMessageDialog dialog = new HIGMessageDialog(
                    parent,
                    0,
                    Gtk.MessageType.Info,
                    Gtk.ButtonsType.Ok,
                    "Import entries",
                    msg);

                dialog.Run();
                dialog.Destroy();
            }
            else
            {
                HIGMessageDialog dialog = new HIGMessageDialog(
                    parent,
                    0,
                    Gtk.MessageType.Error,
                    Gtk.ButtonsType.Ok,
                    "Import error",
                    msg);

                dialog.Run();
                dialog.Destroy();
            }
        }
Example #4
0
File: Util.cs Project: MrJoe/lat
        static void import(Connection conn, Gtk.Window parent, Uri uri)
        {
            int numImported = 0;

            LDIF ldif = new LDIF(conn);

            numImported = ldif.Import(uri);

            string msg = String.Format(
                Mono.Unix.Catalog.GetString("Imported {0} entries\nfrom {1}."),
                numImported, uri.ToString());

            if (numImported > 0)
            {
                HIGMessageDialog dialog = new HIGMessageDialog(
                    parent,
                    0,
                    Gtk.MessageType.Info,
                    Gtk.ButtonsType.Ok,
                    "Import entries",
                    msg);

                dialog.Run();
                dialog.Destroy();
            }
            else
            {
                HIGMessageDialog dialog = new HIGMessageDialog(
                    parent,
                    0,
                    Gtk.MessageType.Error,
                    Gtk.ButtonsType.Ok,
                    "Import error",
                    msg);

                dialog.Run();
                dialog.Destroy();
            }
        }
Example #5
0
File: Util.cs Project: MrJoe/lat
        static void import(Connection conn, Gtk.Window parent, Uri uri)
        {
            int numImported = 0;

            LDIF ldif = new LDIF (conn);

            numImported = ldif.Import (uri);

            string msg = String.Format (
                Mono.Unix.Catalog.GetString ("Imported {0} entries\nfrom {1}."),
                numImported, uri.ToString());

            if (numImported > 0) {

                HIGMessageDialog dialog = new HIGMessageDialog (
                    parent,
                    0,
                    Gtk.MessageType.Info,
                    Gtk.ButtonsType.Ok,
                    "Import entries",
                    msg);

                dialog.Run ();
                dialog.Destroy ();

            } else {

                HIGMessageDialog dialog = new HIGMessageDialog (
                    parent,
                    0,
                    Gtk.MessageType.Error,
                    Gtk.ButtonsType.Ok,
                    "Import error",
                    msg);

                dialog.Run ();
                dialog.Destroy ();
            }
        }
Example #6
0
File: Util.cs Project: MrJoe/lat
        static string export(Connection conn, string dn)
        {
            StringBuilder data = new StringBuilder();

            LdapEntry le = (LdapEntry) conn.Data.GetEntry (dn);
            LDIF _ldif = new LDIF (le);

            data.AppendFormat ("{0}\n", _ldif.Export());

            LdapEntry[] children = conn.Data.GetEntryChildren (dn);

            foreach (LdapEntry cle in children) {
                LDIF cldif = new LDIF (cle);
                data.AppendFormat ("{0}\n", cldif.Export());

                getChildren (conn, cle.DN, data);
            }

            return data.ToString ();
        }
Example #7
0
File: Util.cs Project: MrJoe/lat
        public static void ImportData(Connection conn, Gtk.Window parent, string data)
        {
            int numImported = 0;
            string msg = null;

            LDIF ldif = new LDIF (conn);

            numImported = ldif.Import (data);

            msg = String.Format (
                Mono.Unix.Catalog.GetString ("Imported {0} entries."),
                numImported);

            if (numImported > 0) {

                HIGMessageDialog dialog = new HIGMessageDialog (
                    parent,
                    0,
                    Gtk.MessageType.Info,
                    Gtk.ButtonsType.Ok,
                    "Import entries",
                    msg);

                dialog.Run ();
                dialog.Destroy ();

            } else {

                HIGMessageDialog dialog = new HIGMessageDialog (
                    parent,
                    0,
                    Gtk.MessageType.Error,
                    Gtk.ButtonsType.Ok,
                    "Import error",
                    msg);

                dialog.Run ();
                dialog.Destroy ();
            }
        }
Example #8
0
File: Util.cs Project: MrJoe/lat
        public static void getChildren(Connection conn, string name, StringBuilder sb)
        {
            LdapEntry[] children = conn.Data.GetEntryChildren (name);

            if (children == null)
                return;

            foreach (LdapEntry cle in children) {
                LDIF cldif = new LDIF (cle);
                sb.AppendFormat ("{0}\n", cldif.Export());

                getChildren (conn, cle.DN, sb);
            }
        }