コード例 #1
0
ファイル: AlarmSystem.cs プロジェクト: jacauc/alarmserver
        private void TpiSocket_ResponseReceived(object sender, TpiResponse response)
        {
            switch (response.ResponseType)
            {
            case TpiResponseType.System:
                this.ProcessEvent(response);
                break;

            case TpiResponseType.Partition:
                // Find the partition and process it (ignore any partitions that are not defined in app settings)
                Partition p = PartitionList.FirstOrDefault(x => x.Id == response.PartitionId);
                if (p != null)
                {
                    p.ProcessEvent(response);
                }
                break;

            case TpiResponseType.Zone:
                // Find the zone and process it (ignore any zones that are not defined in app settings)
                Zone z = ZoneList.FirstOrDefault(x => x.Id == response.ZoneId);
                if (z != null)
                {
                    z.ProcessEvent(response);
                }
                break;
            }
        }
コード例 #2
0
 public LocationInfoResponse()
 {
     response_code      = 0;
     stereo_pair_status = "none";
     name      = "Home";
     zone_list = new ZoneList();
 }
コード例 #3
0
        public void ListRequestObject()
        {
            moq::Mock <Zones.ZonesClient> mockGrpcClient = new moq::Mock <Zones.ZonesClient>(moq::MockBehavior.Strict);
            ListZonesRequest request = new ListZonesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                ReturnPartialSuccess = false,
            };
            ZoneList expectedResponse = new ZoneList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Zone(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ZonesClient client   = new ZonesClientImpl(mockGrpcClient.Object, null);
            ZoneList    response = client.List(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
ファイル: AlarmSystem.cs プロジェクト: jacauc/alarmserver
        private void ProcessEvent(TpiResponse response)
        {
            // Send a password if requested
            if (response.Command == ResponseCommand.LoginInteraction && response.Data == "3")
            {
                _tpiSocket.ExecuteCommand(new TpiCommand(RequestCommand.NetworkLogin, Password));
                Thread.Sleep(500);
            }

            if (response.Command == ResponseCommand.LoginInteraction && response.Data == "1")
            {
                _tpiSocket.ExecuteCommand(new TpiCommand(RequestCommand.TimeStampControl, "1"));
                Thread.Sleep(1500);
                _tpiSocket.ExecuteCommand(new TpiCommand(RequestCommand.StatusReport));
            }

            if (response.Command == ResponseCommand.EnvisalinkZoneTimerDump)
            {
                for (int i = 0; i < 64; i++)
                {
                    Zone z = ZoneList.FirstOrDefault(x => x.Id == i + 1);
                    if (z != null)
                    {
                        z.SecondsSinceLastClose = response.SecondsSinceOpened[i];
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Zone List Screen Constructor
        /// </summary>
        public ZoneListScreen()
            : base("ZoneList")
        {
            TransOnTime  = TimeSpan.FromSeconds(0.5f);
            TransOffTime = TimeSpan.FromSeconds(0.5f);

            //Create our button entries
            ButtonEntry Back = new ButtonEntry("Back", true);
            ButtonEntry Exit = new ButtonEntry("Exit", true);

            //Set the hooks
            Back.Selected += Back_Selected;
            Exit.Selected += OnExit;

            //Add the entries to our main list
            ButtonEntries.Add(Back);
            ButtonEntries.Add(Exit);

            //Dont draw the login title
            DrawTitle = false;

            //Make our object linker
            _zonelist        = new ZoneList();
            _zonelist.Screen = this;
        }
コード例 #6
0
        public async stt::Task ListAsync()
        {
            moq::Mock <Zones.ZonesClient> mockGrpcClient = new moq::Mock <Zones.ZonesClient>(moq::MockBehavior.Strict);
            ListZonesRequest request = new ListZonesRequest
            {
                Project = "projectaa6ff846",
            };
            ZoneList expectedResponse = new ZoneList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Zone(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ZoneList>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ZonesClient client = new ZonesClientImpl(mockGrpcClient.Object, null);
            ZoneList    responseCallSettings = await client.ListAsync(request.Project, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            ZoneList responseCancellationToken = await client.ListAsync(request.Project, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #7
0
ファイル: SettingsView.cs プロジェクト: brannow/ikaros
 public SettingsView(Storage storage, ZoneList zoneList, TrayMenu del)
 {
     this.storage  = storage;
     this.del      = del;
     this.zoneList = zoneList;
     InitializeComponent();
 }
コード例 #8
0
ファイル: SettingsView.cs プロジェクト: brannow/ikaros
        private void RefreshZoneComboBox(ZoneList zones)
        {
            ZoneComboBox.Items.Clear();
            if (zones.list.Length > 0)
            {
                Zone currentZone = zones.GetCurrentZone();
                ZoneComboBox.Enabled = true;
                int index = 0, selectedIndex = 0;
                foreach (ZoneFileName zfn in zones.list)
                {
                    ZoneComboBox.Items.Add(new ComboBoxItem()
                    {
                        Text  = zfn.displayName,
                        Value = zfn.id
                    });
                    if (currentZone != null && zfn.id == currentZone.id)
                    {
                        selectedIndex = index;
                    }
                    index++;
                }

                ZoneComboBox.SelectedIndex = selectedIndex;
            }
            else
            {
                ZoneComboBox.Enabled = false;
            }
        }
コード例 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ZonesDB db = new ZonesDB();
         ZoneList.DataSource = db.GetZonesByBankCode(Int32.Parse(Request.Cookies["BankCode"].Value));
         ZoneList.DataBind();
         if (Request.QueryString["RoutingNo"] != null)
         {
             ZoneList.SelectedValue = db.GetZoneIDByRoutingNo(Int32.Parse(Request.QueryString["RoutingNo"])).ToString();
         }
         BindBranchList();
         if (Request.QueryString["RoutingNo"] != null)
         {
             BranchList.SelectedValue = Request.QueryString["RoutingNo"];
         }
         if (Request.QueryString["ClearingType"] != null)
         {
             ClearingTypeList.SelectedValue = Request.QueryString["ClearingType"];
         }
         if (Request.Cookies["RoleID"].Value != "4")
         {
             ZoneList.SelectedValue = Request.Cookies["ZoneID"].Value;
             ZoneList.Enabled       = false;
             BindBranchList();
             BranchList.SelectedValue = Request.Cookies["RoutingNo"].Value;
             BranchList.Enabled       = false;
         }
     }
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TzdbDatabase" /> class.
 /// </summary>
 internal TzdbDatabase(string version)
 {
     zoneLists = new SortedList<string, ZoneList>();
     Rules = new Dictionary<string, IList<ZoneRule>>();
     Aliases = new Dictionary<string, string>();
     currentZoneList = null;
     this.Version = version;
 }
コード例 #11
0
 public override void InitZones()
 {
     for (int i = 0; i < DimensionX; i++)
     {
         for (int j = 0; j < DimensionY; j++)
         {
             ZoneList.Add(Fabrique.CreerZone(String.Format("Zone en X={0}, Y={1}", i, j), Fabrique.CreerPosition(i, j)));
         }
     }
 }
コード例 #12
0
 /// <summary>Snippet for List</summary>
 public void List()
 {
     // Snippet: List(string, CallSettings)
     // Create client
     ZonesClient zonesClient = ZonesClient.Create();
     // Initialize request argument(s)
     string project = "";
     // Make the request
     ZoneList response = zonesClient.List(project);
     // End snippet
 }
コード例 #13
0
        public override void FournirAcces()
        {
            foreach (var unInsecte in PersonnagesList)
            {
                List <ZoneAbstrait> zoneAdjacentes = new List <ZoneAbstrait>();
                zoneAdjacentes.AddRange(ZoneList.Where(x => x.Position.X > (unInsecte.Position.X - 2) && x.Position.X <(unInsecte.Position.X + 2) &&
                                                                                                                       x.Position.Y> (unInsecte.Position.Y - 2) && x.Position.Y < (unInsecte.Position.Y + 2)
                                                       ));

                unInsecte.ChoixZoneSuivante = Fabrique.CreerAcces(zoneAdjacentes);
            }
        }
コード例 #14
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListAsync()
        {
            // Snippet: ListAsync(string, CallSettings)
            // Additional: ListAsync(string, CancellationToken)
            // Create client
            ZonesClient zonesClient = await ZonesClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            // Make the request
            ZoneList response = await zonesClient.ListAsync(project);

            // End snippet
        }
コード例 #15
0
        public static ZoneList getCqZoneList()
        {
            ZoneList list = new ZoneList();
            Zone     zone;

            for (int i = 0; i < 40; i++)
            {
                zone = new Zone()
                {
                    ZoneNumber = (i + 1)
                };
                list.Add(zone);
            }
            return(list);
        }
コード例 #16
0
ファイル: TrayMenu.cs プロジェクト: brannow/ikaros
        private void InitializeComponent()
        {
            this.storage = Services.StorageHandler.ReadStorageToFile("storage", "dat");
            this.zones   = new ZoneList(this.storage);
            Hotkey.Setup(this.storage);


            systemMenu = new ContextMenuStrip();
            mapStrip   = new ToolStripMenuItem("Map", null, new EventHandler(OnMapToggle));
            systemMenu.Items.Add(mapStrip);
            descStrip = new ToolStripMenuItem("Description", null, new EventHandler(OnDescriptionToggle));
            systemMenu.Items.Add(descStrip);
            systemMenu.Items.Add(new ToolStripSeparator());
            lockStrip = new ToolStripMenuItem("Lock", null, new EventHandler(OnToggleLockForms));
            systemMenu.Items.Add(lockStrip);
            systemMenu.Items.Add(new ToolStripSeparator());
            systemMenu.Items.Add(new ToolStripMenuItem("Settings", null, new EventHandler(OnSettings)));
            systemMenu.Items.Add(new ToolStripMenuItem("Exit", null, new EventHandler(OnExit)));

            Icon i = Icon.FromHandle(Properties.Resources.icon.GetHicon());

            trayIcon = new NotifyIcon
            {
                BalloonTipTitle  = "Ikaros",
                Icon             = i,
                ContextMenuStrip = systemMenu,
                Visible          = true
            };

            // Forms
            map         = new MapView(this.storage);
            description = new DescriptionView(this.storage);
            settings    = new SettingsView(this.storage, this.zones, this);

            if (storage.mapShown)
            {
                OnMapToggle(mapStrip, null);
            }
            if (storage.descriptionShown)
            {
                OnDescriptionToggle(descStrip, null);
            }


            m_GlobalHook          = Hook.GlobalEvents();
            m_GlobalHook.KeyDown += GlobalHookKeyPress;
        }
コード例 #17
0
    public void Dtbind()
    {
        ZoneList.DataKeyNames = new string[] { "DataNo" };
        Fannie.DownloadZone dz1 = new Fannie.DownloadZone();
        DataSet             ds1 = new DataSet();
        DataTable           dt1 = new DataTable();

        ds1 = dz1.Getfile();
        dt1 = ds1.Tables[0];
        for (int i = 0; i < dt1.Rows.Count; i++)
        {
            dt1.Rows[i]["title"]    = SubStr(Convert.ToString(dt1.Rows[i]["title"]), 40);
            dt1.Rows[i]["describe"] = SubStr(Convert.ToString(dt1.Rows[i]["describe"]), 50);
        }
        ZoneList.DataSource = dz1.Getfile();
        ZoneList.DataBind();
    }
コード例 #18
0
        public void Dispose()
        {
            Extras.Clear();
            liquids.Clear();
            leaves.Clear();
            ListCheck.Clear(); listCheckExists.Clear();
            ListUpdate.Clear(); listUpdateExists.Clear();
            UndoBuffer.Clear();
            BlockDB.Cache.Clear();
            ZoneList.Clear();

            lock (queueLock)
                blockqueue.Clear();
            lock (saveLock) {
                blocks       = null;
                CustomBlocks = null;
            }
        }
コード例 #19
0
 /// <summary>Snippet for List</summary>
 public void ListRequestObject()
 {
     // Snippet: List(ListZonesRequest, CallSettings)
     // Create client
     ZonesClient zonesClient = ZonesClient.Create();
     // Initialize request argument(s)
     ListZonesRequest request = new ListZonesRequest
     {
         PageToken            = "",
         MaxResults           = 0U,
         OrderBy              = "",
         Project              = "",
         Filter               = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     ZoneList response = zonesClient.List(request);
     // End snippet
 }
コード例 #20
0
 protected void BindZones()
 {
     ZoneListPanel.Visible = (UseZoneRestriction.SelectedIndex > 0);
     if (ZoneListPanel.Visible)
     {
         ZoneList.DataSource = ShipZoneDataSource.LoadAll("Name");
         ZoneList.DataBind();
         if (ZoneList.Items.Count > 4)
         {
             ZoneList.Rows = 8;
         }
         foreach (ShipZone item in _ShipMethod.ShipZones)
         {
             ListItem listItem = ZoneList.Items.FindByValue(item.Id.ToString());
             if (listItem != null)
             {
                 listItem.Selected = true;
             }
         }
     }
 }
コード例 #21
0
        protected void Page_Init()
        {
            IList <TaxCode> taxCodes = TaxCodeDataSource.LoadAll();

            TaxCodes.DataSource = taxCodes;
            TaxCodes.DataBind();
            TaxCode.Items.Clear();
            TaxCode.Items.Add("");
            TaxCode.DataSource = taxCodes;
            TaxCode.DataBind();
            ZoneList.DataSource = ShipZoneDataSource.LoadAll("Name");
            ZoneList.DataBind();
            GroupList.DataSource = GroupDataSource.LoadAll("Name");
            GroupList.DataBind();

            // ROUNDING RULE
            RoundingRule.Items.Clear();
            RoundingRule.Items.Add(new ListItem("Common Method", ((int)CommerceBuilder.Taxes.RoundingRule.Common).ToString()));
            RoundingRule.Items.Add(new ListItem("Round to Even", ((int)CommerceBuilder.Taxes.RoundingRule.RoundToEven).ToString()));
            RoundingRule.Items.Add(new ListItem("Always Round Up", ((int)CommerceBuilder.Taxes.RoundingRule.AlwaysRoundUp).ToString()));
        }
コード例 #22
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListZonesRequest, CallSettings)
            // Additional: ListAsync(ListZonesRequest, CancellationToken)
            // Create client
            ZonesClient zonesClient = await ZonesClient.CreateAsync();

            // Initialize request argument(s)
            ListZonesRequest request = new ListZonesRequest
            {
                PageToken            = "",
                MaxResults           = 0U,
                OrderBy              = "",
                Project              = "",
                Filter               = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            ZoneList response = await zonesClient.ListAsync(request);

            // End snippet
        }
コード例 #23
0
        /// <summary>
        ///   Returns a newly created <see cref="DateTimeZone" /> built from the given time zone data.
        /// </summary>
        /// <param name="zoneList">The time zone definition parts to add.</param>
        /// <param name="ruleSets">The rule sets map to use in looking up rules for the time zones..</param>
        private static DateTimeZone CreateTimeZone(ZoneList zoneList, IDictionary<string, IList<ZoneRule>> ruleSets)
        {
            var builder = new DateTimeZoneBuilder();
            foreach (var zone in zoneList)
            {
                builder.SetStandardOffset(zone.Offset);
                if (zone.Rules == null)
                {
                    builder.SetFixedSavings(zone.Format, Offset.Zero);
                }
                else
                {
                    try
                    {
                        // Check if iRules actually just refers to a savings.
                        var savings = ParserHelper.ParseOffset(zone.Rules);
                        builder.SetFixedSavings(zone.Format, savings);
                    }
                    catch (FormatException)
                    {
                        var rs = ruleSets[zone.Rules];
                        if (rs == null)
                        {
                            throw new ArgumentException("Rules not found: " + zone.Rules);
                        }
                        AddRecurring(builder, zone.Format, rs);
                    }
                }
                if (zone.Year == Int32.MaxValue)
                {
                    break;
                }

                builder.AddCutover(zone.Year, TransitionMode.Wall, zone.MonthOfYear, zone.DayOfMonth, 0, true, zone.TickOfDay);
            }
            return builder.ToDateTimeZone(zoneList.Name);
        }
コード例 #24
0
        public void List()
        {
            moq::Mock <Zones.ZonesClient> mockGrpcClient = new moq::Mock <Zones.ZonesClient>(moq::MockBehavior.Strict);
            ListZonesRequest request = new ListZonesRequest
            {
                Project = "projectaa6ff846",
            };
            ZoneList expectedResponse = new ZoneList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Zone(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ZonesClient client   = new ZonesClientImpl(mockGrpcClient.Object, null);
            ZoneList    response = client.List(request.Project);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #25
0
ファイル: Level.Blocks.cs プロジェクト: Peteys93/MCGalaxy
        bool CheckZones(Player p, ushort x, ushort y, ushort z, byte b, ref bool AllowBuild, ref bool inZone, ref string Owners)
        {
            bool foundDel = false;

            if ((p.group.Permission < LevelPermission.Admin || p.ZoneCheck || p.zoneDel) && !Block.AllowBreak(b))
            {
                List <Zone> toDel = null;
                if (ZoneList.Count == 0)
                {
                    AllowBuild = true;
                }
                else
                {
                    for (int index = 0; index < ZoneList.Count; index++)
                    {
                        Zone zn = ZoneList[index];
                        if (x < zn.smallX || x > zn.bigX || y < zn.smallY || y > zn.bigY || z < zn.smallZ || z > zn.bigZ)
                        {
                            continue;
                        }
                        inZone = true;
                        if (p.zoneDel)
                        {
                            if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp"))
                            {
                                string grpName = zn.Owner.Substring(3);
                                if (p.group.Permission < Group.Find(grpName).Permission)
                                {
                                    continue;
                                }
                            }
                            else if (zn.Owner != "" && (zn.Owner.ToLower() != p.name.ToLower()))
                            {
                                Group group = Group.findPlayerGroup(zn.Owner.ToLower());
                                if (p.group.Permission < group.Permission)
                                {
                                    continue;
                                }
                            }

                            Database.executeQuery("DELETE FROM `Zone" + p.level.name + "` WHERE Owner='" +
                                                  zn.Owner + "' AND SmallX='" + zn.smallX + "' AND SMALLY='" +
                                                  zn.smallY + "' AND SMALLZ='" + zn.smallZ + "' AND BIGX='" +
                                                  zn.bigX + "' AND BIGY='" + zn.bigY + "' AND BIGZ='" + zn.bigZ + "'");
                            if (toDel == null)
                            {
                                toDel = new List <Zone>();
                            }
                            toDel.Add(zn);

                            Player.SendMessage(p, "Zone deleted for &b" + zn.Owner);
                            foundDel = true;
                        }
                        else
                        {
                            if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp"))
                            {
                                string grpName = zn.Owner.Substring(3);
                                if (Group.Find(grpName).Permission <= p.group.Permission && !p.ZoneCheck)
                                {
                                    AllowBuild = true; break;
                                }
                                AllowBuild = false;
                                Owners    += ", " + grpName;
                            }
                            else
                            {
                                if (zn.Owner.ToLower() == p.name.ToLower() && !p.ZoneCheck)
                                {
                                    AllowBuild = true; break;
                                }
                                AllowBuild = false;
                                Owners    += ", " + zn.Owner;
                            }
                        }
                    }
                }

                if (p.zoneDel)
                {
                    if (!foundDel)
                    {
                        Player.SendMessage(p, "No zones found to delete.");
                    }
                    else
                    {
                        foreach (Zone Zn in toDel)
                        {
                            ZoneList.Remove(Zn);
                        }
                    }
                    p.zoneDel = false;
                    return(false);
                }

                if (!AllowBuild || p.ZoneCheck)
                {
                    if (p.ZoneCheck || p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow)
                    {
                        if (Owners != "")
                        {
                            Player.SendMessage(p, "This zone belongs to &b" + Owners.Remove(0, 2) + ".");
                        }
                        else
                        {
                            Player.SendMessage(p, "This zone belongs to no one.");
                        }
                        p.ZoneSpam = DateTime.UtcNow;
                    }
                    if (p.ZoneCheck && !p.staticCommands)
                    {
                        p.ZoneCheck = false;
                    }
                    return(false);
                }
            }
            return(true);
        }
コード例 #26
0
 /// <summary>
 /// Returns a newly created <see cref="DateTimeZone" /> built from the given time zone data.
 /// </summary>
 /// <param name="zoneList">The time zone definition parts to add.</param>
 private DateTimeZone CreateTimeZone(ZoneList zoneList)
 {
     var builder = new DateTimeZoneBuilder();
     foreach (Zone zone in zoneList)
     {
         builder.SetStandardOffset(zone.Offset);
         if (zone.Rules == null)
         {
             builder.SetFixedSavings(zone.Format, Offset.Zero);
         }
         else
         {
             IList<ZoneRule> ruleSet;
             if (Rules.TryGetValue(zone.Rules, out ruleSet))
             {
                 AddRecurring(builder, zone.Format, ruleSet);
             }
             else
             {
                 try
                 {
                     // Check if Rules actually just refers to a savings.
                     var savings = ParserHelper.ParseOffset(zone.Rules);
                     builder.SetFixedSavings(zone.Format, savings);
                 }
                 catch (FormatException)
                 {
                     throw new ArgumentException(
                         String.Format("Daylight savings rule name '{0}' for zone {1} is neither a known ruleset nor a fixed offset",
                             zone.Rules, zone.Name));
                 }
             }
         }
         if (zone.UntilYear == Int32.MaxValue)
         {
             break;
         }
         builder.AddCutover(zone.UntilYear, zone.UntilYearOffset);
     }
     return builder.ToDateTimeZone(zoneList.Name);
 }
コード例 #27
0
 /// <summary>
 /// Adds the given zone to the current zone list. If there is no zone list or the
 /// zone is for a different named zone a new zone list is created.
 /// </summary>
 /// <param name="zone">The zone to add.</param>
 internal void AddZone(Zone zone)
 {
     var name = zone.Name;
     if (String.IsNullOrEmpty(name))
     {
         if (currentZoneList == null)
         {
             throw new InvalidOperationException("A continuation zone must be preceeded by an initially named zone");
         }
         name = currentZoneList.Name;
     }
     if (currentZoneList == null || currentZoneList.Name != name)
     {
         currentZoneList = new ZoneList();
         zoneLists.Add(name, currentZoneList);
     }
     currentZoneList.Add(zone);
 }
コード例 #28
0
        private static ZoneList MakeZoneList(List<string> zoneListStrings)
        {
            ZoneList newZoneList = new ZoneList();
            newZoneList.zoneListNames = new List<string>();
            Regex semiColonRegex = new Regex(EPlusRegexString.semicolon);
            Regex nameRegex = new Regex(EPlusRegexString.Name);
            Regex zoneListStartRegex = new Regex(EPlusRegexString.startZoneList);

            try
            {
                foreach (string line in zoneListStrings)
                {
                    Match semiColonMatch = semiColonRegex.Match(line);
                    if (!semiColonMatch.Success)
                    {
                        Match zoneListStart = zoneListStartRegex.Match(line);
                        if (zoneListStart.Success)
                        {
                            //do not need to do anything.
                            continue;
                        }
                        Match nameMatch = nameRegex.Match(line);
                        if (nameMatch.Success)
                        {
                            string purify = @"(?'ws'\s*)(?'goods'.*)(?'comma',)";
                            Regex purifyRegex = new Regex(purify);
                            Match pure = purifyRegex.Match(nameMatch.Groups["1"].Value);
                            if (pure.Success)
                            {
                                newZoneList.name = pure.Groups["goods"].Value;
                                continue;
                            }
                        }
                        //match any generic line that does not have a semicolon in it
                        //dangerous as this will greedily match just about anything
                        string purifyList = @"(?'ws'\s*)(?'goods'.*)(?'comma',)(?'stuff'.*)";
                        Regex purifyRegex2 = new Regex(purifyList);
                        Match pureList = purifyRegex2.Match(line);
                        if (pureList.Success)
                        {
                            string zoneName = pureList.Groups["goods"].Value;
                            newZoneList.zoneListNames.Add(zoneName);
                            continue;
                        }
                    }
                    else
                    {
                        //string purification with a semicolong instead of a comma
                        string purifyList = @"(?'ws'\s*)(?'goods'.*)(?'semicolon';)(?'stuff'.*)";
                        Regex purifyRegex2 = new Regex(purifyList);
                        Match pureList = purifyRegex2.Match(line);
                        if (pureList.Success)
                        {
                            string zoneName = pureList.Groups["goods"].Value;
                            newZoneList.zoneListNames.Add(zoneName);
                            continue;
                        }

                    }
                }
                return newZoneList;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return newZoneList;
        }
コード例 #29
0
ファイル: TzdbDatabase.cs プロジェクト: manirana007/NodaTime
 /// <summary>
 ///   Adds the given zone to the current zone list. If there is no zone list or the
 ///   zone is for a different named zone a new zone list is created.
 /// </summary>
 /// <param name="zone">The zone to add.</param>
 internal void AddZone(Zone zone)
 {
     var name = zone.Name;
     if (string.IsNullOrEmpty(name))
     {
         if (CurrentZoneList == null)
         {
             throw new ArgumentException("A continuation zone must be preceeded by an initially named zone");
         }
         name = CurrentZoneList.Name;
     }
     if (CurrentZoneList == null || CurrentZoneList.Name != name)
     {
         CurrentZoneList = new ZoneList();
         zoneLists.Add(name, CurrentZoneList);
     }
     CurrentZoneList.Add(zone);
 }
コード例 #30
0
        public static List <IEnergyPlusClass> ToEnergyPlus(this BHE.Panel panel)
        {
            List <IEnergyPlusClass> classes = new List <IEnergyPlusClass>();

            List <Point> vertices = BH.Engine.Environment.Query.Polyline(panel).ControlPoints();

            vertices.RemoveAt(vertices.Count - 1);
            int    vertexCount  = vertices.Count;
            string panelName    = panel.Name == "" ? panel.BHoM_Guid.ToString() : panel.Name;
            string zoneName     = panel.ConnectedSpaces[0];
            string sunExposure  = panel.SunWindExposure() ? "SunExposed" : "NoSun";
            string windExposure = panel.SunWindExposure() ? "WindExposed" : "NoWind";

            GlobalGeometryRules globalGeometryRules = new GlobalGeometryRules();

            classes.Add(globalGeometryRules);

            if (panel.Type == BHE.PanelType.Shade)
            {
                ShadingBuildingDetailed shadingSurface = new ShadingBuildingDetailed();
                shadingSurface.Name             = panelName;
                shadingSurface.Vertices         = vertices;
                shadingSurface.NumberOfVertices = vertexCount;
                classes.Add(shadingSurface);
            }
            else
            {
                Zone zone = new Zone();
                zone.Name = zoneName;
                classes.Add(zone);

                ZoneList zoneList = new ZoneList();
                zoneList.ZoneNames.Add(zoneName);
                classes.Add(zoneList);

                if (panel.Construction == null)
                {
                    panel = panel.AssignGenericConstructions(assignOpenings: true);
                }

                classes.AddRange(((Construction)panel.Construction).ToEnergyPlus());

                BuildingSurfaceDetailed buildingSurface = new BuildingSurfaceDetailed();
                string surfaceName = panelName;
                buildingSurface.Name                     = surfaceName;
                buildingSurface.SurfaceType              = panel.Type.ToEnergyPlus();
                buildingSurface.ConstructionName         = panel.Construction.Name;
                buildingSurface.ZoneName                 = zoneName;
                buildingSurface.OutsideBoundaryCondition = panel.BoundaryCondition();

                if (buildingSurface.OutsideBoundaryCondition == OutsideBoundaryCondition.Zone)
                {
                    buildingSurface.OutsideBoundaryConditionObject = panel.ConnectedSpaces[-1];
                }
                else
                {
                    buildingSurface.OutsideBoundaryConditionObject = "";
                }

                buildingSurface.SunExposure      = sunExposure;
                buildingSurface.WindExposure     = windExposure;
                buildingSurface.Vertices         = vertices;
                buildingSurface.NumberOfVertices = vertexCount;
                classes.Add(buildingSurface);

                foreach (BHE.Opening o in panel.Openings)
                {
                    classes.AddRange(o.ToEnergyPlus(panelName));
                }
            }

            return(classes);
        }
コード例 #31
0
ファイル: TzdbDatabase.cs プロジェクト: wondertrap/nodatime
 /// <summary>
 /// Returns a newly created <see cref="DateTimeZone" /> built from the given time zone data.
 /// </summary>
 /// <param name="zoneList">The time zone definition parts to add.</param>
 private DateTimeZone CreateTimeZone(string id, ZoneList zoneList)
 {
     var ruleSets = zoneList.Select(zone => zone.ResolveRules(Rules)).ToList();
     return DateTimeZoneBuilder.Build(id, ruleSets);
 }