Пример #1
0
		public void Initialize(Hal.NCSPlugin.IPluginHost host)
		{
			_core = host as Control.ICore;
			if (_core == null) {
				throw new ApplicationException("ホストが正しくありません。");
			}
		}
Пример #2
0
        public static CdromDevice Resolve (Hal.Manager manager, Hal.Device device)
        {
            if (device["storage.drive_type"] == "cdrom") {
                return new CdromDevice (manager, device);
            }

            return null;
        }
Пример #3
0
		public object OnCellValueNeeded(Hal.NCSPlugin.IChat chat)
		{
			Hal.NCSPlugin.IFilterdChat f = chat as Hal.NCSPlugin.IFilterdChat;
			if (f != null) {
				return f.NgSource;
			} else {
				return "";
			}
		}
Пример #4
0
            static public Hal Load(string aUri)
            {
                XmlSerializer xml    = new XmlSerializer(typeof(Hal));
                TextReader    reader = new StreamReader(aUri);
                Hal           hal    = (Hal)xml.Deserialize(reader);

                reader.Close();
                return(hal);
            }
Пример #5
0
		public void Initialize(Hal.NCSPlugin.IPluginHost host)
		{
			_host = host;

			_menuItem = new System.Windows.Forms.ToolStripMenuItem("インポート(&I)");
			_menuItem.Click += new EventHandler(menuitem_Click);
			_host.AddMenuStripItem("ファイル(&F)", _menuItem);

		}
Пример #6
0
        protected Volume (BlockDevice parent, Hal.Manager manager, Hal.Device device) : base (manager, device)
        {
            this.parent = parent ?? BlockDevice.Resolve<IBlockDevice> (manager, device.Parent);
            dk_disk = DkDisk.FindByDevice (DeviceNode);

            method_names = HalDevice.PropertyExists (method_names_property)
                ? device.GetPropertyStringList (method_names_property)
                : new string[0];
        }
Пример #7
0
        public static UsbDevice Resolve (Hal.Manager manager, Hal.Device device)
        {
            if (device["info.subsystem"] == "usb_device" &&
                device.PropertyExists ("usb_device.product_id") &&
                device.PropertyExists ("usb_device.vendor_id")) {
                return new UsbDevice (manager, device);
            }

            return null;
        }
Пример #8
0
        private bool IsMounted(Hal.Device device)
        {
            try {
                if (!device.PropertyExists ("volume.mount_point"))
                    return false;
            } catch {
                return false;
            }

            string mountPoint = device.GetPropertyString ("volume.mount_point");
            return mountPoint != null && mountPoint != String.Empty;
        }
Пример #9
0
        private dynamic GetProfiles()
        {
            var index    = (int?)Request.Query["index"] ?? 0;
            var count    = 10;
            var profiles = db.ListProfiles().Skip(index).Take(count);
            var total    = db.CountProfiles();
            var links    = Hal.Paginate("/profiles", index, count, total);

            return(new {
                _links = links,
                items = profiles
            });
        }
Пример #10
0
        public void NotBeEquivalentTo_UseRuntimeType()
        {
            // Per default [Not]BeEquivalentTo uses the compile-time type of the expectation argument,
            // i.e. here it uses the members of ISuperComputer.

            // Arrange
            ISuperComputer expected = new Hal();

            // Act
            ISuperComputer computer = GetSuperComputer();

            // Assert
            throw new NotImplementedException();
        }
Пример #11
0
		private static Hal.NicoApiSharp.Live.NGType PluginTypeToApiType(Hal.NCSPlugin.NGType value)
		{
			switch (value) {
				case Hal.NCSPlugin.NGType.None:
					return Hal.NicoApiSharp.Live.NGType.None;
				case Hal.NCSPlugin.NGType.Id:
					return Hal.NicoApiSharp.Live.NGType.Id;
				case Hal.NCSPlugin.NGType.Command:
					return Hal.NicoApiSharp.Live.NGType.Command;
				case Hal.NCSPlugin.NGType.Word:
					return Hal.NicoApiSharp.Live.NGType.Word;
				default:
					return Hal.NicoApiSharp.Live.NGType.None;
			}
		}
Пример #12
0
		public void OnCellFormatting(Hal.NCSPlugin.IChat chat, DataGridViewCellFormattingEventArgs e)
		{
			if (e.ColumnIndex == 1) {
				NCSPlugin.IFilterdChat f = chat as NCSPlugin.IFilterdChat;
				if (f != null) {
					if (f.NgType == NCSPlugin.NGType.Word) {
						e.CellStyle.ForeColor = System.Drawing.Color.Crimson;
					} else if (f.NgType == NCSPlugin.NGType.Id) {
						e.CellStyle.ForeColor = System.Drawing.Color.Blue;
					} else if (f.NgType == NCSPlugin.NGType.Command) {
						e.CellStyle.ForeColor = System.Drawing.Color.Green;
					}
				}
			}
		}
