コード例 #1
0
        private ServerLimits(Builder builder)
        {
            if (builder.mailbox_max_count_per_user < 0)
                throw new ArgumentException("Invalid domain id", "builder");

            MailboxMaxCountPerUser = builder.mailbox_max_count_per_user;
        }
コード例 #2
0
		public void CanCreateInstances()
		{
			string config =
				@"<object-builder-config xmlns=""pag-object-builder"">
               <build-rules>
						<build-rule type=""" + FullNameSimpleObject + @""" mode=""Instance"">
							<constructor-params>
								<value-param type=""System.Int32"">12</value-param>
							</constructor-params>
						</build-rule>
					</build-rules>
				</object-builder-config>";

			Builder builder = new Builder(ObjectBuilderXmlConfig.FromXml(config));
			Locator locator = CreateLocator();

			SimpleObject m1 = builder.BuildUp<SimpleObject>(locator, null, null);
			SimpleObject m2 = builder.BuildUp<SimpleObject>(locator, null, null);

			Assert.IsNotNull(m1);
			Assert.IsNotNull(m2);
			Assert.AreEqual(12, m1.IntParam);
			Assert.AreEqual(12, m2.IntParam);
			Assert.IsTrue(m1 != m2);
		}
コード例 #3
0
        protected override ISecurityService GetSecurityService()
        {
            var userBuilder = new Builder<IUser>(Mock.Of<IUser>)
                .With(u =>
                          {
                              u.Email = SecurityTestData.User.Email;
                              u.PasswordHash = HashService.Hash64(SecurityTestData.User.CorrectPassword);
                              u.Active = true;
                          });

            var user = userBuilder.Build();
            var inactiveUser = userBuilder
                .Build(u =>
                          {
                              u.Email = SecurityTestData.User.InactiveEmail;
                              u.Active = false;
                          });

            return new SecurityService(
                new UserDataServiceBuilder()
                    .WithUser(user)
                    .WithUser(inactiveUser)
                    .Build(),
                new SessionDataServiceBuilder()
                    .Build(),
                HashService,
                new UserRegistrationValidator()
                );
        }
コード例 #4
0
        public void CreatingAList()
        {
            var builderSetup = new BuilderSetup();
            var products = new Builder<Product>(builderSetup).CreateListOfSize(10).Build();

            // Note: The asserts here are intentionally verbose to show how NBuilder works

            // It sets strings to their name plus their 1-based sequence number
            Assert.That(products[0].Title, Is.EqualTo("Title1"));
            Assert.That(products[1].Title, Is.EqualTo("Title2"));
            Assert.That(products[2].Title, Is.EqualTo("Title3"));
            Assert.That(products[3].Title, Is.EqualTo("Title4"));
            Assert.That(products[4].Title, Is.EqualTo("Title5"));
            Assert.That(products[5].Title, Is.EqualTo("Title6"));
            Assert.That(products[6].Title, Is.EqualTo("Title7"));
            Assert.That(products[7].Title, Is.EqualTo("Title8"));
            Assert.That(products[8].Title, Is.EqualTo("Title9"));
            Assert.That(products[9].Title, Is.EqualTo("Title10"));

            // Ints are set to their 1-based sequence number
            Assert.That(products[0].Id, Is.EqualTo(1));
            // ... 2, 3, 4, 5, 6, 7, 8 ...
            Assert.That(products[9].Id, Is.EqualTo(10));

            // Any other numeric types are set to their 1-based sequence number
            Assert.That(products[0].PriceBeforeTax, Is.EqualTo(1m));
            // ... 2m, 3m, 4m, 5m, 6m, 7m, 8m ...
            Assert.That(products[9].PriceBeforeTax, Is.EqualTo(10m));
        }
コード例 #5
0
        public void ConnectionDroppingTimeoutTest()
        {
            var originalTraceLevel = Diagnostics.CassandraTraceSwitch.Level;
            Diagnostics.CassandraTraceSwitch.Level = TraceLevel.Verbose;
            var sw = Stopwatch.StartNew();
            var thrown = false;
            try
            {
                var builder = new Builder().WithDefaultKeyspace("system")
                                           .AddContactPoints("1.1.1.1") // IP address that drops (not rejects !) the inbound connection
                                           .WithSocketOptions(new SocketOptions().SetConnectTimeoutMillis(700));
                var cluster = builder.Build();
                cluster.Connect();
            }
            catch (NoHostAvailableException)
            {
                thrown = true;
            }

            sw.Stop();

            Assert.True(thrown, "Expected exception");
            Assert.Greater(sw.Elapsed.TotalMilliseconds, 700, "The connection timeout was not respected");

            Diagnostics.CassandraTraceSwitch.Level = originalTraceLevel;
        }
