コード例 #1
0
        public LaunchSite(string sName, string sAuthor, SiteType sType, Texture sLogo, Texture sIcon,
			string sDescription, string sDevice, float fOpenCost, float fCloseValue, string sOpenCloseState, float fRefLon, 
			float fRefLat, float fRefAlt, float fLength, float fWidth, float fRefund, float fRecoveryFactor, float fRecoveryRange,
			GameObject gameObject, PSystemSetup.SpaceCenterFacility newFacility = null, string sFavourite = "No")
        {
            name = sName;
            author = sAuthor;
            type = sType;
            logo = sLogo;
            icon = sIcon;
            description = sDescription;
            category = sDevice;
            opencost = fOpenCost;
            closevalue = fCloseValue;
            openclosestate = sOpenCloseState;
            GameObject = gameObject;
            facility = newFacility;
            reflon = fRefLon;
            reflat = fRefLat;
            refalt = fRefAlt;
            sitelength = fLength;
            sitewidth = fWidth;
            launchrefund = fRefund;
            recoveryfactor = fRecoveryFactor;
            recoveryrange = fRecoveryRange;
            favouritesite = sFavourite;
        }
コード例 #2
0
        public LaunchSite(string sName, string sAuthor, SiteType sType, Texture sLogo, Texture sIcon,
			string sDescription, string sDevice, float fOpenCost, float fCloseValue, string sOpenCloseState, float fRefLon, 
			float fRefLat, float fRefAlt, float fLength, float fWidth, float fRefund, float fRecoveryFactor, float fRecoveryRange,
			GameObject gameObject, PSystemSetup.SpaceCenterFacility newFacility = null, 
			string sMissionLog = "Too busy to keep this log. Signed Gene Kerman.", 
			string sNation = "United Kerbin", string sFavourite = "No", float fMissionCount = 0)
        {
            name = sName;
            author = sAuthor;
            type = sType;
            logo = sLogo;
            icon = sIcon;
            description = sDescription;
            category = sDevice;
            opencost = fOpenCost;
            closevalue = fCloseValue;
            openclosestate = sOpenCloseState;
            GameObject = gameObject;
            facility = newFacility;
            reflon = fRefLon;
            reflat = fRefLat;
            refalt = fRefAlt;
            sitelength = fLength;
            sitewidth = fWidth;
            launchrefund = fRefund;
            recoveryfactor = fRecoveryFactor;
            recoveryrange = fRecoveryRange;
            favouritesite = sFavourite;
            missioncount = fMissionCount;
            nation = sNation;
            missionlog = sMissionLog;
        }
コード例 #3
0
 public BindingConfiguration(string url, UriScheme scheme, SiteType siteType, string certificate, bool requireSni = false)
 {
     Url = url;
     Scheme = scheme;
     SiteType = siteType;
     Certificate = certificate;
     RequireSni = requireSni;
 }
コード例 #4
0
ファイル: SiteDB.cs プロジェクト: nblaurenciana-md/Websites
    public static Site GetSiteByType(SiteType siteType, Site[] allSites = null, string DB = null)
    {
        Site[] sites = allSites != null ? allSites : GetAll(DB);
        for (int i = 0; i < sites.Length; i++)
            if ((int)siteType == sites[i].SiteType.ID)
                return sites[i];

        return null; // should not get here
    }
コード例 #5
0
        /// <summary>
        /// Gets the data for a particular site type
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static SiteTypeData GetData(SiteType type)
        {
            if (siteData == null)
            {
                ReadData();
            }

            return siteData.Where(sd => sd.SiteType.Equals(type)).First();
        }
コード例 #6
0
 public static string GetIpAdress(SiteType siteType, TargetType targetType)
 {
     if (EnvironmentConfigSection != null)
     {
         if (siteType == SiteType.ELM)
         {
             return null;
         }
         else
         {
             switch (targetType)
             {
                 case TargetType.QA1:
                     if (siteType == SiteType.TPO)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA1"].TPO;
                     else if (siteType == SiteType.WBC)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA1"].WebCenter;
                     else if (siteType == SiteType.CDW)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA1"].ConsumerDirect;
                     else
                         return null;
                 case TargetType.QA2:
                     if (siteType == SiteType.TPO)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA2"].TPO;
                     else if (siteType == SiteType.WBC)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA2"].WebCenter;
                     else if (siteType == SiteType.CDW)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA2"].ConsumerDirect;
                     else
                         return null;
                 case TargetType.QA3:
                     if (siteType == SiteType.TPO)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA3"].TPO;
                     else if (siteType == SiteType.WBC)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA3"].WebCenter;
                     else if (siteType == SiteType.CDW)
                         return EnvironmentConfigSection.EnvironmentSettingCollection["QA3"].ConsumerDirect;
                     else
                         return null;
                 case TargetType.LOCAL:
                     return "127.0.0.1";
                 default:
                     return null;
             }
         }
     }
     else
     {
         return null;
     }
 }
コード例 #7
0
        public void ChangeDomainSiteType(HostDomain domain, SiteType newSiteType)
        {
            try
            {
                if (domain.SiteType == newSiteType) return;

                string newIp = EnvironmentMnager.GetIpAdress(newSiteType, domain.Target);
                _helper.ChangeIp(domain.Ip, newIp, domain.DomainName, true);
            }
            catch (Exception ex)
            {
                _loger.WriteLine(ex.ToString());
                throw;
            }
        }
コード例 #8
0
		public LaunchSite(string sName, string sAuthor, SiteType sType, Texture sLogo, Texture sIcon, string sDescription, string sDevice, float fOpenCost, float fCloseValue, string sOpenCloseState, GameObject gameObject, PSystemSetup.SpaceCenterFacility newFacility = null)
		{
			name = sName;
			author = sAuthor;
			type = sType;
			logo = sLogo;
			icon = sIcon;
			description = sDescription;
			category = sDevice;
			opencost = fOpenCost;
			closevalue = fCloseValue;
			openclosestate = sOpenCloseState;
			GameObject = gameObject;
			facility = newFacility;
		}
コード例 #9
0
        /// <summary>
        /// Adds or updates the given model in the database
        /// depending on its state.
        /// </summary>
        /// <param name="model">The model</param>
        public async Task SaveAsync(SiteType model)
        {
            // Validate model
            var context = new ValidationContext(model);

            Validator.ValidateObject(model, context, true);

            // Call hooks & save
            App.Hooks.OnBeforeSave <SiteType>(model);
            await _repo.Save(model).ConfigureAwait(false);

            App.Hooks.OnAfterSave <SiteType>(model);

            // Clear cache
            _cache?.Remove("Piranha_SiteTypes");
        }
コード例 #10
0
        protected List <NavigationDto> GetNavigationDtoCacheList(SiteType siteType)
        {
            string strCacheKey = CacheKey.NavigationDto.ToString() + siteType.ToString();
            List <NavigationDto> navigationDtoList = CacheHelper.GetCache <List <NavigationDto> >(strCacheKey);

            if (navigationDtoList == null)
            {
                navigationDtoList = _Db.Navigations
                                    .Where(o => o.SiteType == siteType)
                                    .ProjectTo <NavigationDto>()
                                    .OrderBy(o => o.OrderIndex)
                                    .ToList();
                CacheHelper.SetCache(navigationDtoList, strCacheKey);
            }
            return(navigationDtoList);
        }
コード例 #11
0
ファイル: LineModule.cs プロジェクト: wuheideyun/keda_wcs
        public SitePos(int id, Point point, int direction, int rate, SiteType type, String name, String upName)
        {
            ID = id;

            _siteP = point;

            _direction = direction;

            _rate = rate;

            _type = type;

            Name = name;

            UpName = upName;
        }
コード例 #12
0
        private void Search(CandidateType candidateType, SiteType siteType, Community community, Member member)
        {
            Search(candidateType, siteType, community);

            // Assert that the member is shown or not shown as appropriate.

            if (member == null)
            {
                AssertNoResults();
            }
            else
            {
                AssertResultCounts(1, 1, 1);
                AssertMembers(member);
            }
        }
コード例 #13
0
        public static IVideoItem CreateVideoItem(VideoItemPOCO poco,
                                                 SiteType site,
                                                 bool isJoinName  = false,
                                                 SyncState sstate = SyncState.Notset)
        {
            IVideoItem vi;

            switch (site)
            {
            case SiteType.YouTube:
                vi = new YouTubeItem
                {
                    ID             = poco.ID,
                    Title          = poco.Title,
                    ParentID       = poco.ParentID,
                    Description    = poco.Description,  // .WordWrap(80);
                    ViewCount      = poco.ViewCount,
                    Duration       = poco.Duration,
                    Comments       = poco.Comments,
                    Thumbnail      = poco.Thumbnail,
                    Timestamp      = poco.Timestamp,
                    LikeCount      = poco.LikeCount,
                    DislikeCount   = poco.DislikeCount,
                    ViewDiff       = poco.ViewDiff,
                    SyncState      = sstate == SyncState.Notset ? (SyncState)poco.SyncState : sstate,
                    WatchState     = (WatchState)poco.WatchState,
                    DurationString = StringExtensions.IntTostrTime(poco.Duration),
                    DateTimeAgo    = StringExtensions.TimeAgo(poco.Timestamp),
                    Subtitles      = new ObservableCollection <ISubtitle>(),
                    ParentTitle    = isJoinName ? poco.ParentName : string.Empty
                };
                break;

            case SiteType.Tapochek:
                vi = new TapochekItem();
                break;

            case SiteType.RuTracker:
                vi = new RuTrackerItem();
                break;

            default:
                vi = null;
                break;
            }
            return(vi);
        }
