void Start () { if (instance != null) { Destroy(gameObject, 0f); return; } DontDestroyOnLoad(gameObject); instance = this; }
public DimensionCube(Basics.BBox3D bbox, Color color, bool above) { _position = bbox.PtMin; _dim[0] = bbox.Length; _dim[1] = bbox.Width; _dim[2] = bbox.Height; _color = color; _above = above; for (int i = 0; i < 3; ++i) _showArrow[i] = true; BuildPoints(); }
public void Test003_SerializeString() { // Non null string using (var serialized = new ReusableMemoryStream(null)) { Basics.SerializeString(serialized, TheValue); Assert.AreEqual(2 + Value.Length, serialized.Length); serialized.Position = 0; Assert.AreEqual(TheValue.Length, BigEndianConverter.ReadInt16(serialized)); CompareArrays(Value, serialized.GetBuffer(), 2); } // Null string using (var serialized = new ReusableMemoryStream(null)) { Basics.SerializeString(serialized, null); Assert.AreEqual(2, serialized.Length); serialized.Position = 0; Assert.AreEqual(-1, BigEndianConverter.ReadInt16(serialized)); } }
public double gotoNextRetroSolarCusp(double ut) { return(ut); #if DND Longitude cusp_start = new Longitude(0); Longitude cusp_end = new Longitude(0); BodyPosition bp_sun = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(Body.Name.Sun), Body.Name.Sun, BodyType.Name.Other); BodyPosition bp_b = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other); Longitude diff = bp_b.longitude.sub(bp_sun.longitude); if (Transit.CircLonLessThan(cusp_start, diff) && Transit.CircLonLessThan(diff, cusp_end)) { return(ut); } Longitude diffIncrease = diff.sub(cusp_start); double ret = ut + (diffIncrease.value * 360.0 / 365.2425); return(ret); #endif }
public ActionResult E_Contact() { Basics basic = (from e in db.Basics select e).OrderByDescending(e => e.BasicID) .FirstOrDefault(); ViewBag.email = basic.email; ViewBag.callus = basic.callus; ViewBag.parImgtxt = basic.parImgtxt; IEnumerable <Services> Service = (from e in db.Services select e); string s = ""; foreach (Services item in Service) { s += item.enName + ","; } ViewBag.service = s; return(View(basic)); }
public ActionResult E_GetSearchProduct(string searchname) { try { Basics basic = (from e in db.Basics select e).OrderByDescending(e => e.BasicID) .FirstOrDefault(); ViewBag.email = basic.email; ViewBag.callus = basic.callus; ViewBag.parImgtxt = basic.parImgtxt; IEnumerable <SocialMedia> SocialMedialist = (from e in db.SocialMedia select e); ViewData["listSocial"] = SocialMedialist; IEnumerable <Services> Service = (from e in db.Services select e); string s = ""; foreach (Services item in Service) { s += item.enName + ","; } ViewBag.service = s; con.Close(); con.Open(); com = new SqlCommand("select * from Products where enText like '%" + searchname + "%'", con); SqlDataReader SqlDr = com.ExecuteReader(); DataTable d = new DataTable(); d.Load(SqlDr); ViewBag.c**t = d.Rows.Count; con.Close(); return(View("~/Views/Home/E_Products.cshtml", d)); } catch { return(View()); } }
public void init(double x1, double y1, double x2, double y2, double x3, double y3) { m_start_x = x1; m_start_y = y1; m_end_x = x3; m_end_y = y3; double dx1 = x2 - x1; double dy1 = y2 - y1; double dx2 = x3 - x2; double dy2 = y3 - y2; double len = Math.Sqrt(dx1 * dx1 + dy1 * dy1) + Math.Sqrt(dx2 * dx2 + dy2 * dy2); m_num_steps = (int)Basics.UnsignedRound(len * 0.25 * m_scale); if (m_num_steps < 4) { m_num_steps = 4; } double subdivide_step = 1.0 / m_num_steps; double subdivide_step2 = subdivide_step * subdivide_step; double tmpx = (x1 - x2 * 2.0 + x3) * subdivide_step2; double tmpy = (y1 - y2 * 2.0 + y3) * subdivide_step2; m_saved_fx = m_fx = x1; m_saved_fy = m_fy = y1; m_saved_dfx = m_dfx = tmpx + (x2 - x1) * (2.0 * subdivide_step); m_saved_dfy = m_dfy = tmpy + (y2 - y1) * (2.0 * subdivide_step); m_ddfx = tmpx * 2.0; m_ddfy = tmpy * 2.0; m_step = m_num_steps; }
public async Task Roll(CommandContext ctx) { Console.WriteLine(DateTime.Now.ToString("[HH:mm:ss] ", CultureInfo.CreateSpecificCulture("en-GB")) + "Roll Command"); string nick = ctx.Member.DisplayName; string message; try { int number = Basics.Roll(ctx.Message.Content); message = nick + " rolled a " + number; await ctx.RespondAsync(message).ConfigureAwait(false); } catch (FormatException) { await ctx.RespondAsync("Wrong Format").ConfigureAwait(false); } catch (OverflowException) { await ctx.RespondAsync("Number too large").ConfigureAwait(false); } }
public void TestDeserializeOffsetResponse() { var response = new CommonResponse <OffsetPartitionResponse> { TopicsResponse = new [] { new TopicData <OffsetPartitionResponse> { TopicName = "yoleeroy", PartitionsData = new[] { new OffsetPartitionResponse { ErrorCode = ErrorCode.BrokerNotAvailable, Partition = 32, Offsets = new [] { 1L, 142L } } } } } }; using (var serialized = new ReusableMemoryStream(null)) { Basics.WriteArray(serialized, response.TopicsResponse); TestCommonResponse(serialized, null, response, (p1, p2) => { if (p1.Partition != p2.Partition) { return(false); } if (p1.ErrorCode != p2.ErrorCode) { return(false); } Assert.AreEqual(p1.Offsets.Length, p2.Offsets.Length); CollectionAssert.AreEqual(p1.Offsets, p2.Offsets); return(true); }); } }
public static string GetByQuerySimple(string query, string connectionString) { string res = ConstantValue.EmptyJsonList; using (var cmd = new SqlCommand(query)) { cmd.CommandType = CommandType.Text; using (var cnn = new SqlConnection(connectionString)) { cmd.Connection = cnn; res = Basics.SQLStreamSimple(cmd); } } // Si no existe se devuelve un item vacío con id -1 if (string.IsNullOrEmpty(res)) { res = "{Id:-1}"; } return(res); }
public ActionResult GetSearchProduct(string searchname) { try { // string dd= RouteData.Values["CategoryID"].ToString(); Basics basic = (from e in db.Basics select e).First(); ViewBag.email = basic.email; ViewBag.callus = basic.callus; ViewBag.parImgtxt = basic.parImgtxt; IEnumerable <SocialMedia> SocialMedialist = (from e in db.SocialMedia select e); ViewData["listSocial"] = SocialMedialist; IEnumerable <Services> Service = (from e in db.Services select e); string s = ""; foreach (Services item in Service) { s += item.Name + ","; } ViewBag.service = s; con.Close(); con.Open(); com = new SqlCommand("select * from Products where Text like N'%" + searchname + "%'", con); SqlDataReader SqlDr = com.ExecuteReader(); DataTable d = new DataTable(); d.Load(SqlDr); ViewBag.c**t = d.Rows.Count; con.Close(); return(View("~/Views/Home/Products.cshtml", d)); } catch (Exception) { throw; } }
public ActionResult About() { Basics basic = (from e in db.Basics select e).First(); ViewBag.email = basic.email; ViewBag.callus = basic.callus; ViewBag.parImgtxt = basic.parImgtxt; IEnumerable <SocialMedia> SocialMedialist = (from e in db.SocialMedia select e); ViewData["listSocial"] = SocialMedialist; IEnumerable <Services> Service = (from e in db.Services select e); string s = ""; foreach (Services item in Service) { s += item.Name + ","; } ViewBag.service = s; return(View(basic)); }
public void TestSerializeOffsetRequest() { var offset = new OffsetRequest { TopicsData = new[] { new TopicData <OffsetPartitionData> { TopicName = "boloss", PartitionsData = new[] { new OffsetPartitionData { MaxNumberOfOffsets = 3, Partition = 123, Time = 21341 } } } } }; using (var serialized = offset.Serialize(new ReusableMemoryStream(null), 1235, ClientId, null)) { CheckHeader(Basics.ApiKey.OffsetRequest, 0, 1235, TheClientId, serialized); Assert.AreEqual(-1, BigEndianConverter.ReadInt32(serialized)); // ReplicaId Assert.AreEqual(1, BigEndianConverter.ReadInt32(serialized)); // 1 topic data Assert.AreEqual(offset.TopicsData.First().TopicName, Basics.DeserializeString(serialized)); Assert.AreEqual(1, BigEndianConverter.ReadInt32(serialized)); // 1 partition data var od = new OffsetPartitionData(); od.Deserialize(serialized, null); Assert.AreEqual(123, od.Partition); Assert.AreEqual(21341, od.Time); Assert.AreEqual(3, od.MaxNumberOfOffsets); } }
public ActionResult Index() { Basics basic = (from e in db.Basics select e).First(); ViewBag.email = basic.email; ViewBag.callus = basic.callus; ViewBag.parImgtxt = basic.parImgtxt; string image = (from e in db.ImageBackground select e.imgSrc).First(); ViewBag.ImageBackground = image; IEnumerable <Services> Service = (from e in db.Services select e); string s = ""; foreach (Services item in Service) { s += item.Name + ","; } ViewBag.service = s; return(View(basic)); }
private static void commandHandler() { if (command == COMMAND_MULTIPLAYER || command == COMMAND_COMPUTER) { while (winner == null) { Basics.renderGame(); if (currentTurn % 2 == 0 && command == COMMAND_COMPUTER) { Mechanics.checkGame(); Computer.Handler(); } else { Player.Handler(); } if (currentTurn > 4) { Mechanics.checkGame(); } } Basics.resetGame(); } }
public void Calculate(IImageFilterFunction <T> filter, bool normalization) { T r = filter.Radius(); ReAllocLut(r); uint i; uint pivot = Diameter() << ((int)SubPixelScale.Shift - 1); for (i = 0; i < pivot; i++) { T x = M.New <T>(i).Divide((double)SubPixelScale.Scale); T y = filter.CalcWeight(x); m_weight_array.Array[pivot + i] = m_weight_array.Array[pivot - i] = (short)Basics.RoundInt(y.Multiply((int)FilterScale.Scale)); } uint end = (Diameter() << (int)SubPixelScale.Shift) - 1; m_weight_array.Array[0] = m_weight_array.Array[end]; if (normalization) { Normalize(); } }
public ActionResult Home(Basics bas, string addr) { try { int[] r = new int[2]; r = getids(); int brow = r[0]; int benrow = r[1]; con.Open(); if (brow == 0 && benrow == 0) { com = new SqlCommand("insert into Basics(email,Address,website,callus) Values ('" + bas.email + "',N'" + bas.Address + "','" + bas.website + "','" + bas.callus + "')", con); com.ExecuteNonQuery(); com = new SqlCommand("insert into Basics(Address) Values ('" + addr + "')", con); com.ExecuteNonQuery(); con.Close(); ViewBag.msg = "your Data inserted successfully"; } else { com = new SqlCommand("update Basics set email='" + bas.email + "',Address=N'" + bas.Address + "',website='" + bas.website + "',callus='" + bas.callus + "' where BasicID=" + brow, con); com.ExecuteNonQuery(); com = new SqlCommand("update Basics set Address='" + addr + "' where BasicID=" + benrow, con); com.ExecuteNonQuery(); con.Close(); ViewBag.msg = "your Data Edited successfully"; } return(Redirect("Home")); } catch { ViewBag.Emsg = "your Data didn't insert correctly"; return(View()); } }
protected virtual IfStatementSyntax GenerateIfBsonTypeNull() { return(SF.IfStatement( condition: SF.BinaryExpression( SyntaxKind.EqualsExpression, Basics.TryParseBsonTypeIdentifier, SF.Token(SyntaxKind.EqualsEqualsToken), Basics.NumberLiteral(10) ), statement: SF.Block( SF.ExpressionStatement( SF.AssignmentExpression( kind: SyntaxKind.SimpleAssignmentExpression, left: Basics.SimpleMemberAccess(Basics.TryParseOutVariableIdentifier, Basics.IdentifierName(MemberDecl.DeclSymbol)), right: SF.LiteralExpression(SyntaxKind.DefaultLiteralExpression)) ), SF.ContinueStatement()) )); }
public static async Task <bool> MainAsync() { try { Console.WriteLine("Starting demo of InstaSharper project"); // create user session data and provide login details var userSession = new UserSessionData { UserName = "******", Password = "******" }; // create new InstaApi instance using Builder _instaApi = new InstaApiBuilder() .SetUser(userSession) .UseLogger(new DebugFileLogger()) // use logger for requests and debug messages .SetRequestDelay(TimeSpan.FromSeconds(1)) // set delay between requests .Build(); // login Console.WriteLine($"Logging in as {userSession.UserName}"); var logInResult = await _instaApi.LoginAsync(); if (!logInResult.Succeeded) { Console.WriteLine($"Unable to login: {logInResult.Info.Message}"); } else { Console.WriteLine("Press 1 to start basic demo samples"); Console.WriteLine("Press 2 to start upload photo demo sample"); Console.WriteLine("Press 3 to start comment media demo sample"); var key = Console.ReadKey(); Console.WriteLine(Environment.NewLine); switch (key.Key) { case ConsoleKey.D1: var basics = new Basics(_instaApi); await basics.DoShow(); break; case ConsoleKey.D2: var upload = new UploadPhoto(_instaApi); await upload.DoShow(); break; case ConsoleKey.D3: var comment = new CommentMedia(_instaApi); await comment.DoShow(); break; default: break; } Console.WriteLine("Done. Press esc key to exit..."); key = Console.ReadKey(); return(key.Key == ConsoleKey.Escape); } } catch (Exception ex) { Console.WriteLine(ex); } finally { var logoutResult = Task.Run(() => _instaApi.LogoutAsync()).GetAwaiter().GetResult(); if (logoutResult.Succeeded) { Console.WriteLine("Logout succeed"); } } return(false); }
public override string GetSectionUrl(Project project) { return(Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditExpectedPerformanceMeasureValues(project.ProjectID)) : null); }
public override string GetSectionUrl(Project project) { return(Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Regions(project.ProjectID)) : null); }
public void CalculateSumTestInvalid() { int result = Basics.CalculateSum("1+"); }
public void CalculateSumTestFormatException() { int result = Basics.CalculateSum("a+b"); }
public void FibonacciTest() { Assert.AreEqual(8, Basics.FibonacciSequence(6)); }
public void PIPrecisionTest() { int iterations = Basics.PIPrecision(); Assert.AreEqual(10372345, iterations); }
public int Calculate(int x, int y, int d) { return((int)Basics.UnsignedRound(System.Math.Abs(System.Math.Atan2((double)(y), (double)(x))) * (double)(d) / System.Math.PI)); }
//-------------------------------------------------------------------- public Gray8(RGBA_Doubles c, double a_) { v = ((byte)Basics.UnsignedRound((0.299 * c.R_Byte + 0.587 * c.G_Byte + 0.114 * c.B_Byte) * (double)(base_mask))); a = ((byte)Basics.UnsignedRound(a_ * (double)(base_mask))); }
public int Calculate(int x, int y, int d) { return((int)Basics.UnsignedRound(System.Math.Sqrt((double)(x) * (double)(x) + (double)(y) * (double)(y)))); }
private void Grow(Geometry.Point a, Geometry.Point b, Geometry.Point t) { Perimeter -= Basics.DistanceBetween(a, b); Area += Math.Abs(Basics.Area(a, b, t)); }
public Polygon(Geometry.Point a, Geometry.Point b, Geometry.Point c) { PushFront(b); if (b.IsLighted(a, c)) { PushFront(a); PushBack(c); } else { PushFront(c); PushBack(a); } Perimeter = Basics.DistanceBetween(a, b) + Basics.DistanceBetween(b, c) + Basics.DistanceBetween(c, a); Area = Math.Abs(Basics.Area(a, b, c)); }
//-------------------------------------------------------------------- public Gray8(RGBA_Doubles c, double a_) { v = ((byte)Basics.RoundUint((0.299 * c.R_Byte + 0.587 * c.G_Byte + 0.114 * c.B_Byte) * (double)(BaseMask))); a = ((byte)Basics.RoundUint(a_ * (double)(BaseMask))); }
static void RunApp() { bool appRunning = true; Console.Clear(); while (appRunning) { Console.Write("Select a subject: a for basics, b for polymorphism, c for interfaces, d for generics, z for jawed, e to exit" + "\n"); string caseSwitch = Console.ReadLine(); System.Console.WriteLine("\n"); switch (caseSwitch) { case "a": Console.Clear(); Basics basics = new Basics(); basics.ToggleState(true); if (basics.isRunning) { basics.AddMainLogic(); } else { System.Console.WriteLine("Basics not running"); } System.Console.WriteLine("\n"); break; case "b": Console.Clear(); Polymorphism polymorphism = new Polymorphism(); polymorphism.ToggleState(true); if (polymorphism.isRunning) { polymorphism.AddMainLogic(); System.Console.ResetColor(); } else { System.Console.WriteLine("Polymorphism not running"); } System.Console.WriteLine("\n"); break; case "c": Console.Clear(); Interfaces interfaces = new Interfaces(); interfaces.ToggleState(true); if (interfaces.isRunning) { interfaces.AddMainLogic(); System.Console.ResetColor(); } else { System.Console.WriteLine("interfaces not running"); } System.Console.WriteLine("\n"); break; case "d": Console.Clear(); Generics generics = new Generics(); generics.ToggleState(true); if (generics.isRunning) { generics.AddMainLogic(); } break; case "z": Console.Clear(); Jawed jawed = new Jawed(); jawed.ToggleState(true); if (jawed.isRunning) { jawed.AddMainLogic(); } break; case "e": System.Console.WriteLine("Shutting down"); Console.Clear(); appRunning = false; break; default: Console.Clear(); System.Console.WriteLine("Not a valid option please try again."); break; } } }