コード例 #6
0
 public static IReaderStrategy Create(
     ISourceDefinitionConfigurator sources, ITimeProvider timeProvider, IPrincipal runAs)
 {
     var builder = new Builder();
     sources.ConfigureSourceProcessingStrategy(builder);
     return builder.Build(timeProvider, runAs);
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: srosenthal/git-bin
        static int Main(string[] args)
        {
            try
            {
                var builder = new Builder();
                ApplicationRegistrations.Register(builder);
                var container = builder.Create();

                var commandFactory = container.Resolve<ICommandFactory>();

                var command = commandFactory.GetCommand(args);
                command.Execute();
            }
            catch (ಠ_ಠ lod)
            {
                GitBinConsole.WriteLine(lod.Message);
                return 1;
            }
            catch (Exception e)
            {
                GitBinConsole.WriteLine("Uncaught exception, please report this bug! " + e);
                return 2;
            }

            return 0;
        }
コード例 #8
0
 private CloneDatabasePayload(Builder builder)
 {
     _newDBName = builder.NewDBName;
     _newDBDesc = builder.NewDBDesc;
     _keepData = builder.KeepData;
     _excludeFiles = builder.ExcludeFiles;
 }
コード例 #9
0
 private ExtendedThreadPool(Builder builder)
 {
     Name = builder.Name;
     SetThreadingRange(builder);
     MultiThreadingCapacity = builder.MultiThreadingCapacity;
     _taskQueueController = builder.TaskQueueController;
 }
コード例 #10
0
    //GameObject proj; //last spawned projectile
    //projectileScript pScript; //last spawned projectile's script
    // Use this for initialization
    void Start()
    {
        mainCamera = GameObject.Find("Main Camera").GetComponent<Camera>();
        aim = gameObject.transform.up;

        builder = GameObject.Find ("Builder").GetComponent<Builder>();
    }
コード例 #11
0
ファイル: OwinHandler.cs プロジェクト: kevinswiber/NRack
        public void ProcessRequest(IDictionary<string, object> environment, 
            ResponseCallBack responseCallBack, Action<Exception> errorCallback)
        {
            Dictionary<string, dynamic> nrackEnvironment = GetNrackEnvironment(environment);

            var config = ConfigResolver.GetRackConfigInstance();
            var builder = new Builder(config.ExecuteStart);
            var response = new OwinResponseAdapter(builder.Call(nrackEnvironment));

            responseCallBack(response.Status, response.Headers.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToString()),
                (next, error, complete) =>
                    {
                        try
                        {
                            next(response.GetBody(), null);
                            complete();
                        }
                        catch (Exception ex)
                        {
                            error(ex);
                        }

                        return () => { };
                    });
        }
コード例 #12
0
        public static void m2()
        {
            Builder builder = new Builder(
                    typeof(SqlDataMapper<>),
                   new Object[] { SqlMapperUnitTest.getMySqlConnectionString() },
                   typeof(PropertyColumnMapper),
                   typeof(ExplicitConnectionPolicy));

            IDataMapper<ProductSimple> productMapper = builder.Build<ProductSimple>();
            IConnectionPolicy explicitConnectionPolicy = productMapper.GetConnectionPolicy();

            // Act
            explicitConnectionPolicy.OpenConnection();
            explicitConnectionPolicy.BeginTransaction();

            ProductSimple p1 = productMapper.GetAll().First();

            p1.ProductName = "Potatoes";
            productMapper.Update(p1);

            ProductSimple p2 = productMapper.GetAll().First();

            // Assert
            bool result = p1.ProductName == p2.ProductName;
            explicitConnectionPolicy.RollBack();
            explicitConnectionPolicy.Dispose();
        }
コード例 #13
0
        public static void m3()
        {
            SqlConnectionStringBuilder sqlConnectionStringBuilder = new SqlConnectionStringBuilder();
            sqlConnectionStringBuilder.DataSource = @"RoXaSDTD-PC\SQLEXPRESS";
            sqlConnectionStringBuilder.InitialCatalog = "PlaylistManager";
            sqlConnectionStringBuilder.UserID = "Rafael";
            sqlConnectionStringBuilder.Password = "******";
            sqlConnectionStringBuilder.IntegratedSecurity = true;
            string connectionString = sqlConnectionStringBuilder.ConnectionString;

            Builder builder = new Builder(
                   typeof(SqlDataMapper<>),
                   new Object[] { connectionString },
                   typeof(PropertyColumnMapper),
                   typeof(MultipleConnectionPolicy));

            IDataMapper<Playlist> playlistMapper = builder.Build<Playlist>();
            IConnectionPolicy policy = playlistMapper.GetConnectionPolicy();

            Playlist p = playlistMapper.GetAll().First();
            p.name = "teste";
            playlistMapper.Update(p);

            Playlist p2 = playlistMapper.GetAll().First();
            p2.name = "JoanaPlaylist";
            playlistMapper.Update(p2);
        }
コード例 #14
0
ファイル: GuitarSpec.cs プロジェクト: juanferfranco/PDOO
        public GuitarSpec(Builder builder, string model, Typeg type,
			int numStrings, Wood backWood, Wood topWood)
            : base(builder,model,type,
				backWood,topWood)
        {
            this.numStrings = numStrings;
        }
コード例 #15
0
ファイル: BuilderTest.cs プロジェクト: nbucket/bounce
        Dictionary<string, IEnumerable<WebSiteConfig>> WebSiteEnvironmnents()
        {
            var webSite = new Builder<WebSiteConfig>(() => new WebSiteConfig {
                AppPoolName = "MyWebSite",
                Port = 80,
                HostName = "mywebsite.com",
                Directory = @"C:\Sites\MyWebSite",
            });

            var envs = new Dictionary<string,IEnumerable<WebSiteConfig>>();

            var live = webSite;
            envs["live"] = live.OnMachines("live1", "live2");

            var stage = webSite.WithHostName("mywebsitestage.com");
            envs["stage"] = stage.OnMachines("stage1", "stage2");

            var test = webSite.WithHostName("mywebsitetest");
            envs["test"] = test.OnMachines("test1");

            var dev = webSite.WithNoHostName().WithPort(6001);
            envs["dev"] = dev.OnMachines("localhost");

            return envs;
        }
コード例 #16
0
ファイル: Utils.cs プロジェクト: Powerino73/paradox
 public static Builder CreateBuilder()
 {
     var logger = GlobalLogger.GetLogger("Builder");
     logger.ActivateLog(LogMessageType.Debug);
     var builder = new Builder(BuildPath, "Windows", "index", "inputHashes", logger) { BuilderName = "TestBuilder", SlaveBuilderPath = @"SiliconStudio.BuildEngine.exe" };
     return builder;
 }
