public ActionResult ContactEdit(Cake model) { if (ModelState.IsValid) { } return View(); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; var solutionFileName = Cake.Environment.WorkingDirectory.GetDirectoryName() + ".sln"; var projects = Cake.ParseSolution(solutionFileName) .Projects .Where(p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder"); // We do not generate NuGet packages for /Tests projects for this solution. var projectsToPublish = projects .Where(p => !p.Path.Segments.Contains("Tests") && !p.Path.Segments.Contains("Benchmark") && !p.Path.Segments.Contains("Common") && !p.Path.Segments.Contains("ChartsNite.ReplayOrganizer")); SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); StandardGlobalInfo globalInfo = CreateStandardGlobalInfo(gitInfo) .AddNuGet(projectsToPublish) .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("bin"))); Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("obj"))); Cake.CleanDirectories(globalInfo.ReleasesFolder); Cake.DeleteFiles("Tests/**/TestResult*.xml"); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { StandardSolutionBuild(globalInfo, solutionFileName); }); //Task( "Unit-Testing" ) // .IsDependentOn( "Build" ) // .WithCriteria( () => Cake.InteractiveMode() == InteractiveMode.NoInteraction // || Cake.ReadInteractiveOption( "RunUnitTests", "Run Unit Tests?", 'Y', 'N' ) == 'Y' ) // .Does( () => // { // var testProjects = projects.Where( p => p.Name.EndsWith( ".Tests" ) ); // StandardUnitTests( globalInfo, testProjects ); // } ); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Build") .Does(() => { StandardCreateNuGetPackages(globalInfo); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; const string solutionName = "CK-AspNet"; const string solutionFileName = solutionName + ".sln"; var coreBuildFile = Cake.File( "CodeCakeBuilder/CoreBuild.proj" ); var releasesDir = Cake.Directory( "CodeCakeBuilder/Releases" ); var projects = Cake.ParseSolution( solutionFileName ) .Projects .Where( p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder" ); // We do not publish .Tests projects for this solution. var projectsToPublish = projects .Where( p => !p.Path.Segments.Contains( "Tests" ) ); // The SimpleRepositoryInfo should be computed once and only once. SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); // This default global info will be replaced by Check-Repository task. // It is allocated here to ease debugging and/or manual work on complex build script. CheckRepositoryInfo globalInfo = new CheckRepositoryInfo { Version = gitInfo.SafeNuGetVersion }; Task( "Check-Repository" ) .Does( () => { globalInfo = StandardCheckRepository( projectsToPublish, gitInfo ); if( globalInfo.ShouldStop ) { Cake.TerminateWithSuccess( "All packages from this commit are already available. Build skipped." ); } } ); Task( "Clean" ) .IsDependentOn( "Check-Repository" ) .Does( () => { Cake.CleanDirectories( projects.Select( p => p.Path.GetDirectory().Combine( "bin" ) ) ); Cake.CleanDirectories( projects.Select( p => p.Path.GetDirectory().Combine( "obj" ) ) ); Cake.CleanDirectories( releasesDir ); } ); Task( "Build" ) .IsDependentOn( "Clean" ) .IsDependentOn( "Check-Repository" ) .Does( () => { StandardSolutionBuild( solutionFileName, gitInfo, globalInfo.BuildConfiguration ); } ); Task( "Unit-Testing" ) .IsDependentOn( "Build" ) .WithCriteria( () => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption( "RunUnitTests", "Run Unit Tests?", 'Y', 'N' ) == 'Y' ) .Does( () => { StandardUnitTests( globalInfo.BuildConfiguration, projects.Where( p => p.Name.EndsWith( ".Tests" ) ) ); } ); Task( "Create-NuGet-Packages" ) .WithCriteria( () => gitInfo.IsValid ) .IsDependentOn( "Unit-Testing" ) .Does( () => { StandardCreateNuGetPackages( releasesDir, projectsToPublish, gitInfo, globalInfo.BuildConfiguration ); } ); Task( "Push-NuGet-Packages" ) .WithCriteria( () => gitInfo.IsValid ) .IsDependentOn( "Create-NuGet-Packages" ) .Does( () => { StandardPushNuGetPackages( globalInfo, releasesDir ); } ); // The Default task for this script can be set here. Task( "Default" ) .IsDependentOn( "Push-NuGet-Packages" ); }
public async Task <int> RemoveFromCartAsync(Cake cake) { return(await AddOrRemoveCart(cake, -1)); }
/// <summary> /// Implements Package promotion in @CI, @Exploratory, @Preview, @Latest and @Stable views. /// </summary> /// <param name="ctx">The Cake context.</param> /// <param name="pushes">The set of artifacts to promote.</param> /// <returns>The awaitable.</returns> protected override async Task OnAllArtifactsPushed(IEnumerable <ArtifactPush> pushes) { string basicAuth = Convert.ToBase64String(Encoding.ASCII.GetBytes(":" + Cake.InteractiveEnvironmentVariable(SecretKeyName))); foreach (ArtifactPush p in pushes) { foreach (PackageLabel view in p.Version.PackageQuality.GetLabels()) { string url = ProjectName != null ? $"https://pkgs.dev.azure.com/{Organization}/{ProjectName}/_apis/packaging/feeds/{FeedName}/nuget/packagesBatch?api-version=5.0-preview.1" : $"https://pkgs.dev.azure.com/{Organization}/_apis/packaging/feeds/{FeedName}/nuget/packagesBatch?api-version=5.0-preview.1"; using (HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, url)) { req.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", basicAuth); string body = GetPromotionJSONBody(p.Name, p.Version.ToNormalizedString(), view.ToString()); req.Content = new StringContent(body, Encoding.UTF8, "application/json"); using (HttpResponseMessage m = await StandardGlobalInfo.SharedHttpClient.SendAsync(req)) { if (m.IsSuccessStatusCode) { Cake.Information($"Package '{p.Name}' promoted to view '@{view}'."); } else { Cake.Error($"Package '{p.Name}' promotion to view '@{view}' failed."); // Throws! m.EnsureSuccessStatusCode(); } } } } } }
public static void insertNew(Cake cake) { CakeRepositories.insertCake(cake); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); StandardGlobalInfo globalInfo = CreateStandardGlobalInfo(gitInfo) .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Create-NuGet-Packages") .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Packages"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; const string solutionName = "dotnettar"; const string solutionFileName = solutionName + ".sln"; string configuration = Cake.Argument("configuration", "Release"); IEnumerable <SolutionProject> projects = Cake.ParseSolution(solutionFileName) .Projects .Where(p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder"); // We do not publish .Tests projects for this solution. IEnumerable <SolutionProject> projectsToPublish = projects .Where(p => !p.Path.Segments.Contains("Tests")); // The SimpleRepositoryInfo should be computed once and only once. SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); // This default global info will be replaced by Check-Repository task. // It is allocated here to ease debugging and/or manual work on complex build script. // Git .ignore file should ignore this folder. // Here, we name it "Releases" (default , it could be "Artefacts", "Publish" or anything else, // but "Releases" is by default ignored in https://github.com/github/gitignore/blob/master/VisualStudio.gitignore. ConvertableDirectoryPath releasesDir = Cake.Directory("CodeCakeBuilder/Releases"); CheckRepositoryInfo globalInfo = new CheckRepositoryInfo { Version = gitInfo.SafeNuGetVersion }; Task("Check-Repository") .Does(() => { globalInfo = StandardCheckRepository(projectsToPublish, gitInfo); }); Task("Clean") .Does(() => { // Avoids cleaning CodeCakeBuilder itself! Cake.CleanDirectories("**/bin/" + configuration, d => !d.Path.Segments.Contains("CodeCakeBuilder")); Cake.CleanDirectories("**/obj/" + configuration, d => !d.Path.Segments.Contains("CodeCakeBuilder")); Cake.CleanDirectories(releasesDir); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { //StandardSolutionBuild( solutionFileName, gitInfo, globalInfo.BuildConfiguration ); }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Build") .Does(() => { StandardCreateNuGetPackages(releasesDir, projectsToPublish, gitInfo, globalInfo.BuildConfiguration); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { //StandardUnitTests( globalInfo.BuildConfiguration, projects.Where( p => p.Name.EndsWith( ".Tests" ) ) ); }); Task("Push-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Create-NuGet-Packages") .Does(() => { StandardPushNuGetPackages(globalInfo, releasesDir); }); Task("Default") .IsDependentOn("Push-NuGet-Packages"); }
public BuilderTest() { var builderApp = new MainBuilderApp(); _myCake = builderApp.Main(); }
public void Test_Broadcast() { var r = Cake.AmBroadcast("-a android.settings.SETTINGS", settings: GetAdbToolSettings()); Assert.True(r == 0); }
public void Test_ForceStop() { Cake.AmForceStop("com.android.settings", settings: GetAdbToolSettings()); }
public void Test_StartService() { var r = Cake.AmStartService("-a android.settings.SETTINGS", settings: GetAdbToolSettings()); Assert.True(r); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); StandardGlobalInfo globalInfo = CreateStandardGlobalInfo(gitInfo) .AddDotnet() .SetCIBuildTag(); var nuGetType = globalInfo.ArtifactTypes.OfType <NuGetArtifactType>().Single(); //Because this CCB is our reference for the ApplySettings, we must not modify Build.NuGetArtifactType.GetRemoteFeeds //So here we modify the feed. IList <ArtifactFeed> feeds = nuGetType.GetTargetFeeds(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .Does(() => { // Cheat here for this build.cs to avoid changing the default // // protected override IEnumerable<ArtifactFeed> GetRemoteFeeds() // { // yield return new SignatureVSTSFeed( this, "Signature-Code", "CKEnvTest3" ); // } // // that is targeted by the CK.Env.Plugin.NuGetCodeCakeBuilderFolder.AdaptBuildNugetRepositoryForPushFeeds // method. // globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
static void Main(string[] args) { // генерируем сдачу в автомате границы - случайные числа coin_1 = (uint)generator.Next(0, 10); coin_2 = (uint)generator.Next(0, 10); coin_5 = (uint)generator.Next(0, 10); coin_10 = (uint)generator.Next(0, 10); int user_balance = (int)CASH; // остаток на счету у покупателя machine_balance += coin_1 * RUBLE + coin_2 * TWO + coin_5 * FIVE + coin_10 * TEN; string command; // команда для управления меню cakes = new Cake(CAKE_N, CAKE_P, cake_q, CAKE_ID); biscuits = new Biscuit(BISCUIT_N, BUSCUIT_P, busciut_q, BISCUIT_ID); wafers = new Wafer(WAFER_N, WAFER_P, wafer_q, WAFER_ID); //собрали все продукты в список menu = new List<Product>(); menu.Add(cakes); menu.Add(biscuits); menu.Add(wafers); // допущение: если в автомате менее 20 рублей, то он не сможет выдать сдачу, // в таком случае он не принимает заказы от покупателей if (machine_balance > 20) { do { // предоставляем меню GetMenu(cakes, biscuits, wafers, user_balance); uint money = GetMoney("Введите сумму: ", user_balance); machine_balance += money; int id; // код продукта // если покупатель ввёл сумму, не прывашающую в его кошельке if (money <= user_balance) { user_balance -= (int)money; Console.WriteLine("\nВы внесли: {0} рублей", money); Console.WriteLine("Ваш остаток: {0} рублей", user_balance); // пока деньги не кончились while (money > 0) { // выбор продукта id = GetProductId(); Product choosen_product = menu.Find(item => item.Id == id); // если товар в наличии if (choosen_product.Quantity > 0) OrderProcessing(choosen_product, ref money, ref user_balance); // если товара в наличии нет else { Console.WriteLine("Выбранного товара нет в наличии..."); command = GetCommand("Нажмите + для выбора другого товара\n\t- для возврата денег: "); if (command == "+") continue; else { ReturnDelivery(money); user_balance += (int)money; Console.WriteLine("Доступно в кошельке: {0}", user_balance); money = 0; } } } } // если покупатель попытался ввёл больше, чем у него есть (в реальной жизни так не получится) else { Console.WriteLine("Недостаточно средств в кошельке..."); money = (uint)user_balance; user_balance = 0; command = GetCommand("Вернуть сдачу? (+ / -): "); if (command == "+") { ReturnDelivery(money); user_balance += (int)money; Console.WriteLine("Доступно в кошельке: {0}", user_balance); money = 0; } else money = GetMoney("Введите деньги: ", user_balance); } Console.WriteLine("\nДля выхода из программы нажмите ESCAPE...\n"); } while (Console.ReadKey().Key != ConsoleKey.Escape); } else Console.WriteLine("К сожалению, в автомате нет сдачи..."); }
private void FindCake(Cake cake) { target = cake.transform; //SetTargetPosition(cake.transform.position); }
/// <summary> /// Метод выводит на экран меню автомата /// </summary> /// <param name="cakes"></param> кексы /// <param name="biscuits"></param> печенья /// <param name="wafers"></param> вафли /// <param name="user_balance"></param> кол-во денег у пользователя в кошельке public static void GetMenu(Cake cakes, Biscuit biscuits, Wafer wafers, int user_balance) { Console.WriteLine("\n=============================="); Console.WriteLine("Название | Цена | Кол-во | Код"); Console.WriteLine("=============================="); Console.WriteLine(cakes.ToString()); Console.WriteLine(biscuits.ToString()); Console.WriteLine(wafers.ToString()); Console.WriteLine("\r\nАвтомат принимает монеты по 1, 2, 5, 10 рублей\n"); Console.WriteLine("ДОСТУПНО В КОШЕЛЬКЕ: {0}\n", user_balance); }
public AddCakeView(Cake cake) { this.cake = cake; }
/// <summary> /// Creates a new <see cref="StandardGlobalInfo"/> initialized by the /// current environment. /// </summary> /// <param name="gitInfo">The git info.</param> /// <returns>A new info object.</returns> StandardGlobalInfo CreateStandardGlobalInfo(SimpleRepositoryInfo gitInfo) { var result = new StandardGlobalInfo(Cake, gitInfo); // By default: if (!gitInfo.IsValid) { if (Cake.InteractiveMode() != InteractiveMode.NoInteraction && Cake.ReadInteractiveOption("PublishDirtyRepo", "Repository is not ready to be published. Proceed anyway?", 'Y', 'N') == 'Y') { Cake.Warning("GitInfo is not valid, but you choose to continue..."); result.IgnoreNoArtifactsToProduce = true; } else { // On Appveyor, we let the build run: this gracefully handles Pull Requests. if (Cake.AppVeyor().IsRunningOnAppVeyor) { result.IgnoreNoArtifactsToProduce = true; } else { Cake.TerminateWithError("Repository is not ready to be published."); } } // When the gitInfo is not valid, we do not try to push any packages, even if the build continues // (either because the user choose to continue or if we are on the CI server). // We don't need to worry about feeds here. } else { // gitInfo is valid: it is either ci or a release build. var v = gitInfo.Info.FinalSemVersion; // If a /LocalFeed/ directory exists above, we publish the packages in it. var localFeedRoot = Cake.FindSiblingDirectoryAbove(Cake.Environment.WorkingDirectory.FullPath, "LocalFeed"); if (localFeedRoot != null) { if (v.AsCSVersion == null) { if (v.Prerelease.EndsWith(".local")) { // Local releases must not be pushed on any remote and are copied to LocalFeed/Local // feed (if LocalFeed/ directory above exists). result.IsLocalCIRelease = true; result.LocalFeedPath = System.IO.Path.Combine(localFeedRoot, "Local"); } else { // CI build versions are routed to LocalFeed/CI result.LocalFeedPath = System.IO.Path.Combine(localFeedRoot, "CI"); } } else { // Release or prerelease go to LocalFeed/Release result.LocalFeedPath = System.IO.Path.Combine(localFeedRoot, "Release"); } System.IO.Directory.CreateDirectory(result.LocalFeedPath); } else { result.IsLocalCIRelease = v.Prerelease.EndsWith(".local"); } // Creating the right remote feed. if (!result.IsLocalCIRelease && (Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("PushToRemote", "Push to Remote feeds?", 'Y', 'N') == 'Y')) { result.PushToRemote = true; } } return(result); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Setup(context => { context.Log.Information("Executed BEFORE the first task."); }); Teardown(context => { context.Log.Information("Executed AFTER the last task."); }); TaskSetup(setupContext => { setupContext.Log.Information($"TaskSetup for Task: {setupContext.Task.Name}"); }); TaskTeardown(teardownContext => { teardownContext.Log.Information($"TaskTeardown for Task: {teardownContext.Task.Name}"); }); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder.ToString()); Cake.DeleteFiles("Tests/**/TestResult*.xml"); }); Task("Build") .IsDependentOn("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Build") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-NuGet-Packages") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(async() => { await globalInfo.PushArtifactsAsync(); }); Task("Default").IsDependentOn("Push-NuGet-Packages"); }
public static void Main() { Cake cake = new Cake("sasa"); Fish fish = new Fish("sas", 51); }
public void TestMethod1() { var cake = new Cake(); Assert.AreEqual(cake.SayHello(), "Hello Cake"); }
public static int minusCake(Cake c) { return(CakeRepositories.minusCake(c)); }
public static void Main(string[] args) { Cake cake = new Cake("myCake"); System.Console.WriteLine(cake.Calories); }
public async Task <int> AddToCartAsync(Cake cake, int quantity = 1) { return(await AddOrRemoveCart(cake, quantity)); }
public static void SeedCakes(EFDbContext _context) { if (!_context.Cakes.Any()) { var cake = new Cake(); cake.Name = "Prague"; cake.Image = @"\images\praga.jpg"; cake.Price = 200; cake.Weight = 1.5; cake.CategoryId = 10; _context.Cakes.Add(cake); _context.SaveChanges(); var cake2 = new Cake(); cake2.Name = "Black Forest"; cake2.Image = @"\images\blackForest.jpg"; cake2.Price = 300; cake2.Weight = 1.5; cake2.CategoryId = 10; _context.Cakes.Add(cake2); _context.SaveChanges(); var cake3 = new Cake(); cake3.Name = "Berries Marshmallow"; cake3.Image = @"\images\berriesM.jpg"; cake3.Price = 10; cake3.Weight = 0.05; cake3.CategoryId = 13; _context.Cakes.Add(cake3); _context.SaveChanges(); var cake4 = new Cake(); cake4.Name = "Lime Marshmallow"; cake4.Image = @"\images\limeM.jpg"; cake4.Price = 10; cake4.Weight = 0.05; cake4.CategoryId = 13; _context.Cakes.Add(cake4); _context.SaveChanges(); var cake5 = new Cake(); cake5.Name = "Vanilla Marshmallow"; cake5.Image = @"\images\vanillaM.jpg"; cake5.Price = 10; cake5.Weight = 0.05; cake5.CategoryId = 13; _context.Cakes.Add(cake5); _context.SaveChanges(); var cake6 = new Cake(); cake6.Name = "Three Chokolates"; cake6.Image = @"\images\3chokolates.jpg"; cake6.Price = 250; cake6.Weight = 1.5; cake6.CategoryId = 12; _context.Cakes.Add(cake6); _context.SaveChanges(); var cake7 = new Cake(); cake7.Name = "Bird's Milk"; cake7.Image = @"\images\birdsMilk.jpg"; cake7.Price = 200; cake7.Weight = 1.6; cake7.CategoryId = 12; _context.Cakes.Add(cake7); _context.SaveChanges(); } ; }
public Build() { // The configuration ("Debug", etc.) defaults to "Release". var configuration = Cake.Argument("configuration", "Release"); // Git .ignore file should ignore this folder. // Here, we name it "Releases" (default , it could be "Artefacts", "Publish" or anything else, // but "Releases" is by default ignored in https://github.com/github/gitignore/blob/master/VisualStudio.gitignore. var releasesDir = Cake.Directory("CodeCakeBuilder/Releases"); SimpleRepositoryInfo gitInfo = null; Task("Check-Repository") .Does(() => { gitInfo = Cake.GetSimpleRepositoryInfo(); if (!gitInfo.IsValid) { configuration = "Debug"; Cake.Warning("Repository is not ready to be published. Setting configuration to {0}.", configuration); } else { configuration = gitInfo.IsValidRelease && gitInfo.PreReleaseName.Length == 0 ? "Release" : "Debug"; Cake.Information("Publishing {0} in {1}.", gitInfo.SemVer, configuration); } }); Task("Clean") .Does(() => { // Avoids cleaning CodeCakeBuilder itself! Cake.CleanDirectories("**/bin/" + configuration, d => !d.Path.Segments.Contains("CodeCakeBuilder")); Cake.CleanDirectories("**/obj/" + configuration, d => !d.Path.Segments.Contains("CodeCakeBuilder")); Cake.CleanDirectories(releasesDir); }); Task("Restore-NuGet-Packages") .Does(() => { // Reminder for first run. // Bootstrap.ps1 ensures that Tools/nuget.exe exists // and compiles this CodeCakeBuilder application in Release mode. // It is the first thing that a CI should execute in the initialization phase and // once done bin/Release/CodeCakeBuilder.exe can be called to do its job. // (Of course, the following check can be removed and nuget.exe be conventionnaly located somewhere else.) if (!Cake.FileExists("CodeCakeBuilder/Tools/nuget.exe")) { throw new Exception("Please execute Bootstrap.ps1 first."); } Cake.Information("Restoring nuget packages for existing .sln files at the root level.", configuration); foreach (var sln in Cake.GetFiles("*.sln")) { Cake.NuGetRestore(sln); } }); Task("Build") .IsDependentOn("Clean") .IsDependentOn("Restore-NuGet-Packages") .Does(() => { Cake.Information("Building all existing .sln files at the root level with '{0}' configuration (excluding this builder application).", configuration); foreach (var sln in Cake.GetFiles("*.sln")) { using (var tempSln = Cake.CreateTemporarySolutionFile(sln)) { // Excludes "CodeCakeBuilder" itself from compilation! tempSln.ExcludeProjectsFromBuild("CodeCakeBuilder"); Cake.MSBuild(tempSln.FullPath, new MSBuildSettings() .SetConfiguration(configuration) .SetVerbosity(Verbosity.Minimal) .SetMaxCpuCount(1)); } } }); Task("Unit-Testing") .IsDependentOn("Build") .Does(() => { Cake.CreateDirectory(releasesDir); Cake.NUnit("*.Tests/bin/" + configuration + "/*.Tests.dll", new NUnitSettings() { Framework = "v4.5", OutputFile = releasesDir.Path + "/TestResult.txt", StopOnError = true }); }); Task("Create-NuGet-Packages") .IsDependentOn("Build") .IsDependentOn("Unit-Testing") .Does(() => { Cake.CreateDirectory(releasesDir); var settings = new NuGetPackSettings() { // Hard coded version!? // Cake offers tools to extract the version number from a ReleaseNotes.txt. // But other tools exist: have a look at SimpleGitVersion.Cake to easily // manage Constrained Semantic Versions on Git repositories. Version = "1.0.0-alpha", BasePath = Cake.Environment.WorkingDirectory, OutputDirectory = releasesDir }; foreach (var nuspec in Cake.GetFiles("CodeCakeBuilder/NuSpec/*.nuspec")) { Cake.NuGetPack(nuspec, settings); } }); // We want to push on NuGet only the Release packages. Task("Push-NuGet-Packages") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => configuration == "Release") .Does(() => { // Resolve the API key: if the environment variable is not found // AND CodeCakeBuilder is running in interactive mode (ie. no -nointeraction parameter), // then the user is prompted to enter it. // This is specific to CodeCake (in Code.Cake.dll). var apiKey = Cake.InteractiveEnvironmentVariable("MYGET_API_KEY"); if (string.IsNullOrEmpty(apiKey)) { throw new InvalidOperationException("Could not resolve NuGet API key."); } var settings = new NuGetPushSettings { Source = "https://www.myget.org/F/calculatricecakent/api/v2/package", ApiKey = apiKey }; foreach (var nupkg in Cake.GetFiles(releasesDir.Path + "/*.nupkg")) { Cake.NuGetPush(nupkg, settings); } }); Task("Default").IsDependentOn("Push-NuGet-Packages"); }
public static void Main(string[] args) { Cake cake = new Cake("Space Cake"); System.Console.WriteLine($"{cake.Name} - {cake.Grams} - {cake.Calories} - {cake.Price}"); }
public static List <Order> GetOrders() { var result = new List <Order>(); string jsonFilePath = "./Data/orders.json"; var json = File.ReadAllText(jsonFilePath); try { JArray orders = JArray.Parse(json); //int skipValue = pageCurrent == 1 ? 0 : (pageCurrent - 1) * perPage; //trips = new JArray(trips.Skip(skipValue).Take(perPage)); foreach (var order in orders) { Order orderObject = new Order(); orderObject.Id = order["Id"].ToString(); orderObject.Name = order["Name"].ToString(); orderObject.TotalPrice = int.Parse(order["TotalPrice"].ToString()); orderObject.CreatedDate = order["CreatedDate"].ToString(); orderObject.CartItems = new List <CartItem>(); JArray CartItems = JArray.Parse(order["CartItems"].ToString()); foreach (var cartItem in CartItems) { CartItem newCartItem = new CartItem() { Id = cartItem["Id"].ToString(), Quantity = int.Parse(cartItem["Quantity"].ToString()), TotalPrice = int.Parse(cartItem["TotalPrice"].ToString()), }; var cakeObj = JObject.Parse(cartItem["Cake"].ToString()); Cake cake = new Cake() { Id = cakeObj["Id"].ToString(), Name = cakeObj["Name"].ToString(), Description = cakeObj["Description"].ToString(), Price = int.Parse(cakeObj["Price"].ToString()), Image_Main = cakeObj["Image_Main"].ToString(), }; var categoryObj = JObject.Parse(cakeObj["Category"].ToString()); Category category = new Category() { Id = categoryObj["Id"].ToString(), Name = categoryObj["Name"].ToString() }; cake.Category = category; newCartItem.Cake = cake; orderObject.CartItems.Add(newCartItem); } result.Add(orderObject); } } catch (Exception) { throw; } return(result); }
public Captured1(int count, Cake cake, ListBox listOfFinishedOrders) { this.count = count; this.cake = cake; this.listOfFinishedOrders = listOfFinishedOrders; }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder.ToString()); Cake.CleanDirectory("Tests/LocalTestHelper/LocalTestStore"); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Runtimes-and-Engines") .IsDependentOn("Unit-Testing") .WithCriteria(() => globalInfo.IsValid) .Does(() => { StandardPushCKSetupComponents(globalInfo); }); Task("Push-NuGet-Packages") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(async() => { await globalInfo.PushArtifactsAsync(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Runtimes-and-Engines") .IsDependentOn("Push-NuGet-Packages"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; const string solutionName = "CK-ControlChannel-Abstractions"; const string solutionFileName = solutionName + ".sln"; var releasesDir = Cake.Directory("CodeCakeBuilder/Releases"); var projects = Cake.ParseSolution(solutionFileName) .Projects .Where(p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder"); // We do not publish .Tests projects for this solution. var projectsToPublish = projects .Where(p => !p.Path.Segments.Contains("Tests")); SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); // Configuration is either "Debug" or "Release". string configuration = "Debug"; Task("Check-Repository") .Does(() => { if (!gitInfo.IsValid) { if (Cake.IsInteractiveMode() && Cake.ReadInteractiveOption("Repository is not ready to be published. Proceed anyway?", 'Y', 'N') == 'Y') { Cake.Warning("GitInfo is not valid, but you choose to continue..."); } else if (!Cake.AppVeyor().IsRunningOnAppVeyor) { throw new Exception("Repository is not ready to be published."); } } if (gitInfo.IsValidRelease && (gitInfo.PreReleaseName.Length == 0 || gitInfo.PreReleaseName == "rc")) { configuration = "Release"; } Cake.Information("Publishing {0} projects with version={1} and configuration={2}: {3}", projectsToPublish.Count(), gitInfo.SemVer, configuration, projectsToPublish.Select(p => p.Name).Concatenate()); }); Task("Unit-Testing") .IsDependentOn("Check-Repository") .Does(() => { Cake.DotNetCoreRestore(); var testDirectories = Cake.ParseSolution(solutionFileName) .Projects .Where(p => p.Name.EndsWith(".Tests")) .Select(p => p.Path.FullPath); foreach (var test in testDirectories) { Cake.DotNetCoreTest(test); } }); Task("Clean") .IsDependentOn("Check-Repository") .IsDependentOn("Unit-Testing") .Does(() => { Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("bin"))); Cake.CleanDirectories(releasesDir); }); Task("Restore-NuGet-Packages-With-Version") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Clean") .Does(() => { // https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets Cake.DotNetCoreRestore(new DotNetCoreRestoreSettings().AddVersionArguments(gitInfo)); }); Task("Build-With-Version") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Check-Repository") .IsDependentOn("Unit-Testing") .IsDependentOn("Clean") .IsDependentOn("Restore-NuGet-Packages-With-Version") .Does(() => { foreach (var p in projectsToPublish) { Cake.DotNetCoreBuild(p.Path.GetDirectory().FullPath, new DotNetCoreBuildSettings().AddVersionArguments(gitInfo, s => { s.Configuration = configuration; })); } }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Build-With-Version") .Does(() => { Cake.CreateDirectory(releasesDir); foreach (SolutionProject p in projectsToPublish) { Cake.Warning(p.Path.GetDirectory().FullPath); var s = new DotNetCorePackSettings(); s.ArgumentCustomization = args => args.Append("--include-symbols"); s.NoBuild = true; s.Configuration = configuration; s.OutputDirectory = releasesDir; s.AddVersionArguments(gitInfo); Cake.DotNetCorePack(p.Path.GetDirectory().FullPath, s); } }); Task("Push-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Create-NuGet-Packages") .Does(() => { IEnumerable <FilePath> nugetPackages = Cake.GetFiles(releasesDir.Path + "/*.nupkg"); if (Cake.IsInteractiveMode()) { var localFeed = Cake.FindDirectoryAbove("LocalFeed"); if (localFeed != null) { Cake.Information("LocalFeed directory found: {0}", localFeed); if (Cake.ReadInteractiveOption("Do you want to publish to LocalFeed?", 'Y', 'N') == 'Y') { Cake.CopyFiles(nugetPackages, localFeed); } } } if (gitInfo.IsValidRelease) { if (gitInfo.PreReleaseName == "" || gitInfo.PreReleaseName == "prerelease" || gitInfo.PreReleaseName == "rc") { PushNuGetPackages("NUGET_API_KEY", "https://www.nuget.org/api/v2/package", nugetPackages); } else { // An alpha, beta, delta, epsilon, gamma, kappa goes to invenietis-preview. PushNuGetPackages("MYGET_PREVIEW_API_KEY", "https://www.myget.org/F/invenietis-preview/api/v2/package", nugetPackages); } } else { Debug.Assert(gitInfo.IsValidCIBuild); PushNuGetPackages("MYGET_CI_API_KEY", "https://www.myget.org/F/invenietis-ci/api/v2/package", nugetPackages); } if (Cake.AppVeyor().IsRunningOnAppVeyor) { Cake.AppVeyor().UpdateBuildVersion(gitInfo.SemVer); } }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-NuGet-Packages"); }
public void OnInputClicked(InputClickedEventData eventData) { Cake.onPostData(this.gameObject); ////Detecting if the player clicked on the left mouse button and also if there is no animation playing //if (Input.GetButtonDown("Fire1")) //{ // Destroy(_currentIndicator); // //The 3 following lines is to get the clicked GameObject and getting the RaycastHit2D that will help us know the clicked object // Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); // RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); // if (hit.transform != null) // { // if (hit.transform.gameObject.name == _emptyGameobject.name + "(Clone)") { DoEmptyDown(ref _arrayOfShapes); return; } // if (hit.transform.gameObject.name == _MenuButton.name) // { // GetComponent<AudioSource>().PlayOneShot(MenuSound); // hit.transform.localScale = new Vector3(1.1f, 1.1f, 0); // Application.LoadLevel("MainMenu"); // } // if (hit.transform.gameObject.name == _ReloadButton.name) { GetComponent<AudioSource>().PlayOneShot(MenuSound); Time.timeScale = 1; isPaused = false; HOTween.Play(); hit.transform.localScale = new Vector3(1.1f, 1.1f, 0); Application.LoadLevel(Application.loadedLevelName); } // if (hit.transform.gameObject.name == _PauseButton.name && !isPaused && !isCountingDown && !isEnded && HOTween.GetTweenersByTarget(_PlayButton.transform, false).Count == 0 && HOTween.GetTweenersByTarget(_MenuButton.transform, false).Count == 0) { GetComponent<AudioSource>().PlayOneShot(MenuSound); StartCoroutine(ShowMenu()); hit.transform.localScale = new Vector3(1.1f, 1.1f, 0); } // else if ((hit.transform.gameObject.name == _PauseButton.name || hit.transform.gameObject.name == _PlayButton.name) && !isEnded && !isCountingDown && isPaused && HOTween.GetTweenersByTarget(_PlayButton.transform, false).Count == 0 && HOTween.GetTweenersByTarget(_MenuButton.transform, false).Count == 0) { GetComponent<AudioSource>().PlayOneShot(MenuSound); StartCoroutine(HideMenu()); hit.transform.localScale = new Vector3(1f, 1f, 0); } // var Infos = HOTween.GetTweenInfos(); // bool founGem = false; // bool gemIsTweening = false; // Vector2 gemPosition = new Vector2(-1, -1); // for (var x = 0; x <= _arrayOfShapes.GetUpperBound(0); x++) // { // for (var y = 0; y <= _arrayOfShapes.GetUpperBound(1); y++) // { // if (_arrayOfShapes[x, y].GetInstanceID() == hit.transform.gameObject.GetInstanceID()) { founGem = true; gemPosition = new Vector2(x, y); } // if (HOTween.GetTweenersByTarget(_arrayOfShapes[x, y].transform, false).Count > 0) gemIsTweening = true; // } // } // if (!founGem || isPaused || gemIsTweening) return; // //To know if the user already selected a tile or not yet // if (_FirstObject == null) _FirstObject = hit.transform.gameObject; // else // { // _SecondObject = hit.transform.gameObject; // shouldTransit = true; // } // _currentIndicator = GameObject.Instantiate(_indicator, new Vector3(hit.transform.gameObject.transform.position.x, hit.transform.gameObject.transform.position.y, -1), transform.rotation) as GameObject; // if (hit.transform.gameObject.name == _theRandomizeGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theRandomizeGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.Randomize; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // //Replace the matching tile with an empty one // _arrayOfShapes[(int)go.transform.position.x, (int)go.transform.position.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)go.transform.position.x, (int)go.transform.position.y, -1), transform.rotation) as GameObject; // Destroy(go); // var destroyingParticle = GameObject.Instantiate(_randomizeGemEffectWhenMatch as GameObject, new Vector3(go.transform.position.x, go.transform.position.y, -2), transform.rotation) as GameObject; // Destroy(destroyingParticle, 3f); // // StartCoroutine( ShowMessage(_Message, "Randomize")); // StartCoroutine(Randomize()); // Destroy(_currentIndicator); // shouldTransit = false; // GetComponent<AudioSource>().PlayOneShot(RandomizeSound); // } // else if (hit.transform.gameObject.name == _theChangeFateGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theChangeFateGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.ChangeFate; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // //Replace the matching tile with an empty one // _arrayOfShapes[(int)go.transform.position.x, (int)go.transform.position.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)go.transform.position.x, (int)go.transform.position.y, -1), transform.rotation) as GameObject; // Destroy(go); // var destroyingParticle = GameObject.Instantiate(_changeFateGemEffectWhenMatch as GameObject, new Vector3(go.transform.position.x, go.transform.position.y, -2), transform.rotation) as GameObject; // Destroy(destroyingParticle, 10f); // if (!Matches.Contains(go)) // { // Matches.Add(go); // } // // StartCoroutine( ShowMessage(_Message, "Change of fate")); // Destroy(_currentIndicator); // shouldTransit = false; // GetComponent<AudioSource>().PlayOneShot(ChangeFateSound); // } // else if (hit.transform.gameObject.name == _theFlappyBirdGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theFlappyBirdGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.FlappyBird; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // //Destroy(go); // //Replace the matching tile with an empty one // _arrayOfShapes[(int)go.transform.position.x, (int)go.transform.position.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)go.transform.position.x, (int)go.transform.position.y, -1), transform.rotation) as GameObject; // if (!Matches.Contains(go)) // { // Matches.Add(go); // } // //StartCoroutine( ShowMessage(_Message, "Flappy Time")); // CreateAFlappyBird(_theFlappyBirdStartingPosition); // StartCoroutine(ShowMessage(_Message, "Tap Tap Tap...")); // Destroy(_currentIndicator); // shouldTransit = false; // GetComponent<AudioSource>().PlayOneShot(FlappySound); // } // else if (hit.transform.gameObject.name == _theResetimeGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theResetimeGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.TimeReset; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // //Replace the matching tile with an empty one // _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)gemPosition.x, (int)gemPosition.y, -1), transform.rotation) as GameObject; // FreezeTime(go); // Destroy(go); // if (!Matches.Contains(go)) // { // Matches.Add(go); // } // //StartCoroutine( ShowMessage(_Message, "Time saver")); // Destroy(_currentIndicator); // shouldTransit = false; // GetComponent<AudioSource>().PlayOneShot(ResetTimeSound); // } // else if (hit.transform.gameObject.name == _theBlackHoleGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theBlackHoleGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.BLackHole; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // var destroyingParticle = GameObject.Instantiate(_theBlackHoleGemEffectWhenMatch as GameObject, new Vector3(go.transform.position.x, go.transform.position.y, -2), transform.rotation) as GameObject; // Destroy(destroyingParticle, 1f); // //Replace the matching tile with an empty one // _arrayOfShapes[(int)go.transform.position.x, (int)go.transform.position.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)go.transform.position.x, (int)go.transform.position.y, -1), transform.rotation) as GameObject; // Destroy(go); // Destroy(_currentIndicator); // StartCoroutine(ShowBlackHole(go.transform.position)); // //shouldTransit= false; // GetComponent<AudioSource>().PlayOneShot(BlackHoleSound); // } // else if (hit.transform.gameObject.name == _theBombGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theBombGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.BombermanBomb; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // var destroyingParticle = GameObject.Instantiate(_theBombGemEffectWhenMatch as GameObject, new Vector3(go.transform.position.x, go.transform.position.y, -2), transform.rotation) as GameObject; // Destroy(destroyingParticle, 3f); // //Replace the matching tile with an empty one // _arrayOfShapes[(int)go.transform.position.x, (int)go.transform.position.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)go.transform.position.x, (int)go.transform.position.y, -1), transform.rotation) as GameObject; // Destroy(go); // //StartCoroutine( ShowMessage(_Message, "Bomberman")); // Destroy(_currentIndicator); // StartCoroutine(ShowBombermanBomb(go.transform.position)); // shouldTransit = false; // GetComponent<AudioSource>().PlayOneShot(BombermanSound); // } // else if (hit.transform.gameObject.name == _theFreezeGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theFreezeGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.Freeze; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // //Replace the matching tile with an empty one // _arrayOfShapes[(int)go.transform.position.x, (int)go.transform.position.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)go.transform.position.x, (int)go.transform.position.y, -1), transform.rotation) as GameObject; // Destroy(go); // if (!Matches.Contains(go)) // { // Matches.Add(go); // } // var destroyingParticle = GameObject.Instantiate(_theFreezeGemEffectWhenMatch as GameObject, new Vector3(go.transform.position.x, go.transform.position.y, -2), transform.rotation) as GameObject; // Destroy(destroyingParticle, 1f); // //StartCoroutine( ShowMessage(_Message, "Freeze time")); // Destroy(_currentIndicator); // StartCoroutine(FreezeGems(go.transform.position)); // shouldTransit = false; // GetComponent<AudioSource>().PlayOneShot(FreezeSound); // } // else if (hit.transform.gameObject.name == _theIncreasetimeGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theIncreasetimeGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.TimeIncrease; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // //Replace the matching tile with an empty one // _arrayOfShapes[(int)go.transform.position.x, (int)go.transform.position.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)go.transform.position.x, (int)go.transform.position.y, -1), transform.rotation) as GameObject; // if (!Matches.Contains(go)) // { // Matches.Add(go); // } // IncreaseTime(go); // Destroy(go); // //StartCoroutine( ShowMessage(_Message, "Time waster")); // Destroy(_currentIndicator); // shouldTransit = false; // GetComponent<AudioSource>().PlayOneShot(IncreaseTimeSound); // } // else if (hit.transform.gameObject.name == _theBlindnessGem.name + "(Clone)" || (_SecondObject != null && _SecondObject.name == _theBlindnessGem.name + "(Clone)")) // { // _thePlayingEffect = thePlayingEffect.Blindness; // GameObject go = _arrayOfShapes[(int)gemPosition.x, (int)gemPosition.y]; // //Replace the matching tile with an empty one // _arrayOfShapes[(int)go.transform.position.x, (int)go.transform.position.y] = GameObject.Instantiate(_emptyGameobject, new Vector3((int)go.transform.position.x, (int)go.transform.position.y, -1), transform.rotation) as GameObject; // Destroy(go); // if (!Matches.Contains(go)) // { // Matches.Add(go); // } // //StartCoroutine( ShowMessage(_Message, "Toxic vision")); // Destroy(_currentIndicator); // StartCoroutine(ShowBlindness(go.transform.position)); // shouldTransit = false; // GetComponent<AudioSource>().PlayOneShot(BlindnessSound); // } // //If the user select the second tile we will swap the two tile and animate them // if (shouldTransit) // { // //Getting the position between the 2 tiles // var distance = _FirstObject.transform.position - _SecondObject.transform.position; // //Testing if the 2 tiles are next to each others otherwise we will not swap them // if (Mathf.Abs(distance.x) <= 1 && Mathf.Abs(distance.y) <= 1) // { //If we dont want the player to swap diagonally // if (!_canTransitDiagonally) // { // if (distance.x != 0 && distance.y != 0) // { // Destroy(_currentIndicator); // _FirstObject = null; // _SecondObject = null; // return; // } // } // //Animate the transition // DoSwapMotion(_FirstObject.transform, _SecondObject.transform); // //Swap the object in array // DoSwapTile(_FirstObject, _SecondObject, ref _arrayOfShapes); // } // else // { // _FirstObject = null; // _SecondObject = null; // } // Destroy(_currentIndicator); // } // } //} }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; const string solutionName = "CK-Glouton"; const string solutionFileName = "../" + solutionName + ".sln"; var releasesDir = Cake.Directory("CodeCakeBuilder/Releases"); var projects = Cake.ParseSolution(solutionFileName) .Projects .Where(p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder"); // We do not publish .Tests projects for this solution. var projectsToPublish = projects .Where(p => !p.Path.Segments.Contains("Tests")); SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); // Configuration is either "Debug" or "Release". string configuration = "Debug"; Task("Check-Repository") .Does(() => { if (!gitInfo.IsValid) { if (Cake.IsInteractiveMode() && Cake.ReadInteractiveOption("Repository is not ready to be published. Proceed anyway?", 'Y', 'N') == 'Y') { Cake.Warning("GitInfo is not valid, but you choose to continue..."); } else if (!Cake.AppVeyor().IsRunningOnAppVeyor) { throw new Exception("Repository is not ready to be published."); } } if (gitInfo.IsValidRelease && (gitInfo.PreReleaseName.Length == 0 || gitInfo.PreReleaseName == "rc")) { configuration = "Release"; } Cake.Information("Publishing {0} projects with version={1} and configuration={2}: {3}", projectsToPublish.Count(), gitInfo.SafeSemVersion, configuration, projectsToPublish.Select(p => p.Name).Concatenate()); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("bin"))); Cake.CleanDirectories(releasesDir); }); Task("Restore-NPM-Package") .IsDependentOn("Clean") .Does(() => { var settings = new NpmInstallSettings(); settings.LogLevel = NpmLogLevel.Warn; settings.WorkingDirectory = "../src/CK.Glouton.Web/app"; settings.InstallLocally(); NpmInstallAliases.NpmInstall(this.Cake, settings); }); Task("NPM-Build") .IsDependentOn("Restore-NPM-Package") .IsDependentOn("Clean") .Does(() => { var settings = new NpmRunScriptSettings(); settings.LogLevel = NpmLogLevel.Info; settings.WorkingDirectory = "../src/CK.Glouton.Web/app"; settings.ScriptName = "build"; NpmRunScriptAliases.NpmRunScript(this.Cake, settings); }); Task("Build-With-Version") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .IsDependentOn("Restore-NPM-package") .IsDependentOn("NPM-Build") .Does(() => { using (var tempSln = Cake.CreateTemporarySolutionFile(solutionFileName)) { tempSln.ExcludeProjectsFromBuild("CodeCakeBuilder"); Cake.DotNetCoreBuild(tempSln.FullPath.FullPath, new DotNetCoreBuildSettings().AddVersionArguments(gitInfo, s => { s.Configuration = configuration; })); } }); Task("Unit-Testing") .IsDependentOn("Build-With-Version") .Does(() => { var testProjects = projects.Where(p => p.Path.Segments.Contains("Tests")); var testNetFrameworkDlls = testProjects .Where(p => p.Name.EndsWith(".NetFramework")) .Select(p => p.Path.GetDirectory().CombineWithFilePath("bin/" + configuration + "/net461/" + p.Name + ".dll")); Cake.Information("Testing: {0}", string.Join(", ", testNetFrameworkDlls.Select(p => p.GetFilename().ToString()))); Cake.NUnit(testNetFrameworkDlls); var testNetCoreDirectories = testProjects .Where(p => p.Name.EndsWith(".NetCore")) .Select(p => p.Path.GetDirectory()); Cake.Information("Testing: {0}", string.Join(", ", testNetCoreDirectories.Select(p => p.GetDirectoryName().ToString()))); foreach (var testNetCoreDirectory in testNetCoreDirectories) { Cake.DotNetCoreRun(testNetCoreDirectory.FullPath); } }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { Cake.CreateDirectory(releasesDir); foreach (SolutionProject p in projectsToPublish) { Cake.Warning(p.Path.GetDirectory().FullPath); var s = new DotNetCorePackSettings(); s.ArgumentCustomization = args => args.Append("--include-symbols"); s.NoBuild = true; s.Configuration = configuration; s.OutputDirectory = releasesDir; s.AddVersionArguments(gitInfo); Cake.DotNetCorePack(p.Path.GetDirectory().FullPath, s); } }); Task("Push-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Create-NuGet-Packages") .Does(() => { IEnumerable <FilePath> nugetPackages = Cake.GetFiles(releasesDir.Path + "/*.nupkg"); if (Cake.IsInteractiveMode()) { var localFeed = Cake.FindDirectoryAbove("LocalFeed"); if (localFeed != null) { Cake.Information("LocalFeed directory found: {0}", localFeed); if (Cake.ReadInteractiveOption("Do you want to publish to LocalFeed?", 'Y', 'N') == 'Y') { Cake.CopyFiles(nugetPackages, localFeed); } } } if (gitInfo.IsValidRelease) { // All Version PushNuGetPackages("MYGET_PREVIEW_API_KEY", "https://www.myget.org/F/glouton-preview/api/v2/package", nugetPackages); } else { Debug.Assert(gitInfo.IsValidCIBuild); PushNuGetPackages("MYGET_CI_API_KEY", "https://www.myget.org/F/glouton-ci/api/v2/package", nugetPackages); } if (Cake.AppVeyor().IsRunningOnAppVeyor) { Cake.AppVeyor().UpdateBuildVersion(gitInfo.SafeSemVersion); } }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-NuGet-Packages"); }