Exemplo n.º 1
0
 internal void SetRowProperties(DataRow dr, Properties.MovieGenreProperties row)
 {
     row.Movie = Convert.ToInt32(dr["Movie"]);
     row.Genre = Convert.ToByte(dr["Genre"]);
     row.Exists = true;
     row.HasChanged = false;
 }
Exemplo n.º 2
0
        protected override void ReadValue(PsdReader reader, object userData, out IProperties value)
        {
            value = new Properties();

            short version = reader.ReadInt16();
            int count = reader.ReadInt16();

            for (int i = 0; i < count; i++)
            {
                string _8bim = reader.ReadAscii(4);
                string effectType = reader.ReadAscii(4);
                int size = reader.ReadInt32();
                long p = reader.Position;

                switch (effectType)
                {
                    case "dsdw":
                        {
                            //ShadowInfo.Parse(reader);
                        }
                        break;
                    case "sofi":
                        {
                            //this.solidFillInfo = SolidFillInfo.Parse(reader);
                        }
                        break;
                }

                reader.Position = p + size;
            }
        }
Exemplo n.º 3
0
		public Codon(AddIn addIn, string name, Properties properties, ICondition[] conditions)
		{
			this.addIn      = addIn;
			this.name       = name;
			this.properties = properties;
			this.conditions = conditions;
		}
Exemplo n.º 4
0
		void AddOptionPanels(IEnumerable<IDialogPanelDescriptor> dialogPanelDescriptors)
		{
			Properties newProperties = new Properties();
			newProperties.Set("Project", project);
			
			foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) {
				descriptors.Add(descriptor);
				if (descriptor != null && descriptor.DialogPanel != null && descriptor.DialogPanel.Control != null) { // may be null, if it is only a "path"
					descriptor.DialogPanel.CustomizationObject = newProperties;
					descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Activated);
					ICanBeDirty dirtyable = descriptor.DialogPanel as ICanBeDirty;
					if (dirtyable != null) {
						dirtyable.DirtyChanged += PanelDirtyChanged;
					}
					
					TabPage page = new TabPage(descriptor.Label);
					page.UseVisualStyleBackColor = true;
					page.Controls.Add(descriptor.DialogPanel.Control);
					tabControl.TabPages.Add(page);
				}
				
				if (descriptor.ChildDialogPanelDescriptors != null) {
					AddOptionPanels(descriptor.ChildDialogPanelDescriptors);
				}
			}
			// re-evaluate dirty because option pages can be dirty when they are newly loaded
			PanelDirtyChanged(null, null);
		}
		public void Init()
		{
			string addinXml = "<AddIn name     = 'Xml Editor'\r\n" +
       								"author      = ''\r\n" +
       								"copyright   = 'prj:///doc/copyright.txt'\r\n" +
       								"description = ''\r\n" +
       								"addInManagerHidden = 'preinstalled'>\r\n" +
								"</AddIn>";

			using (StringReader reader = new StringReader(addinXml)) {
				var addInTree = MockRepository.GenerateStrictMock<IAddInTree>();
				AddIn addin = AddIn.Load(addInTree, reader);
				
				AddInTreeNode addinTreeNode = new AddInTreeNode();

				Properties properties1 = new Properties();
				properties1.Set<string>("id", ".xml");
				properties1.Set<string>("namespaceUri", "http://example.com");
				
				Properties properties2 = new Properties();
				properties2.Set<string>("id", ".xsl");
				properties2.Set<string>("namespaceUri", "http://example.com/xsl");
				properties2.Set<string>("namespacePrefix", "xs");
				
				addinTreeNode.AddCodons(
					new Codon[] {
						new Codon(addin, "SchemaAssociation", properties1, new ICondition[0]),
						new Codon(addin, "SchemaAssociation", properties2, new ICondition[0])
					});
				
				schemaAssociations = new DefaultXmlSchemaFileAssociations(addinTreeNode);
			}
		}
		internal FormSettings(Properties.Settings settings)
		{
			InitializeComponent();

			AutoDecrypt = settings.AutoDecrypt;
			AutoVerify = settings.AutoVerify;
			AutoEncrypt = settings.AutoEncrypt;
			AutoSign = settings.AutoSign;
			Encrypt2Self = settings.Encrypt2Self;

			DefaultKey = settings.DefaultKey;
			DefaultDomain = settings.DefaultDomain;

			SaveDecrypted = settings.SaveDecrypted;

			Default2PlainFormat = settings.Default2PlainFormat;

			IgnoreIntegrityCheck = settings.IgnoreIntegrityCheck;

			Cipher = settings.Cipher;
			Digest = settings.Digest;

			// Temporary disable all settings regarding auto-verify/decrypt
			// MainTabControl.TabPages.RemoveByKey(ReadTab.Name);
		}
Exemplo n.º 7
0
        public ErrorListPad()
        {
            instance = this;
            properties = PropertyService.NestedProperties("ErrorListPad");

            TaskService.Cleared += TaskServiceCleared;
            TaskService.Added   += TaskServiceAdded;
            TaskService.Removed += TaskServiceRemoved;
            TaskService.InUpdateChanged += delegate {
                if (!TaskService.InUpdate)
                    InternalShowResults();
            };

            SD.BuildService.BuildFinished += ProjectServiceEndBuild;
            SD.ProjectService.SolutionOpened += OnSolutionOpen;
            SD.ProjectService.SolutionClosed += OnSolutionClosed;
            errors = new ObservableCollection<SDTask>(TaskService.Tasks.Where(t => t.TaskType != TaskType.Comment));

            toolBar = ToolBarService.CreateToolBar(contentPanel, this, "/SharpDevelop/Pads/ErrorList/Toolbar");

            contentPanel.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
            contentPanel.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            contentPanel.Children.Add(toolBar);
            contentPanel.Children.Add(errorView);
            Grid.SetRow(errorView, 1);
            errorView.ItemsSource = errors;
            errorView.MouseDoubleClick += ErrorViewMouseDoubleClick;
            errorView.Style = (Style)new TaskViewResources()["TaskListView"];
            errorView.ContextMenu = MenuService.CreateContextMenu(errorView, DefaultContextMenuAddInTreeEntry);

            errorView.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, ExecuteCopy, CanExecuteCopy));
            errorView.CommandBindings.Add(new CommandBinding(ApplicationCommands.SelectAll, ExecuteSelectAll, CanExecuteSelectAll));

            InternalShowResults();
        }
Exemplo n.º 8
0
        public static void Main()
        {
            System.IO.Stream icon = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("bakkappah.bakkappah.ico");
            systray.Icon = new System.Drawing.Icon(icon);
            systray.Text = "bakkappah";
            props = new Properties();
            EventHandler quitHandler = new EventHandler(quit);

            ContextMenu menu = new ContextMenu();
            MenuItem item = new MenuItem("Backup now!", new EventHandler(sync));
            menu.MenuItems.Add(item);
            item = new MenuItem("Configuration", new EventHandler(config));
            menu.MenuItems.Add(item);
            item = new MenuItem("-");
            menu.MenuItems.Add(item);
            item = new MenuItem("Quit", quitHandler);
            menu.MenuItems.Add(item);

            systray.ContextMenu = menu;
            systray.Visible = true;

            timer.Tick += new EventHandler(sync);
            timer.Interval = props.Interval * 60000;
            timer.Start();

            Application.ApplicationExit += quitHandler;
            Application.Run();
        }
Exemplo n.º 9
0
		public LazyLoadDoozer(AddIn addIn, Properties properties)
		{
			this.addIn      = addIn;
			this.name       = properties["name"];
			this.className  = properties["class"];
			
		}
Exemplo n.º 10
0
		/// <summary>
		/// Default constructor - initializes all fields to default values
		/// </summary>
		public GeneratePushDataReport(ReportModel reportModel,		                              
		                              Properties properties):base(reportModel,properties)
		{
			
			base.UpdateGenerator();
			base.UpdateModel();
		}
        public WolfEntity(Rectangle rect, Properties properties, GameScene gs)
        {
            position.X = rect.X;
            position.Y = rect.Y;

            spriteChoice.texture = spritesheet;
            animState.AnimationName = "alive";
            hitbox = new Rectangle (0, 0, rect.Width, rect.Height);
            spriteChoice.rect = anim.GetRectangle (animState);
            Visible = true;
            inverseMass = 5;

            health = 10;
            contactDamage = 2;
            fireDefense = 0;
            waterDefense = 0;
            earthDefense = 1;
            airDefense = 0;

            this.properties = properties;
            this.gs = gs;

            baseline = hitbox.Bottom;
            seePlayer = false;
            positionPushTimer = new TimeSpan(0,0,0,0,1000);

            backtracking = false;
        }
Exemplo n.º 12
0
        public void OperatorInTest()
        {
            var p1 = new Properties();
            p1.SetProperty("name", "jack");
            p1.SetProperty("count", 3);

            var p2 = new Properties();
            p2.SetProperty("name", "jill");
            p2.SetProperty("count", 3);

            var node1 = Node.CreateNode(p1);
            var node2 = Node.CreateNode(p1);
            var node3 = Node.CreateNode(p2);

            var cypher = new Cypher();
            cypher.Start(s => s.Node("node", node1.Id, node2.Id, node3.Id));
            cypher.Where(w => w.Node("node").Property("name").In("jack"));
            cypher.Return(r => r.Node("node"));

            var result = cypher.Execute();

            Assert.IsTrue(result.Count() == 2);
            Assert.IsTrue(result.First().Field<Node>("node") == node1);
            Assert.IsTrue(result.ElementAt(1).Field<Node>("node") == node2);
        }
Exemplo n.º 13
0
		public static AddInReference Create(Properties properties, string hintPath)
		{
			AddInReference reference = new AddInReference(properties["addin"]);
			string version = properties["version"];
			if (version != null && version.Length > 0) {
				int pos = version.IndexOf('-');
				if (pos > 0) {
					reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath);
					reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath);
				} else {
					reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath);
				}
				
				if (reference.Name == "SharpDevelop") {
					// HACK: SD 4.1 AddIns work with SharpDevelop 4.2
					// Because some 4.1 AddIns restrict themselves to SD 4.1, we extend the
					// supported SD range.
					if (reference.maximumVersion == new Version("4.1")) {
						reference.maximumVersion = new Version("4.2");
					}
				}
			}
			reference.requirePreload = string.Equals(properties["requirePreload"], "true", StringComparison.OrdinalIgnoreCase);
			return reference;
		}
		public void GeneratePlainReport_1()
		{
			ReportModel model = ReportModel.Create();
			Properties customizer = new Properties();
			
			customizer.Set("ReportLayout",GlobalEnums.ReportLayout.ListLayout);
			IReportGenerator generator = new GeneratePlainReport(model,customizer);
			generator.GenerateReport();
			
			XDocument doc1 = XDocument.Load(new XmlNodeReader (generator.XmlReport));
			
			XDocument doc2 = new XDocument();
			
			using (XmlWriter w = doc2.CreateWriter()){
				generator.XmlReport.Save (w);
			}
			XDocument doc3 = ReportGenerationHelper.XmlDocumentToXDocument(generator.XmlReport);
			Assert.IsNotNull (doc1);
			Assert.IsNotNull (doc2);
			Assert.IsNotNull (doc2);
			
			var sq = from si in doc1.Descendants() select si;
			Console.WriteLine ("xxxxx");
			foreach (XElement a in sq)
			{
				Console.WriteLine (a.Name);
		}
			
		}