コード例 #17
0
        public void ConnectionRejectingTimeoutTest()
        {
            var originalTraceLevel = Diagnostics.CassandraTraceSwitch.Level;
            Diagnostics.CassandraTraceSwitch.Level = TraceLevel.Verbose;
            var sw = Stopwatch.StartNew();
            var thrown = false;
            try
            {
                var builder = new Builder().WithDefaultKeyspace("system")
                                           .AddContactPoints("127.9.9.9") // local IP that will most likely not be in use
                                           .WithQueryTimeout(500);
                builder.SocketOptions.SetConnectTimeoutMillis(500);
                var cluster = builder.Build();
                cluster.Connect();
            }
            catch (NoHostAvailableException)
            {
                thrown = true;
            }

            sw.Stop();

            Assert.True(thrown, "Expected exception");
            Assert.True(sw.Elapsed.TotalMilliseconds < 1000, "The connection timeout was not respected");

            Diagnostics.CassandraTraceSwitch.Level = originalTraceLevel;
        }
コード例 #18
0
ファイル: BuilderTests.cs プロジェクト: danthomas/Parsing
        public void BuildParser()
        {
            var builder = new Builder();

            var text = @"grammar Tester
            defs
            Main : Things
            Things : newLine things Thing+
            Thing : newLine Identifier colon Identifier+
            patterns
            newLine : '\n'
            colon : ':'
            things
            Identifier : '^[a-zA-Z_][a-zA-Z1-9_]*$'";

            Core.GrammarDef.Parser parser = new Core.GrammarDef.Parser();

            Node<Core.GrammarDef.NodeType> root = parser.Parse(text);

            builder.PreProcess(root);

            Grammar grammar = builder.BuildGrammar(root);

            var parserDef = builder.BuildParser2(grammar);
        }
コード例 #19
0
 public Builder CreateBuilder()
 {
     Builder temp = new Builder(new Vector2(50, 50), 3);
     this.builders.Add(temp);
     this.idleBuilders.Add(temp);
     return temp;
 }
コード例 #20
0
        public void PagingOnBoundStatementTest_Async_UsingConfigBasedPagingSetting()
        {
            var pageSize = 10;
            var queryOptions = new QueryOptions().SetPageSize(pageSize);
            Builder builder = new Builder().WithQueryOptions(queryOptions).WithDefaultKeyspace(KeyspaceName);
            builder.AddContactPoint(TestCluster.InitialContactPoint);

            using (ISession session = builder.Build().Connect())
            {
                var totalRowLength = 1003;
                Tuple<string, string> tableNameAndStaticKeyVal = CreateTableWithCompositeIndexAndInsert(session, totalRowLength);
                string statementToBeBound = "SELECT * from " + tableNameAndStaticKeyVal.Item1 + " where label=?";
                PreparedStatement preparedStatementWithoutPaging = session.Prepare(statementToBeBound);
                PreparedStatement preparedStatementWithPaging = session.Prepare(statementToBeBound);
                BoundStatement boundStatemetWithoutPaging = preparedStatementWithoutPaging.Bind(tableNameAndStaticKeyVal.Item2);
                BoundStatement boundStatemetWithPaging = preparedStatementWithPaging.Bind(tableNameAndStaticKeyVal.Item2);

                var rsWithSessionPagingInherited = session.ExecuteAsync(boundStatemetWithPaging).Result;

                var rsWithoutPagingInherited = Session.Execute(boundStatemetWithoutPaging);

                //Check that the internal list of items count is pageSize
                Assert.AreEqual(pageSize, rsWithSessionPagingInherited.InnerQueueCount);
                Assert.AreEqual(totalRowLength, rsWithoutPagingInherited.InnerQueueCount);

                var allTheRowsPaged = rsWithSessionPagingInherited.ToList();
                Assert.AreEqual(totalRowLength, allTheRowsPaged.Count);
            }
        }
コード例 #21
0
ファイル: BuilderTests.cs プロジェクト: danthomas/Parsing
        public void BuildGrammar()
        {
            var utils = new Utils();

            var builder = new Builder();

            var text = GetDef<Core.GrammarDef.Parser>();

            Core.GrammarDef.Parser parser = new Core.GrammarDef.Parser();

            Node<Core.GrammarDef.NodeType> root = parser.Parse(text);

            builder.PreProcess(root);

            File.WriteAllText(@"C:\temp\node.txt", utils.NodeToString(root));

            Grammar grammar = builder.BuildGrammar(root);

            var actual = utils.GrammarToDefString(grammar);

            Assert.That(actual, Is.EqualTo(text));

            File.WriteAllText(@"C:\temp\parser.cs", builder.BuildParser2(grammar));

            //var parser2 = builder.CreateParser(grammar);
            //
            //var root2 = parser2.GetType().GetMethod("Parse").Invoke(parser2, new object[] { text });
        }
コード例 #22
0
        public static void m1()
        {
            Builder builder = new Builder(
               SqlDataMapperType,
               DataMapperParams,
               PropertyColumnMapperType,
               MultipleConnectionPolicyType);
            IDataMapper<ProductSimple> productMapper = builder.Build<ProductSimple>();

            ISqlEnumerable<ProductSimple> prods = productMapper.GetAll();
            foreach (ProductSimple p in prods)
            {
                Console.WriteLine(p);
            }

            Console.WriteLine("-------------");
            ISqlEnumerable<ProductSimple> prods2 = prods.Where("CategoryID = 7");
            foreach (ProductSimple p in prods2)
            {
                Console.WriteLine(p);
            }

            Console.WriteLine("-------------");
            ISqlEnumerable<ProductSimple> prods3 = prods2.Where("UnitsinStock > 30");
            foreach (ProductSimple p in prods3)
            {
                Console.WriteLine(p);
            }
        }
