Value evaluate(Value x, Value y) { if (y.Type == Value.ValueType.Complex && x.Type != Value.ValueType.Complex) { x = new Complex(x.Number); } if (y.Type == Value.ValueType.Big && x.Type != Value.ValueType.Big) { x = new Big(x.Number); } if (x.Type == Value.ValueType.Case && y.Type != Value.ValueType.Case) { var _case = (Case)x; y = new Case(_case.Value, y, false, _case.Required, _case.Condition); } switch (x.Type) { case Value.ValueType.Date: case Value.ValueType.Rational: case Value.ValueType.Complex: case Value.ValueType.Big: case Value.ValueType.Case: case Value.ValueType.Object: case Value.ValueType.Set: return(MessagingState.SendMessage(x, Message, new Arguments(y))); default: return((x.IsArray || y.IsArray) && UseArrayVersion?evaluateArray(x, y) : Evaluate(x, y)); } }
public void Fix(Big big, ref Action action, Big big2) { action += Handler; var tr = __makeref(action); _ptr = (void *)&tr; }
public void TitleCaseJson() { var json = @"{ 'BigValues': [ { 'BigValue':99999999 }]}".Replace("'", "\""); var cfg = new Big(json); var problems = cfg.Errors(); Assert.AreEqual(0, problems.Length); Assert.AreEqual(99999999, cfg.BigValues.First().BigValue); }
public void TitleCaseXml() { const string xml = @"<cfg><BigValues><add BigValue=""99999999"" /></BigValues></cfg>"; var cfg = new Big(xml); var problems = cfg.Errors(); Assert.AreEqual(0, problems.Length); Assert.AreEqual(99999999, cfg.BigValues.First().BigValue); }
/// <summary> /// Convert the given number of bytes from the given array, from the given start /// position, into a long, using the bytes as the least significant part of the long. /// By the time this is called, the arguments have been checked for validity. /// </summary> /// <param name="value">The bytes to convert</param> /// <param name="startIndex">The index of the first byte to convert</param> /// <param name="bytesToConvert">The number of bytes to use in the conversion</param> /// <returns>The converted number</returns> protected internal override long FromBytes(byte[] value, int startIndex, int bytesToConvert) { if (this.IsLittleEndian()) { return(Little.FromBytes(value, startIndex, bytesToConvert)); } return(Big.FromBytes(value, startIndex, bytesToConvert)); }
private static void CovarianceTest() { //covariance allows you to use a derived class where a base class is expected (rule: can accept big if small is expected). Small s1 = new Small(); Small s2 = new Big(); Small s3 = new Bigger(); Big b1 = new Big(); Big b2 = new Bigger(); //Big b3 = new Small(); }
/// <summary> /// Copies the given number of bytes from the least-specific /// end of the specified value into the specified byte array, beginning /// at the specified index. /// This must be implemented in concrete derived classes, but the implementation /// may assume that the value will fit into the buffer. /// </summary> /// <param name="value">The value to copy bytes for</param> /// <param name="bytes">The number of significant bytes to copy</param> /// <param name="buffer">The byte array to copy the bytes into</param> /// <param name="index">The first index into the array to copy the bytes into</param> protected internal override void CopyBytesImpl(long value, int bytes, byte[] buffer, int index) { if (this.IsLittleEndian()) { Little.CopyBytesImpl(value, bytes, buffer, index); } else { Big.CopyBytesImpl(value, bytes, buffer, index); } }
public void SlugsXml() { const string xml = @"<cfg><big-values><add big-value=""99999999"" /></big-values></cfg>"; var cfg = new Big(xml); var problems = cfg.Errors(); Assert.AreEqual(0, problems.Length); Assert.AreEqual(0, cfg.Sequence); Assert.AreEqual(1, cfg.BigValues.First().Sequence); Assert.AreEqual(99999999, cfg.BigValues.First().BigValue); }
public static void Execute() { Small sm1 = new Small(); Small sm2 = new Big(); Small sm3 = new Bigger(); Big big1 = new Big(); Big big2 = new Bigger(); //IMyInterface2 imyint1 = new Bigger(); //Huge h1 = new Big(); //Big big3 = new Huge(); //Big big3 = new Small(); }
private void big_Click(object sender, EventArgs e) { string Name = Convert.ToString(name.Text); int Age = Convert.ToInt32(age.Text); double Chinese = Convert.ToDouble(chinese.Text); double Math = Convert.ToDouble(math.Text); double English = Convert.ToDouble(english.Text); Big stu = new Big(Name, Age, Chinese, Math, English); result.Text += "\n" + "总人数:" + Student.number + "姓名:" + stu.Name + ",中学生,平均成绩为:" + stu.Average() + "\r\n"; }
public void CamelCaseJson() { var json = @"{ 'bigValues': [ { 'bigValue':99999999 }]}".Replace("'", "\""); var cfg = new Big(json); var problems = cfg.Errors(); foreach (var problem in problems) { Console.WriteLine(problem); } Assert.AreEqual(0, problems.Length); Assert.AreEqual(99999999, cfg.BigValues.First().BigValue); }
public void SlugsJson() { var json = @"{'big-values':[ { 'big-value':99999999 }]}".Replace("'", "\""); var cfg = new Big(json); var problems = cfg.Errors(); foreach (var problem in problems) { Console.WriteLine(problem); } Assert.AreEqual(0, problems.Length); Assert.AreEqual(99999999, cfg.BigValues.First().BigValue); }
private static void Example1() { //Covariance : an instance of more derived type object/class to be assign to less derived type object or class. //Pass derive type where base type expected Small sm1 = new Small(); Small sm2 = new Big(); Small sm3 = new Bigger(); Big b1 = new Big(); Big b2 = new Bigger(); //Contravarience //Big b3 = new Small(); }
void Start() { velocidad = velocidadInicial; spawnerObject = GameObject.Find("Spawner"); zombieScript = spawnerObject.GetComponent <Zombie>(); bigScript = spawnerObject.GetComponent <Big>(); crispScript = spawnerObject.GetComponent <Crisp>(); bossScript = spawnerObject.GetComponent <Boss>(); throwScript = spawnerObject.GetComponent <Throw>(); aoeScript = spawnerObject.GetComponent <Aoe>(); mouse = GameObject.Find("cursor"); audioSource = gameObject.GetComponent <AudioSource>(); audioScript = GameObject.Find("Audios").GetComponent <Audios>(); audioGeneral = GameObject.Find("Audios").GetComponent <AudioSource>(); vidaSprite = GameObject.Find("vida"); bonusSprite = GameObject.Find("bonus"); }
private void SelectField() { Console.WriteLine($"Select the field{Environment.NewLine}1 - Small field (10x15){Environment.NewLine}2 - Big field (50x55)"); try { ConsoleKeyInfo entry = Console.ReadKey(intercept: true); switch (entry.Key) { case ConsoleKey.D1: { PlayerField = new Small(10, 15, 2, 2, 3); break; } case ConsoleKey.D2: { PlayerField = new Big(50, 55, 9, 15, 11); break; } default: { Console.WriteLine($"Invalid number"); SelectField(); break; } } } catch (Exception) { Console.WriteLine($"Invalid number"); SelectField(); } }
protected override void Initialise(CommandLine cl) { if (cl.args.Count != 2) { // TODO We should probably allow multiple file names on the command line if (Utils.IsLinux) { throw new SyntaxException("The put command requires two parameters. Did you remember to escape wildcard parameters?"); } else { throw new SyntaxException("The put command requires two parameters"); } } keyArgument = cl.args[0]; fileArgument = cl.args[1]; acl = Acl.GetOptionParameter(cl, typeof(Acl), false); backup = cl.options.ContainsKey(typeof(Backup)); sync = cl.options.ContainsKey(typeof(Sync)); big = cl.options.ContainsKey(typeof(Big)); sub = cl.options.ContainsKey(typeof(Sub)); storageClass = StorageClass.GetOptionParameter(cl, typeof(StorageClass), false); if (sub) { subWithDelete = (cl.options[typeof(Sub)] as Sub).withDelete; } if (big && sub) { throw new SyntaxException("The /big option is not currently compatible with the /sub option"); } if (big && sync) { throw new SyntaxException("There is no need to specify the /sync option with the /big option because /big uses checksums to upload only the chunks that need to be uploaded"); } if (big) { Big bigOption = (Big)cl.options[typeof(Big)]; perChunkBytes = (long)(bigOption.chunkMegabytes * 1024.0 * 1024.0); } int slashIdx = keyArgument.IndexOf("/"); if (slashIdx == -1) { baseKey = ""; bucket = keyArgument; } else { baseKey = keyArgument.Substring(slashIdx + 1); bucket = keyArgument.Substring(0, slashIdx); if (sub && !baseKey.EndsWith("/")) { throw new SyntaxException("With the /sub option, either specify a bucket name only or a key that ends with a slash (/)"); } } }
static Small Method2(Big bg) { Console.WriteLine("Method2"); return(new Small()); }
static Big Method1(Big bg) { Console.WriteLine("Method1"); return(new Big()); }
public static Big Method1(Big bg) { Console.WriteLine("Test Corvariance Method1."); return(new Big()); }
public static Small Method2(Big bg) { Console.WriteLine("Test Corvariance Method2."); return(new Small()); }
// Use this for initialization void Start() { float width = Screen.width; float height = Screen.height; float W_height = 10; float W_width = width / height * W_height; Vector2 max_vec = new Vector2(width, height); select.GetComponent <RectTransform>().localPosition = max_vec; select.GetComponent <RectTransform>().sizeDelta = max_vec; back_home.GetComponent <RectTransform>().localPosition = new Vector3(-0.34f * width, -0.46f * height, 0); back_home.GetComponent <RectTransform>().sizeDelta = new Vector2(0.3f * width, 0.06f * height); stage3.GetComponent <RectTransform>().localPosition = new Vector3(0.12f * width, 0.3f * height, 0); stage3.GetComponent <RectTransform>().sizeDelta = new Vector2(0.5f * width, 0.35f * height); stage2.GetComponent <RectTransform>().localPosition = new Vector3(-0.2f * width, 0.05f * height, 0); stage2.GetComponent <RectTransform>().sizeDelta = new Vector2(0.48f * width, 0.3f * height); stage1.GetComponent <RectTransform>().localPosition = new Vector3(0.2f * width, -0.13f * height, 0); stage1.GetComponent <RectTransform>().sizeDelta = new Vector2(0.48f * width, 0.2f * height); stage0.GetComponent <RectTransform>().localPosition = new Vector3(-0.2f * width, -0.28f * height, 0); stage0.GetComponent <RectTransform>().sizeDelta = new Vector2(0.35f * width, 0.13f * height); detail.GetComponent <RectTransform>().localPosition = max_vec; detail.GetComponent <RectTransform>().sizeDelta = max_vec; Big.GetComponent <RectTransform>().localPosition = new Vector3(0, 0.1f * height, 0); Big.GetComponent <RectTransform>().sizeDelta = new Vector2(0.95f * width, 1.3f * width); Dtitle.GetComponent <RectTransform>().localPosition = new Vector3(0, 0.4f * height, 0); Dtitle.GetComponent <RectTransform>().sizeDelta = new Vector2(0.95f * width, 0.2f * width); text.GetComponent <RectTransform>().localPosition = new Vector3(0, -0.28f * height, 0); text.GetComponent <RectTransform>().sizeDelta = new Vector2(0.9f * width, 0.25f * height); Title.GetComponent <RectTransform>().localPosition = new Vector3(0, 0.451f * height, 0); Title.GetComponent <RectTransform>().sizeDelta = new Vector2(width, 0.11f * height); Menu.GetComponent <RectTransform>().localPosition = new Vector3(0, -0.44f * height, 0); Menu.GetComponent <RectTransform>().sizeDelta = new Vector2(width, 0.12f * height); BG.GetComponent <RectTransform>().sizeDelta = new Vector2(5f * width, height); BG.GetComponent <RectTransform>().localPosition = new Vector2(2f * width, 0); HP.GetComponent <RectTransform>().sizeDelta = new Vector2(0.6f * width, 0.1f * height); HP.GetComponent <RectTransform>().localPosition = new Vector3(0.2f * width, 0.12f * height); home_img.GetComponent <RectTransform>().sizeDelta = new Vector2(1.3f * width, 1.05f * height); home_img.GetComponent <RectTransform>().localPosition = new Vector2(-2.1f * width, -0.1f * height); Ready.sizeDelta = new Vector2(0.34f * width, 0.2f * height); Ready.localPosition = new Vector3(0.3f * width, -0.26f * height); GameObject.Find("Hikousen").GetComponent <RectTransform>().sizeDelta = new Vector2(0.2f * width, 0.1f * height); for (int n = 0; n < 12; n++) { int i = Mathf.FloorToInt(n / 4f); int j = Mathf.RoundToInt(n % 4f); box_Chara[n].GetComponent <RectTransform>().sizeDelta = new Vector2(0.25f * width, 0.15f * height); box_Chara[n].GetComponent <RectTransform>().localPosition = new Vector3((-0.375f + j * 0.25f) * width, (0.02f - 0.15f * i) * height); texts[n].GetComponent <RectTransform>().sizeDelta = new Vector2(0.23f * width, 0.14f * height); //texts[n].GetComponent<RectTransform>().localPosition = new Vector3(0, - 0.1f * height); } party_Chara[0].GetComponent <RectTransform>().sizeDelta = new Vector2(0.33f * width, 0.25f * height); party_Chara[0].GetComponent <RectTransform>().localPosition = new Vector3(0.33f * width, 0.26f * height); party_Chara[1].GetComponent <RectTransform>().sizeDelta = new Vector2(0.33f * width, 0.25f * height); party_Chara[1].GetComponent <RectTransform>().localPosition = new Vector3(0, 0.26f * height); party_Chara[2].GetComponent <RectTransform>().sizeDelta = new Vector2(0.33f * width, 0.25f * height); party_Chara[2].GetComponent <RectTransform>().localPosition = new Vector3(-0.33f * width, 0.26f * height); Ptext[0].GetComponent <RectTransform>().sizeDelta = new Vector2(0.3f * width, 0.22f * height); Ptext[1].GetComponent <RectTransform>().sizeDelta = new Vector2(0.3f * width, 0.22f * height); Ptext[2].GetComponent <RectTransform>().sizeDelta = new Vector2(0.3f * width, 0.22f * height); Destroy(this.gameObject, 1f); /*PlayerPrefs.SetInt("Box_ID" + 1, 3); * PlayerPrefs.SetInt("Box_ID" + 2, 2); * PlayerPrefs.SetInt("Box_ID" + 3, 4); * PlayerPrefs.SetInt("Box_ID" + 4, 3); * PlayerPrefs.SetInt("Box_ID" + 5, 2);*/ }
public void Build(Package package) { HashSet <UInt32> types = new HashSet <uint>(); Dictionary <UInt32, List <ProjectFile> > files = new Dictionary <uint, List <ProjectFile> >(); Big big = new Big(); Big bundle_patch = new Big(); foreach (var file in Files) { if (types.Add(file.Type)) { if (!files.ContainsKey(file.Type)) { files[file.Type] = new List <ProjectFile>(); } } files[file.Type].Add(file); String full_path = Path.GetFullPath(Path.Combine(DirPath, file.Filename)); if (file.Type == 0x100) // bundle { bundle_patch.AddFile(file.FileID, full_path, file.Flags); } else { big.AddFile(file.FileID, full_path, file.Flags); } } foreach (var t in types) { var init_id = Utils.SH(String.Format(".\\{0}\\{1}_init.bin", package.PackageName, Utils.BundleTypeName(t))); var bundle_id = Utils.SH(String.Format(".\\{0}\\bundles\\{1}.bundle", package.PackageName, Utils.BundleMgrName(t))); var init_file = package.Main.FindFirst(init_id); var bundle_file = package.Main.FindFirst(bundle_id); if (init_file != null) { Init init = new Init(); init.Load(init_file.GetStream()); bool changed = false; foreach (var file in files[t]) { if (init.Add(file.FileID, file.SymbolName.GetHash())) { changed = true; } } if (changed) { String init_filename = String.Format("tmp\\{0}_init.bin", Utils.BundleTypeName(t)); init.Save(new FileStream(init_filename, FileMode.Create)); big.AddFile(init_id, init_filename, 0x14); } } if (bundle_file != null) { Bundle bundle = new Bundle(); bundle.Load(bundle_file.GetStream()); bool changed = false; foreach (var file in files[t]) { if (bundle.Add(file.FileID, (byte)file.Type, false)) { changed = true; } } if (changed) { String bundle_filename = String.Format("tmp\\{0}.bundle", Utils.BundleMgrName(t)); bundle.Save(new FileStream(bundle_filename, FileMode.Create)); bundle_patch.AddFile(bundle_id, bundle_filename, 0x14); } } } Directory.CreateDirectory(Path.Combine(package.BasePath, "Patches")); big.Build(Path.Combine(package.BasePath, "Patches", "generated_patch.big")); bundle_patch.Build(Path.Combine(package.BasePath, "BundleTarget", "generated_patch.big")); }