Пример #13
0
        public object Get(int index = 0)
        {
            var RESULTS_PER_PAGE = 10;
            var profiles         = db.ListProfiles()
                                   .Skip(index)
                                   .Take(RESULTS_PER_PAGE);

            var total = db.CountProfiles();

            var result = new {
                _links = Hal.Paginate("/profiles", index, RESULTS_PER_PAGE, total),
                items  = profiles
            };

            return(result);
        }
Пример #14
0
        public static Volume Resolve (BlockDevice parent, Hal.Manager manager, Hal.Device device)
        {
            if (!device.IsVolume) {
                return null;
            }

            try {
                Volume volume = (parent is ICdromDevice || (parent == null && device.QueryCapability ("volume.disc")))
                    ? DiscVolume.Resolve (parent, manager, device)
                    : new Volume (parent, manager, device);

                return CheckVolumeMounted (volume) ? volume : null;
            } catch (Exception e) {
                Hyena.Log.Exception (e);
            }

            return null;
        }
Пример #15
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>A hash code for the current <see cref="T:System.Object"/>.</returns>
 public override int GetHashCode()
 {
     return(Architecture.GetHashCode()
            ^ Bootable.GetHashCode()
            ^ CustomizedInfo.GetHashCode()
            ^ DefaultLanguageIndex
            ^ (String.IsNullOrEmpty(EditionId) ? 0 : EditionId.GetHashCode())
            ^ (String.IsNullOrEmpty(Hal) ? 0 : Hal.GetHashCode())
            ^ (String.IsNullOrEmpty(ImageDescription) ? 0 : ImageDescription.GetHashCode())
            ^ ImageIndex.GetHashCode()
            ^ ImageType.GetHashCode()
            ^ (String.IsNullOrEmpty(InstallationType) ? 0 : InstallationType.GetHashCode())
            ^ Languages.GetHashCode()
            ^ (String.IsNullOrEmpty(ProductName) ? 0 : ProductName.GetHashCode())
            ^ (String.IsNullOrEmpty(ProductSuite) ? 0 : ProductSuite.GetHashCode())
            ^ (String.IsNullOrEmpty(ProductType) ? 0 : ProductType.GetHashCode())
            ^ ProductVersion.GetHashCode()
            ^ SpLevel.GetHashCode()
            ^ (String.IsNullOrEmpty(SystemRoot) ? 0 : SystemRoot.GetHashCode()));
 }
Пример #16
0
        public object GetProfiles(int index = 0, int count = 10)
        {
            var _links   = Hal.Paginate(Request.RequestUri.AbsolutePath, index, count, db.CountProfiles());
            var items    = db.ListProfiles().Skip(index).Take(count).Select(profile => profile.ToResource());
            var _actions = new {
                create = new {
                    name   = "Create a new profile",
                    href   = Request.RequestUri.AbsolutePath,
                    method = "POST",
                    type   = "application/json",
                    schema = new { href = "/schemas/profile.json" }
                }
            };
            var result = new {
                _links,
                _actions,
                items
            };

            return(result);
        }
Пример #17
0
        public static string GetUserName(Hal.CookieGetterSharp.ICookieGetter cookieGetter)
        {
            try {
                string url = "http://www.nicovideo.jp/my/channel";
                string name = "user_session";
                System.Net.CookieContainer container = new CookieContainer();
                container.Add(cookieGetter.GetCookie(new Uri(url), name));
                string res = GetResponseText(url, container,5000);

                if (!string.IsNullOrEmpty(res)) {

                    System.Text.RegularExpressions.Match namem = System.Text.RegularExpressions.Regex.Match(res, "nickname = \"([^<>]+)\";", System.Text.RegularExpressions.RegexOptions.Singleline);
                    if (namem.Success) {
                        return namem.Groups[1].Value;
                    }
                }

            } catch {
            }
            return null;
        }
Пример #18
0
		/// <summary>
		/// カラムを追加する
		/// </summary>
		/// <param name="cfm"></param>
		public void AddCellFormattingCallback(Hal.NCSPlugin.CellFormattingCallback callback)
		{
			if (callback != null) {
				_cellFormattingCallbacks.Add(callback);
			}
		}
Пример #19
0
		/// <summary>
		/// チャット配列を追加する
		/// </summary>
		/// <param name="chats"></param>
		public void AddRange(Hal.NCSPlugin.IChat[] chats)
		{

			dataGridView1.SuspendLayout();


			foreach (Hal.NCSPlugin.IChat c in chats) {
				_chats.Add(c);
				// 現在のフォントでの文字列の長さを取得する
				_heightList.Add(0);
			}
			dataGridView1.RowCount = _chats.Count;

			if (dataGridView1.RowCount != 0) {
				dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.RowCount - 1;
			}

			dataGridView1.ResumeLayout();
		}