コード例 #23
0
      public Notification Build(Builder b) {
        Notification.Builder builder = new Notification.Builder(b.Context);
        builder.SetContentTitle(b.ContentTitle)
          .SetContentText(b.ContentText)
          .SetTicker(b.Notification.TickerText)
          .SetSmallIcon(b.Notification.Icon, b.Notification.IconLevel)
          .SetContentIntent(b.ContentIntent)
          .SetDeleteIntent(b.Notification.DeleteIntent)
          .SetAutoCancel((b.Notification.Flags & NotificationFlags.AutoCancel) != 0)
          .SetLargeIcon(b.LargeIcon)
          .SetDefaults(b.Notification.Defaults);

        if (b.Style != null) {
          if (b.Style is BigTextStyle) {
            BigTextStyle staticStyle = b.Style as BigTextStyle;
            Notification.BigTextStyle style = new Notification.BigTextStyle(builder);
            style.SetBigContentTitle(staticStyle.BigContentTitle)
              .BigText(staticStyle.bigText);
            if (staticStyle.SummaryTextSet) {
              style.SetSummaryText(staticStyle.SummaryText);
            }
          }
        }

        return builder.Build();
      }
コード例 #24
0
ファイル: ServerPackets.cs プロジェクト: welterde/Spacecraft
 public override byte[] ToByteArray()
 {
     Builder<byte> b = new Builder<byte>();
     b.Append(PacketID);
     b.Append(Packet.PackString(Reason));
     return b.ToArray();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GooglePlayGames.BasicApi.PlayGamesClientConfiguration"/> struct.
 /// </summary>
 /// <param name="builder">Builder for this configuration.</param>
 private PlayGamesClientConfiguration(Builder builder)
 {
     this.mEnableSavedGames = builder.HasEnableSaveGames();
     this.mInvitationDelegate = builder.GetInvitationDelegate();
     this.mMatchDelegate = builder.GetMatchDelegate();
     this.mPermissionRationale = builder.GetPermissionRationale();
 }
コード例 #26
0
 public void When_class_is_changed_to_interface_changed_attributes_are_reported()
 {
     Assembly assembly1 = ApiBuilder.CreateApi().Class("Class").Build().Build();
       Assembly assembly2 = ApiBuilder.CreateApi().Interface("Class").Build().Build();
       var sut = new Builder(assembly1, assembly2).ComparerResultMock;
       sut.Verify(result => result.AddChangedFlag("Interface", false, Severity.Error), Times.Once);
 }
コード例 #27
0
ファイル: ServerPackets.cs プロジェクト: welterde/Spacecraft
 public override byte[] ToByteArray()
 {
     Builder<byte> b = new Builder<byte>();
     b.Append(PacketID);
     b.Append(PlayerID);
     return b.ToArray();
 }
コード例 #28
0
        public void PersistingAListOfProductsAndCategories()
        {
            const int numProducts = 500;
            const int numCategories = 50;
            const int numCategoriesForEachProduct = 5;

            var builder = new Builder(builderSettings);
            var categories = builder
                .CreateListOfSize<Category>(numCategories)
                .Persist();

            builder
                .CreateListOfSize<Product>(numProducts)
                .All()
                .With(x => x.Categories = Pick<Category>.
                    UniqueRandomList(With.Exactly(numCategoriesForEachProduct).Elements)
                    .From(categories)
                    .ToList())
                .Persist(); // NB: Persistence is setup in the RepositoryBuilderSetup class

            DataTable productsTable = Database.GetContentsOf(Database.Tables.Product);
            DataTable categoriesTable = Database.GetContentsOf(Database.Tables.Category);
            DataTable productCategoriesTable = Database.GetContentsOf(Database.Tables.ProductCategory);

            Assert.That(productsTable.Rows.Count, Is.EqualTo(numProducts), "products");
            Assert.That(categoriesTable.Rows.Count, Is.EqualTo(numCategories), "categories");
            Assert.That(productCategoriesTable.Rows.Count, Is.EqualTo(numCategoriesForEachProduct * numProducts));
        }
コード例 #29
0
        public void UpdateSupplierFromProduct()
        {
            // Arrange
            Builder builder = new Builder(
                SqlDataMapperType,
                DataMapperParams,
                PropertyColumnMapperType,
                MultipleConnectionPolicyType);
            IDataMapper productMapper = builder.Build<Product>();
            IConnectionPolicy explicitConnectionPolicy = productMapper.GetConnectionPolicy();
            String fakeName = "teste";
            String trueName = "";
            String updatedName = "";
            // Act
            Product p1 = (Product)productMapper.GetAll().First();
            trueName = p1.SupplierID.CompanyName;
            p1.SupplierID.CompanyName = fakeName;
            productMapper.Update(p1);

            Product p2 = (Product)productMapper.GetAll().First();
            updatedName = p2.SupplierID.CompanyName;

            p2.SupplierID.CompanyName = trueName;
            productMapper.Update(p2);

            // Assert
            Assert.AreEqual(fakeName, updatedName);
        }
コード例 #30
0
 private PlayGamesClientConfiguration(Builder builder)
 {
     this.mEnableSavedGames = builder.HasEnableSaveGames();
     this.mEnableDeprecatedCloudSave = builder.HasEnableDeprecatedCloudSave();
     this.mInvitationDelegate = builder.GetInvitationDelegate();
     this.mMatchDelegate = builder.GetMatchDelegate();
 }
コード例 #31
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public bool StartDictKey()
 {
     Builder.AppendLine("StartDictKey");
     return(true);
 }
コード例 #32
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public void EndList()
 {
     Builder.AppendLine("EndList");
 }
コード例 #33
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public void EndItem()
 {
     Builder.AppendLine("EndItem");
 }
コード例 #34
0
        public void Throws_ArgumentNullException_For_Message()
        {
            Action testCode = () => Builder.SetResponse(null);

            testCode.Should().Throw <ArgumentNullException>();
        }
コード例 #35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        field = (string)Request["field"];
        id = (string)Request["id"];

                if(!CheckSecurity())
        {
            return;
        }

        if(!string.IsNullOrEmpty(categoryField))
        {
	        categoryvalue= (string)Request["category"];
        }

        Builder builder = Factory.CreateBuilder();
        Smarty.Table tableInfo = builder.Tables[strTableName];
        Smarty.Field fieldInfo = tableInfo.Fields[field] as Field;

        smarty.Add("add_new_item", true);

        fastType = fieldInfo.FastType;
        useAjax = true;

        if(!CheckAddNewItemAllowed(field))
        {
	        return;
        }

        if(Request["newitem"] != null)
        {
            obj = Control.GoodFieldName(field);
        }

        mode = Control.FromString((string)Request["mode"]);

        if ( fastType && useAjax) 
        {
            smarty.Add("fastTypeNAjax", true);
	        if ( mode == MODE.MODE_INLINE_EDIT || mode == MODE.MODE_INLINE_ADD ) 
	        {
		        element="window.opener.document.getElementById('" + id + "')";
		        dispelement="window.opener.document.getElementById('display_" + id + "')";
	        }
	        else
	        {
		        element="window.opener.document.forms.editform.value_" + obj;
		        dispelement="window.opener.document.forms.editform.display_value_" + obj;
	        }
            smarty.Add("dispelement", dispelement);
            smarty.Add("element", element);
            smarty.Add("data1", data1);
            smarty.Add("data2", data2);
        }
        else
        {
            smarty.Add("notfastTypeNAjax", true);
            if ( mode == MODE.MODE_INLINE_EDIT || mode == MODE.MODE_INLINE_ADD ) 
            {
		        element="window.opener.document.getElementById('"+ id + "')";
            }
	        else
            {
		        element="window.opener.document.forms.editform.value_" + obj;
            }

            if(!string.IsNullOrEmpty(categoryField) && !useAjax)
            {
                smarty.Add("notAjaxcategoryField", true);
            }

            smarty.Add("dispelement", dispelement);
            smarty.Add("element", element);
            smarty.Add("data1", data1);
            smarty.Add("data2", data2);
            smarty.Add("data0", data0);
            smarty.Add("obj", obj);
            smarty.Add("category", category);
        }

        smarty.Add("save_msg", saveMsg);
        smarty.Add("close_window_msg", closeWindowMsg);

        this.Response.Write(func.BuildOutput(this, @"~\PBJ_addnewitem.aspx", smarty));
        this.Response.End();
    }
