public Status(float AviableMoney, float currentstack, bool ontable, PT pt = PT.HUMAN) { _AviableMoney = AviableMoney; _currentstack = currentstack; _ontable = ontable; player = pt; }
private static object GetAttachedObject(string propertyName, object attachedTo) { // This function assumes that the propertyName is not a path (no '.' in it) int index = propertyName.IndexOf('['); string nonIndexedProperty = (index < 0) ? propertyName : propertyName.Substring(0, index); TrustedType trustedType = PT.Trust(attachedTo.GetType()); TrustedPropertyInfo property = trustedType.GetProperty(nonIndexedProperty); object returnValue = property.GetValue(attachedTo, null); if (index < 0) { // This isn't a collection, just return what we got. return(returnValue); } else { // This is a collection. Parse the index string and return the value at that index. int indexLength = propertyName.Length - nonIndexedProperty.Length - 2; string s = propertyName.Substring(index + 1, indexLength).Trim(); int i = StringConverter.ToInt(s); // Visual3DCollection does not implement IList like the other collections do :( if (returnValue is Visual3DCollection) { return(((Visual3DCollection)returnValue)[i]); } else { return(((IList)returnValue)[i]); } } }
public bool Parse(string Text) { compilerDirectives = new List <compiler_directive>(); PT parsertools = new PT(); // контекст сканера и парсера parsertools.errors = Errs; parsertools.CurrentFileName = Path.GetFullPath(FileName); var scanner = new PreprocessorScanner(); scanner.SetSource(Text, 0); //scanner.parsertools = parsertools;// передали parsertools в объект сканера var parser = new PreprocessorParser(scanner); parser.compilerDirectives = compilerDirectives; //parser.parsertools = parsertools; // передали parsertools в объект парсера if (!parser.Parse()) { parsertools.AddError("Неопознанная синтаксическая ошибка препроцессора!", null); return(false); } return(true); }
public expression ParseExpression(string Text, int line, int col) { PT parsertools = new PT(); // контекст сканера и парсера parsertools.errors = new List <Error>(); parsertools.warnings = new List <CompilerWarning>(); parsertools.CurrentFileName = System.IO.Path.GetFullPath(this.parsertools.CurrentFileName); parsertools.build_tree_for_format_strings = true; Scanner scanner = new Scanner(); scanner.SetSource("<<expression>>" + Text, 0); scanner.parsertools = parsertools;// передали parsertools в объект сканера GPPGParser parser = new GPPGParser(scanner); parsertools.build_tree_for_formatter = false; parser.lambdaHelper = this.lambdaHelper; parser.parsertools = parsertools; if (!parser.Parse()) { if (parsertools.errors.Count == 0) { parsertools.AddError("Неопознанная синтаксическая ошибка!", null); } } foreach (Error err in parsertools.errors) { this.parsertools.errors.Add(err); } return(parser.root as expression); }
public List <PT> GetPointsInRoom(int group_id) { // find seed with matching group_id PT seed = new PT() { x = -1, y = -1 }; foreach (PT v in seeds) { if (map.t(v).group_id == group_id) { seed = v; break; } } // make sure we actually found something if (seed.x < 0 || seed.y < 0) { Console.WriteLine("group id " + group_id + " not found!"); return(null); } List <PT> visited = new List <PT>(); Queue <PT> unvisited = new Queue <PT>(); List <PT> pointsInGroup = new List <PT>(); unvisited.Enqueue(seed); while (unvisited.Count > 0) { PT pt = unvisited.Dequeue(); visited.Add(pt); if (map.t(pt).group_id == group_id) { pointsInGroup.Add(pt); } PT[] adj = MapGenerator.GetAdjacentTiles(map, pt); foreach (PT n in adj) { if (map.t(n).type == Tile.Type.IMPASSABLE) { continue; } if (!visited.Contains(n)) { visited.Add(n); unvisited.Enqueue(n); } } } return(pointsInGroup); }
private void RefreshAngleState(bool init) { if (init) { //////////////////////// // Setup Ranges // use 'soft limits' rather than 'user limits' because the 'soft limits' *are* the user limits (or rather, the current limits-in-effect) int panMinSteps = PT.GetPanPositionLimitMin(); int panMaxSteps = PT.GetPanPositionLimitMax(); int tiltMinSteps = PT.GetTiltPositionLimitMin(); int tiltMaxSteps = PT.GetTiltPositionLimitMax(); double panMinDegs = PT.ConvertPanStepsToDegrees(panMinSteps); double panMaxDegs = PT.ConvertPanStepsToDegrees(panMaxSteps); double tiltMinDegs = PT.ConvertTiltStepsToDegrees(tiltMinSteps); double tiltMaxDegs = PT.ConvertTiltStepsToDegrees(tiltMaxSteps); __pan.BaseAngle = -180d; __tilt.BaseAngle = -180d; // hmm, it seems with the D48 in 360-deg mode (and how the fark did it get into that state?) it returns a value just-beyond 180... but for the tilt axis. This is weird. __pan.RangeMin = panMinDegs < -180 ? -180 : panMinDegs; __pan.RangeMax = panMaxDegs > 180 ? 180 : panMaxDegs; __tilt.RangeMin = tiltMinDegs < -180 ? -180 : tiltMinDegs; __tilt.RangeMax = tiltMaxDegs > 180 ? 180 : tiltMaxDegs; } _q.AddCommand(new PTQueuedCommandInfo("Idle", delegate(PTUnit unit) { // "Idle" is a lie, it's really polling, but whatever; when you set it to "Polling" it just flashes annoyingly //////////////////////// // Set position short panStepsDes, tiltStepsDes; short panStepsCur, tiltStepsCur; PT.GetCurrentPosition(out panStepsCur, out tiltStepsCur); panStepsDes = PT.GetPanDesiredPosition(); tiltStepsDes = PT.GetTiltDesiredPosition(); Double panDegreesDes = PT.ConvertPanStepsToDegrees(panStepsDes); Double tiltDegreesDes = PT.ConvertTiltStepsToDegrees(tiltStepsDes); Double panDegreesCur = PT.ConvertPanStepsToDegrees(panStepsCur); Double tiltDegreesCur = PT.ConvertTiltStepsToDegrees(tiltStepsCur); // Angle0 = Desired Position // Angle1 = Current Position Invoke(new DoSub(delegate() { if (IsDisposed) { return; } __pan.SetAngles(new Double[] { panDegreesDes, panDegreesCur }); __tilt.SetAngles(new Double[] { tiltDegreesDes, tiltDegreesCur }); })); })); }
/// <summary> /// 创建fieldtype,如CE,XCN等 /// </summary> /// <param name="parent"></param> /// <param name="product"></param> /// <param name="name"></param> /// <returns></returns> public override abstractType Create(compositeType parent, Enum product, string name) { abstractType tmp = null; switch (product) { case enumField.CE: tmp = new CE(parent, name); break; case enumField.CM: tmp = new CM(parent, name); break; case enumField.CWE: tmp = new CWE(parent, name); break; case enumField.CX: tmp = new CX(parent, name); break; case enumField.DLN: tmp = new DLN(parent, name); break; case enumField.EI: tmp = new EI(parent, name); break; case enumField.ELD: tmp = new ELD(parent, name); break; case enumField.FN: tmp = new FN(parent, name); break; case enumField.HD: tmp = new HD(parent, name); break; case enumField.MSG: tmp = new MSG(parent, name); break; case enumField.PT: tmp = new PT(parent, name); break; case enumField.VID: tmp = new VID(parent, name); break; case enumField.XAD: tmp = new XAD(parent, name); break; case enumField.XCN: tmp = new XCN(parent, name); break; case enumField.XPN: tmp = new XPN(parent, name); break; case enumField.XTN: tmp = new XTN(parent, name); break; case enumField.ERL: tmp = new ERL(parent, name); break; case enumField.FC: tmp = new FC(parent, name); break; case enumField.XON: tmp = new XON(parent, name); break; case enumField.PL: tmp = new PL(parent, name); break; case enumField.CP: tmp = new CP(parent, name); break; case enumField.JCC: tmp = new JCC(parent, name); break; case enumField.TQ: tmp = new TQ(parent, name); break; case enumField.CQ: tmp = new CQ(parent, name); break; default: throw new NotSupportedException(); } return(tmp); }
public async Task <ActionResult> DeleteConfirmed(int id) { PT pT = await db.PT.FindAsync(id); db.PT.Remove(pT); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public void RoundTripTest() { Assert.AreEqual((byte)123, PT.RoundTrip((byte)123)); Assert.AreEqual((short)12345, PT.RoundTrip((short)12345)); Assert.AreEqual((int)12345678, PT.RoundTrip((int)12345678)); Assert.AreEqual((long)123456789101112, PT.RoundTrip((long)123456789101112)); Assert.AreEqual((float)1.23, PT.RoundTrip((float)1.23)); Assert.AreEqual((double)1.23456789, PT.RoundTrip((double)1.23456789)); }
public Status(float HP, float EN, float Money, float Food, PT pt = PT.HUMAN) { playercounter++; _HP = HP; _EN = EN; _Money = Money; _Food = Food; player = pt; }
public FuncEntry(func f, int minimum, int max, PT type) { fname = f.Method.Name; numberparasmin = minimum; paratype = new PT[max]; for (int i = 0; i < max; i++) { paratype[i] = type; } }
public MSH() { SendingApplication = new EI(); SendingFacility = new EI(); ReceivingApplication = new EI(); ReceivingFacility = new EI(); MessageType = new MSG(); ProcessingID = new PT(); VersionID = new VID(); }
static void Main(string[] args) { if (!Log.init()) { //Abort.. Console.WriteLine("Logger initialization failed, exiting.."); Thread.Sleep(10000); return; } DdMonitor.bNoSync = false; DdMonitor.bEnabled = false; DdMonitor.DefaultTimeout = -1; //Register our catch-all exception handler Thread.GetDomain().UnhandledException += onException; //Create a logging client for the main loader thread LogClient handlerLogger = Log.createClient("LoaderHandler"); Log.assume(handlerLogger); //Is Diablo 3 available? IntPtr pHandle = PT.GetProcessHandle(exeName); if (pHandle == IntPtr.Zero) { Log.write("Failed to find game process, Is Diablo 3 running?"); Thread.Sleep(8000); return; } Globals.mem.Attach(); //Initilize the bot! Game.Bot bot = new Game.Bot(); if (!bot.init()) { Log.write("Failed to initialize D3BLoader, exiting..."); Thread.Sleep(8000); return; } //Begin! bot.begin(); Log.write("D3BLoader running..."); while (true) { Console.Read(); } }
public async Task <ActionResult> Edit([Bind(Include = "Id,Monto,Interes,Plazo,Cuota,CIID,FechaInicioPrestamo")] PT pT) { if (ModelState.IsValid) { db.Entry(pT).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CIID = new SelectList(db.CI, "Id", "Nombre", pT.CIID); return(View(pT)); }
public void ParsePacket(CustomPacket packet) { PT packetProtocolID = (PT)packet.PopProtocalID(); switch (packetProtocolID) { case PT.PT_CS_LOGIN_REQ: break; case PT.PT_CS_CHAT_REQ: CS_CHAT_REQ(packet); break; } }
/// <summary> /// public wrapper of the internal API "DependencyProperty.FromName" /// </summary> /// <param name="propertyName">The name of the property to get</param> /// <param name="propertyType">The type of the property owner</param> /// <returns>The DependencyProperty represented by the name/type pair</returns> /// <exception cref="ArgumentException">Thrown when propertyName is not a valid DependencyProperty on propertyType</exception> public static DependencyProperty GetDependencyProperty(string propertyName, Type propertyType) { TrustedType trustedType = PT.Trust(propertyType); TrustedFieldInfo field = trustedType.GetField( propertyName + "Property", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy ); if (field == null) { throw new ArgumentException("Could not locate property " + propertyName + " on " + propertyType.Name, "propertyName"); } return((DependencyProperty)field.GetValue(null)); }
public string GetString(PT pt, char ss) { var sb = new StringBuilder(); if (!string.IsNullOrWhiteSpace(pt.ProcessingID.Value)) { sb.Append($"{pt.ProcessingID.Value}"); } if (!string.IsNullOrWhiteSpace(pt.ProcessingMode.Value)) { sb.Append($"{ss}{pt.ProcessingMode.Value}"); } return(sb.ToString()); }
// GET: PTs/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PT pT = await db.PT.FindAsync(id); if (pT == null) { return(HttpNotFound()); } return(View(pT)); }
// GET: PTs/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PT pT = await db.PT.FindAsync(id); if (pT == null) { return(HttpNotFound()); } ViewBag.CIID = new SelectList(db.CI, "Id", "Nombre", pT.CIID); return(View(pT)); }
private void RefreshSliderState(bool init) { /////////////////////////////// // Pan short panSpeed = (short)PT.GetPanDesiredSpeed(); if (init) { if (panSpeed > __panSpeed.Maximum || panSpeed < __panSpeed.Minimum) { panSpeed = (short)((__panSpeed.Maximum - __panSpeed.Minimum) / 2); PT.SetPanDesiredSpeed(panSpeed); } __panSpeed.Minimum = __panBase.Minimum = PT.GetPanSpeedLimitMin(); __panSpeed.Maximum = __panBase.Maximum = PT.GetPanSpeedLimitMax(); } __panSpeed.Value = panSpeed; __panBase.Value = PT.GetPanBaseSpeed(); __panAccl.Value = (int)PT.GetPanAcceleration(); /////////////////////////////// // Tilt short tiltSpeed = (short)PT.GetTiltDesiredSpeed(); if (init) { if (tiltSpeed > __tiltSpeed.Maximum || tiltSpeed < __tiltSpeed.Minimum) { tiltSpeed = (short)((__tiltSpeed.Maximum - __tiltSpeed.Minimum) / 2); PT.SetTiltDesiredSpeed(tiltSpeed); } __tiltSpeed.Minimum = __tiltBase.Minimum = PT.GetTiltSpeedLimitMin(); __tiltSpeed.Maximum = __tiltBase.Maximum = PT.GetTiltSpeedLimitMax(); } UInt32 tiltAccel = PT.GetTiltAcceleration(); __tiltSpeed.Value = tiltSpeed; __tiltBase.Value = PT.GetTiltBaseSpeed(); __tiltAccl.Value = (int)tiltAccel; }
public int[] GetRoomIDs() { List <int> l = new List <int>(); for (int a = 0; a < seeds.Count; a++) { PT pt = seeds[a]; Tile tile = map.t(pt); if (!l.Contains(tile.group_id)) { l.Add(tile.group_id); } } return(l.ToArray()); }
/// <summary> /// Get the object that owns the property specified. /// </summary> /// <param name="complexPropertyPath">A "dot-down" path to a property</param> /// <param name="attachedTo">The object to start the search from</param> /// <returns>The object that owns the property specified</returns> /// <exception cref="ArgumentException">Thrown when the path does not lead to a valid object</exception> public static object GetPropertyOwner(string complexPropertyPath, object attachedTo) { // complexProperty will come in like this: // // path == Thickness attachedTo == ScreenSpaceLines3D return: ScreenSpaceLines3D // path == Material[0].Brush.Color attachedTo == GeometryModel3D return: Brush // path == Brush.Color attachedTo == Material return: Brush // path == Color attachedTo == Brush return: Brush // path == Children[0] attachedTo == Viewport3D return: Visual3DCollection int dotIndex = complexPropertyPath.IndexOf('.'); if (dotIndex < 0) { int bracketIndex = complexPropertyPath.IndexOf('['); if (bracketIndex < 0) { // The property should be on the object we're looking at right now. // Throw an exception if the property does not exist on this object. TrustedType trustedType = PT.Trust(attachedTo.GetType()); TrustedPropertyInfo property = trustedType.GetProperty(complexPropertyPath); if (property == null) { throw new ArgumentException(complexPropertyPath + " does not exist on " + trustedType.Name); } return(attachedTo); } else { // Trim the index from the property (the collection is the owner) string nonIndexedProperty = complexPropertyPath.Substring(0, bracketIndex); return(GetAttachedObject(nonIndexedProperty, attachedTo)); } } // The property is not on the current object string localPropertyName = complexPropertyPath.Substring(0, dotIndex); string remainingProperties = complexPropertyPath.Substring(dotIndex + 1); object next = GetAttachedObject(localPropertyName, attachedTo); return(GetPropertyOwner(remainingProperties, next)); }
/// <summary> /// Map query against structure & return highlighted match /// </summary> /// <param name="cs"></param> /// <returns></returns> public MoleculeMx HighlightMatchingSubstructure( MoleculeMx cs) { if (cs.IsBiopolymerFormat) // fix later { return(cs); } MoleculeMx cs2 = null; PerformanceTimer pt = PT.Start("HighlightMatchingSubstructure"); string molfile = CdkMolUtil.HilightSSSMatch(cs.GetMolfileString()); cs2 = new MoleculeMx(MoleculeFormat.Molfile, molfile); pt.Update(); return(cs2); }
public static bool Phase3() { AntiProxyParams Params = PhaseParam; Params.asmReflection = Assembly.LoadFile(Globals.DeobContext.InPath); InitMethodCallList(); foreach (var PT in Params.lstProxyTypes) { PT.InitProxyType(Params.ResolveFieldMD.MetadataToken.ToInt32(), Params.ResolveMethodMD.MetadataToken.ToInt32(), Params.asmReflection); DoAntiProxy(PT, Params); //MarkMember(PT.Type); } return(true); }
/// <summary> /// Align supplied structure to query structure /// </summary> /// <param name="skid"></param> /// <returns></returns> public MoleculeMx AlignToMatchingSubstructure( MoleculeMx target) { if (target.IsBiopolymerFormat) // fix later { return(target); } MoleculeMx cs2 = null; PerformanceTimer pt = PT.Start("AlignToMatchingSubstructure"); Stopwatch sw = Stopwatch.StartNew(); string molfile = CdkMolUtil.OrientToMatchingSubstructure(target.GetMolfileString()); cs2 = new MoleculeMx(MoleculeFormat.Molfile, molfile); pt.Update(); return(cs2); }
public syntax_tree_node Parse(string Text, List <compiler_directive> compilerDirectives = null) { #if DEBUG #if _ERR FileInfo f = new FileInfo(FileName); var sv = Path.ChangeExtension(FileName, ".grmtrack1"); var sw = new StreamWriter(sv); Console.SetError(sw); #endif #endif PT parsertools = new PT(); // контекст сканера и парсера parsertools.errors = Errs; parsertools.warnings = Warnings; parsertools.compilerDirectives = compilerDirectives; parsertools.CurrentFileName = Path.GetFullPath(FileName); Scanner scanner = new Scanner(); scanner.SetSource(Text, 0); scanner.parsertools = parsertools;// передали parsertools в объект сканера if (DefinesList != null) { scanner.Defines.AddRange(DefinesList); } GPPGParser parser = new GPPGParser(scanner); parsertools.build_tree_for_formatter = build_tree_for_formatter; parser.parsertools = parsertools; // передали parsertools в объект парсера if (!parser.Parse()) { if (Errs.Count == 0) { parsertools.AddError("Неопознанная синтаксическая ошибка!", null); } } #if DEBUG #if _ERR sw.Close(); #endif #endif return(parser.root); }
private static BCColor SelectColor(PT Type, BlockColors basis) { switch (Type) { case PT.Light: return(basis.LightColor); case PT.Glint: return(basis.GlintColor); case PT.Center: return(basis.CenterColor); case PT.Shaded: return(basis.ShadedColor); default: return(basis.CenterColor); } }
public PT GetValue <PT>() { PT @default = (PT)DefaultValue; var user = PluginManager.Instance.User; switch (Scope) { case PreferenceScope.Global: return(Config.GetGlobal(PreferenceKey, @default)); case PreferenceScope.Profile: return(Config.GetProfile(user, PreferenceKey, @default)); case PreferenceScope.User: return(Config.GetUser(user, PreferenceKey, @default)); default: throw new Exception("Unhandled preference scope!"); } }
public async Task <ActionResult> Create([Bind(Include = "Id,Monto,Interes,Plazo,Cuota,CIID,FechaInicioPrestamo")] PT pT) { if (ModelState.IsValid) { double cantidadPagar = 0d; double interes = 0d; double cuota = 0d; cantidadPagar = pT.Monto / (pT.Plazo * 12); interes = (pT.Monto * pT.Interes / 100) / 12; cuota = cantidadPagar + interes; pT.Cuota = cuota; db.PT.Add(pT); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CIID = new SelectList(db.CI, "Id", "Nombre", pT.CIID); return(View(pT)); }
private void RefreshState(bool init) { __state.SelectedObject = Program.PTUnitState; __joystick.Enabled = Program.Joystick != null; if (init) { if (_q != null) { _q.Stop(); } _q = new PTQueue(PT); _q.StatusChanged += new EventHandler(_q_StatusChanged); _q.Start(); __firmware.Text = PT.GetFirmwareInfo(); __environment.Text = PT.GetEnvironmentInfo(); __firmwareLbl.Text = PT.ComPort + ":"; } RefreshAngleState(init); RefreshSliderState(init); RefreshConfigurationState(); }
public static void EndProfile(PT etag) { // int tag = (int)etag; // profiles[tag].totalTime += DateTime.UtcNow - profiles[tag].lastRecorded; // ++profiles[tag].totalCalls; }
public static void StartProfile(PT tag) { // profiles[(int)tag].lastRecorded = DateTime.UtcNow; }