コード例 #14
0
ファイル: frmBoard.cs プロジェクト: pjongsik/ScrapTest
        /// <summary>
        /// 추가        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cbbMonth.Text) ||
                string.IsNullOrEmpty(txtday.Text) ||
                string.IsNullOrEmpty(cbSite.Text))
            {
                MessageBox.Show("날짜 및 사이트 선택오류~!");
                return;
            }

            if (string.IsNullOrEmpty(txtName.Text) ||
                string.IsNullOrEmpty(txtBirth.Text) ||
                string.IsNullOrEmpty(txtM1.Text) ||
                string.IsNullOrEmpty(txtM2.Text) ||
                string.IsNullOrEmpty(txtM3.Text))
            {
                MessageBox.Show("개인정보를 입력해주세요~!");
                return;
            }

            int year  = DateTime.Now.Year;
            int month = int.Parse(cbbMonth.Text);
            int day   = int.Parse(txtday.Text);

            if (new DateTime(year, month, day) <= DateTime.Now.Date)
            {
                MessageBox.Show("날짜 선택오류 - 내일부터 선택가능~!");
            }

            SiteType stieType = (SiteType)cbSite.SelectedIndex;

            _selectedList.Add(new SelectionBase()
            {
                Year     = year,
                Month    = month,
                Day      = day,
                Site     = stieType,
                Name     = txtName.Text,
                BirthDay = txtBirth.Text,
                Phone1   = txtM1.Text,
                Phone2   = txtM2.Text,
                Phone3   = txtM3.Text
            });

            SetDataSource();
        }
コード例 #15
0
        public static IVideoItem CreateVideoItem(SiteType site)
        {
            switch (site)
            {
            case SiteType.YouTube:
                return(new YouTubeItem());

            case SiteType.Tapochek:
                return(new TapochekItem());

            case SiteType.RuTracker:
                return(new RuTrackerItem());

            default:
                return(null);
            }
        }
コード例 #16
0
        public List <NavigationDto> GetTreeListAsync(SiteType siteType)
        {
            List <Navigation> navigationList = _Db.Navigations.AsNoTracking().Where(o => o.SiteType == siteType).OrderBy(o => o.OrderIndex).ToList();

            return((from a in navigationList.Where(o => o.ParentId == 0)
                    let b = navigationList.Where(o => o.ParentId == a.Id).OrderBy(o => o.OrderIndex).ToList()
                            select new NavigationDto
            {
                Id = a.Id,
                PageName = a.PageName,
                PageUrl = a.PageUrl,
                ParentId = a.ParentId,
                OrderIndex = a.OrderIndex,
                SiteType = a.SiteType,
                Children = b
            }).ToList());
        }
コード例 #17
0
ファイル: Wood_1_79.cs プロジェクト: martongyiran/codingame
    public void Update(int type, int owner, int canTrain, int creepType)
    {
        Owner    = owner == -1 ? SiteOwner.None : owner == 0 ? SiteOwner.Friendly : SiteOwner.Enemy;
        CanTrain = canTrain == 0;

        switch (type)
        {
        case -1:
            Type = SiteType.None;
            break;

        case 0:
            Type = SiteType.Mine;
            break;

        case 1:
            Type = SiteType.Tower;
            break;

        case 2:
            Type = SiteType.Barrack;
            break;
        }

        switch (creepType)
        {
        case -1:
            CreepType = CreepType.None;
            break;

        case 0:
            CreepType = CreepType.Knight;
            Upkeep    = 80;
            break;

        case 1:
            CreepType = CreepType.Archer;
            Upkeep    = 100;
            break;

        case 2:
            CreepType = CreepType.Giant;
            Upkeep    = 140;
            break;
        }
    }
コード例 #18
0
        public void LoadData(string cid, SiteType st)
        {
            if (Count > 0)
            {
                Clear();
                _selectedLogs.Clear();
            }
            var all = _sqlite.GetLogs(cid, st);

            if (null != all)
            {
                foreach (var item in all)
                {
                    base.Add(item);
                }
            }
        }
コード例 #19
0
ファイル: SiteUtils.Theme.cs プロジェクト: huutoannht/mart
        public static string GetDataTheme(SiteType siteType)
        {
            var cacheHelper = ObjectFactory.GetInstance<ICacheHelper>();
            var list = cacheHelper.GetAppSettings(AppSettingType.SiteStyleSettings);
            var dataThem = "blue";
            switch (siteType)
            {
                case SiteType.StoreSite:
                    dataThem = (list.FirstOrDefault(i => i.Name == ConstKeys.StoreSiteColor) ?? new AppSetting()).Value;
                    break;
                case SiteType.SuperSite:
                    dataThem = (list.FirstOrDefault(i => i.Name == ConstKeys.AdminSiteColor) ?? new AppSetting()).Value;
                    break;
            }

            return dataThem;
        }
コード例 #20
0
		public Constructable(string languageCode, bool literalText, string imagePath, string idCode, 
		                     IEnumerable<Prerequisite> prerequisites, SiteType constructableAt, bool isVirtual, string stockpileGroup,
		                     Formula condition, Formula cost, Formula turnLimit, IEnumerable<IConstructionEffect> effects)
		{
			this.LanguageCode = languageCode;
			this.LiteralText = literalText;
			this.ImagePath = imagePath;
			this.IdCode = idCode;
			this.Prerequisites = prerequisites;
			this.ConstructableAt = constructableAt;
			this.IsVirtual = isVirtual;
			this.StockpileGroup = stockpileGroup;
			this.Condition = condition;
			this.Cost = cost;
			this.TurnLimit = turnLimit;
			this.Effects = effects;
		}
コード例 #21
0
        public static DateTime ParseDate(HtmlDocument htmlDoc, SiteType site)
        {
            var      root    = htmlDoc.DocumentNode;
            DateTime date    = DateTime.MinValue;
            var      dateStr = root.SelectSingleNode("//body").InnerText;
            var      regs    = new List <Regex>();

            regs.Add(new Regex("[0-9]{4}-[0-9]{1,2}-[0-9]{2}"));
            regs.Add(new Regex("[0-9]{4}/[0-9]{1,2}/[0-9]{2}"));
            switch (site)
            {
            case SiteType.JingDeZhen:
                dateStr = root.SelectSingleNode("//*[@class='info']").InnerText;
                break;

            case SiteType.GanZhou:
                //dateStr = root.SelectSingleNode("//td[@class='main']//tbody/tr[2]").InnerText;
                dateStr = GetFirstLine(root.InnerText, new Regex("时间"));
                break;

            case SiteType.FuZhou:
                dateStr = GetFirstLine(root.InnerText, new Regex("来源"));
                break;

            case SiteType.NanChang:
                dateStr = root.SelectSingleNode("//td[@class='article_date']").InnerText;
                break;

            case SiteType.JiangXi:
                dateStr = root.SelectSingleNode("//*[@id='tdTitle']").InnerText;
                break;
            }
            if (dateStr != null)
            {
                foreach (var regex in regs)
                {
                    var match = regex.Match(dateStr);
                    if (match.Success)
                    {
                        date = DateTime.Parse(match.Value);
                        break;
                    }
                }
            }
            return(date);
        }
コード例 #22
0
        private void ChampsSports_CartViewCompletedEvent(object sender, bool result)
        {
            var cartView = sender as CartView;

            if (cartView == null)
            {
                return;
            }
            cartView.CartViewCompletedEvent -= ChampsSports_CartViewCompletedEvent;
            const SiteType type = SiteType.ChampsSports;

            TrackTaskDone(type, result);
            if (!result)
            {
                RestartSite(type);
            }
        }
コード例 #23
0
        private void FootLocker_CartViewCompletedEvent(object sender, bool result)
        {
            var cartView = sender as CartView;

            if (cartView == null)
            {
                return;
            }
            cartView.CartViewCompletedEvent -= FootLocker_CartViewCompletedEvent;
            const SiteType type = SiteType.FootLocker;

            TrackTaskDone(type, result);
            if (!result)
            {
                cartView.Stop();
                RestartSite(type);
            }
        }
コード例 #24
0
        public static CheckElement GetCheckResultElement(SiteType type)
        {
            switch (type)
            {
            case SiteType.ChampsSports:
                return(new CheckElement(ConfigElement.ChamsSports_CheckResultID));

            case SiteType.Eastbay:
                return(new CheckElement(ConfigElement.Eastbay_CheckResultID));

            case SiteType.Footaction:
                return(new CheckElement(ConfigElement.Footaction_CheckResultID));

            case SiteType.FootLocker:
                return(new CheckElement(ConfigElement.FootLocker_CheckResultID));
            }
            return(null);
        }
コード例 #25
0
        public static SetElement GetSizeElement(SiteType type, string value)
        {
            switch (type)
            {
            case SiteType.ChampsSports:
                return(new SetElement(ConfigElement.ChamsSports_ProductSizeID, value));

            case SiteType.Eastbay:
                return(new SetElement(ConfigElement.Eastbay_SizeID, value));

            case SiteType.Footaction:
                return(new SetElement(ConfigElement.Footaction_SizeID, value));

            case SiteType.FootLocker:
                return(new SetElement(ConfigElement.FootLocker_ProductSizeID, value));
            }
            return(null);
        }