コード例 #36
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public void OidReference(ulong oid)
 {
     Builder.AppendLine($"OidReference {oid}");
 }
コード例 #37
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public void ScalarAsText(string content)
 {
     Builder.AppendLine($"ScalarStr {content}");
 }
コード例 #38
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public void ScalarAsObject(object content)
 {
     Builder.AppendLine(string.Format(CultureInfo.InvariantCulture, "ScalarObj {0}", content));
 }
コード例 #39
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public bool StartField(string name)
 {
     Builder.AppendLine($"StartField {name}");
     return(true);
 }
コード例 #40
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UpgradeView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.UpgradeView.glade");

            window1          = (Window)builder.GetObject("window1");
            button1          = (Button)builder.GetObject("button1");
            button2          = (Button)builder.GetObject("button2");
            table1           = (Table)builder.GetObject("table1");
            table2           = (Table)builder.GetObject("table2");
            firstNameBox     = (Entry)builder.GetObject("firstNameBox");
            lastNameBox      = (Entry)builder.GetObject("lastNameBox");
            organisationBox  = (Entry)builder.GetObject("organisationBox");
            emailBox         = (Entry)builder.GetObject("emailBox");
            countryBox       = (ComboBox)builder.GetObject("countryBox");
            label1           = (Label)builder.GetObject("label1");
            licenseContainer = (Container)builder.GetObject("licenseContainer");
            checkbutton1     = (CheckButton)builder.GetObject("checkbutton1");
            listview1        = (Gtk.TreeView)builder.GetObject("listview1");
            alignment7       = (Alignment)builder.GetObject("alignment7");
            oldVersions      = (CheckButton)builder.GetObject("checkbutton2");
            listview1.Model  = listmodel;

            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            if (version.Revision == 0)
            {
                button1.Sensitive = false;
                table2.Hide();
                checkbutton1.Hide();
            }

            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;

            TreeViewColumn column0 = new TreeViewColumn("Version", textRender, "text", 0);

            listview1.AppendColumn(column0);
            column0.Sizing    = TreeViewColumnSizing.Autosize;
            column0.Resizable = true;

            TreeViewColumn column1 = new TreeViewColumn("Description", textRender, "text", 1);

            listview1.AppendColumn(column1);
            column1.Sizing    = TreeViewColumnSizing.Autosize;
            column1.Resizable = true;

            // Populate the combo box with a list of valid country names.
            ListStore countries = new ListStore(typeof(string));

            foreach (string country in Constants.Countries)
            {
                countries.AppendValues(country);
            }
            countryBox.Model = countries;

            // Add a cell renderer to the combo box.
            CellRendererText cell = new CellRendererText();

            countryBox.PackStart(cell, false);
            countryBox.AddAttribute(cell, "text", 0);

            // Make the tab order a little more sensible than the defaults
            table1.FocusChain = new Widget[] { alignment7, button1, button2 };
            table2.FocusChain = new Widget[] { firstNameBox, lastNameBox, emailBox, organisationBox, countryBox };

            licenseView = new MarkdownView(owner);
            licenseContainer.Add(licenseView.MainWidget);
            tabbedExplorerView = owner as IMainView;

            window1.TransientFor = owner.MainWidget.Toplevel as Window;
            window1.Modal        = true;
            oldVersions.Toggled += OnShowOldVersionsToggled;
            button1.Clicked     += OnUpgrade;
            button2.Clicked     += OnViewMoreDetail;
            window1.Destroyed   += OnFormClosing;
            window1.MapEvent    += OnShown;
        }
