Initialize() private method

private Initialize ( string userName, string connectionString, int timeout ) : void
userName string
connectionString string
timeout int
return void
コード例 #1
0
        public static bool InitializeMaintBinding()
        {
            int         num;
            PListConfig config = new PListConfig("Library/ServerPreferences.plist");
            string      user   = config["Maint UserName"];
            string      str2   = config["Maint Server"];
            string      str3   = config["Maint project name"];
            string      str4   = config["Maint database name"];
            string      str5   = config["Maint port number"];

            if (!int.TryParse(config["Maint Timeout"], out num))
            {
                num = 5;
            }
            if (((str2.Length == 0) || (str3.Length == 0)) || ((str4.Length == 0) || (user.Length == 0)))
            {
                AssetServer.SetProjectName(string.Empty);
                return(false);
            }
            AssetServer.SetProjectName(string.Format("{0} @ {1}", str3, str2));
            string[] textArray1       = new string[] { "host='", str2, "' user='******' password='******' dbname='", str4, "' port='", str5, "' sslmode=disable ", config["Maint Connection Settings"] };
            string   connectionString = string.Concat(textArray1);

            AssetServer.Initialize(user, connectionString, num);
            return(true);
        }
コード例 #2
0
        public static bool InitializeMaintBinding()
        {
            PListConfig plistConfig = new PListConfig("Library/ServerPreferences.plist");
            string      str1        = plistConfig["Maint UserName"];
            string      server      = plistConfig["Maint Server"];
            string      str2        = plistConfig["Maint project name"];
            string      str3        = plistConfig["Maint database name"];
            string      str4        = plistConfig["Maint port number"];
            int         result;

            if (!int.TryParse(plistConfig["Maint Timeout"], out result))
            {
                result = 5;
            }
            if (server.Length == 0 || str2.Length == 0 || (str3.Length == 0 || str1.Length == 0))
            {
                AssetServer.SetProjectName(string.Empty);
                return(false);
            }
            AssetServer.SetProjectName(string.Format("{0} @ {1}", (object)str2, (object)server));
            string connectionString = "host='" + server + "' user='******' password='******' dbname='" + str3 + "' port='" + str4 + "' sslmode=disable " + plistConfig["Maint Connection Settings"];

            AssetServer.Initialize(str1, connectionString, result);
            return(true);
        }
コード例 #3
0
        public static bool InitializeMaintBinding()
        {
            PListConfig pListConfig = new PListConfig("Library/ServerPreferences.plist");
            string      text        = pListConfig["Maint UserName"];
            string      text2       = pListConfig["Maint Server"];
            string      text3       = pListConfig["Maint project name"];
            string      text4       = pListConfig["Maint database name"];
            string      text5       = pListConfig["Maint port number"];
            int         timeout;

            if (!int.TryParse(pListConfig["Maint Timeout"], out timeout))
            {
                timeout = 5;
            }
            bool result;

            if (text2.Length == 0 || text3.Length == 0 || text4.Length == 0 || text.Length == 0)
            {
                AssetServer.SetProjectName("");
                result = false;
            }
            else
            {
                AssetServer.SetProjectName(string.Format("{0} @ {1}", text3, text2));
                string connectionString = string.Concat(new string[]
                {
                    "host='",
                    text2,
                    "' user='******' password='******' dbname='",
                    text4,
                    "' port='",
                    text5,
                    "' sslmode=disable ",
                    pListConfig["Maint Connection Settings"]
                });
                AssetServer.Initialize(text, connectionString, timeout);
                result = true;
            }
            return(result);
        }