コード例 #26
0
        public List <NavigationDto> GetTreeList(SiteType siteType)
        {
            List <NavigationDto> navigationDtoList = GetNavigationDtoCacheList(siteType);

            List <NavigationDto> firstLayerList = navigationDtoList.Where(o => o.ParentId == 0).ToList();

            firstLayerList.ForEach(second => {
                second.Children = navigationDtoList.Where(o => o.ParentId == second.Id & o.NavigationType == NavigationType.Page)
                                  .OrderBy(o => o.OrderIndex).ToList();

                second.Children.ForEach(third =>
                {
                    third.Children = navigationDtoList.Where(o => o.ParentId == third.Id & o.NavigationType == NavigationType.Button)
                                     .OrderBy(o => o.OrderIndex).ToList();
                });
            });
            return(firstLayerList);
        }
コード例 #27
0
        public static ClickElement GetClickElement(SiteType type)
        {
            switch (type)
            {
            case SiteType.ChampsSports:
                return(new ClickElement(ConfigElement.ChamsSports_AddToCartID));

            case SiteType.Eastbay:
                return(new ClickElement(ConfigElement.Eastbay_AddToCartID));

            case SiteType.Footaction:
                return(new ClickElement(ConfigElement.Footaction_AddToCartID));

            case SiteType.FootLocker:
                return(new ClickElement(ConfigElement.FootLocker_AddToCartID));
            }
            return(null);
        }
コード例 #28
0
        public static SetElement GetSelectedSizeDisplayElement(SiteType type, string value)
        {
            switch (type)
            {
            case SiteType.ChampsSports:
                return(new SetElement(ConfigElement.ChamsSports_SelectedSizeDisplay, value));

            case SiteType.Eastbay:
                return(new SetElement(ConfigElement.Footaction_SelectedSizeDisplay, value));

            case SiteType.Footaction:
                return(new SetElement(ConfigElement.Footaction_SelectedSizeDisplay, value));

            case SiteType.FootLocker:
                return(new SetElement(ConfigElement.FootLocker_SelectedSizeDisplay, value));
            }
            return(null);
        }