コード例 #41
0
 public virtual IList<ActInputControlDto> GetActsInputControlFilter(ActInputControlFilter filter)
 {
     return Builder<ActInputControlDto>.CreateListOfSize(10).Build();
 }
コード例 #42
0
            public override Expression BuildExpression(Expression expression, int level)
            {
                var idx = ConvertToIndex(expression, level, ConvertFlags.Field);

                return(Builder.BuildSql(typeof(bool), idx[0].Index));
            }
コード例 #43
0
        public Int32 Count(FilterDefinition <T> filter)
        {
            var query = Builder.And(filter, Builder.Eq("Inactive", false));

            return(Collection.Find(query).ToList <T>().Count);
        }
コード例 #44
0
        public Int32 CountAll()
        {
            var query = Builder.Eq("Inactive", false);

            return(Collection.Find(query).ToList <T>().Count);
        }
コード例 #45
0
ファイル: User.cs プロジェクト: AnHoa/DesignPattern
 public User(Builder builder)
 {
     this.builder = builder;
 }
コード例 #46
0
ファイル: Director.cs プロジェクト: qcjwq/DesignPatterns
 public void Construct(Builder builder)
 {
     builder.BuildPartA();
     builder.BuildPartB();
 }
コード例 #47
0
 public override void ConsumeToken(IT4Token token) => Builder.Append(Convert(token));
コード例 #48
0
 public override string Produce(ITreeNode lookahead) => Builder.ToString();
コード例 #49
0
        /// <summary>
        ///     Configures whether this property must have a value assigned or whether null is a valid value.
        ///     A property can only be configured as non-required if it is based on a CLR type that can be
        ///     assigned null.
        /// </summary>
        /// <param name="required"> A value indicating whether the property is required. </param>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual PropertyBuilder IsRequired(bool required = true)
        {
            Builder.IsRequired(required, ConfigurationSource.Explicit);

            return(this);
        }
コード例 #50
0
        /// <summary>
        ///     Configures the maximum length of data that can be stored in this property.
        ///     Maximum length can only be set on array properties (including <see cref="string" /> properties).
        /// </summary>
        /// <param name="maxLength"> The maximum length of data allowed in the property. </param>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual PropertyBuilder HasMaxLength(int maxLength)
        {
            Builder.HasMaxLength(maxLength, ConfigurationSource.Explicit);

            return(this);
        }
コード例 #51
0
        /// <summary>
        ///     Configures a property to never have a value generated when an instance of this
        ///     entity type is saved.
        /// </summary>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        /// <remarks>
        ///     Note that temporary values may still be generated for use internally before a
        ///     new entity is saved.
        /// </remarks>
        public virtual PropertyBuilder ValueGeneratedNever()
        {
            Builder.ValueGenerated(ValueGenerated.Never, ConfigurationSource.Explicit);

            return(this);
        }
コード例 #52
0
        /// <summary>
        ///     Configures a property to have a value generated only when saving a new or existing entity, unless
        ///     a non-null, non-temporary value has been set for a new entity, or the existing property value has
        ///     been modified for an existing entity, in which case the set value will be saved instead.
        /// </summary>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual PropertyBuilder ValueGeneratedOnAddOrUpdate()
        {
            Builder.ValueGenerated(ValueGenerated.OnAddOrUpdate, ConfigurationSource.Explicit);

            return(this);
        }
