Exemple #1
0
        protected List <Navigation> GetButtonCacheList(SiteType siteType)
        {
            string            strCacheKey    = CacheKey.Navigation.ToString() + siteType.ToString();
            List <Navigation> navigationList = CacheHelper.GetCache <List <Navigation> >(strCacheKey);

            if (navigationList == null)
            {
                navigationList = _Db.Navigations
                                 .Where(o => o.SiteType == siteType)
                                 .OrderBy(o => o.OrderIndex)
                                 .ToList();
                CacheHelper.SetCache(navigationList, strCacheKey);
            }
            return(navigationList);
        }
 public static string GetShortName(SiteType e)
 {
     return(e.GetType().GetField(e.ToString()).GetCustomAttribute <SiteTypeAttribute>().ShortName);
 }
 public static SiteTypeClass GetTypeClass(SiteType e)
 {
     return(e.GetType().GetField(e.ToString()).GetCustomAttribute <SiteTypeAttribute>().TypeClass);
 }
 public static int GetTypeIndex(SiteType e)
 {
     return(e.GetType().GetField(e.ToString()).GetCustomAttribute <SiteTypeAttribute>().TypeIndex);
 }
 public static IEnumerable <string> GetTemplates(SiteType e)
 {
     return(e.GetType().GetField(e.ToString()).GetCustomAttribute <SiteTypeAttribute>().Templates);
 }