コード例 #29
0
ファイル: SiteManager.cs プロジェクト: onesmartguy/e13-kudu
        public bool AddSiteBinding(string applicationName, string siteBinding, SiteType siteType)
        {
            IIS.Site site;

            if (!siteBinding.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
            {
                siteBinding = "http://" + siteBinding;
            }

            var uri = new Uri(siteBinding);

            try
            {
                using (var iis = GetServerManager())
                {
                    if (!IsAvailable(uri.Host, uri.Port, iis))
                    {
                        return(false);
                    }

                    if (siteType == SiteType.Live)
                    {
                        site = iis.Sites[GetLiveSite(applicationName)];
                    }
                    else
                    {
                        site = iis.Sites[GetServiceSite(applicationName)];
                    }

                    if (site != null)
                    {
                        site.Bindings.Add("*:" + uri.Port + ":" + uri.Host, "http");
                        iis.CommitChanges();

                        Thread.Sleep(1000);
                    }
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #30
0
        /// <summary>
        /// 추가        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (_keepRunning)
            {
                MessageBox.Show("중지 후 추가가능합니다.");
                return;
            }

            if (string.IsNullOrEmpty(cbSite.Text))
            {
                MessageBox.Show("사이트를 선택해주십시오!");
                return;
            }

            // dtpDate
            DateTime selectedDate = dtpDate.Value.Date;

            if (selectedDate < DateTime.Now.Date)
            {
                MessageBox.Show("날짜 선택오류 - 오늘부터 선택가능합니다.");
            }

            int year  = selectedDate.Year;
            int month = selectedDate.Month;
            int day   = selectedDate.Day;

            SiteType siteType = (SiteType)cbSite.SelectedIndex;

            // 동일 내용존재여부확인
            if (_selectedList.Any(x => x.Year == year && x.Month == month && x.Day == day && (x.Site == SiteType.전체 || x.Site == siteType)))
            {
                return;
            }

            _selectedList.Add(new SelectionBase()
            {
                Year  = year,
                Month = month,
                Day   = day,
                Site  = siteType,
            });

            SetDataSource();
        }
コード例 #31
0
        public static ISpiderService Create(SiteType siteType)
        {
            ISpiderService spider;
            switch (siteType)
            {
                case SiteType.DianPing:
                    spider = new DianpingService();
                    break;

                case SiteType.MafengWo:
                    spider = new MafengWoService();
                    break;

                default:
                    throw new Exception("Unsupport Spider Type");
            }

            return spider;
        }
コード例 #32
0
        public static IChannel CreateChannel(SiteType site)
        {
            IChannel channel = null;

            switch (site)
            {
            case SiteType.YouTube:
                channel = new YouChannel();
                break;
            }

            if (channel == null)
            {
                throw new Exception();
            }

            channel.ChannelItemsCollectionView = CollectionViewSource.GetDefaultView(channel.ChannelItems);
            return(channel);
        }
コード例 #33
0
        public static string ParseTitle(HtmlDocument htmlDoc, SiteType site)
        {
            var      rootNode  = htmlDoc.DocumentNode;
            HtmlNode titleNode = null;

            switch (site)
            {
            case SiteType.JiangXi:
                titleNode = rootNode.SelectSingleNode("//*[@id='lblTitle']");
                break;

            case SiteType.PinXiang:
                titleNode = rootNode.SelectSingleNode("//*[@id='lblTitle']");
                break;

            case SiteType.JingDeZhen:
                titleNode = rootNode.SelectSingleNode("//h2");
                break;

            case SiteType.GanZhou:
                titleNode = rootNode.SelectSingleNode("//div[@align='center']");
                break;

            case SiteType.FuZhou:
                titleNode = rootNode.SelectSingleNode("//span[@class='news_title']");
                break;

            case SiteType.NanChang:
                titleNode = rootNode.SelectSingleNode("//td[@class='article_bt']");
                break;

            default:
                break;
            }
            //titleNode = titleNode ?? rootNode.SelectSingleNode("//h2");
            //titleNode = titleNode ?? rootNode.SelectSingleNode("//span[@id='lblTitle']");
            //titleNode = titleNode ?? rootNode.SelectSingleNode("//td[@class='article_bt']");
            //titleNode = titleNode ?? rootNode.SelectSingleNode("//span[@class='news_title']");
            //titleNode = titleNode ?? rootNode.SelectSingleNode("//p[@align='center']");
            //titleNode = titleNode ?? rootNode.SelectSingleNode("//div[@align='center']");
            return(titleNode == null ? "" : titleNode.InnerText);
        }
コード例 #34
0
        public async Task <JsonResult> AddSiteType([Bind(Include = "CustomerID, Name")] SiteType siteType)
        {
            bool SiteTypeUnique = await _sitesRepository.ValidateSiteTypeUniqueForCustomer(siteType);

            if (!SiteTypeUnique)
            {
                return(Json(new { success = false, responseText = "Site already exists for this Customer!" }));
            }

            if (ModelState.IsValid)
            {
                await _sitesRepository.AddSiteType(siteType);

                return(Json(new { success = true, responseText = "SiteType added" }));
            }
            else
            {
                return(Json(new { success = false, responseText = "SiteType missing fields!" }));
            }
        }
コード例 #35
0
        public static async Task <IVideoItem> GetVideoItemNetAsync(string id, SiteType site)
        {
            try
            {
                VideoItemPOCO poco = null;
                switch (site)
                {
                case SiteType.YouTube:
                    poco = await YouTubeSite.GetVideoItemNetAsync(id).ConfigureAwait(false);

                    break;
                }
                IVideoItem vi = CreateVideoItem(poco, site);
                return(vi);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #36
0
 public async Task Save(SiteType model)
 {
     await InTx(async session =>
     {
         DateTime now = DateTime.Now;
         var type     = await session.GetAsync <SiteTypeEntity>(model.Id).ConfigureAwait(false);
         if (type == null)
         {
             type = new SiteTypeEntity
             {
                 Id      = model.Id,
                 Created = now
             };
         }
         type.CLRType      = model.CLRType;
         type.Body         = JsonConvert.SerializeObject(model);
         type.LastModified = now;
         await session.SaveOrUpdateAsync(type).ConfigureAwait(false);
     }).ConfigureAwait(false);
 }
コード例 #37
0
        public bool RemoveSiteBinding(string applicationName, string siteBinding, SiteType siteType)
        {
            IIS.Site site;

            try
            {
                using (var iis = GetServerManager())
                {
                    if (siteType == SiteType.Live)
                    {
                        site = iis.Sites[GetLiveSite(applicationName)];
                    }
                    else
                    {
                        site = iis.Sites[GetServiceSite(applicationName)];
                    }

                    if (site != null)
                    {
                        var uri     = new Uri(siteBinding);
                        var binding = site.Bindings.FirstOrDefault(x => x.Host.Equals(uri.Host) &&
                                                                   x.EndPoint.Port.Equals(uri.Port) &&
                                                                   x.Protocol.Equals(uri.Scheme));

                        if (binding != null)
                        {
                            site.Bindings.Remove(binding);
                            iis.CommitChanges();

                            Thread.Sleep(1000);
                        }
                    }
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #38
0
        /// <summary>
        /// Adds or updates the given model in the database
        /// depending on its state.
        /// </summary>
        /// <param name="model">The model</param>
        public async Task Save(SiteType model)
        {
            var type = await _db.SiteTypes
                       .FirstOrDefaultAsync(t => t.Id == model.Id)
                       .ConfigureAwait(false);

            if (type == null)
            {
                type = new Data.SiteType
                {
                    Id      = model.Id,
                    Created = DateTime.Now
                };
                await _db.SiteTypes.AddAsync(type).ConfigureAwait(false);
            }
            type.CLRType      = model.CLRType;
            type.Body         = JsonConvert.SerializeObject(model);
            type.LastModified = DateTime.Now;

            await _db.SaveChangesAsync().ConfigureAwait(false);
        }
コード例 #39
0
        private void TrackSiteInAllTasks(SiteType type, bool status)
        {
            if (_dictStopTracking == null || _dictStopTracking.Count <= 0)
            {
                return;
            }

            if (_dictStopTracking.ContainsKey(type))
            {
                _dictStopTracking[type] = status;
                //UpdateProgessBarValue(GetTrackingProgess());
            }
            if (_dictStopTracking.All(p => p.Value))
            {
                btnStart.Enabled    = true;
                btnStop.Enabled     = false;
                btnReadFile.Enabled = true;
                //UpdateProgessBarValue(100);
                StartStopProgessBar(false);
            }
        }
コード例 #40
0
 //TODO: See how we can avoid injecting EventBus into the Domain entities
 public Site(Guid id, int siteNumber, string siteName, SiteStatus status, SiteFacilityType siteFacitlityType, SiteType siteType,
             DateTimeRange contractDuration, PhoneNumber primaryPhoneNumber, Contact contactDetails, VO.Address address, string email,
             string countyCode, string countyServedCode, LicenceStatus licenceStatus, IEnumerable <SiteHoliday> holidays, IEnumerable <SiteRate> rates /*, IBus bus*/) : base(id /*, bus*/)
 {
     SiteNumber         = siteNumber;
     SiteName           = siteName;
     Status             = status;
     SiteFacitlityType  = siteFacitlityType;
     SiteType           = siteType;
     ContractDuration   = contractDuration;
     PrimaryPhoneNumber = primaryPhoneNumber;
     ContactDetails     = contactDetails;
     Address            = address;
     Email            = email;
     CountyCode       = countyCode;
     CountyServedCode = countyServedCode;
     LicencingStatus  = licenceStatus;
     InitializeDbState();
     holidays.ForEach(AddNewHoliday);
     rates.ForEach(AddNewSiteRate);
 }
コード例 #41
0
ファイル: Site.cs プロジェクト: srivelicheti/learning-DDD
 //TODO: See how we can avoid injecting EventBus into the Domain entities
 public Site(Guid id, int siteNumber, string siteName, SiteStatus status, SiteFacilityType siteFacitlityType, SiteType siteType,
     DateTimeRange contractDuration, PhoneNumber primaryPhoneNumber, Contact contactDetails, VO.Address address, string email,
     string countyCode, string countyServedCode, LicenceStatus licenceStatus, IEnumerable<SiteHoliday> holidays, IEnumerable<SiteRate> rates/*, IBus bus*/)
     : base(id/*, bus*/)
 {
     SiteNumber = siteNumber;
     SiteName = siteName;
     Status = status;
     SiteFacitlityType = siteFacitlityType;
     SiteType = siteType;
     ContractDuration = contractDuration;
     PrimaryPhoneNumber = primaryPhoneNumber;
     ContactDetails = contactDetails;
     Address = address;
     Email = email;
     CountyCode = countyCode;
     CountyServedCode = countyServedCode;
     LicencingStatus = licenceStatus;
     InitializeDbState();
     holidays.ForEach(AddNewHoliday);
     rates.ForEach(AddNewSiteRate);
 }
コード例 #42
0
        public BindingConfiguration(string url, UriScheme scheme, SiteType siteType)
            : this(url, scheme, siteType, null, false)
        {

        }
コード例 #43
0
        public void setEditorType(SiteType type)
        {
            editorType = (KerbalKonstructs.instance.launchFromAnySite) ? SiteType.Any : type;
            if (selectedSite != null)
            {
                if (selectedSite.type != editorType && selectedSite.type != SiteType.Any)
                {
                    selectedSite = LaunchSiteManager.getLaunchSites(editorType)[0];
                }

                // if (!isCareerGame())
                LaunchSiteManager.setLaunchSite(selectedSite);
            }
        }
コード例 #44
0
 protected BindingConfigurationElement(SiteType siteType)
 {
     SiteType = siteType;
 }
コード例 #45
0
        // INSTANCE EDITOR
        void drawToolWindow(int windowID)
        {
            BoxNoBorder = new GUIStyle(GUI.skin.box);
            BoxNoBorder.normal.background = null;
            BoxNoBorder.normal.textColor = Color.white;

            DeadButton = new GUIStyle(GUI.skin.button);
            DeadButton.normal.background = null;
            DeadButton.hover.background = null;
            DeadButton.active.background = null;
            DeadButton.focused.background = null;
            DeadButton.normal.textColor = Color.yellow;
            DeadButton.hover.textColor = Color.white;
            DeadButton.active.textColor = Color.yellow;
            DeadButton.focused.textColor = Color.yellow;
            DeadButton.fontSize = 14;
            DeadButton.fontStyle = FontStyle.Normal;

            DeadButtonRed = new GUIStyle(GUI.skin.button);
            DeadButtonRed.normal.background = null;
            DeadButtonRed.hover.background = null;
            DeadButtonRed.active.background = null;
            DeadButtonRed.focused.background = null;
            DeadButtonRed.normal.textColor = Color.red;
            DeadButtonRed.hover.textColor = Color.yellow;
            DeadButtonRed.active.textColor = Color.red;
            DeadButtonRed.focused.textColor = Color.red;
            DeadButtonRed.fontSize = 12;
            DeadButtonRed.fontStyle = FontStyle.Bold;

            string smessage = "";
            ScreenMessageStyle smsStyle = (ScreenMessageStyle)2;
            Vector3 position = Vector3.zero;
            float alt = 0;
            float newRot = 0;
            float vis = 0;
            bool shouldUpdateSelection = false;
            bool manuallySet = false;

            double objLat = 0;
            double objLon = 0;

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

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

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(21)))
                {
                    KerbalKonstructs.instance.saveObjects();
                    KerbalKonstructs.instance.deselectObject(true, true);
                }
            }
            GUILayout.EndHorizontal();

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

            GUILayout.Space(2);

            GUILayout.Box((string)selectedObject.model.getSetting("title"));

            GUI.enabled = !KerbalKonstructs.instance.bDisablePositionEditing;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Position   ");
                GUILayout.Space(15);

                if (GUILayout.Button(new GUIContent(tCopyPos, "Copy Position."), GUILayout.Width(23), GUILayout.Height(23)))
                {
                    savedpos = true;
                    savedxpos = xPos;
                    savedypos = yPos;
                    savedzpos = zPos;
                    savedalt = altitude;
                    savedrot = rotation;
                    // Debug.Log("KK: Instance position copied");
                }
                if (GUILayout.Button(new GUIContent(tPastePos, "Paste Position."), GUILayout.Width(23), GUILayout.Height(23)))
                {
                    if (savedpos)
                    {
                        pospasted = true;
                        xPos = savedxpos;
                        yPos = savedypos;
                        zPos = savedzpos;
                        altitude = savedalt;
                        rotation = savedrot;
                        // Debug.Log("KK: Instance position pasted");
                    }
                }
                if (GUILayout.Button(new GUIContent(tSnap, "Snap to Target."), GUILayout.Width(23), GUILayout.Height(23)))
                {
                    if (snapTargetInstance == null)
                    {

                    }
                    else
                    {
                        Vector3 snapTargetPos = (Vector3)snapTargetInstance.getSetting("RadialPosition");
                        float snapTargetAlt = (float)snapTargetInstance.getSetting("RadiusOffset");
                        selectedObject.setSetting("RadialPosition", snapTargetPos);
                        selectedObject.setSetting("RadiusOffset", snapTargetAlt);
                    }

                    if (!KerbalKonstructs.instance.DevMode)
                    {
                        selectedObject.setSetting("CustomInstance", "True");
                    }
                    updateSelection(selectedObject);
                }

                GUILayout.FlexibleSpace();
                GUILayout.Label("Increment");
                increment = GUILayout.TextField(increment, 3, GUILayout.Width(30));
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Label("X:");
            GUILayout.FlexibleSpace();
            xPos = GUILayout.TextField(xPos, 25, GUILayout.Width(80));
            if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
            {
                position.x -= float.Parse(increment);
                shouldUpdateSelection = true;
            }
            if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
            {
                position.x += float.Parse(increment);
                shouldUpdateSelection = true;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Y:");
            GUILayout.FlexibleSpace();
            yPos = GUILayout.TextField(yPos, 25, GUILayout.Width(80));
            if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
            {
                position.y -= float.Parse(increment);
                shouldUpdateSelection = true;
            }
            if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
            {
                position.y += float.Parse(increment);
                shouldUpdateSelection = true;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Z:");
            GUILayout.FlexibleSpace();
            zPos = GUILayout.TextField(zPos, 25, GUILayout.Width(80));
            if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
            {
                position.z -= float.Parse(increment);
                shouldUpdateSelection = true;
            }
            if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
            {
                position.z += float.Parse(increment);
                shouldUpdateSelection = true;
            }
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            {
                var objectpos = KerbalKonstructs.instance.getCurrentBody().transform.InverseTransformPoint(selectedObject.gameObject.transform.position);
                var dObjectLat = NavUtils.GetLatitude(objectpos);
                var dObjectLon = NavUtils.GetLongitude(objectpos);
                var disObjectLat = dObjectLat * 180 / Math.PI;
                var disObjectLon = dObjectLon * 180 / Math.PI;

                if (disObjectLon < 0) disObjectLon = disObjectLon + 360;

                selectedObject.setSetting("RefLatitude", disObjectLat);
                selectedObject.setSetting("RefLongitude", disObjectLon);

                GUILayout.Box("Latitude");
                GUILayout.Box(disObjectLat.ToString("#0.00"));
                GUILayout.Box("Longitude");
                GUILayout.Box(disObjectLon.ToString("#0.00"));
            }
            GUILayout.EndHorizontal();

            GUI.enabled = !KerbalKonstructs.instance.bDisablePositionEditing;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Alt.");
                GUILayout.FlexibleSpace();
                altitude = GUILayout.TextField(altitude, 25, GUILayout.Width(80));
                if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    alt -= float.Parse(increment);
                    shouldUpdateSelection = true;
                }
                if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    alt += float.Parse(increment);
                    shouldUpdateSelection = true;
                }
            }
            GUILayout.EndHorizontal();

            var pqsc = ((CelestialBody)selectedObject.getSetting("CelestialBody")).pqsController;

            if (GUILayout.Button("Snap to Terrain", GUILayout.Height(21)))
            {
                alt = 1.0f + ((float)(pqsc.GetSurfaceHeight((Vector3)selectedObject.getSetting("RadialPosition")) - pqsc.radius - (float)selectedObject.getSetting("RadiusOffset")));
                shouldUpdateSelection = true;
            }

            GUI.enabled = true;

            bool isDevMode = KerbalKonstructs.instance.DevMode;

            if (isDevMode && selectedObject != null)
            {
                GUILayout.Space(10);
                GUILayout.Box("SNAP-POINTS");

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Source ");
                    GUILayout.Box("" + vbsnapangle1.ToString() + "d");
                    GUILayout.Box("Wpos " + snapSourceWorldPos.ToString());
                    GUILayout.FlexibleSpace();
                    Transform[] transformList = selectedObject.gameObject.GetComponentsInChildren<Transform>();
                    List<GameObject> snappointList = (from t in transformList where t.gameObject.name == "snappoint" select t.gameObject).ToList();

                    foreach (GameObject tSnapPoint in snappointList)
                    {
                        GUI.enabled = (tSnapPoint != selectedSnapPoint);
                        if (GUILayout.Button("*", GUILayout.Width(23), GUILayout.Height(23)))
                        {
                            selectedSnapPoint = tSnapPoint;
                            SnapToTarget();
                            updateSelection(selectedObject);
                        }
                        GUI.enabled = true;
                    }
                }
                GUILayout.EndHorizontal();
            }

            if (isDevMode && snapTargetInstance != null)
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Target ");
                    GUILayout.Box("" + vbsnapangle2.ToString() + "d");
                    GUILayout.Box("Wpos " + snapTargetWorldPos.ToString());
                    GUILayout.FlexibleSpace();
                    Transform[] transformList2 = snapTargetInstance.gameObject.GetComponentsInChildren<Transform>();
                    List<GameObject> snappointList2 = (from t2 in transformList2 where t2.gameObject.name == "snappoint" select t2.gameObject).ToList();

                    foreach (GameObject tSnapPoint2 in snappointList2)
                    {
                        GUI.enabled = (tSnapPoint2 != selectedSnapPoint2);
                        if (GUILayout.Button("*", GUILayout.Width(23), GUILayout.Height(23)))
                        {
                            selectedSnapPoint2 = tSnapPoint2;
                            SnapToTarget(SnapRotateMode);
                            updateSelection(selectedObject);
                        }
                        GUI.enabled = true;
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    sSTROT = snapTargetInstance.pqsCity.reorientFinalAngle.ToString();
                    GUILayout.Box("Rot " + sSTROT);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Snap", GUILayout.Height(23)))
                    {
                        SnapToTarget(SnapRotateMode);
                    }
                    GUILayout.Space(10);

                    SnapRotateMode = GUILayout.Toggle(SnapRotateMode, "SnapRot Mode", GUILayout.Height(23));

                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("DriftFix", GUILayout.Height(23)))
                    {
                        if (selectedSnapPoint == null || selectedSnapPoint2 == null)
                        {
                        }
                        else
                        {
                            FixDrift(SnapRotateMode);
                        }
                    }
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.Space(5);

            GUI.enabled = !KerbalKonstructs.instance.bDisablePositionEditing;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Rot.");
                GUILayout.FlexibleSpace();
                rotation = GUILayout.TextField(rotation, 4, GUILayout.Width(80));

                if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    newRot -= float.Parse(increment) / 10f;
                    shouldUpdateSelection = true;
                }
                if (GUILayout.Button(new GUIContent("<", "-45"), GUILayout.Width(30), GUILayout.Height(23)))
                {
                    newRot -= 45.0f;
                    shouldUpdateSelection = true;
                }
                if (GUILayout.Button(new GUIContent(">", "+45"), GUILayout.Width(30), GUILayout.Height(23)))
                {
                    newRot += 45.0f;
                    shouldUpdateSelection = true;
                }
                if (GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    newRot += float.Parse(increment) / 10f;
                    shouldUpdateSelection = true;
                }
            }
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Vis.");
                GUILayout.FlexibleSpace();
                visrange = GUILayout.TextField(visrange, 6, GUILayout.Width(80));
                if (GUILayout.Button("Min", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    vis -= 1000000000f;
                    //visrange = "2500";
                    shouldUpdateSelection = true;
                }
                if (GUILayout.Button("-", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    vis -= 2500f;
                    shouldUpdateSelection = true;
                }
                if (GUILayout.Button("+", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    vis += 2500f;
                    shouldUpdateSelection = true;
                }
                if (GUILayout.Button("Max", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    vis = (float)KerbalKonstructs.instance.maxEditorVisRange;
                    shouldUpdateSelection = true;
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(5);

            GUI.enabled = !KerbalKonstructs.instance.bDisablePositionEditing;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Orientation");
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(new GUIContent("U", "Top Up"), GUILayout.Height(21), GUILayout.Width(18)))
                {
                    xOri = "0"; yOri = "1"; zOri = "0"; pospasted = true; shouldUpdateSelection = true;
                }
                if (GUILayout.Button(new GUIContent("D", "Bottom Up"), GUILayout.Height(21), GUILayout.Width(18)))
                {
                    xOri = "0"; yOri = "-1"; zOri = "0"; pospasted = true; shouldUpdateSelection = true;
                }
                if (GUILayout.Button(new GUIContent("L", "On Left"), GUILayout.Height(21), GUILayout.Width(18)))
                {
                    xOri = "1"; yOri = "0"; zOri = "0"; pospasted = true; shouldUpdateSelection = true;
                }
                if (GUILayout.Button(new GUIContent("R", "On Right"), GUILayout.Height(21), GUILayout.Width(18)))
                {
                    xOri = "-1"; yOri = "0"; zOri = "0"; pospasted = true; shouldUpdateSelection = true;
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("(-1 to +1)");
                GUILayout.FlexibleSpace();

                GUILayout.Label("X");
                if (GUILayout.Button(new GUIContent("<", "Tip X"), GUILayout.Height(21), GUILayout.Width(18)))
                {
                    float fxOri = float.Parse(xOri);
                    fxOri = fxOri - 0.01f;
                    if (fxOri < -1.00f) xOri = "-1";
                        else  xOri = fxOri.ToString("#0.00");
                    pospasted = true;
                    shouldUpdateSelection = true;
                }
                xOri = GUILayout.TextField(xOri, 25, GUILayout.Width(25));
                if (GUILayout.Button(new GUIContent(">", "Tip X"), GUILayout.Height(21), GUILayout.Width(18)))
                {
                    float fxOri = float.Parse(xOri);
                    fxOri = fxOri + 0.01f;
                    if (fxOri > 1.00f) xOri = "1";
                        else xOri = fxOri.ToString("#0.00");
                    pospasted = true;
                    shouldUpdateSelection = true;
                }

                GUILayout.Label(" Y");
                yOri = GUILayout.TextField(yOri, 25, GUILayout.Width(25));

                GUILayout.Label(" Z");
                if (GUILayout.Button(new GUIContent("<", "Tip Z"), GUILayout.Height(21), GUILayout.Width(18)))
                {
                    float fzOri = float.Parse(zOri);
                    fzOri = fzOri - 0.01f;
                    if (fzOri < -1.00f) zOri = "-1";
                        else zOri = fzOri.ToString("#0.00");
                    pospasted = true;
                    shouldUpdateSelection = true;
                }
                zOri = GUILayout.TextField(zOri, 25, GUILayout.Width(25));
                if (GUILayout.Button(new GUIContent(">", "Tip Z"), GUILayout.Height(21), GUILayout.Width(18)))
                {
                    float fzOri = float.Parse(zOri);
                    fzOri = fzOri + 0.01f;
                    if (fzOri > 1.00f) zOri = "1";
                        else zOri = fzOri.ToString("#0.00");
                    pospasted = true;
                    shouldUpdateSelection = true;
                }
            }
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.Space(5);

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Facility Type: ", GUILayout.Height(23));
                GUILayout.FlexibleSpace();
                facType = GUILayout.TextField(facType, 30, GUILayout.Width(185), GUILayout.Height(23));
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Group: ", GUILayout.Height(23));
                GUILayout.FlexibleSpace();
                sGroup = GUILayout.TextField(sGroup, 30, GUILayout.Width(185), GUILayout.Height(23));
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(5);

            GUI.enabled = !KerbalKonstructs.instance.bDisablePositionEditing;

            GUILayout.BeginHorizontal();
            {
                enableColliders = GUILayout.Toggle(enableColliders, "Enable Colliders", GUILayout.Width(140), GUILayout.Height(23));

                Transform[] gameObjectList = selectedObject.gameObject.GetComponentsInChildren<Transform>();
                List<GameObject> colliderList = (from t in gameObjectList where t.gameObject.collider != null select t.gameObject).ToList();

                if (enableColliders)
                {
                    foreach (GameObject collider in colliderList)
                    {
                        collider.collider.enabled = true;
                    }
                }
                if (!enableColliders)
                {
                    foreach (GameObject collider in colliderList)
                    {
                        collider.collider.enabled = false;
                    }
                }

                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Duplicate", GUILayout.Width(130), GUILayout.Height(23)))
                {
                    KerbalKonstructs.instance.saveObjects();
                    StaticModel oModel = selectedObject.model;
                    float fOffset = (float)selectedObject.getSetting("RadiusOffset");
                    Vector3 vPosition = (Vector3)selectedObject.getSetting("RadialPosition");
                    float fAngle = (float)selectedObject.getSetting("RotationAngle");
                    smessage = "Spawned duplicate " + selectedObject.model.getSetting("title");
                    KerbalKonstructs.instance.deselectObject(true, true);
                    spawnInstance(oModel, fOffset, vPosition, fAngle);
                    ScreenMessages.PostScreenMessage(smessage, 10, smsStyle);
                }
            }
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.Space(10);

            GUI.enabled = !editingSite;

            string sLaunchPadTransform = (string)selectedObject.getSetting("LaunchPadTransform");
            string sDefaultPadTransform = (string)selectedObject.model.getSetting("DefaultLaunchPadTransform");
            string sLaunchsiteDesc = (string)selectedObject.getSetting("LaunchSiteDescription");
            string sModelDesc = (string)selectedObject.model.getSetting("description");

            if (sLaunchPadTransform == "" && sDefaultPadTransform == "")
                GUI.enabled = false;

            if (GUILayout.Button(((selectedObject.settings.ContainsKey("LaunchSiteName")) ? "Edit" : "Make") + " Launchsite", GUILayout.Height(23)))
            {
                // Edit or make a launchsite
                siteName = (string)selectedObject.getSetting("LaunchSiteName");
                siteTrans = (selectedObject.settings.ContainsKey("LaunchPadTransform")) ? sLaunchPadTransform : sDefaultPadTransform;

                if (sLaunchsiteDesc != "")
                    siteDesc = sLaunchsiteDesc;
                else
                    siteDesc = sModelDesc;

                siteCategory = (string)selectedObject.getSetting("Category");
                siteType = (SiteType)selectedObject.getSetting("LaunchSiteType");
                flOpenCost = (float)selectedObject.getSetting("OpenCost");
                flCloseValue = (float)selectedObject.getSetting("CloseValue");
                stOpenCost = string.Format("{0}", flOpenCost);
                stCloseValue = string.Format("{0}", flCloseValue);

                flRecoveryFactor = (float)selectedObject.getSetting("RecoveryFactor");
                flRecoveryRange = (float)selectedObject.getSetting("RecoveryRange");
                flLaunchRefund = (float)selectedObject.getSetting("LaunchRefund");

                stRecoveryFactor = string.Format("{0}", flRecoveryFactor);
                stRecoveryRange = string.Format("{0}", flRecoveryRange);
                stLaunchRefund = string.Format("{0}", flLaunchRefund);

                siteAuthor = (selectedObject.settings.ContainsKey("author")) ? (string)selectedObject.getSetting("author") : (string)selectedObject.model.getSetting("author");
                // Debug.Log("KK: Making or editing a launchsite");
                editingSite = true;
            }

            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Save", GUILayout.Width(130), GUILayout.Height(23)))
                {
                    KerbalKonstructs.instance.saveObjects();
                    smessage = "Saved all changes to all objects.";
                    ScreenMessages.PostScreenMessage(smessage, 10, smsStyle);
                }
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Deselect", GUILayout.Width(130), GUILayout.Height(23)))
                {
                    KerbalKonstructs.instance.saveObjects();
                    KerbalKonstructs.instance.deselectObject(true, true);
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Delete Instance", GUILayout.Height(21)))
            {
                if (snapTargetInstance == selectedObject) snapTargetInstance = null;
                if (snapTargetInstancePrevious == selectedObject) snapTargetInstancePrevious = null;
                if (selectedObjectPrevious == selectedObject) selectedObjectPrevious = null;
                KerbalKonstructs.instance.deleteObject(selectedObject);
                selectedObject = null;
            }

            GUILayout.Space(15);

            if (Event.current.keyCode == KeyCode.Return || (pospasted))
            {
                ScreenMessages.PostScreenMessage("Applied changes to object.", 10, smsStyle);
                pospasted = false;
                manuallySet = true;
                position.x = float.Parse(xPos);
                position.y = float.Parse(yPos);
                position.z = float.Parse(zPos);

                //if (float.Parse(xOri) > 1.0f || float.Parse(xOri) < -1.0f) xOri = "0";
                //if (float.Parse(yOri) > 1.0f || float.Parse(yOri) < -1.0f) yOri = "0";
                //if (float.Parse(zOri) > 1.0f || float.Parse(zOri) < -1.0f) zOri = "0";
                orientation.x = float.Parse(xOri);
                orientation.y = float.Parse(yOri);
                orientation.z = float.Parse(zOri);

                selectedObject.setSetting("Orientation", orientation);

                vis = float.Parse(visrange);
                alt = float.Parse(altitude);

                float rot = float.Parse(rotation);
                while (rot > 360 || rot < 0)
                {
                    if (rot > 360)
                    {
                        rot -= 360;
                    }
                    else if (rot < 0)
                    {
                        rot += 360;
                    }
                }
                newRot = rot;
                rotation = rot.ToString();

                shouldUpdateSelection = true;
            }

            if (shouldUpdateSelection)
            {
                if (!manuallySet)
                {
                    position += (Vector3)selectedObject.getSetting("RadialPosition");
                    orientation.x = float.Parse(xOri);
                    orientation.y = float.Parse(yOri);
                    orientation.z = float.Parse(zOri);
                    alt += (float)selectedObject.getSetting("RadiusOffset");
                    newRot += (float)selectedObject.getSetting("RotationAngle");
                    vis += (float)selectedObject.getSetting("VisibilityRange");

                    if ((float)orientation.x > 1.0f || (float)orientation.x < -1.0f)
                    {
                        //xOri = "0";
                        //orientation.x = 0.0f;
                    }
                    if ((float)orientation.y > 1.0f || (float)orientation.y < -1.0f)
                    {
                        //yOri = "0";
                        //orientation.y = 0.0f;
                    }
                    if ((float)orientation.z > 1.0f || (float)orientation.z < -1.0f)
                    {
                        //zOri = "0";
                        //orientation.z = 0.0f;
                    }
                    selectedObject.setSetting("Orientation", orientation);

                    while (newRot > 360 || newRot < 0)
                    {
                        if (newRot > 360)
                        {
                            newRot -= 360;
                        }
                        else if (newRot < 0)
                        {
                            newRot += 360;
                        }
                    }

                    if (vis > (float)KerbalKonstructs.instance.maxEditorVisRange || vis < 1000)
                    {
                        if (vis > (float)KerbalKonstructs.instance.maxEditorVisRange)
                        {
                            vis = (float)KerbalKonstructs.instance.maxEditorVisRange;
                        }
                        else if (vis < 1000)
                        {
                            vis = 1000;
                        }
                    }
                }

                selectedObject.setSetting("RadialPosition", position);

                selectedObject.setSetting("RadiusOffset", alt);
                selectedObject.setSetting("RotationAngle", newRot);
                selectedObject.setSetting("VisibilityRange", vis);
                selectedObject.setSetting("RefLatitude", objLat);
                selectedObject.setSetting("RefLongitude", objLon);

                selectedObject.setSetting("FacilityType", facType);
                selectedObject.setSetting("Group", sGroup);

                if (!KerbalKonstructs.instance.DevMode)
                {
                    selectedObject.setSetting("CustomInstance", "True");
                }

                updateSelection(selectedObject);
            }

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

            GUILayout.Space(2);

            if (GUI.tooltip != "")
            {
                var labelSize = GUI.skin.GetStyle("Label").CalcSize(new GUIContent(GUI.tooltip));
                GUI.Box(new Rect(Event.current.mousePosition.x - (25 + (labelSize.x / 2)), Event.current.mousePosition.y - 40, labelSize.x + 10, labelSize.y + 5), GUI.tooltip);
            }

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }
コード例 #46
0
ファイル: SiteManager.cs プロジェクト: albertjan/kudu
        public bool RemoveSiteBinding(string applicationName, string siteBinding, SiteType siteType)
        {
            IIS.Site site;

            try
            {
                using (var iis = GetServerManager())
                {
                    if (siteType == SiteType.Live)
                    {
                        site = iis.Sites[GetLiveSite(applicationName)];
                    }
                    else
                    {
                        site = iis.Sites[GetServiceSite(applicationName)];
                    }

                    if (site != null)
                    {
                        var uri = new Uri(siteBinding);
                        var binding = site.Bindings.FirstOrDefault(x => x.Host.Equals(uri.Host)
                                && x.EndPoint.Port.Equals(uri.Port)
                                && x.Protocol.Equals(uri.Scheme));

                        if (binding != null)
                        {
                            site.Bindings.Remove(binding);
                            iis.CommitChanges();

                            Thread.Sleep(1000);
                        }
                    }
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
 /// <remarks/>
 public System.IAsyncResult BeginCreateSite(SiteType siteType, SiteStatus status, int primaryAddressObjid, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("CreateSite", new object[] {
                 siteType,
                 status,
                 primaryAddressObjid}, callback, asyncState);
 }
コード例 #48
0
		public void setValue(string configValue)
		{
			type = getSiteTypefromString(configValue);
		}
コード例 #49
0
		public void setDefaultValue(object value)
		{
			defaultType = (SiteType) value;
		}
コード例 #50
0
ファイル: Program.cs プロジェクト: wordtinker/Cgatherer
 public static Site CreateSite(SiteType siteType, string basePage, string section="")
 {
     Site site = null;
     switch (siteType)
     {
         case SiteType.GUARDIAN:
             site = new Guardian(basePage, section);
             break;
         case SiteType.REGISTER:
             site = new Register(basePage, section);
             break;
         case SiteType.INSIDER:
             site = new Insider(basePage, section);
             break;
         default:
             throw new NotImplementedException("Wrong site type");
     }
     return site;
 }
コード例 #51
0
        // LAUNCHSITE EDITOR
        void drawSiteEditorWindow(int id)
        {
            BoxNoBorder = new GUIStyle(GUI.skin.box);
            BoxNoBorder.normal.background = null;
            BoxNoBorder.normal.textColor = Color.white;

            DeadButton = new GUIStyle(GUI.skin.button);
            DeadButton.normal.background = null;
            DeadButton.hover.background = null;
            DeadButton.active.background = null;
            DeadButton.focused.background = null;
            DeadButton.normal.textColor = Color.yellow;
            DeadButton.hover.textColor = Color.white;
            DeadButton.active.textColor = Color.yellow;
            DeadButton.focused.textColor = Color.yellow;
            DeadButton.fontSize = 14;
            DeadButton.fontStyle = FontStyle.Normal;

            DeadButtonRed = new GUIStyle(GUI.skin.button);
            DeadButtonRed.normal.background = null;
            DeadButtonRed.hover.background = null;
            DeadButtonRed.active.background = null;
            DeadButtonRed.focused.background = null;
            DeadButtonRed.normal.textColor = Color.red;
            DeadButtonRed.hover.textColor = Color.yellow;
            DeadButtonRed.active.textColor = Color.red;
            DeadButtonRed.focused.textColor = Color.red;
            DeadButtonRed.fontSize = 12;
            DeadButtonRed.fontStyle = FontStyle.Bold;

            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)))
                {
                    editingSite = false;
                }
            }
            GUILayout.EndHorizontal();

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

            GUILayout.Space(2);

            GUILayout.Box((string)selectedObject.model.getSetting("title"));

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

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

            GUILayout.BeginHorizontal();
                GUILayout.Label("Site Category: ", GUILayout.Width(120));
                GUILayout.Label(siteCategory, GUILayout.Width(80));
                GUILayout.FlexibleSpace();
                GUI.enabled = !(siteCategory == "RocketPad");
                if (GUILayout.Button("RP"))
                    siteCategory = "RocketPad";
                GUI.enabled = !(siteCategory == "Runway");
                if (GUILayout.Button("RW"))
                    siteCategory = "Runway";
                GUI.enabled = !(siteCategory == "Helipad");
                if (GUILayout.Button("HP"))
                    siteCategory = "Helipad";
                GUI.enabled = !(siteCategory == "Other");
                if (GUILayout.Button("OT"))
                    siteCategory = "Other";
            GUILayout.EndHorizontal();

            GUI.enabled = true;

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

            GUI.enabled = true;

            //Switch to enable RemoteTech functionality.
            GUILayout.BeginHorizontal ();
                GUILayout.Label ("RemoteTech station", GUILayout.Width (120));
                if (!RTGroundstation)
                    GUILayout.Label ("Disabled", GUILayout.Width (40));
                else
                    GUILayout.Label ("Enabled", GUILayout.Width (40));
                GUILayout.FlexibleSpace ();
                GUI.enabled = !RTGroundstation;
                if (GUILayout.Button ("Enable"))
                    RTGroundstation = true;
                GUI.enabled = RTGroundstation;
                if (GUILayout.Button ("Disable"))
                    RTGroundstation = false;
            GUILayout.EndHorizontal ();

            GUI.enabled = true;

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

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

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

            GUILayout.BeginHorizontal();
            GUILayout.Label("Recovery Factor: ", GUILayout.Width(120));
            stRecoveryFactor = GUILayout.TextField(stRecoveryFactor);
            GUILayout.Label(" %");
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Effective Range: ", GUILayout.Width(120));
            stRecoveryRange = GUILayout.TextField(stRecoveryRange);
            GUILayout.Label(" m");
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Launch Refund: ", GUILayout.Width(120));
            stLaunchRefund = GUILayout.TextField(stLaunchRefund);
            GUILayout.Label(" %");
            GUILayout.EndHorizontal();

            GUILayout.Label("Description: ");
            descScroll = GUILayout.BeginScrollView(descScroll);
                siteDesc = GUILayout.TextArea(siteDesc, GUILayout.ExpandHeight(true));
            GUILayout.EndScrollView();

            GUI.enabled = true;
            GUILayout.BeginHorizontal();
                if (GUILayout.Button("Save", GUILayout.Width(115)))
                {
                    Boolean addToDB = (selectedObject.settings.ContainsKey("LaunchSiteName") && siteName != "");
                    selectedObject.setSetting("LaunchSiteName", siteName);
                    selectedObject.setSetting("LaunchSiteType", siteType);
                    selectedObject.setSetting("LaunchPadTransform", siteTrans);
                    selectedObject.setSetting("LaunchSiteDescription", siteDesc);
                    selectedObject.setSetting("OpenCost", float.Parse(stOpenCost));
                    selectedObject.setSetting("CloseValue", float.Parse(stCloseValue));
                    selectedObject.setSetting("RecoveryFactor", float.Parse(stRecoveryFactor));
                    selectedObject.setSetting("RecoveryRange", float.Parse(stRecoveryRange));
                    selectedObject.setSetting("LaunchRefund", float.Parse(stLaunchRefund));
                    selectedObject.setSetting("OpenCloseState", "Open");
                    selectedObject.setSetting("Category", siteCategory);
                    selectedObject.setSetting ("RemoteTechGroundstation", RTGroundstation);

                    if (siteAuthor != (string)selectedObject.model.getSetting("author"))
                        selectedObject.setSetting("LaunchSiteAuthor", siteAuthor);

                    if(addToDB)
                    {
                        LaunchSiteManager.createLaunchSite(selectedObject);
                    }
                    KerbalKonstructs.instance.saveObjects();

                    List<LaunchSite> basesites = LaunchSiteManager.getLaunchSites();
                    PersistenceFile<LaunchSite>.SaveList(basesites, "LAUNCHSITES", "KK");
                    editingSite = false;
                }
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Cancel", GUILayout.Width(115)))
                {
                    editingSite = false;
                }
            GUILayout.EndHorizontal();

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

            GUILayout.Space(2);

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }
コード例 #52
0
 private IEnumerable<IBindingConfiguration> LegacyBinding(string key, SiteType type)
 {
     string legacyBinding = _appSettings[key];
     if (string.IsNullOrEmpty(legacyBinding))
     {
         yield break;
     }
     yield return new BindingConfiguration(legacyBinding, UriScheme.Http, type, null);
 }
コード例 #53
0
 // Returns a list of launchsites. Supports sitetype and category filtering.
 public static List<LaunchSite> getLaunchSites(SiteType type, Boolean allowAny = true, String appliedFilter = "ALL")
 {
     List<LaunchSite> sites = new List<LaunchSite>();
     foreach (LaunchSite site in launchSites)
     {
         if (site.type.Equals(type) || (site.type.Equals(SiteType.Any) && allowAny))
         {
             if (appliedFilter.Equals("ALL"))
             {
                 sites.Add(site);
             }
             else
             {
                 if (site.category.Equals(appliedFilter))
                 {
                     sites.Add(site);
                 }
             }
         }
     }
     return sites;
 }
 public ToolkitResultProtocol CreateSite(SiteType siteType, SiteStatus status, int primaryAddressObjid)
 {
     object[] results = this.Invoke("CreateSite", new object[] {
                 siteType,
                 status,
                 primaryAddressObjid});
     return ((ToolkitResultProtocol)(results[0]));
 }
コード例 #55
0
ファイル: SiteManager.cs プロジェクト: albertjan/kudu
        public bool AddSiteBinding(string applicationName, string siteBinding, SiteType siteType)
        {
            IIS.Site site;

            if (!siteBinding.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
            {
                siteBinding = "http://" + siteBinding;
            }

            var uri = new Uri(siteBinding);

            try
            {
                using (var iis = GetServerManager())
                {
                    if (!IsAvailable(uri.Host, uri.Port, iis))
                    {
                        return false;
                    }

                    if (siteType == SiteType.Live)
                    {
                        site = iis.Sites[GetLiveSite(applicationName)];
                    }
                    else
                    {
                        site = iis.Sites[GetServiceSite(applicationName)];
                    }

                    if (site != null)
                    {
                        site.Bindings.Add("*:" + uri.Port + ":" + uri.Host, "http");
                        iis.CommitChanges();

                        Thread.Sleep(1000);
                    }
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
コード例 #56
0
ファイル: SiteEventList.cs プロジェクト: rocketeerbkw/DNA
        /// <summary>
        /// 
        /// </summary>
        /// <param name="siteIds"></param>
        /// <param name="typeIds"></param>
        /// <param name="startIndex"></param>
        /// <param name="itemsPerPage"></param>
        /// <param name="startDate"></param>
        /// <param name="readerCreator"></param>
        /// <returns></returns>
        static public SiteEventList GetSiteEventList(int[] siteIds, int[] typeIds, int startIndex, int itemsPerPage,
            DateTime startDate, DateTime endDate, IDnaDataReaderCreator readerCreator, bool isSuperUser, SiteType siteType)
        {
            var siteEventList = new SiteEventList()
            {
                Sites = siteIds,
                Types = typeIds
            };

            if (siteIds.Length == 0 && !isSuperUser)
            {
                throw new Exception("Missing site list for non-super user");
            }

            var typeIdsDelimited = String.Join("|", typeIds.Select(p => p.ToString()).ToArray());
            var siteIdsDelimited = String.Join("|", siteIds.Select(p => p.ToString()).ToArray());

            using(var reader = readerCreator.CreateDnaDataReader("getsiteevents"))
            {
                reader.AddParameter("itemsperpage", itemsPerPage);
                reader.AddParameter("startindex", startIndex);
                reader.AddParameter("sitetype", siteType);
                if(startDate != DateTime.MinValue)
                {
                    reader.AddParameter("startdate", startDate);
                }
                if(endDate != DateTime.MaxValue)
                {
                    reader.AddParameter("enddate", endDate);
                }
            
                if (siteIds.Length > 0)
                {
                    reader.AddParameter("siteids", siteIdsDelimited);
                }
                if (typeIds.Length > 0)
                {
                    reader.AddParameter("typeids", typeIdsDelimited);
                }

                reader.Execute();

                if (reader.Read())
                {
                    siteEventList.TotalItems = reader.GetInt32NullAsZero("total");
                    siteEventList.StartIndex = reader.GetLongNullAsZero("n")-1;
                    siteEventList.ItemsPerPage = itemsPerPage;
                    if (startDate != DateTime.MinValue)
                    {
                        siteEventList.StartDate = new DateElement(startDate);
                    }
                    if (endDate != DateTime.MaxValue)
                    {
                        siteEventList.EndDate = new DateElement(endDate);
                    }

                    do
                    {
                        var siteEvent = new SiteEvent();
                        try
                        {
                            siteEvent.ActivityData = XElement.Parse(reader.GetXmlAsString("activitydata"));
                            
                        }
                        catch
                        {//skip a badly formatted element
                            continue;
                        }
                        siteEvent.Date = new Date(reader.GetDateTime("datetime"));
                        siteEvent.SiteId = reader.GetInt32NullAsZero("siteid");
                        siteEvent.Type = (SiteActivityType)reader.GetInt32NullAsZero("type");

                        siteEventList.SiteEvents.Add(siteEvent);
                    }
                    while (reader.Read());

                }
            }

            return siteEventList;
        }
コード例 #57
0
        public void ChangeSiteType(HostDNS host, SiteType newSiteType)
        {
            try
            {
                if (host == null || host.Remark == null)
                {
                    throw new ArgumentException("Invald domain argument.");
                }
                else if (host.Remark.SiteType == newSiteType)
                    return;
                HostRemark newRemark = new HostRemark() { SiteType = newSiteType, Target = host.Remark.Target, Comment = host.Remark.Comment };
                string newIp = EnvironmentMnager.GetIpAdress(newSiteType, host.Remark.Target);
                if (!string.IsNullOrEmpty(newIp))
                {

                    _helper.ChangeIpAndRemark(host.DomainName, host.IP, newIp, newRemark, true);
                    DNSManager.FulshDNS();
                }
                else
                {
                    _helper.ChangeRemark(host.IP, host.DomainName, newRemark, true);
                }
            }
            catch (Exception ex)
            {
                _loger.WriteLine(ex.ToString());
                throw;
            }
        }
コード例 #58
0
 public void setEditorType(SiteType type)
 {
     editorType = (KerbalKonstructs.instance.launchFromAnySite) ? SiteType.Any : type;
     if (selectedSite != null)
     {
         if (selectedSite.type != editorType && selectedSite.type != SiteType.Any)
         {
             selectedSite = LaunchSiteManager.getLaunchSites(editorType)[0];
         }
         // ASH Career Mode Unlocking
         // In career the launchsite is not set by the launchsite list but rather in the launchsite description
         // panel on the right
         // if (!isCareerGame())
         LaunchSiteManager.setLaunchSite(selectedSite);
     }
 }
コード例 #59
0
ファイル: SiteManager.cs プロジェクト: Walk4Muscle/kudu
        public bool RemoveSiteBinding(string applicationName, string siteBinding, SiteType siteType)
        {
            try
            {
                using (ServerManager iis = GetServerManager())
                {
                    IIS.Site site = siteType == SiteType.Live
                        ? iis.Sites[GetLiveSite(applicationName)]
                        : iis.Sites[GetServiceSite(applicationName)];

                    if (site == null)
                    { return true; }

                    Uri uri = new Uri(siteBinding);
                    Binding binding = site.Bindings
                        .FirstOrDefault(x => x.Host.Equals(uri.Host)
                            && x.EndPoint.Port.Equals(uri.Port)
                            && x.Protocol.Equals(uri.Scheme));

                    if (binding == null)
                    { return true; }

                    site.Bindings.Remove(binding);
                    iis.CommitChanges();
                    Thread.Sleep(1000);
                }
                return true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                return false;
            }
        }
コード例 #60
0
ファイル: SiteSummaryStats.cs プロジェクト: rocketeerbkw/DNA
        /// <summary>
        /// Gets the stats for the given site and date range
        /// </summary>
        /// <param name="creator"></param>
        /// <param name="siteId"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public static SiteSummaryStats GetStatsByType(IDnaDataReaderCreator creator, SiteType type, int userId, DateTime startDate, DateTime endDate)
        {
            var siteSummaryStats = new SiteSummaryStats() { EndDate = endDate, StartDate = startDate, Type = (int)type, UserId = userId};
            using (IDnaDataReader dataReader = creator.CreateDnaDataReader("getsitedailysummaryreportbytype"))
            {
                dataReader.AddParameter("enddate", endDate);
                dataReader.AddParameter("startdate", startDate);
                dataReader.AddParameter("type", (int)type);
                dataReader.AddParameter("userId", userId);

                dataReader.Execute();

                //replace empty items with actual queue data
                while (dataReader.Read())
                {

                    siteSummaryStats.TotalModerations = dataReader.GetInt32NullAsZero("TotalModerations");
                    siteSummaryStats.TotalReferredModerations = dataReader.GetInt32NullAsZero("TotalReferredModerations");
                    siteSummaryStats.TotalComplaints = dataReader.GetInt32NullAsZero("TotalComplaints");
                    siteSummaryStats.UniqueModerationUsers = dataReader.GetInt32NullAsZero("UniqueModerationUsers");
                    siteSummaryStats.TotalNotablePosts = dataReader.GetInt32NullAsZero("TotalNotablePosts");
                    siteSummaryStats.TotalHostPosts = dataReader.GetInt32NullAsZero("TotalHostPosts");
                    siteSummaryStats.TotalPosts = dataReader.GetInt32NullAsZero("TotalPosts");
                    siteSummaryStats.TotalExLinkModerations = dataReader.GetInt32NullAsZero("TotalExLinkModerations");
                    siteSummaryStats.TotalExLinkReferrals = dataReader.GetInt32NullAsZero("TotalExLinkReferrals");
                    siteSummaryStats.TotalExLinkModPasses = dataReader.GetInt32NullAsZero("TotalExLinkModPasses");
                    siteSummaryStats.TotalExLinkModFails = dataReader.GetInt32NullAsZero("TotalExLinkModFails");
                    siteSummaryStats.TotalPostsFailed = dataReader.GetInt32NullAsZero("TotalPostsFailed");
                    siteSummaryStats.TotalNewUsers = dataReader.GetInt32NullAsZero("TotalNewUsers");
                    siteSummaryStats.TotalBannedUsers = dataReader.GetInt32NullAsZero("TotalBannedUsers");
                    siteSummaryStats.TotalNickNamesModerations = dataReader.GetInt32NullAsZero("TotalNickNamesModerations");
                    siteSummaryStats.TotalRestrictedUsers = dataReader.GetInt32NullAsZero("TotalRestrictedUsers");
                }
            }
            return siteSummaryStats;
        }