Exemplo n.º 15
0
        public void OperatorHasTest2()
        {
            var p1 = new Properties();
            p1.SetProperty("name", "jack");

            var p2 = new Properties();
            p2.SetProperty("name", "jill");
            p2.SetProperty("count", 3);

            var node1 = Node.CreateNode();
            var node2 = Node.CreateNode();
            var node3 = Node.CreateNode();

            var rel1 = node1.CreateRelationshipTo(node2, "like", p1);
            var rel2 = node1.CreateRelationshipTo(node3, "like", p2);

            var cypher = new Cypher();
            cypher.Start(s => s.Relationship("rel", rel1.Id	, rel2.Id));
            cypher.Where(w => w.RelationshipHas("rel", "count"));
            cypher.Return(r => r.Relationship("rel"));

            var result = cypher.Execute();

            Assert.IsTrue(result.Count() == 1);
            Assert.IsTrue(result.First().Field<Relationship>("rel") == rel2);
        }
		public void SetUp()
		{
			string addinXml = "<AddIn name     = 'Xml Editor'\r\n" +
       								"author      = ''\r\n" +
       								"copyright   = 'prj:///doc/copyright.txt'\r\n" +
       								"description = ''\r\n" +
       								"addInManagerHidden = 'preinstalled'>\r\n" +
								"</AddIn>";

			using (StringReader reader = new StringReader(addinXml)) {
				AddIn addin = AddIn.Load(reader);
				
				AddInTreeNode addinTreeNode = new AddInTreeNode();

				Properties properties = new Properties();
				properties.Set<string>("extensions", " .xml; .xsd ");
				properties.Set<string>("id", "Xml");
				
				addinTreeNode.AddCodons(
					new Codon[] {
						new Codon(addin, "CodeCompletionC#", new Properties(), new ICondition[0]),
						new Codon(addin, "CodeCompletionXml", properties, new ICondition[0])
					});
				
				fileExtensions = new DefaultXmlFileExtensions(addinTreeNode);
			}
		}
Exemplo n.º 17
0
		public PropertyChangedEventArgs(Properties properties, string key, object oldValue, object newValue)
		{
			this.properties = properties;
			this.key        = key;
			this.oldValue   = oldValue;
			this.newValue   = newValue;
		}
Exemplo n.º 18
0
		public CompilerPanel (Properties customizationObject)
		{
			this.Build ();
			
			project = customizationObject.Get<CProject> ("Project");
			
			compilers = AddinManager.GetExtensionObjects ("/CBinding/Compilers");
			
			foreach (ICompiler compiler in compilers) {
				compilerComboBox.AppendText (compiler.Name);
			}
			
			int active = 0;
			Gtk.TreeIter iter;
			Gtk.ListStore store = (Gtk.ListStore)compilerComboBox.Model;
			store.GetIterFirst (out iter);
			while (store.IterIsValid (iter)) {
				if ((string)store.GetValue (iter, 0) == project.Compiler.Name) {
					break;
				}
				store.IterNext (ref iter);
				active++;
			}

			compilerComboBox.Active = active;
			
			useCcacheCheckBox.Active = ((CProjectConfiguration)project.ActiveConfiguration).UseCcache;
			
			Update ();
		}
Exemplo n.º 19
0
		/// <param name="propertyFilePath">
		/// </param>
		/// <returns> void
		/// 
		/// @Description: 使用普通模式导入
		/// @author liaoqiqi
		/// @date 2013-6-19 </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static java.util.Properties loadWithNormalMode(final String propertyFilePath) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
		private static Properties loadWithNormalMode(string propertyFilePath)
		{

			Properties props = new Properties();
			props.load(new System.IO.StreamReader(new System.IO.FileStream(propertyFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read), Encoding.UTF8));
			return props;
		}
Exemplo n.º 20
0
        public void SetNodeProperty2()
        {
            var now = DateTime.Now;

            var p = new Properties();
            p.SetProperty("name", "jack");
            p.SetProperty("age", 12);
            p.SetProperty("date", now);

            var node1 = Node.CreateNode();

            var cypher = new Cypher();

            cypher.Start(s => s.Node("node1", node1.Id));
            cypher.Set(s => s.Node("node1", p));
            cypher.Return(r => r.Node("node1"));

            var results = cypher.Execute();

            var n1 = results.Rows[0].Field<Node>("node1");

            Assert.IsTrue(n1.GetProperty<string>("name") == "jack");
            Assert.IsTrue(n1.GetProperty<int>("age") == 12);
            Assert.IsTrue(n1.GetProperty<DateTime>("date") == now);
        }
Exemplo n.º 21
0
    public void Load(string Filename)
    {
        List levelLisp = Util.Load(Filename, "supertux-level");

        Properties props = new Properties(levelLisp);
        int version = 1;
        props.Get("version", ref version);
        if(version == 1)
            throw new Exception("Old Level format not supported");
        if(version > 2)
            Console.WriteLine("Warning: Level Format newer than application");

        props.Get("name", ref Name);
        props.Get("author", ref Author);

        LispIterator iter = new LispIterator(levelLisp);
        while(iter.MoveNext()) {
            switch(iter.Key) {
                case "sector":
                    Sector sector = new Sector();
                    sector.Parse(this, iter.List);
                    break;
                default:
                    Console.WriteLine("Ignoring unknown tag '" + iter.Key + "' in level");
                    break;
            }
        }
    }
Exemplo n.º 22
0
        public void CreateRelationshipWithProperties()
        {
            var node1 = Node.CreateNode();
            var node2 = Node.CreateNode();

            var p = new Properties();
            p.SetProperty("name", "jack");
            p.SetProperty("age", 12);

            var cypher = new Cypher();
            cypher.Start(s => s.Node("n1", node1.Id).Node("n2", node2.Id));

            cypher.Create(c => c.Node("n1").To("r", "like", p).Node("n2"));

            cypher.Return(r => r.Relationship("r"));

            var result = cypher.Execute();

            Assert.IsTrue(result.Count() == 1);
            Assert.IsTrue(result.First().Field<Relationship>("r") != null);
            var rel = result.First().Field<Relationship>("r");
            Assert.IsTrue(rel.StartNode == node1);
            Assert.IsTrue(rel.EndNode == node2);
            Assert.IsTrue(rel.GetProperty<string>("name") == "jack");
            Assert.IsTrue(rel.GetProperty<int>("age") == 12);
        }
Exemplo n.º 23
0
        private static Properties SetProperties()
        {
            const string mzTabProperties = "conf/mztab/mztab.properties";
            const string formatProperties = "conf/mztab/mztab_format_error.properties";
            const string logicalProperties = "conf/mztab/mztab_logical_error.properties";
            const string crosscheckProperties = "conf/mztab/mztab_crosscheck_error.properties";
            try{
                properties = new Properties();
                StreamReader reader = new StreamReader(mzTabProperties);
                properties.load(reader);
                reader.Close();

                reader = new StreamReader(formatProperties);
                properties.load(reader);
                reader.Close();

                reader = new StreamReader(logicalProperties);
                properties.load(reader);
                reader.Close();

                reader = new StreamReader(crosscheckProperties);
                properties.load(reader);
                reader.Close();

                return properties;
            }
            catch (FileNotFoundException e){
                Console.Error.WriteLine(e.Message);
            }
            catch (IOException e){
                Console.Error.WriteLine(e.Message);
            }

            return null;
        }
Exemplo n.º 24
0
 internal void SetRowProperties(DataRow dr, Properties.AudioLanguagesProperties row)
 {
     row.ID = Convert.ToInt16(dr["ID"]);
     row.Description = Convert.ToString(dr["Description"]);
     row.Exists = true;
     row.HasChanged = false;
 }
Exemplo n.º 25
0
		public ErrorListPad()
		{
			instance = this;
			properties = PropertyService.Get("ErrorListPad", new Properties());
			
			RedrawContent();
			ResourceService.LanguageChanged += delegate { RedrawContent(); };
			
			TaskService.Cleared += new EventHandler(TaskServiceCleared);
			TaskService.Added   += new TaskEventHandler(TaskServiceAdded);
			TaskService.Removed += new TaskEventHandler(TaskServiceRemoved);
			TaskService.InUpdateChanged += delegate {
				if (!TaskService.InUpdate)
					InternalShowResults();
			};
			
			ProjectService.BuildFinished  += ProjectServiceEndBuild;
			ProjectService.SolutionLoaded += OnSolutionOpen;
			ProjectService.SolutionClosed += OnSolutionClosed;
			
			taskView.CreateControl();
			contentPanel.Controls.Add(taskView);
			
			toolStrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/Pads/ErrorList/Toolbar");
			toolStrip.Stretch   = true;
			toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
			
			contentPanel.Controls.Add(toolStrip);
			
			InternalShowResults();
		}
        public override void Load()
        {
            Name = "TDSMPlugin Example";
            Description = "Plugin Example for TDSM.";
            Author = "DeathCradle";
            Version = "1";
            TDSMBuild = 32; //You put here the release this plugin was made/build for.

            plugin = this;

            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + "TDSM";
            //Create folder if it doesn't exist
            CreateDirectory(pluginFolder);

            //setup a new properties file
            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + "tdsmplugin.properties");
            properties.Load();
            properties.pushData(); //Creates default values if needed. [Out-Dated]
            properties.Save();

            //read properties data
            spawningAllowed = properties.SpawningCancelled;
            tileBreakageAllowed = properties.TileBreakage;
            explosivesAllowed = properties.ExplosivesAllowed;
        }
Exemplo n.º 27
0
    public WorldmapSector(string Filename)
    {
        List WorldMapL = Util.Load(Filename, "supertux-worldmap");

        LispIterator iter = new LispIterator(WorldMapL);
        while(iter.MoveNext()) {
            switch(iter.Key) {
                case "properties":
                    Properties Props = new Properties(iter.List);
                    Props.Get("name", ref Name);
                    Props.Get("music", ref Music);
                    Console.WriteLine("Name: " + Name);
                    Console.WriteLine("Music: " + Music);
                    Props.PrintUnusedWarnings();
                    break;
                case "spawnpoint":
                    WorldmapSpawnPoint SpawnPoint = new WorldmapSpawnPoint();
                    SpawnPoint.Parse(iter.List);
                    SpawnPoints.Add(SpawnPoint.Name, SpawnPoint);
                    break;
                default:
                    GameObject Object = ParseObject(iter.Key, iter.List);
                    if(Object != null)
                        AddObject(Object);
                    break;
            }
        }

        Player = new WorldmapTux(this);
        AddObject(Player);
        Spawn("default");
    }
Exemplo n.º 28
0
 internal void SetRowProperties(DataRow dr, Properties.VideoQualityTypeProperties row)
 {
     row.ID = Convert.ToByte(dr["ID"]);
     row.Description = Convert.ToString(dr["Description"]);
     row.Exists = true;
     row.HasChanged = false;
 }
Exemplo n.º 29
0
        public static List<Properties> ReadSampleBlock(Stream source)
        {
            BinaryReader sourceReader = new BinaryReader(source);
            byte[] sourceData = sourceReader.ReadBytes(0x2000);
            int count = 256;
            List<Properties> result = new List<Properties>();

            // load sample block
            using (MemoryStream tempMem = new MemoryStream(sourceData))
            {
                BinaryReaderEx dataReader = new BinaryReaderEx(tempMem);
                for (int i = 0; i < count; i++)
                {
                    Properties props = new Properties();
                    props.Channel = dataReader.ReadByte();
                    props.Flag01 = dataReader.ReadByte();
                    props.Frequency = dataReader.ReadUInt16S();
                    props.Volume = dataReader.ReadByte();
                    props.Panning = dataReader.ReadByte();
                    props.SampleOffset = dataReader.ReadInt24S() * 2;
                    props.SampleLength = ((dataReader.ReadInt24S() * 2) - props.SampleOffset);
                    props.Value0C = dataReader.ReadInt16S();
                    props.Flag0E = dataReader.ReadByte();
                    props.Flag0F = dataReader.ReadByte();
                    props.SizeInBlocks = dataReader.ReadInt16S();
                    result.Add(props);
                }
            }

            return result;
        }
        protected override void Initialize()
        {
            base.Initialize();

            var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (null != mcs) {
                var id = new CommandID(GuidList.GuidCmdSet, (int)PkgCmdIDList.FormatDocumentCommand);
                _formatDocMenuCommand = new OleMenuCommand(FormatDocumentCallback, id);
                mcs.AddCommand(_formatDocMenuCommand);
                _formatDocMenuCommand.BeforeQueryStatus += OnBeforeQueryStatus;

                id = new CommandID(GuidList.GuidCmdSet, (int)PkgCmdIDList.FormatSelectionCommand);
                _formatSelMenuCommand = new OleMenuCommand(FormatSelectionCallback, id);
                mcs.AddCommand(_formatSelMenuCommand);
                _formatSelMenuCommand.BeforeQueryStatus += OnBeforeQueryStatus;
            }

            _dte = (DTE)GetService(typeof(DTE));

            _documentEventListener = new DocumentEventListener(this);
            _documentEventListener.BeforeSave += OnBeforeDocumentSave;

            if (_dte.RegistryRoot.Contains("VisualStudio")) {
                _isCSharpEnabled = true;
            }

            _props = _dte.Properties["AStyle Formatter", "General"];
            _props.Item("IsCSarpEnabled").Value = _isCSharpEnabled;
        }