コード例 #53
0
        public void ImplementBamlInitializer(Builder builder)
        {
            this.LogInfo($"Checking for xaml/baml resources without initializers.");

            var xamlList = builder.ResourceNames?.Where(x => x.EndsWith(".baml")).Select(x => x.Replace(".baml", ".xaml")).ToArray();

            if (xamlList == null || xamlList.Length == 0 || !builder.TypeExists("System.Windows.Application"))
            {
                return;
            }

            var application        = new __Application(builder);
            var extensions         = new __Extensions(builder);
            var resourceDictionary = new __ResourceDictionary(builder);
            var collection         = new __ICollection_1(builder);

            this.LogInfo($"Implementing XAML initializer for baml resources.");

            // First we have to find every InitializeComponent method so that we can remove bamls that are already initialized.
            var allInitializeComponentMethods = builder.FindMethodsByName(SearchContext.Module, "InitializeComponent", 0).Where(x => !x.IsAbstract);
            var ldStrs = new ConcurrentBag <string>();

            Parallel.ForEach(allInitializeComponentMethods, methods =>
            {
                foreach (var str in methods.GetLoadStrings())
                {
                    ldStrs.Add(str);
                }
            });

            var xamlWithInitializers         = ldStrs.Select(x => x.Substring(x.IndexOf("component/") + "component/".Length)).ToArray();
            var xamlThatRequiredInitializers = xamlList.Where(x => !xamlWithInitializers.Contains(x));

            var resourceDictionaryMergerClass = builder.CreateType("XamlGeneratedNamespace", TypeAttributes.Public | TypeAttributes.Class | TypeAttributes.Sealed, "<>_generated_resourceDictionary_Loader");

            resourceDictionaryMergerClass.CustomAttributes.Add(builder.GetType("Cauldron.Activator.ComponentAttribute"), resourceDictionary.Type.Fullname);
            resourceDictionaryMergerClass.CustomAttributes.AddEditorBrowsableAttribute(EditorBrowsableState.Never);
            resourceDictionaryMergerClass.CustomAttributes.AddCompilerGeneratedAttribute();

            //var method = resourceDictionaryMergerClass.CreateMethod(Modifiers.Private, "AddToDictionary", typeof(string));
            resourceDictionaryMergerClass.CreateConstructor().NewCode().Context(x =>
            {
                x.Load(x.This).Call(builder.GetType(typeof(object)).Import().ParameterlessContructor.Import());

                var resourceDick = x.CreateVariable(collection.Type.MakeGeneric(resourceDictionary.Type));
                x.Call(
                    x.NewCode().Call(x.NewCode().Call(application.Current) /* Instance */, application.Resources) /* Instance */, resourceDictionary.MergedDictionaries)
                .StoreLocal(resourceDick);

                var resourceDictionaryInstance = x.CreateVariable(resourceDictionary.Type);

                foreach (var item in xamlThatRequiredInitializers)
                {
                    x.NewObj(resourceDictionary.Ctor).StoreLocal(resourceDictionaryInstance);
                    x.Call(resourceDick, collection.Add.MakeGeneric(resourceDictionary.Type), resourceDictionaryInstance);
                    x.Call(resourceDictionaryInstance, resourceDictionary.SetSource,
                           x.NewCode().Call(extensions.RelativeUri, $"/{Path.GetFileNameWithoutExtension(this.Builder.Name)};component/{item}")); // TODO -Need modification for UWP)
                }
            })
            .Return()
            .Replace();

            resourceDictionaryMergerClass.ParameterlessContructor.CustomAttributes.AddEditorBrowsableAttribute(EditorBrowsableState.Never);
            resourceDictionaryMergerClass.ParameterlessContructor.CustomAttributes.Add(builder.GetType("Cauldron.Activator.ComponentConstructorAttribute"));
        }
コード例 #54
0
        /// <summary>
        ///     Configures whether this property should be used as a concurrency token. When a property is configured
        ///     as a concurrency token the value in the database will be checked when an instance of this entity type
        ///     is updated or deleted during <see cref="DbContext.SaveChanges()" /> to ensure it has not changed since
        ///     the instance was retrieved from the database. If it has changed, an exception will be thrown and the
        ///     changes will not be applied to the database.
        /// </summary>
        /// <param name="concurrencyToken"> A value indicating whether this property is a concurrency token. </param>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual PropertyBuilder IsConcurrencyToken(bool concurrencyToken = true)
        {
            Builder.IsConcurrencyToken(concurrencyToken, ConfigurationSource.Explicit);

            return(this);
        }
コード例 #55
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public void EndInlineObject()
 {
     Builder.AppendLine("EndInlineObject");
 }