Exemple #6
0
        /// <summary>
        /// Launchsite Editor
        /// </summary>
        /// <param name="id"></param>
        void drawLaunchSiteEditorWindow(int id)
        {
            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

                GUILayout.Button("Launchsite Editor", DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(21)))
                {
                    this.Close();
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.Box(UIMain.tHorizontalSep, BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            GUILayout.Box(selectedObject.model.title);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Site Name: ", GUILayout.Width(120));
            siteName = GUILayout.TextField(siteName, GUILayout.Height(19));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Transform: ", GUILayout.Width(120));
            GUILayout.Box("" + siteTrans);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Length: ", GUILayout.Width(120));
            stLength = GUILayout.TextField(stLength, GUILayout.Height(19));
            GUILayout.Label(" m");
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Width: ", GUILayout.Width(120));
            stWidth = GUILayout.TextField(stWidth, GUILayout.Height(19));
            GUILayout.Label(" m");
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("SpaceCenter Camera rotation: ", GUILayout.Width(220));
            initialCameraRotation = (GUILayout.TextField(initialCameraRotation, GUILayout.Height(19)));
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            GUILayout.Label("Site Category: ", GUILayout.Width(115));
            GUILayout.Label(category.ToString(), GUILayout.Width(85));
            GUILayout.FlexibleSpace();
            GUI.enabled = (category != LaunchSiteCategory.RocketPad);
            if (GUILayout.Button("RP", GUILayout.Width(25), GUILayout.Height(23)))
            {
                category = LaunchSiteCategory.RocketPad;
            }
            GUI.enabled = (category != LaunchSiteCategory.Runway);
            if (GUILayout.Button("RW", GUILayout.Width(25), GUILayout.Height(23)))
            {
                category = LaunchSiteCategory.Runway;
            }
            GUI.enabled = (category != LaunchSiteCategory.Helipad);
            if (GUILayout.Button("HP", GUILayout.Width(25), GUILayout.Height(23)))
            {
                category = LaunchSiteCategory.Helipad;
            }
            GUI.enabled = (category != LaunchSiteCategory.Waterlaunch);
            if (GUILayout.Button("WA", GUILayout.Width(25), GUILayout.Height(23)))
            {
                category = LaunchSiteCategory.Waterlaunch;
            }
            GUI.enabled = (category != LaunchSiteCategory.Other);
            if (GUILayout.Button("OT", GUILayout.Width(25), GUILayout.Height(23)))
            {
                category = LaunchSiteCategory.Other;
            }
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            GUILayout.Label("Site Type: ", GUILayout.Width(120));
            GUILayout.Label(siteType.ToString(), GUILayout.Width(40));
            GUILayout.FlexibleSpace();
            GUI.enabled = !(siteType == (SiteType)0);
            if (GUILayout.Button("VAB", GUILayout.Height(23)))
            {
                siteType = SiteType.VAB;
            }
            GUI.enabled = !(siteType == (SiteType)1);
            if (GUILayout.Button("SPH", GUILayout.Height(23)))
            {
                siteType = SiteType.SPH;
            }
            GUI.enabled = !(siteType == (SiteType)2);
            if (GUILayout.Button("Any", GUILayout.Height(23)))
            {
                siteType = SiteType.Any;
            }
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            GUILayout.Label("Author: ", GUILayout.Width(120));
            siteAuthor = GUILayout.TextField(siteAuthor, GUILayout.Height(19));
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            GUILayout.Label("Open Cost: ", GUILayout.Width(120));
            stOpenCost = GUILayout.TextField(stOpenCost, GUILayout.Height(19));
            GUILayout.Label(" \\F");
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            GUILayout.Label("Close Value: ", GUILayout.Width(120));
            stCloseValue = GUILayout.TextField(stCloseValue, GUILayout.Height(19));
            GUILayout.Label(" \\F");
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Site is hidden: ", GUILayout.Width(115));
            GUILayout.Label(siteHidden, GUILayout.Width(85));
            GUILayout.FlexibleSpace();
            GUI.enabled = !(siteHidden == "false");
            if (GUILayout.Button("No", GUILayout.Width(40), GUILayout.Height(23)))
            {
                siteHidden = "false";
            }
            GUI.enabled = !(siteHidden == "true");
            if (GUILayout.Button("Yes", GUILayout.Width(40), GUILayout.Height(23)))
            {
                siteHidden = "true";
            }
            GUI.enabled = true;
            GUILayout.EndHorizontal();

            //if (ILSConfig.DetectNavUtils ()) {
            // NavUtilities config generator
            GUILayout.BeginHorizontal();
            GUILayout.Label("ILS/HSI on (NavUtilities)", GUILayout.Width(115));
            GUILayout.Label(ILSActive, GUILayout.Width(85));
            GUILayout.FlexibleSpace();
            GUI.enabled = !(ILSActive == "false");
            if (GUILayout.Button("No", GUILayout.Width(40), GUILayout.Height(23)))
            {
                ILSActive = "false";
            }
            GUI.enabled = !(ILSActive == "true");
            if (GUILayout.Button("Yes", GUILayout.Width(40), GUILayout.Height(23)))
            {
                ILSActive = "true";
            }
            GUILayout.EndHorizontal();
            //}
            GUI.enabled = true;
            GUILayout.Label("Description: ");
            descScroll = GUILayout.BeginScrollView(descScroll);
            siteDesc   = GUILayout.TextArea(siteDesc, GUILayout.ExpandHeight(true));
            GUILayout.EndScrollView();

            GUI.enabled = true;
            GUILayout.BeginHorizontal();
            GUI.enabled = siteName.Length > 0;
            if (GUILayout.Button("Save", GUILayout.Width(115), GUILayout.Height(23)))
            {
                SaveSettings();
                this.Close();
            }
            GUI.enabled = true;
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel", GUILayout.Width(115), GUILayout.Height(23)))
            {
                this.Close();
            }
            GUILayout.EndHorizontal();

            GUILayout.Label("NOTE: The SC angle is for a better initial vew on your SpaceCenter on the SC scene");

            GUILayout.Space(1);
            GUILayout.Box(UIMain.tHorizontalSep, BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }
Exemple #7
0
        /// <summary>
        ///  키워드 순위를 업데이트 합니다.
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="sitetype"></param>
        /// <param name="siteURL"></param>
        /// <returns></returns>
        public static int KeyWordRankUpdate(string keyword, SiteType sitetype, string siteURL)
        {
            string      message = string.Empty;
            XmlDocument xmlDoc  = new XmlDocument();
            int         intRank = 1;

            try
            {
                using (WebClient wc = new WebClient())
                {
                    wc.Encoding = System.Text.UTF32Encoding.UTF8;
                    string url = string.Format(Common.naverBlogAndCafeSearchString, Common.naverOpenAPIKey, keyword, naverSearchSnMaxTerm, naverSearchStartNum, sitetype.ToString().ToLower());
                    using (StringReader sr = new StringReader(wc.DownloadString(url)))
                    {
                        xmlDoc.Load(sr);
                    }
                }

                XmlNodeList xmlList = xmlDoc.SelectNodes("rss/channel/item");
                if (xmlList.Count > 0)
                {
                    foreach (XmlNode xNode in xmlList)
                    {
                        //string bloglink = xNode["bloggerlink"] == null ? string.Empty : xNode["bloggerlink"].InnerText.Replace("http://", "");
                        //string cafelink = xNode["cafeurl"] == null ? string.Empty : xNode["cafeurl"].InnerText.Replace("http://","");
                        string link        = xNode["link"] == null ? string.Empty : xNode["link"].InnerText;
                        string responseURL = GetOriginalUrl(link).Replace("http://", "");
                        responseURL = responseURL.Substring(responseURL.IndexOf('/'));

                        if (sitetype == SiteType.Blog)
                        {
                            //blog.naver.com/love386600?Redirect=Log&logNo=220090121890
                            string[] blogs = responseURL.Split('?');
                            if (blogs.Length > 1)
                            {
                                string[] keys  = blogs[1].Split('&');
                                string   logno = string.Empty;
                                if (keys.Length > 0)
                                {
                                    foreach (string str in keys)
                                    {
                                        string[] lognos = str.Split('=');
                                        if (lognos[0].ToLower() == "logno")
                                        {
                                            logno = lognos[1];
                                            break;
                                        }
                                    }
                                }
                                responseURL = blogs[0] + "/" + logno;
                            }
                        }

                        if (string.IsNullOrEmpty(responseURL) == false && siteURL.Contains(responseURL))
                        {
                            break;
                        }
                        ;
                        intRank++;
                    }

                    if (intRank > Convert.ToInt32(naverSearchSnMaxTerm))
                    {
                        intRank = 999;
                    }
                }
                else
                {
                    //검색된 데이터 없음
                    intRank = 0;
                }
            }
            catch (Exception ex)
            {
                //에러
                intRank = 1000;
                message = ex.Message.ToString();
            }

            return(intRank);
        }