private void SaveItem() { if ((string.IsNullOrEmpty(hdPickListItemId.Value)) && (hdMode.Value == "ADD")) { int order = System.Convert.ToInt32(txtOrder.Text); PickList pl = PickList.AddNewPickListItem(hdPickListId.Value, txtItemText.Text, txtCode.Text, order, ""); if (chkIsDefaultItem.Checked) { PickList.SetAsDefaultItem(hdPickListId.Value, pl.ItemId); } } else { PickList pl = PickList.GetPickListItemById(hdPickListId.Value, hdPickListItemId.Value); pl.Shorttext = txtCode.Text; pl.Text = txtItemText.Text; int orderValue = System.Convert.ToInt32(txtOrder.Text); pl.Id = orderValue; PickList.SavePickListItem(pl); if ((chkIsDefaultItem.Checked) && (string.IsNullOrEmpty(hdIsDefault.Value))) { PickList.SetAsDefaultItem(hdPickListId.Value, pl.ItemId); } if ((!chkIsDefaultItem.Checked) && (!string.IsNullOrEmpty(hdIsDefault.Value))) { PickList.SetAsDefaultItem(hdPickListId.Value, ""); } } PLS.ClearPickListCache(); IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>(); refresher.RefreshAll(); }
private async void ImportPlaylists() { var picker = new FileOpenPicker(); FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; openPicker.FileTypeFilter.Add(".m3u"); openPicker.FileTypeFilter.Add(".pls"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { IPlaylist playlist = null; if (Path.GetExtension(file.Path) == ".m3u") { playlist = new M3U(); } else { playlist = new PLS(); } var plist = new Playlist() { Name = file.DisplayName }; Messenger.Instance.NotifyColleagues(MessageTypes.MSG_ADD_PLAYLIST, plist); await playlist.LoadPlaylist(file).ConfigureAwait(false); } }
public void Evaluate() { UpdateConstantProperties(); bool allTrue = true; for (int i = 0; i < this.predicates.Count; i++) { PLS p = this.predicates[i]; bool pTrue = p.Evaluate(); Debug.Log(p.ToString() + "\t" + pTrue); allTrue = allTrue && pTrue; if (pTrue) { this.predicateTexts[i].color = new Color(0, 255, 0); } else { this.predicateTexts[i].color = new Color(255, 0, 0); } } Debug.Log(allTrue); this.winner.SetActive(allTrue); }
async void ImportPlaylists() { var picker = new FileOpenPicker(); FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; openPicker.FileTypeFilter.Add(".m3u"); openPicker.FileTypeFilter.Add(".pls"); StorageFile file = await openPicker.PickSingleFileAsync(); IPlaylist playlist = null; if (Path.GetExtension(file.Path) == ".m3u") { playlist = new M3U(); } else { playlist = new PLS(); } var dict = await playlist.LoadPlaylist(file); LibVM.AddPlaylist(dict, file.DisplayName, ""); }
[System.Security.SecurityCritical] // auto-generated internal void GetZoneAndOrigin(ArrayList zoneList, ArrayList originList, PermissionToken zoneToken, PermissionToken originToken) { CompleteConstruction(null); if (PLS != null) { PLS.GetZoneAndOrigin(zoneList, originList, zoneToken, originToken); } return; }
[System.Security.SecurityCritical] // auto-generated internal void DemandFlagsOrGrantSet(int flags, PermissionSet grantSet) { CompleteConstruction(null); if (PLS == null) { return; } PLS.DemandFlagsOrGrantSet(flags, grantSet); }
[System.Security.SecurityCritical] // auto-generated internal bool CheckDemandNoHalt(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh) { CompleteConstruction(null); if (PLS == null) { return(SecurityRuntime.StackContinue); } else { return(PLS.CheckDemand(demand, permToken, rmh)); } }
[System.Security.SecurityCritical] // auto-generated internal bool CheckSetDemand(PermissionSet pset, RuntimeMethodHandleInternal rmh) { CompleteConstruction(null); if (PLS == null) { return(SecurityRuntime.StackHalt); } else { return(PLS.CheckSetDemand(pset, rmh)); } }
private void CreateExpressions() { this.predicates = new List <PLS>(); PLS predicate = CreateExpression(3); this.predicates.Add(predicate); predicate = CreateExpression(2); this.predicates.Add(predicate); predicate = CreateExpression(2); this.predicates.Add(predicate); }
[System.Security.SecurityCritical] // auto-generated internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh) { CompleteConstruction(null); if (PLS == null) { return(SecurityRuntime.StackHalt); } else { PLS.CheckDemand(demand, permToken, rmh); return(SecurityRuntime.StackHalt); // CS demand check always terminates the stackwalk } }
[System.Security.SecurityCritical] // auto-generated internal bool CheckSetDemandWithModificationNoHalt(PermissionSet pset, out PermissionSet alteredDemandSet, RuntimeMethodHandleInternal rmh) { alteredDemandSet = null; CompleteConstruction(null); if (PLS == null) { return(SecurityRuntime.StackContinue); } else { return(PLS.CheckSetDemandWithModification(pset, out alteredDemandSet, rmh)); } }
async void ImportPlaylists() { var picker = new FileOpenPicker(); FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; openPicker.FileTypeFilter.Add(".m3u"); openPicker.FileTypeFilter.Add(".pls"); StorageFile file = await openPicker.PickSingleFileAsync(); if(file != null) { var plist = new Playlist() { Name = file.DisplayName }; LibVM.AddPlaylist(plist); LibVM.Database.playlists.Insert(plist); IPlaylist playlist = null; if (Path.GetExtension(file.Path) == ".m3u") playlist = new M3U(); else playlist = new PLS(); await playlist.LoadPlaylist(file).ConfigureAwait(false); } }
protected void btnSave_ClickAction(object sender, EventArgs e) { this._pickListView = (IPickListView)this.BindingSource.Current; PickListAttributes att = GetAttributes(); PickList pl = PickList.GetPickListById(_pickListView.Id.ToString()); pl.Text = txtPicklistName.Text; pl.Shorttext = att.ToString(); if (chkIsManaged.Checked) { pl.Id = 1; } else { pl.Id = 0; } PickList.SavePickList(pl); PLS.ClearPickListCache(); }
public void TestMethod1() { var propInfoId = typeof(Process).GetProperty("Id"); var propInfoName = typeof(Process).GetProperty("ProcessName"); var propInfoTime = typeof(Process).GetProperty("StartTime"); ProcessLister lister = new ProcessLister(); var processes = lister.ListProcesses( onlyAccessible: !System.Environment.Is64BitProcess); Assert.IsNotNull(processes); Assert.IsTrue(processes.Count > 0); var procByIdAsc = PLS.Sort(processes, propInfoId); var procByNameAsc = PLS.Sort(processes, propInfoName); var procByIdDesc = PLS.Sort(processes, propInfoId, descending: true); var procByTimeAsc = PLS.Sort(processes, propInfoTime); var procByNameDesc = PLS.Sort(processes, propInfoName, descending: true); var procByTimeDesc = PLS.Sort(processes, propInfoTime, descending: true); // Ensure that sorting does not modify original list, but just reorder. AssertEx.AreSameSets(procByIdAsc, processes); AssertEx.AreSameSets(procByIdDesc, processes); AssertEx.AreSameSets(procByNameAsc, processes); AssertEx.AreSameSets(procByNameDesc, processes); AssertEx.AreSameSets(procByTimeAsc, processes); AssertEx.AreSameSets(procByTimeDesc, processes); // Ensure that returned lists are appropriately ordered. // I know I shouldn't use 'IsOrdered*' until they're extensively tested, // but let's just suppose they're tested. It's already too much // boilerplate code for today. Assert.IsTrue(procByIdAsc.IsOrderedAscending(p => p.Id)); Assert.IsTrue(procByNameAsc.IsOrderedAscending(p => p.ProcessName)); Assert.IsTrue(procByTimeAsc.IsOrderedAscending(p => p.StartTime)); Assert.IsTrue(procByIdDesc.IsOrderedDescending(p => p.Id)); Assert.IsTrue(procByNameDesc.IsOrderedDescending(p => p.ProcessName)); Assert.IsTrue(procByTimeDesc.IsOrderedDescending(p => p.StartTime)); }
private void SaveItem() { if (String.IsNullOrEmpty(txtItemText.Text)) { throw new ValidationException(GetLocalResourceObject("error_InvalidItemName").ToString()); } if ((string.IsNullOrEmpty(hdPickListItemId.Value)) && (hdMode.Value == "ADD")) { int order = Convert.ToInt32(txtOrder.Text); PickList pl = PickList.AddNewPickListItem(hdPickListId.Value, txtItemText.Text, txtCode.Text, order, ""); if (chkIsDefaultItem.Checked) { PickList.SetAsDefaultItem(hdPickListId.Value, pl.ItemId); } } else { PickList pl = PickList.GetPickListItemById(hdPickListId.Value, hdPickListItemId.Value); pl.Shorttext = txtCode.Text; pl.Text = txtItemText.Text; int orderValue = Convert.ToInt32(txtOrder.Text); pl.Id = orderValue; PickList.SavePickListItem(pl); if ((chkIsDefaultItem.Checked) && (string.IsNullOrEmpty(hdIsDefault.Value))) { PickList.SetAsDefaultItem(hdPickListId.Value, pl.ItemId); } if ((!chkIsDefaultItem.Checked) && (!string.IsNullOrEmpty(hdIsDefault.Value))) { PickList.SetAsDefaultItem(hdPickListId.Value, ""); } } PLS.ClearPickListCache(); IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>(); refresher.RefreshAll(); }
private PLS CreateExpression(int size) { PLS predicate = CreateUnaryExpression(); int sizeLeft = size; if (sizeLeft > 0) { int j = Random.Range(0, 4); PLS newExp = CreateExpression(sizeLeft - 1); switch (j) { case 0: predicate = new And(predicate, newExp); break; case 1: predicate = new Or(predicate, newExp); break; case 2: predicate = new To(predicate, newExp); break; case 3: predicate = new Equiv(predicate, newExp); break; } } int i = Random.Range(0, 2); if (i > 0) { predicate = new Neg(predicate); } return(predicate); }
static void Main(string[] args) { if (args.Count() < 2) { Console.WriteLine("Usage: GerberToOutline.exe <infile> <outfile>"); return; } string infile = args[0]; string outfile = args[1]; var FileType = Gerber.FindFileType(infile); if (FileType == BoardFileType.Unsupported) { if (Gerber.ExtremelyVerbose) { Console.WriteLine("Warning: {1}: files with extension {0} are not supported!", Path.GetExtension(infile), Path.GetFileName(infile)); } return; } ParsedGerber PLS; GerberParserState State = new GerberParserState() { PreCombinePolygons = false }; if (FileType == BoardFileType.Drill) { if (Gerber.ExtremelyVerbose) { Console.WriteLine("Log: Drill file: {0}", infile); } PLS = PolyLineSet.LoadExcellonDrillFile(new StandardConsoleLog(), infile, false, 1.0); // ExcellonFile EF = new ExcellonFile(); // EF.Load(a); } else { bool forcezerowidth = false; bool precombinepolygons = false; if (Gerber.ExtremelyVerbose) { Console.WriteLine("Log: Gerber file: {0}", infile); } BoardSide Side = BoardSide.Unknown; BoardLayer Layer = BoardLayer.Unknown; Gerber.DetermineBoardSideAndLayer(infile, out Side, out Layer); if (Layer == BoardLayer.Outline || Layer == BoardLayer.Mill) { forcezerowidth = true; precombinepolygons = true; } State.PreCombinePolygons = precombinepolygons; PLS = PolyLineSet.LoadGerberFile(new StandardConsoleLog(), infile, forcezerowidth, false, State); PLS.Side = State.Side; PLS.Layer = State.Layer; if (Layer == BoardLayer.Outline) { PLS.FixPolygonWindings(); } } SVGGraphicsInterface SG = new SVGGraphicsInterface(PLS.BoundingBox.Width() * 100, PLS.BoundingBox.Height() * 100); SG.ScaleTransform(10, 10); SG.TranslateTransform((float)-PLS.BoundingBox.TopLeft.X, (float)-PLS.BoundingBox.TopLeft.Y); DrawToInterface(PLS, SG); SG.Save(outfile); System.Diagnostics.Process.Start(outfile); Console.WriteLine("press any key to continue.."); Console.ReadKey(); }
public ParsedGerber AddBoardToSet(ProgressLog log, MemoryStream MS, string _originalfilename, bool forcezerowidth = false, bool precombinepolygons = false, double drillscaler = 1.0) { Streams[_originalfilename] = MS; try { // string[] filesplit = originalfilename.Split('.'); // string ext = filesplit[filesplit.Count() - 1].ToLower(); var FileType = Gerber.FindFileTypeFromStream(new StreamReader(MS), _originalfilename); MS.Seek(0, SeekOrigin.Begin); if (FileType == BoardFileType.Unsupported) { if (Gerber.ExtremelyVerbose) { Console.WriteLine("Warning: {1}: files with extension {0} are not supported!", Path.GetExtension(_originalfilename), Path.GetFileName(_originalfilename)); } return(null); } ParsedGerber PLS; GerberParserState State = new GerberParserState() { PreCombinePolygons = precombinepolygons }; if (FileType == BoardFileType.Drill) { if (Gerber.ExtremelyVerbose) { Console.WriteLine("Log: Drill file: {0}", _originalfilename); } PLS = PolyLineSet.LoadExcellonDrillFileFromStream(log, new StreamReader(MS), _originalfilename, false, drillscaler); MS.Seek(0, SeekOrigin.Begin); ExcellonFile EF = new ExcellonFile(); EF.Load(log, new StreamReader(MS), drillscaler); Excellons.Add(EF); } else { if (Gerber.ExtremelyVerbose) { Console.WriteLine("Log: Gerber file: {0}", _originalfilename); } BoardSide Side = BoardSide.Unknown; BoardLayer Layer = BoardLayer.Unknown; Gerber.DetermineBoardSideAndLayer(_originalfilename, out Side, out Layer); if (Layer == BoardLayer.Outline) { forcezerowidth = true; precombinepolygons = true; } State.PreCombinePolygons = precombinepolygons; PLS = PolyLineSet.LoadGerberFileFromStream(log, new StreamReader(MS), _originalfilename, forcezerowidth, false, State); MS.Seek(0, SeekOrigin.Begin); PLS.Side = State.Side; PLS.Layer = State.Layer; if (Layer == BoardLayer.Outline) { PLS.FixPolygonWindings(); } } PLS.CalcPathBounds(); BoundingBox.AddBox(PLS.BoundingBox); Console.WriteLine("Progress: Loaded {0}: {1:N1} x {2:N1} mm", Path.GetFileName(_originalfilename), PLS.BoundingBox.BottomRight.X - PLS.BoundingBox.TopLeft.X, PLS.BoundingBox.BottomRight.Y - PLS.BoundingBox.TopLeft.Y); PLSs.Add(PLS); // } // catch (Exception) // { // } return(PLS); } catch (Exception E) { while (E != null) { Console.WriteLine("Exception adding board: {0}", E.Message); E = E.InnerException; } } return(null); }
static void Main(string[] args) { GerberNumberFormat GNF = new GerberNumberFormat(); GNF.DigitsAfter = 3; GNF.DigitsBefore = 3; GNF.SetMetricMode(); GerberSplitter GS = new GerberSplitter(); GS.Split("X-1.15Y-1.9", GNF, true); foreach (var a in GS.Pairs) { Console.WriteLine("{0}:{1} {2}", a.Key, a.Value.Command, a.Value.Number); } Console.ReadKey(); if (args.Count() == 0) { Console.WriteLine("Usage:"); Console.WriteLine("GerberAnalyse <inputfile> <-forcezerowidth> <-dim>"); return; } ParsedGerber PLS; bool forcezerowidth = false; bool compact = false; for (int i = 1; i < args.Count(); i++) { if (args[i] == "-forcezerowidth") { forcezerowidth = true; } if (args[i] == "-dim") { compact = true; } } if (Gerber.FindFileType(args[0].ToLower()) == BoardFileType.Drill) { PLS = PolyLineSet.LoadExcellonDrillFile(args[0]); // ExcellonFile EF = new ExcellonFile(); // EF.Load(a); } else { // PLS.PreCombinePolygons = false; // forcezerowidth = true; PLS = PolyLineSet.LoadGerberFile(args[0], forcezerowidth, false, new GerberParserState() { PreCombinePolygons = false }); } PLS.CalcPathBounds(); if (compact) { CultureInfo CI = CultureInfo.InvariantCulture; Console.WriteLine("{0}x{1}(mm)", (PLS.BoundingBox.BottomRight.X - PLS.BoundingBox.TopLeft.X).ToString("N3", CI), (PLS.BoundingBox.BottomRight.Y - PLS.BoundingBox.TopLeft.Y).ToString("N3", CI)); Console.WriteLine("{0}x{1}(imp)", ((PLS.BoundingBox.BottomRight.X - PLS.BoundingBox.TopLeft.X) / 25.4).ToString("N3", CI), ((PLS.BoundingBox.BottomRight.Y - PLS.BoundingBox.TopLeft.Y) / 25.4).ToString("N3", CI)); } else { Console.WriteLine("Report for {0}:", args[0]); Console.WriteLine("Suspected file side: {0}, layertype: {1}", PLS.Side.ToString(), PLS.Layer.ToString()); Console.WriteLine("DisplayShape #: {0}", PLS.DisplayShapes.Count); foreach (var o in PLS.DisplayShapes) { Console.WriteLine("\tOutline {0} vertices thin:{1}", o.Vertices.Count, o.Thin); foreach (var v in o.Vertices) { Console.WriteLine("\t\t{0}", v); } } Console.WriteLine("OutlineShape #: {0}", PLS.OutlineShapes.Count); foreach (var o in PLS.OutlineShapes) { Console.WriteLine("\tOutline {0} vertices thin:{1}", o.Vertices.Count, o.Thin); foreach (var v in o.Vertices) { Console.WriteLine("\t\t{0}", v); } } Console.WriteLine("Aperture #: {0}", PLS.State.Apertures.Count); foreach (var apt in PLS.State.Apertures) { Console.Write("\tAperture D{0} ", apt.Key.ToString("D2")); Console.Write("type: {0} ", apt.Value.ShapeType.ToString()); switch (apt.Value.ShapeType) { case GerberApertureShape.Circle: Console.Write("diameter {0} ", apt.Value.CircleRadius * 2); break; } Console.WriteLine(); } Console.WriteLine("Corners: "); Console.WriteLine(PLS.BoundingBox.TopLeft); Console.WriteLine(PLS.BoundingBox.BottomRight); Console.WriteLine("Size: {0}x{1} mm", PLS.BoundingBox.BottomRight.X - PLS.BoundingBox.TopLeft.X, PLS.BoundingBox.BottomRight.Y - PLS.BoundingBox.TopLeft.Y); } // Console.WriteLine("Press any key to continue"); // Console.ReadKey(); }
public BinaryOP(PLS o1, PLS o2) { this.op1 = o1; this.op2 = o2; }
public UnaryOP(PLS o1) { this.op1 = o1; }
public Neg(PLS o1) : base(o1) { }
public And(PLS o1, PLS o2) : base(o1, o2) { }
public Or(PLS o1, PLS o2) : base(o1, o2) { }
public To(PLS o1, PLS o2) : base(o1, o2) { }
private List <Shape> LoadGerber(string Path) { BoardFileType FileType = Gerber.FindFileType(Path); if (FileType == BoardFileType.Unsupported) { return(null); } ParsedGerber PLS; GerberParserState State = new GerberParserState() { PreCombinePolygons = false }; if (FileType == BoardFileType.Drill) { PLS = PolyLineSet.LoadExcellonDrillFile(Path, false, 1.0); } else { bool forcezerowidth = false; bool precombinepolygons = false; BoardSide Side = BoardSide.Unknown; BoardLayer Layer = BoardLayer.Unknown; Gerber.DetermineBoardSideAndLayer(Path, out Side, out Layer); if (Layer == BoardLayer.Outline || Layer == BoardLayer.Mill) { forcezerowidth = true; precombinepolygons = true; } State.PreCombinePolygons = precombinepolygons; PLS = PolyLineSet.LoadGerberFile(Path, forcezerowidth, false, State); PLS.Side = State.Side; PLS.Layer = State.Layer; if (Layer == BoardLayer.Outline) { PLS.FixPolygonWindings(); } } //Convert the gerber polygons into a generic shape list used by other functions List <Shape> retShape = new List <Shape>(); foreach (var shape in PLS.DisplayShapes) { Shape tempShape = new Shape(); tempShape.Vertices = new List <Vector2d>(); for (int i = 0; i < shape.Vertices.Count; i++) { tempShape.Vertices.Add(new Vector2d(shape.Vertices[i].X, shape.Vertices[i].Y)); } retShape.Add(tempShape); } return(retShape); }
public Equiv(PLS o1, PLS o2) : base(o1, o2) { }