Beispiel #1
0
        public static List <Database.ServerData> GetOfficialServer(string documentName)
        {
            var results = new List <Database.ServerData>();


            var db = new Database.DBHelper();

            db.Connect();

            var doc = db.GetDocument("Server", documentName);

            if (doc != null)
            {
                var servers = doc["OfficialServerList"].AsBsonArray;

                foreach (var serverData in servers)
                {
                    results.Add(new Database.ServerData()
                    {
                        Name    = serverData["Name"].AsString,
                        Address = serverData["Address"].AsString,
                        Port    = serverData["Port"].AsString
                    });
                }
            }


            return(results);
        }
Beispiel #2
0
        public static bool GetOfficialServer(string documentName, out string address, out string port)
        {
            var db = new Database.DBHelper();

            db.Connect();

            var doc = db.GetDocument("Server", documentName);

            if (doc == null)
            {
                address = "";
                port    = "";

                return(false);
            }
            else
            {
                address = doc["Address"].AsString;
                port    = doc["Port"].AsString;

                return(true);
            }
        }
Beispiel #3
0
        //#####################################################################################

        public static bool CheckUpdateAndNotice(string documentName, string appVersion,
                                                out string downloadLink, out bool bShutdown, out string notice)
        {
            var db = new Database.DBHelper();

            db.Connect();

            var doc = db.GetDocument("Publish", documentName);

            if (doc == null)
            {
                downloadLink = "http://blog.naver.com/tlsehdgus321";
                bShutdown    = true;
                notice       = "";
                return(true);
            }
            else
            {
                bShutdown = doc["Shutdown"].AsBoolean;
                notice    = doc["Notice"].AsString;


                var currentVersion = new Utility.Version(appVersion);
                var latestVersion  = new Utility.Version(doc["LatestVersion"].AsString);

                if (currentVersion < latestVersion)
                {
                    downloadLink = doc["DownloadLink"].AsString;
                    return(true);
                }
                else
                {
                    downloadLink = "";
                    return(false);
                }
            }
        }