Пример #20
0
		/// <summary>
		/// チャットを追加する
		/// </summary>
		/// <param name="chat"></param>
		public void Add(Hal.NCSPlugin.IChat chat)
		{
			_heightList.Add(0);
			
			dataGridView1.SuspendLayout();
			_chats.Add(chat);
			dataGridView1.RowCount = _chats.Count;

			if (IsAttachBottom()) {
				if (dataGridView1.RowCount != 0) {
					dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.RowCount - 1;
				}
			}


			dataGridView1.ResumeLayout();
		}
Пример #21
0
            static public void Show(Hal aHal)
            {
                XmlSerializer xml = new XmlSerializer(typeof(Hal));

                xml.Serialize(Console.Out, aHal);
            }
Пример #22
0
 public PersonListRepresentation(Hal <Person> personRepresentation)
     : base("/people", personRepresentation)
 {
 }
Пример #23
0
        public static void Generate(CommandEventArgs e)
        {
            CommandSystem.Handle(e.Mobile, Server.Commands.CommandSystem.Prefix + "XmlLoad Spawns/TreasuresOfKotl.xml");

            Map map = Map.TerMur;

            Server.Engines.Points.PointsSystem.TreasuresOfKotlCity.Enabled = true;

            var door = new KotlDoor();

            door.MoveToWorld(new Point3D(610, 2319, 0), map);

            if (!FindItem(new Point3D(595, 2289, 8), map))
            {
                var puzzle = new KotlCityPuzzle();
                puzzle.MoveToWorld(new Point3D(595, 2289, 8), map);
            }

            if (KotlBattleSimulator.Instance == null)
            {
                var simulator = new KotlBattleSimulator();
                simulator.MoveToWorld(new Point3D(545, 2272, 0), map);
            }

            if (!FindItem(new Point3D(607, 2323, 0), map))
            {
                var wheels = new WheelsOfTime();
                wheels.MoveToWorld(new Point3D(607, 2323, 0), map);
            }

            if (!FindItem(new Point3D(592, 2393, 0), map))
            {
                var tiles = new EnergyTileAddon(13, Direction.South);
                tiles.MoveToWorld(new Point3D(592, 2393, 0), map);
            }

            if (!FindItem(new Point3D(600, 2393, 0), map))
            {
                var tiles = new EnergyTileAddon(13, Direction.South);
                tiles.MoveToWorld(new Point3D(600, 2393, 0), map);
            }

            if (!FindItem(new Point3D(608, 2393, 0), map))
            {
                var tiles = new EnergyTileAddon(13, Direction.South);
                tiles.MoveToWorld(new Point3D(608, 2393, 0), map);
            }

            if (!FindItem(new Point3D(616, 2393, 0), map))
            {
                var tiles = new EnergyTileAddon(13, Direction.South);
                tiles.MoveToWorld(new Point3D(616, 2393, 0), map);
            }

            if (!FindItem(new Point3D(624, 2393, 0), map))
            {
                var tiles = new EnergyTileAddon(13, Direction.South);
                tiles.MoveToWorld(new Point3D(624, 2393, 0), map);
            }

            GenTeleporters();
            GenStations();
            GenLOSBlockers();
            GenChests();

            var hal = new Hal();

            hal.MoveToWorld(new Point3D(489, 1606, 40), map);
        }
Пример #24
0
 public new static DiscVolume Resolve (BlockDevice parent, Hal.Manager manager, Hal.Device device)
 {
     return device.QueryCapability ("volume.disc") ? new DiscVolume (parent, manager, device) : null;
 }
Пример #25
0
		public int Compare(Hal.NCSPlugin.IChat x, Hal.NCSPlugin.IChat y)
		{
			return 0;
		}
Пример #26
0
		public object OnCellValueNeeded(Hal.NCSPlugin.IChat chat)
		{
			if (!string.IsNullOrEmpty(chat.UserId) && _users.ContainsKey(chat.UserId)) {
				return _users[chat.UserId].Name;
			}

			return "";
		}
Пример #27
0
		public void OnComment(Hal.NCSPlugin.IChat chat)
		{
			if (!string.IsNullOrEmpty(chat.UserId) && !chat.Anonymity && !_users.ContainsKey(chat.UserId)) {
				AddNameTask(chat.UserId);
			}
		}