Exemplo n.º 31
0
 /// <summary>Remove the named attribute.</summary>
 public void removeAttribute(string name)
 {
     Properties.Remove(name);
 }
Exemplo n.º 32
0
    // public static BookShelf GenerateCustomBookCase(List<BookShelf> BookShelfs)
    // {
    //  BookShelf Customshelf = new BookShelf();
    //  Customshelf.ID = BookShelfAID;
    //  BookShelfAID++;
    //  Customshelf.IsPartiallyGenerated = false;
    //  Customshelf.ShelfName = "Your custom list of bookshelves";
    //  Customshelf.ObscuredBookShelves = BookShelfs;
    //  Customshelf.ICustomBookshelf = true;
    //  IDToBookShelf[Customshelf.ID] = Customshelf;
    //  return (Customshelf);
    // }
    //
    // public static BookShelf GenerateCustomBookCase(BookShelf BookShelf)
    // {
    //  BookShelf Customshelf = new BookShelf();
    //  Customshelf.ID = BookShelfAID;
    //  BookShelfAID++;
    //  Customshelf.IsPartiallyGenerated = false;
    //  Customshelf.ShelfName = "Your custom list of bookshelves";
    //  Customshelf.ObscuredBookShelves.Add(BookShelf);
    //  Customshelf.ICustomBookshelf = true;
    //  IDToBookShelf[Customshelf.ID] = Customshelf;
    //  return (Customshelf);
    // }

    public static Book GetAttributes(Book Book, object Script)
    {
        Type monoType = Script.GetType();
        var  Fields   = monoType.BaseType.GetFields(
            BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static |
            BindingFlags.FlattenHierarchy
            );

        var coolFields = Fields.ToList();

        coolFields.AddRange((monoType.GetFields(
                                 BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static |
                                 BindingFlags.FlattenHierarchy
                                 ).ToList()));

        foreach (FieldInfo Field in coolFields)
        {
            if (Field.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length == 0)
            {
                Page Page = new Page();
                Page.VariableName = Field.Name;
                Page.ID           = PageAID;
                PageAID++;
                Page.Info     = Field;
                Page.Variable = Field.GetValue(Script);
                if (Page.Variable == null)
                {
                    Page.Variable = "null";
                }

                Page.VariableType         = Field.FieldType;
                Page.BindedTo             = Book;
                IDToPage[Page.ID]         = Page;
                Page.Sentences            = new Librarian.Sentence();
                Page.Sentences.SentenceID = Page.ASentenceID;
                Page.ASentenceID++;
                var attribute = Field.GetCustomAttributes(typeof(VVNote), true);
                if (attribute.Length > 0)
                {
                    var VVNoteAttributes = attribute.Cast <VVNote>().ToArray()[0];
                    Page.VVHighlight = VVNoteAttributes.variableHighlightl;
                }

                GenerateSentenceValuesforSentence(Page.Sentences, Field.FieldType, Page, Script, FInfo: Field);
                Book.BindedPagesAdd(Page);
            }
        }

        if (TupleTypeReference != monoType)         //Causes an error if this is not here and Tuples can not get Custom properties so it is I needed to get the properties
        {
            var Propertie = monoType.BaseType.GetProperties(
                BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static |
                BindingFlags.FlattenHierarchy
                );

            var coolProperties = Propertie.ToList();

            coolProperties.AddRange((monoType.GetProperties(
                                         BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static |
                                         BindingFlags.FlattenHierarchy
                                         ).ToList()));
            foreach (PropertyInfo Properties in coolProperties)
            {
                if (Properties.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length == 0)
                {
                    Page Page = new Page();
                    Page.VariableName = Properties.Name;
                    Page.Variable     = Properties.GetValue(Script);
                    Page.VariableType = Properties.PropertyType;
                    Page.PInfo        = Properties;
                    if (Page.Variable == null)
                    {
                        Page.Variable = "null";
                    }

                    Page.ID = PageAID;
                    PageAID++;
                    Page.BindedTo             = Book;
                    IDToPage[Page.ID]         = Page;
                    Page.Sentences            = new Librarian.Sentence();
                    Page.Sentences.SentenceID = Page.ASentenceID;
                    Page.ASentenceID++;

                    var attribute = Properties.GetCustomAttributes(typeof(VVNote), true);
                    if (attribute.Length > 0)
                    {
                        var VVNoteAttributes = attribute.Cast <VVNote>().ToArray()[0];
                        Page.VVHighlight = VVNoteAttributes.variableHighlightl;
                    }

                    GenerateSentenceValuesforSentence(Page.Sentences, Properties.PropertyType, Page, Script,
                                                      PInfo: Properties);
                    Book.BindedPagesAdd(Page);
                }
            }
        }

        var coolMethods = (monoType.GetMethods(
                               BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static |
                               BindingFlags.FlattenHierarchy
                               ).ToList());

        foreach (MethodInfo Method in coolMethods)
        {
            if (Method.GetParameters().Length > 0)
            {
                continue;
            }
            Page Page = new Page();
            Page.VariableName = Method.Name;
            Page.ID           = PageAID;
            PageAID++;
            Page.MInfo = Method;

            if (Page.Variable == null)
            {
                Page.Variable = "null";
            }
            Page.BindedTo             = Book;
            IDToPage[Page.ID]         = Page;
            Page.Sentences            = new Librarian.Sentence();
            Page.Sentences.SentenceID = Page.ASentenceID;
            Page.ASentenceID++;



            var attribute = Method.GetCustomAttributes(typeof(VVNote), true);
            if (attribute.Length > 0)
            {
                var VVNoteAttributes = attribute.Cast <VVNote>().ToArray()[0];
                Page.VVHighlight = VVNoteAttributes.variableHighlightl;
            }

            // GenerateSentenceValuesforSentence(Page.Sentences, Field.FieldType, Page, Script, FInfo: Field);
            Book.BindedPagesAdd(Page);
        }

        return(Book);
    }