コード例 #56
0
ファイル: BuildXMLCommand.cs プロジェクト: ByteChkR/Byt3
        private static void BuildXML(StartupArgumentInfo info, string[] args)
        {
            if (args.Length != 0)
            {
                string file = args[0];
                if (File.Exists(file))
                {
                    BuildSettings bs = Builder.LoadSettings(file);


                    Directory.SetCurrentDirectory(Path.GetDirectoryName(Path.GetFullPath(file)));


                    string outFolder = Path.GetFullPath(bs.OutputFolder);
                    if (!Directory.Exists(outFolder))
                    {
                        Directory.CreateDirectory(outFolder);
                    }

                    string buildOutput = bs.CreateGamePackage ? outFolder + "/build" : outFolder;

                    string outputFolder = Path.GetFullPath(bs.OutputFolder);

                    string projectFile = Path.GetFullPath(bs.Project);

                    string projectFolder = Path.GetDirectoryName(projectFile);
                    projectFolder = Path.GetFullPath(projectFolder);

                    string assetFolder = Path.GetFullPath(bs.AssetFolder);

                    string projectName = Path.GetFileNameWithoutExtension(projectFile);

                    string publishFolder = projectFolder + "/bin/Release/netcoreapp2.1/publish";

                    if (Directory.Exists(projectFolder + "/bin"))
                    {
                        Console.WriteLine("Deleting publish folder to prevent copying the wrong assemblies.");
                        Directory.Delete(projectFolder + "/bin", true);
                    }

                    if (Directory.Exists(projectFolder + "/obj"))
                    {
                        Console.WriteLine("Deleting publish folder to prevent copying the wrong assemblies.");
                        Directory.Delete(projectFolder + "/obj", true);
                    }

                    string filePatterns     = bs.UnpackFiles + "+" + bs.MemoryFiles;
                    string outputPackFolder = bs.BuildFlags == BuildType.PackOnly ? "/packs" : "/" + projectName;
                    string packSubFolder    = bs.BuildFlags == BuildType.PackOnly ? "" : "/" + projectName;
                    string packFolder       = projectFolder + packSubFolder;


                    bool packsCreated = false;
                    if ((bs.BuildFlags == BuildType.PackEmbed || bs.BuildFlags == BuildType.PackOnly) &&
                        Directory.Exists(assetFolder))
                    {
                        Builder.PackAssets(packFolder, bs.PackSize, bs.MemoryFiles,
                                           bs.UnpackFiles,
                                           assetFolder, false);


                        packsCreated = true;
                    }

                    if (bs.BuildFlags == BuildType.PackEmbed || bs.BuildFlags == BuildType.Embed)
                    {
                        string[] files;
                        if (packsCreated)
                        {
                            Console.WriteLine("Embedding Packs.");
                            files = Directory.GetFiles(projectFolder + "/" + projectName, "*",
                                                       SearchOption.AllDirectories);
                        }
                        else
                        {
                            Console.WriteLine("Embedding Files.");
                            files = CreateFileList(assetFolder, filePatterns);
                        }

                        AssemblyEmbedder.EmbedFilesIntoProject(projectFile, files);
                    }

                    Builder.BuildProject(projectFolder);

                    if (Directory.Exists(buildOutput))
                    {
                        Directory.Delete(buildOutput, true);
                    }

                    Thread.Sleep(500);
                    Directory.Move(publishFolder, buildOutput);
                    string[] debugFiles = Directory.GetFiles(buildOutput, "*.pdb", SearchOption.AllDirectories);
                    for (int i = 0; i < debugFiles.Length; i++)
                    {
                        File.Delete(debugFiles[i]);
                    }

                    if (bs.BuildFlags == BuildType.PackEmbed || bs.BuildFlags == BuildType.Embed)
                    {
                        Console.WriteLine("Unembedding items.");
                        AssemblyEmbedder.UnEmbedFilesFromProject(projectFile);
                    }


                    if (packsCreated && bs.BuildFlags == BuildType.PackOnly)
                    {
                        Console.WriteLine("Copying Packs to Output.");
                        Directory.Move(projectFolder + outputPackFolder, buildOutput + outputPackFolder);
                    }
                    else if (packsCreated && bs.BuildFlags == BuildType.PackEmbed)
                    {
                        Console.WriteLine("Deleting Generated Pack Folder.");
                        Directory.Delete(projectFolder + outputPackFolder, true);
                    }

                    if (bs.BuildFlags == BuildType.Copy)
                    {
                        Console.WriteLine("Copying Assets to output");
                        string buildAssetDir = assetFolder.Replace(projectFolder, buildOutput);
                        Directory.CreateDirectory(buildAssetDir);

                        foreach (string dirPath in Directory.GetDirectories(assetFolder, "*",
                                                                            SearchOption.AllDirectories))
                        {
                            Directory.CreateDirectory(dirPath.Replace(projectFolder, buildOutput));
                        }

                        //Copy all the files & Replaces any files with the same name
                        foreach (string newPath in Directory.GetFiles(assetFolder, "*.*",
                                                                      SearchOption.AllDirectories))
                        {
                            File.Copy(newPath, newPath.Replace(projectFolder, buildOutput), true);
                        }
                    }


                    if (bs.CreateGamePackage)
                    {
                        string packagerVersion = string.IsNullOrEmpty(bs.PackagerVersion)
                            ? Creator.DefaultVersion
                            : bs.PackagerVersion;
                        if (info.GetCommandEntries("--packager-version") != 0)
                        {
                            packagerVersion = info.GetValues("--packager-version")[0];
                        }

                        string startArg = projectName + ".dll";
                        if (packagerVersion == "v2")
                        {
                            if (info.GetCommandEntries("--set-start-args") == 0)
                            {
                                Console.WriteLine("Warning. no startup arguments specifed!");
                                startArg = "dotnet " + projectName + ".dll";
                            }
                            else
                            {
                                string[] a = info.GetValues("--set-start-args").ToArray();
                                startArg = a[0];
                                StringBuilder sb = new StringBuilder(a[0]);
                                for (int i = 1; i < a.Length; i++)
                                {
                                    sb.Append(" " + a[i]);
                                }

                                startArg = sb.ToString();
                            }
                        }

                        FileVersionInfo fvi   = FileVersionInfo.GetVersionInfo(buildOutput + "/Engine.dll");
                        string[]        files = Builder.ParseFileList(bs.GamePackageFileList,
                                                                      buildOutput, projectName,
                                                                      bs.BuildFlags == BuildType.Copy, bs.BuildFlags == BuildType.PackOnly, false);
                        Creator.CreateGamePackage(projectName, startArg, outputFolder + "/" + projectName + ".game",
                                                  buildOutput, files,
                                                  fvi.FileVersion, packagerVersion);
                    }
                }
            }
        }
コード例 #57
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public bool StartList()
 {
     Builder.AppendLine("StartList");
     return(true);
 }
コード例 #58
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public bool StartItem()
 {
     Builder.AppendLine("StartItem");
     return(true);
 }
コード例 #59
0
ファイル: ODBIteratorTest.cs プロジェクト: gioia24/BTDB
 public bool StartInlineObject(uint tableId, string tableName, uint version)
 {
     Builder.AppendLine($"StartInlineObject {tableId}-{tableName}-{version}");
     return(true);
 }
コード例 #60
0
        public async Task Arrange()
        {
            UpdateBatchCertificateRequest request = Builder <UpdateBatchCertificateRequest> .CreateNew()
                                                    .With(i => i.Uln                  = 1234567890)
                                                    .With(i => i.StandardCode         = 1)
                                                    .With(i => i.StandardReference    = null)
                                                    .With(i => i.UkPrn                = 12345678)
                                                    .With(i => i.FamilyName           = "Test")
                                                    .With(i => i.CertificateReference = null)
                                                    .With(i => i.CertificateData      = Builder <CertificateData> .CreateNew()
                                                                                        .With(cd => cd.ContactPostCode = "AA11AA")
                                                                                        .With(cd => cd.AchievementDate = DateTime.UtcNow)
                                                                                        .With(cd => cd.OverallGrade    = CertificateGrade.Pass)
                                                                                        .With(cd => cd.CourseOption    = null)
                                                                                        .With(cd => cd.Version         = "1.0")
                                                                                        .Build())
                                                    .Build();

            _validationResult = await Validator.ValidateAsync(request);
        }