Пример #28
0
		public void Initialize(Hal.NCSPlugin.IPluginHost host)
		{
			_host = host;
			_dataBase = UserDatabase.GetInstance("test.sqlite");
			_column = new System.Windows.Forms.DataGridViewTextBoxColumn();
			_column.Name = "nameColumn";
			_column.HeaderText = "Name";
			_column.Width = 50;
			_column.ReadOnly = true;
			_column.Visible = Properties.Settings.Default.IsAlive;

			CreateContextMenu();
		}
Пример #29
0
		public void AddColumnExtention(Hal.NCSPlugin.IColumnExtention columnExtention)
		{
			System.Diagnostics.Debug.Assert(_mainview != null, "フォームの初期化が完了していません。");

			_mainview.RegisterColumnExtention(columnExtention);
		}
Пример #30
0
 private bool IsIPod(Hal.Device device)
 {
     return device.PropertyExists ("org.podsleuth.version");
 }
 public void Initialise(Hal.Client client)
 {
 }
Пример #32
0
        private static void HandleVolumeChanged (object o, Hal.PropertyModifiedArgs args)
        {
            Hal.Device device = o as Hal.Device;
            if (device == null) {
                return;
            }

            lock (mounted_volumes) {
                if (mounted_volumes.ContainsKey (device)) {
                    Volume volume = mounted_volumes[device];
                    bool mounted = false;
                    try {
                        mounted = volume.IsMounted;
                    } catch (Exception) {}

                    if (!mounted) {
                        mounted_volumes.Remove (device);
                        unmounted_volumes[device] = volume;
                        HardwareManager.OnDeviceRemoved (volume.Uuid);
                    }
                } else if (unmounted_volumes.ContainsKey (device)) {
                    Volume volume = unmounted_volumes[device];
                    if (volume.IsMounted) {
                        unmounted_volumes.Remove (device);
                        mounted_volumes[device] = volume;
                        HardwareManager.OnHalDeviceAdded (volume);
                    }
                }
            }
        }
Пример #33
0
		public void OnCellFormatting(Hal.NCSPlugin.IChat chat, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
		{
		}
Пример #34
0
		/// <summary>
		/// 主米によるNG操作を実行する
		/// </summary>
		/// <param name="chat"></param>
		private void OperateNgCommand(Hal.NicoApiSharp.IChat chat)
		{

			Match mat = Regex.Match(chat.Message, "^/ng(?<op>add|del) (?<type>[\\S]+) \"(?<src>[^\"]+)\"");

			if (mat.Success) {
				string types = mat.Groups["type"].Value;
				string src = mat.Groups["src"].Value;

				NGType type = (types.Equals("ID") ? NGType.Id : types.Equals("COMMAND") ? NGType.Command : NGType.Word);

				if (mat.Groups["op"].Value.Equals("add")) {
					AddNg(type, src);
				} else {
					DelNg(type, src);
				}

			}

		}
Пример #35
0
		public NCSChat(Hal.NicoApiSharp.Live.IChat chat) : base(chat) { 
		
		}
Пример #36
0
		public void AddCellFormattingCallBack(Hal.NCSPlugin.CellFormattingCallback callback)
		{
			System.Diagnostics.Debug.Assert(_mainview != null, "フォームの初期化が完了していません。");

			_mainview.RegisterCellFormattingCallback(callback);
		}
Пример #37
0
 private DiscVolume (BlockDevice parent, Hal.Manager manager, Hal.Device device) : base (parent, manager, device)
 {
 }
Пример #38
0
		public bool InsertPluginChat(Hal.NCSPlugin.IChat chat)
		{
			if (_mainview != null) {
				OcvChat ochat = new OcvChat(chat);
				if (_form.InvokeRequired) {
					_form.BeginInvoke(new Action<OcvChat>(NotifyReceiveChat), ochat);
				} else {
					NotifyReceiveChat(ochat);
				}
			}

			return true;
		}
Пример #39
0
		//public void OnCellFormatting(NCSPlugin.IChat chat, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
		//{
		//  NCSPlugin.IFilterdChat f = chat as NCSPlugin.IFilterdChat;
		//  if (f != null) {
		//    if (f.NgType == NCSPlugin.NGType.Word) {
		//      e.CellStyle.ForeColor = System.Drawing.Color.Crimson;
		//    }else if(f.NgType == NCSPlugin.NGType.Id){
		//      e.CellStyle.ForeColor = System.Drawing.Color.Blue;
		//    }else if(f.NgType == NCSPlugin.NGType.Command){
		//      e.CellStyle.ForeColor = System.Drawing.Color.Green;
		//    }
		//  }
		//}

		#endregion

		#region IComparer<IChat> メンバ

		public int Compare(Hal.NCSPlugin.IChat x, Hal.NCSPlugin.IChat y)
		{
			throw new Exception("The method or operation is not implemented.");
		}