Exemplo n.º 33
0
            public static void allTests(global::Test.TestHelper helper)
            {
                Communicator communicator = helper.communicator();
                var          com          = Test.RemoteCommunicatorPrx.Parse($"communicator:{helper.getTestEndpoint(0)}", communicator);

                var rand   = new Random(unchecked ((int)DateTime.Now.Ticks));
                var output = helper.getWriter();

                output.Write("testing binding with single endpoint... ");
                output.Flush();
                {
                    Test.RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default");

                    var test1 = adapter.getTestIntf();
                    var test2 = adapter.getTestIntf();
                    test(test1.GetConnection() == test2.GetConnection());

                    test1.IcePing();
                    test2.IcePing();

                    com.deactivateObjectAdapter(adapter);

                    var test3 = Test.TestIntfPrx.UncheckedCast(test1);
                    test(test3.GetConnection() == test1.GetConnection());
                    test(test3.GetConnection() == test2.GetConnection());

                    try
                    {
                        test3.IcePing();
                        test(false);
                    }
                    catch (ConnectFailedException)
                    {
                    }
                    catch (ConnectTimeoutException)
                    {
                    }
                }
                output.WriteLine("ok");

                output.Write("testing binding with multiple endpoints... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("Adapter11", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter12", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter13", "default"));

                    //
                    // Ensure that when a connection is opened it's reused for new
                    // proxies and that all endpoints are eventually tried.
                    //
                    List <string> names = new List <string>();
                    names.Add("Adapter11");
                    names.Add("Adapter12");
                    names.Add("Adapter13");
                    while (names.Count > 0)
                    {
                        var adpts = new List <Test.RemoteObjectAdapterPrx>(adapters);

                        var test1 = createTestIntfPrx(adpts);
                        shuffle(ref adpts);
                        var test2 = createTestIntfPrx(adpts);
                        shuffle(ref adpts);
                        var test3 = createTestIntfPrx(adpts);
                        test1.IcePing();
                        test(test1.GetConnection() == test2.GetConnection());
                        test(test2.GetConnection() == test3.GetConnection());

                        names.Remove(test1.getAdapterName());
                        test1.GetConnection().close(ConnectionClose.GracefullyWithWait);
                    }

                    //
                    // Ensure that the proxy correctly caches the connection(we
                    // always send the request over the same connection.)
                    //
                    {
                        foreach (var adpt in adapters)
                        {
                            adpt.getTestIntf().IcePing();
                        }

                        var    t      = createTestIntfPrx(adapters);
                        string name   = t.getAdapterName();
                        int    nRetry = 10;
                        int    i;
                        for (i = 0; i < nRetry && t.getAdapterName().Equals(name); i++)
                        {
                            ;
                        }
                        test(i == nRetry);

                        foreach (var adpt in adapters)
                        {
                            adpt.getTestIntf().GetConnection().close(ConnectionClose.GracefullyWithWait);
                        }
                    }

                    //
                    // Deactivate an adapter and ensure that we can still
                    // establish the connection to the remaining adapters.
                    //
                    com.deactivateObjectAdapter((Test.RemoteObjectAdapterPrx)adapters[0]);
                    names.Add("Adapter12");
                    names.Add("Adapter13");
                    while (names.Count > 0)
                    {
                        var adpts = new List <Test.RemoteObjectAdapterPrx>(adapters);

                        var test1 = createTestIntfPrx(adpts);
                        shuffle(ref adpts);
                        var test2 = createTestIntfPrx(adpts);
                        shuffle(ref adpts);
                        var test3 = createTestIntfPrx(adpts);

                        test(test1.GetConnection() == test2.GetConnection());
                        test(test2.GetConnection() == test3.GetConnection());

                        names.Remove(test1.getAdapterName());
                        test1.GetConnection().close(ConnectionClose.GracefullyWithWait);
                    }

                    //
                    // Deactivate an adapter and ensure that we can still
                    // establish the connection to the remaining adapter.
                    //
                    com.deactivateObjectAdapter((Test.RemoteObjectAdapterPrx)adapters[2]);
                    var obj = createTestIntfPrx(adapters);
                    test(obj.getAdapterName().Equals("Adapter12"));

                    deactivate(com, adapters);
                }
                output.WriteLine("ok");

                output.Write("testing binding with multiple random endpoints... ");
                output.Flush();
                {
                    var adapters = new Test.RemoteObjectAdapterPrx[5];
                    adapters[0] = com.createObjectAdapter("AdapterRandom11", "default");
                    adapters[1] = com.createObjectAdapter("AdapterRandom12", "default");
                    adapters[2] = com.createObjectAdapter("AdapterRandom13", "default");
                    adapters[3] = com.createObjectAdapter("AdapterRandom14", "default");
                    adapters[4] = com.createObjectAdapter("AdapterRandom15", "default");

                    int count        = 20;
                    int adapterCount = adapters.Length;
                    while (--count > 0)
                    {
                        Test.TestIntfPrx[] proxies;
                        if (count == 1)
                        {
                            com.deactivateObjectAdapter(adapters[4]);
                            --adapterCount;
                        }
                        proxies = new Test.TestIntfPrx[10];

                        int i;
                        for (i = 0; i < proxies.Length; ++i)
                        {
                            var adpts = new Test.RemoteObjectAdapterPrx[rand.Next(adapters.Length)];
                            if (adpts.Length == 0)
                            {
                                adpts = new Test.RemoteObjectAdapterPrx[1];
                            }
                            for (int j = 0; j < adpts.Length; ++j)
                            {
                                adpts[j] = adapters[rand.Next(adapters.Length)];
                            }
                            proxies[i] = createTestIntfPrx(new List <Test.RemoteObjectAdapterPrx>(adpts));
                        }

                        for (i = 0; i < proxies.Length; i++)
                        {
                            proxies[i].getAdapterNameAsync();
                        }
                        for (i = 0; i < proxies.Length; i++)
                        {
                            try
                            {
                                proxies[i].IcePing();
                            }
                            catch (LocalException)
                            {
                            }
                        }

                        List <Connection> connections = new List <Connection>();
                        for (i = 0; i < proxies.Length; i++)
                        {
                            if (proxies[i].GetCachedConnection() != null)
                            {
                                if (!connections.Contains(proxies[i].GetCachedConnection()))
                                {
                                    connections.Add(proxies[i].GetCachedConnection());
                                }
                            }
                        }
                        test(connections.Count <= adapterCount);

                        foreach (var a in adapters)
                        {
                            try
                            {
                                a.getTestIntf().GetConnection().close(ConnectionClose.GracefullyWithWait);
                            }
                            catch (LocalException)
                            {
                                // Expected if adapter is down.
                            }
                        }
                    }
                }
                output.WriteLine("ok");

                output.Write("testing binding with multiple endpoints and AMI... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("AdapterAMI11", "default"));
                    adapters.Add(com.createObjectAdapter("AdapterAMI12", "default"));
                    adapters.Add(com.createObjectAdapter("AdapterAMI13", "default"));

                    //
                    // Ensure that when a connection is opened it's reused for new
                    // proxies and that all endpoints are eventually tried.
                    //
                    List <string> names = new List <string>();
                    names.Add("AdapterAMI11");
                    names.Add("AdapterAMI12");
                    names.Add("AdapterAMI13");
                    while (names.Count > 0)
                    {
                        var adpts = new List <Test.RemoteObjectAdapterPrx>(adapters);

                        var test1 = createTestIntfPrx(adpts);
                        shuffle(ref adpts);
                        var test2 = createTestIntfPrx(adpts);
                        shuffle(ref adpts);
                        var test3 = createTestIntfPrx(adpts);
                        test1.IcePing();
                        test(test1.GetConnection() == test2.GetConnection());
                        test(test2.GetConnection() == test3.GetConnection());

                        names.Remove(getAdapterNameWithAMI(test1));
                        test1.GetConnection().close(ConnectionClose.GracefullyWithWait);
                    }

                    //
                    // Ensure that the proxy correctly caches the connection(we
                    // always send the request over the same connection.)
                    //
                    {
                        foreach (var adpt in adapters)
                        {
                            adpt.getTestIntf().IcePing();
                        }

                        var    t      = createTestIntfPrx(adapters);
                        string name   = getAdapterNameWithAMI(t);
                        int    nRetry = 10;
                        int    i;
                        for (i = 0; i < nRetry && getAdapterNameWithAMI(t).Equals(name); i++)
                        {
                            ;
                        }
                        test(i == nRetry);

                        foreach (var adpt in adapters)
                        {
                            adpt.getTestIntf().GetConnection().close(ConnectionClose.GracefullyWithWait);
                        }
                    }

                    //
                    // Deactivate an adapter and ensure that we can still
                    // establish the connection to the remaining adapters.
                    //
                    com.deactivateObjectAdapter(adapters[0]);
                    names.Add("AdapterAMI12");
                    names.Add("AdapterAMI13");
                    while (names.Count > 0)
                    {
                        var adpts = new List <Test.RemoteObjectAdapterPrx>(adapters);

                        var test1 = createTestIntfPrx(adpts);
                        shuffle(ref adpts);
                        var test2 = createTestIntfPrx(adpts);
                        shuffle(ref adpts);
                        var test3 = createTestIntfPrx(adpts);

                        test(test1.GetConnection() == test2.GetConnection());
                        test(test2.GetConnection() == test3.GetConnection());

                        names.Remove(getAdapterNameWithAMI(test1));
                        test1.GetConnection().close(ConnectionClose.GracefullyWithWait);
                    }

                    //
                    // Deactivate an adapter and ensure that we can still
                    // establish the connection to the remaining adapter.
                    //
                    com.deactivateObjectAdapter(adapters[2]);
                    var obj = createTestIntfPrx(adapters);
                    test(getAdapterNameWithAMI(obj).Equals("AdapterAMI12"));

                    deactivate(com, adapters);
                }
                output.WriteLine("ok");

                output.Write("testing random endpoint selection... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("Adapter21", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter22", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter23", "default"));

                    var obj = createTestIntfPrx(adapters);
                    test(obj.EndpointSelection == EndpointSelectionType.Random);

                    var names = new List <string>();
                    names.Add("Adapter21");
                    names.Add("Adapter22");
                    names.Add("Adapter23");
                    while (names.Count > 0)
                    {
                        names.Remove(obj.getAdapterName());
                        obj.GetConnection().close(ConnectionClose.GracefullyWithWait);
                    }

                    obj = obj.Clone(endpointSelectionType: EndpointSelectionType.Random);
                    test(obj.EndpointSelection == EndpointSelectionType.Random);

                    names.Add("Adapter21");
                    names.Add("Adapter22");
                    names.Add("Adapter23");
                    while (names.Count > 0)
                    {
                        names.Remove(obj.getAdapterName());
                        obj.GetConnection().close(ConnectionClose.GracefullyWithWait);
                    }

                    deactivate(com, adapters);
                }
                output.WriteLine("ok");

                output.Write("testing ordered endpoint selection... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("Adapter31", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter32", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter33", "default"));

                    var obj = createTestIntfPrx(adapters);
                    obj = obj.Clone(endpointSelectionType: EndpointSelectionType.Ordered);
                    test(obj.EndpointSelection == EndpointSelectionType.Ordered);
                    int nRetry = 3;
                    int i;

                    //
                    // Ensure that endpoints are tried in order by deactiving the adapters
                    // one after the other.
                    //
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter31"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[0]);
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter32"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[1]);
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter33"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[2]);

                    try
                    {
                        obj.getAdapterName();
                    }
                    catch (ConnectFailedException)
                    {
                    }
                    catch (ConnectTimeoutException)
                    {
                    }

                    Endpoint[] endpoints = obj.Endpoints;

                    adapters.Clear();

                    //
                    // Now, re-activate the adapters with the same endpoints in the opposite
                    // order.
                    //
                    adapters.Add(com.createObjectAdapter("Adapter36", endpoints[2].ToString()));
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter36"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    obj.GetConnection().close(ConnectionClose.GracefullyWithWait);
                    adapters.Add(com.createObjectAdapter("Adapter35", endpoints[1].ToString()));
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter35"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    obj.GetConnection().close(ConnectionClose.GracefullyWithWait);
                    adapters.Add(com.createObjectAdapter("Adapter34", endpoints[0].ToString()));
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter34"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);

                    deactivate(com, adapters);
                }
                output.WriteLine("ok");

                output.Write("testing per request binding with single endpoint... ");
                output.Flush();
                {
                    var adapter = com.createObjectAdapter("Adapter41", "default");

                    var test1 = adapter.getTestIntf().Clone(connectionCached: false);
                    var test2 = adapter.getTestIntf().Clone(connectionCached: false);
                    test(!test1.IsConnectionCached);
                    test(!test2.IsConnectionCached);
                    test(test1.GetConnection() != null && test2.GetConnection() != null);
                    test(test1.GetConnection() == test2.GetConnection());

                    test1.IcePing();

                    com.deactivateObjectAdapter(adapter);

                    var test3 = Test.TestIntfPrx.UncheckedCast(test1);
                    try
                    {
                        test(test3.GetConnection() == test1.GetConnection());
                        test(false);
                    }
                    catch (ConnectFailedException)
                    {
                    }
                    catch (ConnectTimeoutException)
                    {
                    }
                }
                output.WriteLine("ok");

                output.Write("testing per request binding with multiple endpoints... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("Adapter51", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter52", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter53", "default"));

                    var obj = createTestIntfPrx(adapters).Clone(connectionCached: false);
                    test(!obj.IsConnectionCached);

                    List <string> names = new List <string>();
                    names.Add("Adapter51");
                    names.Add("Adapter52");
                    names.Add("Adapter53");
                    while (names.Count > 0)
                    {
                        names.Remove(obj.getAdapterName());
                    }

                    com.deactivateObjectAdapter(adapters[0]);

                    names.Add("Adapter52");
                    names.Add("Adapter53");
                    while (names.Count > 0)
                    {
                        names.Remove(obj.getAdapterName());
                    }

                    com.deactivateObjectAdapter(adapters[2]);

                    test(obj.getAdapterName().Equals("Adapter52"));

                    deactivate(com, adapters);
                }
                output.WriteLine("ok");

                output.Write("testing per request binding with multiple endpoints and AMI... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("AdapterAMI51", "default"));
                    adapters.Add(com.createObjectAdapter("AdapterAMI52", "default"));
                    adapters.Add(com.createObjectAdapter("AdapterAMI53", "default"));

                    var obj = createTestIntfPrx(adapters).Clone(connectionCached: false);
                    test(!obj.IsConnectionCached);

                    var names = new List <string>();
                    names.Add("AdapterAMI51");
                    names.Add("AdapterAMI52");
                    names.Add("AdapterAMI53");
                    while (names.Count > 0)
                    {
                        names.Remove(getAdapterNameWithAMI(obj));
                    }

                    com.deactivateObjectAdapter(adapters[0]);

                    names.Add("AdapterAMI52");
                    names.Add("AdapterAMI53");
                    while (names.Count > 0)
                    {
                        names.Remove(getAdapterNameWithAMI(obj));
                    }

                    com.deactivateObjectAdapter(adapters[2]);

                    test(getAdapterNameWithAMI(obj).Equals("AdapterAMI52"));

                    deactivate(com, adapters);
                }
                output.WriteLine("ok");

                output.Write("testing per request binding and ordered endpoint selection... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("Adapter61", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter62", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter63", "default"));

                    var obj = createTestIntfPrx(adapters);
                    obj = obj.Clone(endpointSelectionType: EndpointSelectionType.Ordered);
                    test(obj.EndpointSelection == EndpointSelectionType.Ordered);
                    obj = obj.Clone(connectionCached: false);
                    test(!obj.IsConnectionCached);
                    int nRetry = 3;
                    int i;

                    //
                    // Ensure that endpoints are tried in order by deactiving the adapters
                    // one after the other.
                    //
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter61"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[0]);
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter62"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[1]);
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter63"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[2]);

                    try
                    {
                        obj.getAdapterName();
                    }
                    catch (ConnectFailedException)
                    {
                    }
                    catch (ConnectTimeoutException)
                    {
                    }

                    Endpoint[] endpoints = obj.Endpoints;

                    adapters.Clear();

                    //
                    // Now, re-activate the adapters with the same endpoints in the opposite
                    // order.
                    //
                    adapters.Add(com.createObjectAdapter("Adapter66", endpoints[2].ToString()));
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter66"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    adapters.Add(com.createObjectAdapter("Adapter65", endpoints[1].ToString()));
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter65"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    adapters.Add(com.createObjectAdapter("Adapter64", endpoints[0].ToString()));
                    for (i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter64"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);

                    deactivate(com, adapters);
                }
                output.WriteLine("ok");

                output.Write("testing per request binding and ordered endpoint selection and AMI... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("AdapterAMI61", "default"));
                    adapters.Add(com.createObjectAdapter("AdapterAMI62", "default"));
                    adapters.Add(com.createObjectAdapter("AdapterAMI63", "default"));

                    var obj = createTestIntfPrx(adapters);
                    obj = obj.Clone(endpointSelectionType: EndpointSelectionType.Ordered);
                    test(obj.EndpointSelection == EndpointSelectionType.Ordered);
                    obj = obj.Clone(connectionCached: false);
                    test(!obj.IsConnectionCached);
                    int nRetry = 3;
                    int i;

                    //
                    // Ensure that endpoints are tried in order by deactiving the adapters
                    // one after the other.
                    //
                    for (i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI61"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[0]);
                    for (i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI62"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[1]);
                    for (i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI63"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    com.deactivateObjectAdapter(adapters[2]);

                    try
                    {
                        obj.getAdapterName();
                    }
                    catch (ConnectFailedException)
                    {
                    }
                    catch (ConnectTimeoutException)
                    {
                    }

                    Endpoint[] endpoints = obj.Endpoints;

                    adapters.Clear();

                    //
                    // Now, re-activate the adapters with the same endpoints in the opposite
                    // order.
                    //
                    adapters.Add(com.createObjectAdapter("AdapterAMI66", endpoints[2].ToString()));
                    for (i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI66"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    adapters.Add(com.createObjectAdapter("AdapterAMI65", endpoints[1].ToString()));
                    for (i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI65"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);
                    adapters.Add(com.createObjectAdapter("AdapterAMI64", endpoints[0].ToString()));
                    for (i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI64"); i++)
                    {
                        ;
                    }
                    test(i == nRetry);

                    deactivate(com, adapters);
                }
                output.WriteLine("ok");

                output.Write("testing endpoint mode filtering... ");
                output.Flush();
                {
                    var adapters = new List <Test.RemoteObjectAdapterPrx>();
                    adapters.Add(com.createObjectAdapter("Adapter71", "default"));
                    adapters.Add(com.createObjectAdapter("Adapter72", "udp"));

                    var obj = createTestIntfPrx(adapters);
                    test(obj.getAdapterName().Equals("Adapter71"));

                    var testUDP = obj.Clone(invocationMode: InvocationMode.Datagram);
                    test(obj.GetConnection() != testUDP.GetConnection());
                    try
                    {
                        testUDP.getAdapterName();
                    }
                    catch (TwowayOnlyException)
                    {
                    }
                }
                output.WriteLine("ok");
                if (communicator.getProperties().getProperty("Plugin.IceSSL").Length > 0)
                {
                    output.Write("testing unsecure vs. secure endpoints... ");
                    output.Flush();
                    {
                        var adapters = new List <Test.RemoteObjectAdapterPrx>();
                        adapters.Add(com.createObjectAdapter("Adapter81", "ssl"));
                        adapters.Add(com.createObjectAdapter("Adapter82", "tcp"));

                        var obj = createTestIntfPrx(adapters);
                        int i;
                        for (i = 0; i < 5; i++)
                        {
                            test(obj.getAdapterName().Equals("Adapter82"));
                            obj.GetConnection().close(ConnectionClose.GracefullyWithWait);
                        }

                        var testSecure = obj.Clone(secure: true);
                        test(testSecure.IsSecure);
                        testSecure = obj.Clone(secure: false);
                        test(!testSecure.IsSecure);
                        testSecure = obj.Clone(secure: true);
                        test(testSecure.IsSecure);
                        test(obj.GetConnection() != testSecure.GetConnection());

                        com.deactivateObjectAdapter(adapters[1]);

                        for (i = 0; i < 5; i++)
                        {
                            test(obj.getAdapterName().Equals("Adapter81"));
                            obj.GetConnection().close(ConnectionClose.GracefullyWithWait);
                        }

                        com.createObjectAdapter("Adapter83", (obj.Endpoints[1]).ToString()); // Reactive tcp OA.

                        for (i = 0; i < 5; i++)
                        {
                            test(obj.getAdapterName().Equals("Adapter83"));
                            obj.GetConnection().close(ConnectionClose.GracefullyWithWait);
                        }

                        com.deactivateObjectAdapter(adapters[0]);
                        try
                        {
                            testSecure.IcePing();
                            test(false);
                        }
                        catch (ConnectFailedException)
                        {
                        }
                        catch (ConnectTimeoutException)
                        {
                        }

                        deactivate(com, adapters);
                    }
                    output.WriteLine("ok");
                }

                {
                    output.Write("testing ipv4 & ipv6 connections... ");
                    output.Flush();

                    Properties ipv4 = Util.createProperties();
                    ipv4.setProperty("IPv4", "1");
                    ipv4.setProperty("IPv6", "0");
                    ipv4.setProperty("Adapter.Endpoints", "tcp -h localhost");

                    Properties ipv6 = Util.createProperties();
                    ipv6.setProperty("IPv4", "0");
                    ipv6.setProperty("IPv6", "1");
                    ipv6.setProperty("Adapter.Endpoints", "tcp -h localhost");

                    Properties bothPreferIPv4 = Util.createProperties();
                    bothPreferIPv4.setProperty("IPv4", "1");
                    bothPreferIPv4.setProperty("IPv6", "1");
                    bothPreferIPv4.setProperty("PreferIPv6Address", "0");
                    bothPreferIPv4.setProperty("Adapter.Endpoints", "tcp -h localhost");

                    Properties bothPreferIPv6 = Util.createProperties();
                    bothPreferIPv6.setProperty("IPv4", "1");
                    bothPreferIPv6.setProperty("IPv6", "1");
                    bothPreferIPv6.setProperty("PreferIPv6Address", "1");
                    bothPreferIPv6.setProperty("Adapter.Endpoints", "tcp -h localhost");

                    List <Properties> clientProps = new List <Properties>();
                    clientProps.Add(ipv4);
                    clientProps.Add(ipv6);
                    clientProps.Add(bothPreferIPv4);
                    clientProps.Add(bothPreferIPv6);

                    string endpoint = "tcp -p " + helper.getTestPort(2).ToString();

                    Properties anyipv4 = ipv4.Clone();
                    anyipv4.setProperty("Adapter.Endpoints", endpoint);
                    anyipv4.setProperty("Adapter.PublishedEndpoints", endpoint + " -h 127.0.0.1");

                    Properties anyipv6 = ipv6.Clone();
                    anyipv6.setProperty("Adapter.Endpoints", endpoint);
                    anyipv6.setProperty("Adapter.PublishedEndpoints", endpoint + " -h \".1\"");

                    Properties anyboth = Util.createProperties();
                    anyboth.setProperty("IPv4", "1");
                    anyboth.setProperty("IPv6", "1");
                    anyboth.setProperty("Adapter.Endpoints", endpoint);
                    anyboth.setProperty("Adapter.PublishedEndpoints", endpoint + " -h \"::1\":" + endpoint + " -h 127.0.0.1");

                    Properties localipv4 = ipv4.Clone();
                    localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1");

                    Properties localipv6 = ipv6.Clone();
                    localipv6.setProperty("Adapter.Endpoints", "tcp -h \"::1\"");

                    List <Properties> serverProps = new List <Properties>(clientProps);
                    serverProps.Add(anyipv4);
                    serverProps.Add(anyipv6);
                    serverProps.Add(anyboth);
                    serverProps.Add(localipv4);
                    serverProps.Add(localipv6);

                    bool ipv6NotSupported = false;
                    foreach (Properties p in serverProps)
                    {
                        InitializationData serverInitData = new InitializationData();
                        serverInitData.properties = p;
                        Communicator  serverCommunicator = Util.initialize(serverInitData);
                        ObjectAdapter oa;
                        try
                        {
                            oa = serverCommunicator.createObjectAdapter("Adapter");
                            oa.Activate();
                        }
                        catch (DNSException)
                        {
                            serverCommunicator.destroy();
                            continue; // IP version not supported.
                        }
                        catch (SocketException)
                        {
                            if (p == ipv6)
                            {
                                ipv6NotSupported = true;
                            }
                            serverCommunicator.destroy();
                            continue; // IP version not supported.
                        }

                        var prx = oa.CreateProxy("dummy");
                        try
                        {
                            prx.Clone(collocationOptimized: false).IcePing();
                        }
                        catch (LocalException)
                        {
                            serverCommunicator.destroy();
                            continue; // IP version not supported.
                        }

                        string strPrx = prx.ToString();
                        foreach (Properties q in clientProps)
                        {
                            InitializationData clientInitData = new InitializationData();
                            clientInitData.properties = q;
                            Communicator clientCommunicator = Util.initialize(clientInitData);
                            prx = IObjectPrx.Parse(strPrx, clientCommunicator);
                            try
                            {
                                prx.IcePing();
                                test(false);
                            }
                            catch (ObjectNotExistException)
                            {
                                // Expected, no object registered.
                            }
                            catch (DNSException)
                            {
                                // Expected if no IPv4 or IPv6 address is
                                // associated to localhost or if trying to connect
                                // to an any endpoint with the wrong IP version,
                                // e.g.: resolving an IPv4 address when only IPv6
                                // is enabled fails with a DNS exception.
                            }
                            catch (SocketException)
                            {
                                test((p == ipv4 && q == ipv6) || (p == ipv6 && q == ipv4) ||
                                     (p == bothPreferIPv4 && q == ipv6) || (p == bothPreferIPv6 && q == ipv4) ||
                                     (p == bothPreferIPv6 && q == ipv6 && ipv6NotSupported) ||
                                     (p == anyipv4 && q == ipv6) || (p == anyipv6 && q == ipv4) ||
                                     (p == localipv4 && q == ipv6) || (p == localipv6 && q == ipv4) ||
                                     (p == ipv6 && q == bothPreferIPv4) || (p == ipv6 && q == bothPreferIPv6) ||
                                     (p == bothPreferIPv6 && q == ipv6));
                            }
                            clientCommunicator.destroy();
                        }
                        serverCommunicator.destroy();
                    }

                    output.WriteLine("ok");
                }
                com.shutdown();
            }
Exemplo n.º 34
0
 /// <summary>
 /// Raises the <see cref="Terminating"/> event.
 /// </summary>
 /// <param name="e">Event arguments.</param>
 protected virtual void OnTerminating(CancelEventArgs e)
 {
     Properties.TriggerEvent(TerminatingEvent, this, e);
 }
Exemplo n.º 35
0
 /// <summary>
 /// Raises the <see cref="Initialized"/> event.
 /// </summary>
 /// <remarks>
 /// This is where any of your startup code should be placed, such as creating the main form and showing it.
 /// If you are not subclassing Application, you can handle the <see cref="Initialized"/> event instead.
 /// </remarks>
 /// <param name="e">Event arguments.</param>
 protected virtual void OnInitialized(EventArgs e)
 {
     Properties.TriggerEvent(InitializedKey, this, e);
 }
Exemplo n.º 36
0
 /// <summary>
 /// Raises the <see cref="NotificationActivated"/> event
 /// </summary>
 /// <param name="e">Event arguments</param>
 protected virtual void OnNotificationActivated(NotificationEventArgs e)
 {
     Properties.TriggerEvent(NotificationActivatedEvent, this, e);
 }
Exemplo n.º 37
0
 /// <summary>
 /// Raises the unhandled exception event.
 /// </summary>
 /// <param name="e">Event arguments.</param>
 protected virtual void OnUnhandledException(UnhandledExceptionEventArgs e)
 {
     Properties.TriggerEvent(UnhandledExceptionEvent, this, e);
 }
Exemplo n.º 38
0
 /// <summary>Remove the named attribute.</summary>
 public void removeAttributeNS(string ns, string name)
 {
     Properties.Remove(ns + ":" + name);
 }
Exemplo n.º 39
0
        private IEnumerable <ToSic.Eav.Interfaces.IEntity> GetList()
        {
            EnsureConfigurationIsLoaded();

            var properties = Properties.Split(',').Select(p => p.Trim()).ToArray();
            var portalId   = PortalSettings.Current.PortalId;

            // read all user Profiles
            ArrayList users;

            if (UserIds == "disabled")
            {
                users = UserController.GetUsers(portalId);
            }
            // read user Profiles of specified UserIds
            else
            {
                var userIds = UserIds.Split(',').Select(n => Convert.ToInt32(n)).ToArray();
                users = new ArrayList();
                foreach (var user in userIds.Select(userId => UserController.GetUserById(portalId, userId)))
                {
                    users.Add(user);
                }
            }

            // convert Profiles to Entities
            var result = new List <ToSic.Eav.Interfaces.IEntity>();

            foreach (UserInfo user in users)
            {
                // add Profile-Properties
                var values = new Dictionary <string, object>();
                foreach (var property in properties)
                {
                    string value;
                    switch (property.ToLower())
                    {
                    case "displayname":
                        value = user.DisplayName;
                        break;

                    case "email":
                        value = user.Email;
                        break;

                    case "firstname":
                        value = user.FirstName;
                        break;

                    case "lastname":
                        value = user.LastName;
                        break;

                    case "username":
                        value = user.Username;
                        break;

                    default:
                        value = user.Profile.GetPropertyValue(property);
                        break;
                    }

                    values.Add(property, value);
                }

                // create Entity and add to result
                var entity = new Eav.Data.Entity(Eav.Constants.TransientAppId, user.UserID, ContentType, values, TitleField);
                result.Add(entity);
            }

            return(result);
        }
Exemplo n.º 40
0
 /// <summary>Does this element have the named attribute?</summary>
 public bool hasAttribute(string name)
 {
     return(Properties.ContainsKey(name));
 }
Exemplo n.º 41
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="table"></param>
 /// <returns></returns>
 public static ICollection GetKeySet(Properties table)
 {
     return((table == null) ? new Properties().Keys : table.Keys);
 }
Exemplo n.º 42
0
 /// <summary>Does this element have the named attribute?</summary>
 public bool hasAttributeNS(string ns, string name)
 {
     return(Properties.ContainsKey(ns + ":" + name));
 }
Exemplo n.º 43
0
        public static object initProperties(Type system, Properties props)
        {
            void P(string n, string v)
            {
                props.setProperty(n, v);
            }

            void PI(string n, object v)
            {
                props.setProperty(n, v.ToString());
            }

            P("java.specification.name", "Java Platform API Specification");
            P("java.specification.vendor", "Oracle Corporation");
            P("java.specification.version", "8.0");

            P("java.version", "8.0");
            P("java.vendor", "profMagija");
            P("java.vendor.url", "https://github.com/profMagija/JavaNet");
            P("java.vendor.url.bug", "https://github.com/profMagija/JavaNet/issues");

            P("java.class.version", "55.0");

            P("os.name", Environment.OSVersion.ToString());
            P("os.name", Environment.OSVersion.ToString());

            P("file.separator", Path.DirectorySeparatorChar.ToString());
            P("path.separator", Path.PathSeparator.ToString());
            P("line.separator", Environment.NewLine);

            P("file.encoding", "UTF8");
            P("sun.jnu.encoding", "UTF8");
            P("sun.stdout.encoding", "UTF8");
            P("sun.stderr.encoding", "UTF8");
            P("file.encoding.pkg", "sun.nio");
            P("sun.io.unicode.encoding", "little");
            P("sun.cpu.isalist", "amd64");

            PI("sun.arch.data.model", IntPtr.Size * 8);
            PI("sun.os.patch.level", Environment.OSVersion.Version.Revision);

            P("java.io.tmpdir", Path.GetTempPath());

            P("user.name", Environment.UserName);
            P("user.home", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile));

            P("user.dir", Environment.CurrentDirectory);

            P("sun.desktop", "windows");


            var culture = CultureInfo.CurrentCulture;

            void FillI18NProp(string propName, string value)
            {
                P(propName, value);
                P($"{propName}.display", value);
                P($"{propName}.format", value);
            }

            FillI18NProp("user.language", culture.TwoLetterISOLanguageName);
            FillI18NProp("user.script", "");
            FillI18NProp("user.country", "");
            FillI18NProp("user.variant", "");

            return(props);
        }
Exemplo n.º 44
0
 /**
  * Checks for a true/false value of a key in a Properties object.
  * @param attributes
  * @param key
  * @return
  */
 public static bool CheckTrueOrFalse(Properties attributes, String key)
 {
     return(Util.EqualsIgnoreCase("true", attributes[key]));
 }
Exemplo n.º 45
0
 /// <summary>
 /// 获取属性
 /// </summary>
 /// <param name="key">Key</param>
 /// <returns></returns>
 public string GetProperty(string key)
 {
     return(Properties.ContainsKey(key) ? Properties[key] : null);
 }
Exemplo n.º 46
0
        /// <summary>A fast, rule-based tokenizer for Spanish based on AnCora.</summary>
        /// <remarks>
        /// A fast, rule-based tokenizer for Spanish based on AnCora.
        /// Performs punctuation splitting and light tokenization by default.
        /// <p>
        /// Currently, this tokenizer does not do line splitting. It assumes that the input
        /// file is delimited by the system line separator. The output will be equivalently
        /// delimited.
        /// </p>
        /// </remarks>
        /// <param name="args"/>
        public static void Main(string[] args)
        {
            Properties options = StringUtils.ArgsToProperties(args, ArgOptionDefs());

            if (options.Contains("help"))
            {
                log.Info(Usage());
                return;
            }
            // Lexer options
            ITokenizerFactory <CoreLabel> tf = SpanishTokenizer.CoreLabelFactory();
            string orthoOptions = options.Contains("ancora") ? AncoraOptions : string.Empty;

            if (options.Contains("options"))
            {
                orthoOptions = orthoOptions.IsEmpty() ? options.GetProperty("options") : orthoOptions + ',' + options;
            }
            bool tokens = PropertiesUtils.GetBool(options, "tokens", false);

            if (!tokens)
            {
                orthoOptions = orthoOptions.IsEmpty() ? "tokenizeNLs" : orthoOptions + ",tokenizeNLs";
            }
            tf.SetOptions(orthoOptions);
            // Other options
            string encoding   = options.GetProperty("encoding", "UTF-8");
            bool   toLower    = PropertiesUtils.GetBool(options, "lowerCase", false);
            Locale es         = new Locale("es");
            bool   onePerLine = PropertiesUtils.GetBool(options, "onePerLine", false);
            // Read the file from stdin
            int  nLines    = 0;
            int  nTokens   = 0;
            long startTime = Runtime.NanoTime();

            try
            {
                ITokenizer <CoreLabel> tokenizer = tf.GetTokenizer(new BufferedReader(new InputStreamReader(Runtime.@in, encoding)));
                BufferedWriter         writer    = new BufferedWriter(new OutputStreamWriter(System.Console.Out, encoding));
                bool printSpace = false;
                while (tokenizer.MoveNext())
                {
                    ++nTokens;
                    string word = tokenizer.Current.Word();
                    if (word.Equals(SpanishLexer.NewlineToken))
                    {
                        ++nLines;
                        if (!onePerLine)
                        {
                            writer.NewLine();
                            printSpace = false;
                        }
                    }
                    else
                    {
                        string outputToken = toLower ? word.ToLower(es) : word;
                        if (onePerLine)
                        {
                            writer.Write(outputToken);
                            writer.NewLine();
                        }
                        else
                        {
                            if (printSpace)
                            {
                                writer.Write(" ");
                            }
                            writer.Write(outputToken);
                            printSpace = true;
                        }
                    }
                }
            }
            catch (UnsupportedEncodingException e)
            {
                throw new RuntimeIOException("Bad character encoding", e);
            }
            catch (IOException e)
            {
                throw new RuntimeIOException(e);
            }
            long   elapsedTime = Runtime.NanoTime() - startTime;
            double linesPerSec = (double)nLines / (elapsedTime / 1e9);

            System.Console.Error.Printf("Done! Tokenized %d lines (%d tokens) at %.2f lines/sec%n", nLines, nTokens, linesPerSec);
        }
Exemplo n.º 47
0
 public virtual bool IsProperty(MemberInfo member)
 {
     return(Properties.Contains(member));
 }
Exemplo n.º 48
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     Properties.Clear();
 }
Exemplo n.º 49
0
 public ClassDescripter CreateProperty(params PropertyDescripter[] properties)
 {
     Properties.AddRange(properties);
     return(this);
 }
Exemplo n.º 50
0
        private object StanfordNLP(string input)
        {
            string npath = Directory.GetCurrentDirectory();

            string NLPquery = "";
            string getNoun  = "";
            bool   compound = false;
            var    text     = input;
            // Annotation pipeline configuration
            var props = new Properties();

            props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
            props.setProperty("pos.model", npath + @"\edu\stanford\nlp\models\pos-tagger\english-bidirectional\english-bidirectional-distsim.tagger");
            props.setProperty("ner.model", npath + @"\edu\stanford\nlp\models\ner\english.all.3class.distsim.crf.ser.gz");
            props.setProperty("parse.model", npath + @"\edu\stanford\nlp\models\lexparser\englishPCFG.ser.gz");
            props.setProperty("dcoref.demonym", npath + @"\edu\stanford\nlp\models\dcoref\demonyms.txt");
            props.setProperty("dcoref.states", npath + @"\edu\stanford\nlp\models\dcoref\state-abbreviations.txt");
            props.setProperty("dcoref.animate", npath + @"\edu\stanford\nlp\models\dcoref\animate.unigrams.txt");
            props.setProperty("dcoref.inanimate", npath + @"\edu\stanford\nlp\models\dcoref\inanimate.unigrams.txt");
            props.setProperty("dcoref.male", npath + @"\edu\stanford\nlp\models\dcoref\male.unigrams.txt");
            props.setProperty("dcoref.neutral", npath + @"\edu\stanford\nlp\models\dcoref\neutral.unigrams.txt");
            props.setProperty("dcoref.female", npath + @"\edu\stanford\nlp\models\dcoref\female.unigrams.txt");
            props.setProperty("dcoref.plural", npath + @"\edu\stanford\nlp\models\dcoref\plural.unigrams.txt");
            props.setProperty("dcoref.singular", npath + @"\edu\stanford\nlp\models\dcoref\singular.unigrams.txt");
            props.setProperty("dcoref.countries", npath + @"\edu\stanford\nlp\models\dcoref\countries");
            props.setProperty("dcoref.extra.gender", npath + @"\edu\stanford\nlp\models\dcoref\namegender.combine.txt");
            props.setProperty("dcoref.states.provinces", npath + @"\edu\stanford\nlp\models\dcoref\statesandprovinces");
            props.setProperty("dcoref.singleton.predictor", npath + @"\edu\stanford\nlp\models\dcoref\singleton.predictor.ser");
            props.setProperty("dcoref.big.gender.number", npath + @"\edu\stanford\nlp\models\dcoref\gender.map.ser.gz");
            props.setProperty("sutime.rules", npath + @"\edu\stanford\nlp\models\sutime\defs.sutime.txt, " + npath + @"\edu\stanford\nlp\models\sutime\english.holidays.sutime.txt, " + npath + @"\edu\stanford\nlp\models\sutime\english.sutime.txt");
            props.setProperty("sutime.binders", "0");
            props.setProperty("ner.useSUTime", "0");
            var pipeline = new StanfordCoreNLP(props);

            // Annotation
            var annotation = new Annotation(text);

            pipeline.annotate(annotation);

            List <string> NLPDATA = new List <string>();

            using (var stream = new ByteArrayOutputStream())
            {
                //  pipeline.prettyPrint(annotation, new PrintWriter(stream));
                pipeline.conllPrint(annotation, new PrintWriter(stream));

                string output = stream.toString();
                Console.WriteLine(output);

                string[] lines = Regex.Split(output, "[\r\n]+");
                // Console.WriteLine(lines.Length);
                string[][] wordMatrix = new string[lines.Length][];
                for (var i = 0; i < wordMatrix.Length; i++)
                {
                    wordMatrix[i] = new string[10];
                    string[] words = Regex.Split(lines[i], "[^a-zA-Z0-9]+");
                    // Console.WriteLine(words.Length);
                    for (int ii = 0; ii < words.Length; ii++)
                    {
                        wordMatrix[i][ii] = words[ii];
                    }
                }

                for (int i = 0; i < lines.Length; i++)
                {
                    for (int ii = 0; ii < wordMatrix[i].Length; ii++)
                    {
                        if (wordMatrix[i][ii] == "VB" || wordMatrix[i][ii] == "RP" || wordMatrix[i][ii] == "NN" || wordMatrix[i][ii] == "NNP")
                        {
                            NLPDATA.Add(wordMatrix[i][ii] + " " + wordMatrix[i][ii - 1] + " " + wordMatrix[i][6]);
                            NLPquery = NLPquery + " " + wordMatrix[i][ii - 1];
                        }
                        if (wordMatrix[i][ii] == "NN" || wordMatrix[i][ii] == "NNP" || wordMatrix[i][ii] == "NNS")
                        {
                            if (wordMatrix[i][6] == "compound" || wordMatrix[i][6] == "xcomp")
                            {
                                getNoun  = wordMatrix[i][ii - 1];
                                compound = true;
                            }
                            if (wordMatrix[i][6] == "dep" && compound != true && wordMatrix[i][ii] == "NN")
                            {
                                getNoun = wordMatrix[i][ii - 1];
                            }
                            if (wordMatrix[i][6] == "dobj" && compound != true && wordMatrix[i][ii] == "NN")
                            {
                                getNoun = wordMatrix[i][ii - 1];
                            }
                        }
                    }
                }
                stream.close();
            }
            //Intent, Name,
            NLP nLP = new NLP();
            // nLP.getAnswer(NLPquery.Trim());
            // Console.WriteLine(nLP.getProbability(getNoun.Trim()).ToString());
            string action = nLP.getAnswer(NLPquery.Trim());
            string nprob  = nLP.getProbability(getNoun.Trim()).ToString();
            string aprob  = nLP.getProbability(NLPquery.Trim()).ToString();

            if (action == getNoun)
            {
                nprob = "0";
                aprob = "0";
            }
            compound = false;
            return(new { intent = action, noun = getNoun, action_prob = aprob, noun_prob = nprob });
        }
Exemplo n.º 51
0
 async void Fn_CrearKey()
 {
     if (!Properties.ContainsKey(NombresAux.v_log))
     {
         Properties.Add(NombresAux.v_log, v_log);
     }
     if (!Properties.ContainsKey(NombresAux.v_membre))
     {
         Properties.Add(NombresAux.v_membre, v_membresia);
     }
     if (!Properties.ContainsKey(NombresAux.v_letra))
     {
         Properties.Add(NombresAux.v_letra, v_letra);
     }
     if (!Properties.ContainsKey(NombresAux.v_folio))
     {
         Properties.Add(NombresAux.v_folio, v_folio);
     }
     if (!Properties.ContainsKey(NombresAux.v_perfGen))
     {
         v_perfil = new C_PerfilGen();
         string _json = JsonConvert.SerializeObject(v_perfil);
         Current.Properties.Add(NombresAux.v_perfGen, "");
         Current.Properties[NombresAux.v_perfGen] = _json;
     }
     if (!Properties.ContainsKey(NombresAux.v_perMed))
     {
         v_perfMed = new C_PerfilMed();
         string _json = JsonConvert.SerializeObject(v_perfMed);
         Current.Properties.Add(NombresAux.v_perMed, "");
         Current.Properties[NombresAux.v_perMed] = _json;
     }
     if (!Properties.ContainsKey(NombresAux.v_redmedica2))
     {
         v_medicos = new ObservableCollection <C_Medico>();
         string _json = JsonConvert.SerializeObject(v_medicos);
         Current.Properties.Add(NombresAux.v_redmedica2, "");
         Current.Properties[NombresAux.v_redmedica2] = _json;
         if (Current.Properties.ContainsKey(NombresAux.v_redmedica))//eliminar el valor anterior cuando la red medica
         {
             Current.Properties.Remove(NombresAux.v_redmedica);
         }
     }
     if (!Properties.ContainsKey(NombresAux.v_serviciosmedicos))
     {
         v_servicios = new ObservableCollection <C_Servicios>();
         string _json = JsonConvert.SerializeObject(v_servicios);
         Current.Properties.Add(NombresAux.v_serviciosmedicos, "");
         Current.Properties[NombresAux.v_serviciosmedicos] = _json;
     }
     if (!Properties.ContainsKey(NombresAux.v_serviciosgenereales))
     {
         v_servicios = new ObservableCollection <C_Servicios>();
         string _json = JsonConvert.SerializeObject(v_servicios);
         Current.Properties.Add(NombresAux.v_serviciosgenereales, "");
         Current.Properties[NombresAux.v_serviciosgenereales] = _json;
     }
     if (!Properties.ContainsKey(NombresAux.v_citas))
     {
         v_citas = new ObservableCollection <Cita>();
         string _json = JsonConvert.SerializeObject(v_citas);
         Current.Properties.Add(NombresAux.v_citas, "");
         Current.Properties[NombresAux.v_citas] = _json;
     }
     if (!Properties.ContainsKey(NombresAux.v_Nota))
     {
         v_NotasMedic = new ObservableCollection <C_NotaMed>();
         string _json = JsonConvert.SerializeObject(v_NotasMedic);
         Current.Properties.Add(NombresAux.v_Nota, "");
         Current.Properties[NombresAux.v_Nota] = _json;
     }
     //CIta para la notif
     if (!Properties.ContainsKey(NombresAux.v_citaNot))
     {
         v_nueva = new Cita();
         string _json = JsonConvert.SerializeObject(v_nueva);
         Properties.Add(NombresAux.v_citaNot, _json);
     }
     //if (!Properties.ContainsKey(NombresAux.v_IdCalendar))
     //{
     //    v_IdCalendar = "";
     //    var TodosCalen = await CrossCalendars.Current.GetCalendarsAsync();
     //    Calendar _nuevoCal = new Calendar()
     //    {
     //        AccountName = "Trato Especial",
     //        Name = "Trato Especial",
     //        Color = "2896D1"
     //    };
     //    if (!TodosCalen.Contains(_nuevoCal))
     //    {
     //        await CrossCalendars.Current.AddOrUpdateCalendarAsync(_nuevoCal);
     //        v_IdCalendar = _nuevoCal.ExternalID;
     //        Current.Properties.Add(NombresAux.v_IdCalendar, v_IdCalendar);
     //    }
     //}
     await Current.SavePropertiesAsync();
 }
Exemplo n.º 52
0
 public virtual void SetMemento(Properties memento)
 {
     GetOrCreateBehavior().SetMemento(memento);
 }
 protected void DrawLineStartDelayAndDuration(Rect drawRect, SerializedProperty property)
 {
     Elements.DrawLine(drawRect,
                       Elements.GetLayout(Properties.Get(PropertyName.StartDelay, property), 0.5f),
                       Elements.GetLayout(Properties.Get(PropertyName.Duration, property), 0.5f));
 }
Exemplo n.º 54
0
 protected override void OnStart()
 {    //existe la variable guardada
     //Properties.Clear();
     if (Properties.ContainsKey(NombresAux.v_log))
     {
         //lee el valor guardado
         v_log = Current.Properties[NombresAux.v_log] as string;
         if (v_log == "0")
         {//no esta logeado
             v_perfil    = new C_PerfilGen();
             v_perfMed   = new C_PerfilMed();
             v_membresia = "0000D-0000";
             v_folio     = "";
             v_letra     = "";
             string _json = JsonConvert.SerializeObject(v_perfil);
             Properties[NombresAux.v_perfGen] = _json;
             _json = JsonConvert.SerializeObject(v_perfMed);
             Properties[NombresAux.v_perMed] = _json;
             Properties[NombresAux.v_letra]  = v_letra;
             Properties[NombresAux.v_membre] = v_membresia;
             Properties[NombresAux.v_folio]  = v_folio;
             //v_IdCalendar = Current.Properties[NombresAux.v_IdCalendar] as string;
             //Fn_CargarListas();
             MainPage = new V_Master(false, "Bienvenido a Trato Especial");
         }//si esta logeado
         else if (v_log == "1")
         {
             /*if(v_log=="1" && Fn_GEtToken()=="a")
              * {
              *  Fn_CerrarSesion();
              *  MainPage = new V_Master(false, "Bienvenido a Trato Especial");
              * }*/
             Fn_CargarDatos();
             if (!Current.Properties.ContainsKey(NombresAux.v_perfGen))
             {
                 v_perfil = new C_PerfilGen();
                 string _json = JsonConvert.SerializeObject(v_perfil);
                 Current.Properties.Add(NombresAux.v_perfGen, "");
                 Current.Properties[NombresAux.v_perfGen] = _json;
             }
             else
             {
                 string _jsonGen = Current.Properties[NombresAux.v_perfGen] as string;
                 v_perfil = JsonConvert.DeserializeObject <C_PerfilGen>(_jsonGen);
                 Console.Write("cargca carga " + v_perfil.Fn_GetDatos() + "\n");
             }
             // v_IdCalendar = Current.Properties[NombresAux.v_IdCalendar] as string;
             MainPage = new V_Master(true, "Bienvenido " + v_perfil.v_Nombre);
         }
         else
         {
             MainPage = new V_Master(false, "Bienvenido a Trato Especial");
         }
     }
     else//es la primera ve que abre la app
     {
         v_log       = "0";
         v_perfil    = new C_PerfilGen();
         v_perfMed   = new C_PerfilMed();
         v_folio     = "";
         v_letra     = "";
         v_membresia = "0000D-0000";
         Fn_CrearKey();
         Fn_CargarListas();
         App.Current.MainPage = new V_Master(false, "Bienvenido a Trato Especial");
     }
 }
Exemplo n.º 55
0
        public bool Spawn(SpawnerEntry entry, out EntryFlags flags)
        {
            Map map = Map;

            flags = EntryFlags.None;

            if (map == null || map == Map.Internal || Parent != null)
            {
                return(false);
            }

            //Defrag taken care of in Spawn(), beforehand
            //Count check taken care of in Spawn(), beforehand

            Type type = SpawnerType.GetType(entry.CreaturesName);

            if (type != null)
            {
                try
                {
                    object   o = null;
                    string[] paramargs;
                    string[] propargs;

                    if (String.IsNullOrEmpty(entry.Properties))
                    {
                        propargs = new string[0];
                    }
                    else
                    {
                        propargs = CommandSystem.Split(entry.Properties.Trim());
                    }

                    string[,] props = FormatProperties(propargs);

                    PropertyInfo[] realProps = GetTypeProperties(type, props);

                    if (realProps == null)
                    {
                        flags = EntryFlags.InvalidProps;
                        return(false);
                    }

                    if (String.IsNullOrEmpty(entry.Parameters))
                    {
                        paramargs = new string[0];
                    }
                    else
                    {
                        paramargs = entry.Parameters.Trim().Split(' ');
                    }

                    ConstructorInfo[] ctors = type.GetConstructors();

                    for (int i = 0; i < ctors.Length; ++i)
                    {
                        ConstructorInfo ctor = ctors[i];

                        if (Add.IsConstructable(ctor, AccessLevel.GameMaster))
                        {
                            ParameterInfo[] paramList = ctor.GetParameters();

                            if (paramargs.Length == paramList.Length)
                            {
                                object[] paramValues = Add.ParseValues(paramList, paramargs);

                                if (paramValues != null)
                                {
                                    o = ctor.Invoke(paramValues);
                                    for (int j = 0; j < realProps.Length; j++)
                                    {
                                        if (realProps[j] != null)
                                        {
                                            object toSet  = null;
                                            string result = Properties.ConstructFromString(realProps[j].PropertyType, o, props[j, 1], ref toSet);
                                            if (result == null)
                                            {
                                                realProps[j].SetValue(o, toSet, null);
                                            }
                                            else
                                            {
                                                flags = EntryFlags.InvalidProps;

                                                if (o is IEntity)
                                                {
                                                    ((IEntity)o).Delete();
                                                }

                                                return(false);
                                            }
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                    }

                    if (o is Mobile)
                    {
                        Mobile m = (Mobile)o;

                        m_Creatures.Add(m, entry);
                        entry.Creatures.Add(m);

                        Point3D loc = (m is BaseVendor ? this.Location : GetSpawnPosition());

                        m.OnBeforeSpawn(loc, map);
                        InvalidateProperties();

                        m.MoveToWorld(loc, map);

                        if (m is BaseCreature)
                        {
                            BaseCreature c = (BaseCreature)m;

                            if (m_WalkingRange >= 0)
                            {
                                c.RangeHome = m_WalkingRange;
                            }
                            else
                            {
                                c.RangeHome = m_HomeRange;
                            }

                            c.CurrentWayPoint = m_WayPoint;

                            if (m_Team > 0)
                            {
                                c.Team = m_Team;
                            }

                            c.Home = this.Location;
                            //c.Spawner = (ISpawner)this;
                        }

                        m.Spawner = this;
                        m.OnAfterSpawn();
                    }
                    else if (o is Item)
                    {
                        Item item = (Item)o;

                        m_Creatures.Add(item, entry);
                        entry.Creatures.Add(item);

                        Point3D loc = GetSpawnPosition();

                        item.OnBeforeSpawn(loc, map);

                        item.MoveToWorld(loc, map);

                        item.Spawner = this;
                        item.OnAfterSpawn();
                    }
                    else
                    {
                        flags = EntryFlags.InvalidType | EntryFlags.InvalidParams;
                        return(false);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("EXCEPTION CAUGHT: {0:X}", Serial);
                    Console.WriteLine(e);
                    return(false);
                }

                InvalidateProperties();                 //If its anywhere before finishing the spawning process, DEFRAG will nuke the entry.
                return(true);
            }

            flags = EntryFlags.InvalidType;
            return(false);
        }
Exemplo n.º 56
0
 public ToolArgsParserTypeInfo(Type type)
 {
     Type            = type;
     Properties      = type.GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(t => new ToolArgsParserPropertyInfo(t)).ToList();
     DefaultProperty = Properties.Where(t => t.Property.GetCustomAttribute <ToolArgDefaultAttribute>() != null).FirstOrDefault();
 }
Exemplo n.º 57
0
 public bool HasMoreThanTitle()
 {
     return(HasExplicitShortDescription() || BulletLists.Any() || Children.Any() || Properties.Any());
 }
Exemplo n.º 58
0
        /// <summary>
        ///    Reads the file with a specified read style.
        /// </summary>
        /// <param name="propertiesStyle">
        ///    A <see cref="ReadStyle" /> value specifying at what level
        ///    of accuracy to read the media properties, or <see
        ///    cref="ReadStyle.None" /> to ignore the properties.
        /// </param>
        private void Read(ReadStyle propertiesStyle)
        {
            // TODO: Support Id3v2 boxes!!!
            tag  = new CombinedTag();
            Mode = AccessMode.Read;
            try {
                FileParser parser = new FileParser(this);

                if (propertiesStyle == ReadStyle.None)
                {
                    parser.ParseTag();
                }
                else
                {
                    parser.ParseTagAndProperties();
                }

                InvariantStartPosition = parser.MdatStartPosition;
                InvariantEndPosition   = parser.MdatEndPosition;

                udta_box = parser.UserDataBox;

                if (udta_box != null && udta_box.GetChild(BoxType.Meta)
                    != null && udta_box.GetChild(BoxType.Meta
                                                 ).GetChild(BoxType.Ilst) != null)
                {
                    TagTypesOnDisk |= TagTypes.Apple;
                }

                if (udta_box == null)
                {
                    udta_box = new IsoUserDataBox();
                }

                apple_tag = new AppleTag(udta_box);
                tag.SetTags(apple_tag);

                // If we're not reading properties, we're done.
                if (propertiesStyle == ReadStyle.None)
                {
                    Mode = AccessMode.Closed;
                    return;
                }

                // Get the movie header box.
                IsoMovieHeaderBox mvhd_box = parser.MovieHeaderBox;
                if (mvhd_box == null)
                {
                    Mode = AccessMode.Closed;
                    throw new CorruptFileException(
                              "mvhd box not found.");
                }

                IsoAudioSampleEntry audio_sample_entry =
                    parser.AudioSampleEntry;
                IsoVisualSampleEntry visual_sample_entry =
                    parser.VisualSampleEntry;

                // Read the properties.
                properties = new Properties(mvhd_box.Duration,
                                            audio_sample_entry, visual_sample_entry);
            } finally {
                Mode = AccessMode.Closed;
            }
        }
Exemplo n.º 59
0
        public AbstractServiceRequester()
        {
            LogUtil.Info(this, "AbstractServiceRequester init Start()");

            this.config = CacheManager.getInstance().getConfig();

            //加载主MQ队列管理器
            MQParameter req = new MQParameter(config.getProperty(ConfigConstants.MQ_REQUESTER_REQ_IP),
                                              int.Parse(config.getProperty(ConfigConstants.MQ_REQUESTER_REQ_PORT)),
                                              config.getProperty(ConfigConstants.MQ_REQUESTER_REQ_CHANNEL),
                                              int.Parse(config.getProperty(ConfigConstants.MQ_REQUESTER_REQ_CCSID)),
                                              config.getProperty(ConfigConstants.MQ_REQUESTER_REQ_QMANAGER),
                                              config.getProperty(ConfigConstants.MQ_REQUESTER_REQ_QUEUE));

            reqList.Add(req);

            MQParameter res = new MQParameter(config.getProperty(ConfigConstants.MQ_REQUESTER_RES_IP),
                                              int.Parse(config.getProperty(ConfigConstants.MQ_REQUESTER_RES_PORT)),
                                              config.getProperty(ConfigConstants.MQ_REQUESTER_RES_CHANNEL),
                                              int.Parse(config.getProperty(ConfigConstants.MQ_REQUESTER_RES_CCSID)),
                                              config.getProperty(ConfigConstants.MQ_REQUESTER_RES_QMANAGER),
                                              config.getProperty(ConfigConstants.MQ_REQUESTER_RES_QUEUE));

            resList.Add(res);
            //加入对象池管理
            connectionPoolManager = new MQPool(
                reqList,
                resList,
                int.Parse(config.getProperty(ConfigConstants.MQ_REQUESTER_POOL_MAXNUM)),
                int.Parse(config.getProperty(ConfigConstants.MQ_REQUESTER_GETCONN_TIMEOUT)));

            connectionPoolManagerList.Add(connectionPoolManager);


            //加载备用MQ队列管理器
            String AltConfig = config.getProperty(ConfigConstants.ALTERNATIVE_REQUESTER_CONFIG);

            if (AltConfig != null && AltConfig.Trim() != "")
            {
                String[] AltConfigArr = AltConfig.Split(char.Parse(ConfigConstants.ALTERNATIVE_CONFIG_SPLIT));


                for (int i = 0; i < AltConfigArr.Length; i++)
                {
                    String alt = AltConfigArr[i] + ".";

                    MQParameter req_t = new MQParameter(config.getProperty(alt + ConfigConstants.MQ_REQUESTER_REQ_IP),
                                                        int.Parse(config.getProperty(alt + ConfigConstants.MQ_REQUESTER_REQ_PORT)),
                                                        config.getProperty(alt + ConfigConstants.MQ_REQUESTER_REQ_CHANNEL),
                                                        int.Parse(config.getProperty(alt + ConfigConstants.MQ_REQUESTER_REQ_CCSID)),
                                                        config.getProperty(alt + ConfigConstants.MQ_REQUESTER_REQ_QMANAGER),
                                                        config.getProperty(alt + ConfigConstants.MQ_REQUESTER_REQ_QUEUE));

                    List <MQParameter> reqList_t = new List <MQParameter>();
                    reqList_t.Add(req_t);

                    MQParameter res_t = new MQParameter(config.getProperty(alt + ConfigConstants.MQ_REQUESTER_RES_IP),
                                                        int.Parse(config.getProperty(alt + ConfigConstants.MQ_REQUESTER_RES_PORT)),
                                                        config.getProperty(alt + ConfigConstants.MQ_REQUESTER_RES_CHANNEL),
                                                        int.Parse(config.getProperty(alt + ConfigConstants.MQ_REQUESTER_RES_CCSID)),
                                                        config.getProperty(alt + ConfigConstants.MQ_REQUESTER_RES_QMANAGER),
                                                        config.getProperty(alt + ConfigConstants.MQ_REQUESTER_RES_QUEUE));

                    List <MQParameter> resList_t = new List <MQParameter>();
                    resList_t.Add(res_t);

                    MQPool connectionPoolManager_t = new MQPool(
                        reqList_t,
                        resList_t,
                        int.Parse(config.getProperty(ConfigConstants.MQ_REQUESTER_POOL_MAXNUM)),
                        int.Parse(config.getProperty(ConfigConstants.MQ_REQUESTER_GETCONN_TIMEOUT)));

                    connectionPoolManagerList.Add(connectionPoolManager_t);
                }
            }

            LogUtil.Info(this, "AbstractServiceRequester init End()");
        }
Exemplo n.º 60
0
        public void Render()
        {
            AddNewPage();

            if (m_Page > 0)
            {
                AddEntryButton(20, ArrowLeftID1, ArrowLeftID2, 1, ArrowLeftWidth, ArrowLeftHeight);
            }
            else
            {
                AddEntryHeader(20);
            }

            AddEntryHtml(40 + (m_Columns.Length * 130) - 20 + ((m_Columns.Length - 2) * OffsetSize), Center(string.Format("Page {0} of {1}", m_Page + 1, (m_List.Count + EntriesPerPage - 1) / EntriesPerPage)));

            if ((m_Page + 1) * EntriesPerPage < m_List.Count)
            {
                AddEntryButton(20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight);
            }
            else
            {
                AddEntryHeader(20);
            }

            if (m_Columns.Length > 1)
            {
                AddNewLine();

                for (int i = 0; i < m_Columns.Length; ++i)
                {
                    if (i > 0 && m_List.Count > 0)
                    {
                        object obj = m_List[0];

                        if (obj != null)
                        {
                            string         failReason = null;
                            PropertyInfo[] chain      = Properties.GetPropertyInfoChain(m_From, obj.GetType(), m_Columns[i], PropertyAccess.Read, ref failReason);

                            if (chain != null && chain.Length > 0)
                            {
                                m_Columns[i] = "";

                                for (int j = 0; j < chain.Length; ++j)
                                {
                                    if (j > 0)
                                    {
                                        m_Columns[i] += '.';
                                    }

                                    m_Columns[i] += chain[j].Name;
                                }
                            }
                        }
                    }

                    AddEntryHtml(130 + (i == 0 ? 40 : 0), m_Columns[i]);
                }

                AddEntryHeader(20);
            }

            for (int i = m_Page * EntriesPerPage, line = 0; line < EntriesPerPage && i < m_List.Count; ++i, ++line)
            {
                AddNewLine();

                object obj       = m_List[i];
                bool   isDeleted = false;

                if (obj is Item)
                {
                    Item item = (Item)obj;

                    if (!(isDeleted = item.Deleted))
                    {
                        AddEntryHtml(40 + 130, item.GetType().Name);
                    }
                }
                else if (obj is Mobile)
                {
                    Mobile mob = (Mobile)obj;

                    if (!(isDeleted = mob.Deleted))
                    {
                        AddEntryHtml(40 + 130, mob.Name);
                    }
                }

                if (isDeleted)
                {
                    AddEntryHtml(40 + 130, "(deleted)");

                    for (int j = 1; j < m_Columns.Length; ++j)
                    {
                        AddEntryHtml(130, "---");
                    }

                    AddEntryHeader(20);
                }
                else
                {
                    for (int j = 1; j < m_Columns.Length; ++j)
                    {
                        object src = obj;

                        string value;
                        string failReason = "";

                        PropertyInfo[] chain = Properties.GetPropertyInfoChain(m_From, src.GetType(), m_Columns[j], PropertyAccess.Read, ref failReason);

                        if (chain == null || chain.Length == 0)
                        {
                            value = "---";
                        }
                        else
                        {
                            PropertyInfo p = Properties.GetPropertyInfo(ref src, chain, ref failReason);

                            if (p == null)
                            {
                                value = "---";
                            }
                            else
                            {
                                value = PropertiesGump.ValueToString(src, p);
                            }
                        }

                        AddEntryHtml(130, value);
                    }

                    bool isSelected = (m_Select != null && obj == m_Select);

                    AddEntryButton(20, (isSelected ? 9762 : ArrowRightID1), (isSelected ? 9763 : ArrowRightID2), 3 + i, ArrowRightWidth, ArrowRightHeight);
                }
            }

            FinishPage();
        }