public void Initialize(Hal.NCSPlugin.IPluginHost host) { _core = host as Control.ICore; if (_core == null) { throw new ApplicationException("ホストが正しくありません。"); } }
public static CdromDevice Resolve (Hal.Manager manager, Hal.Device device) { if (device["storage.drive_type"] == "cdrom") { return new CdromDevice (manager, device); } return null; }
public object OnCellValueNeeded(Hal.NCSPlugin.IChat chat) { Hal.NCSPlugin.IFilterdChat f = chat as Hal.NCSPlugin.IFilterdChat; if (f != null) { return f.NgSource; } else { return ""; } }
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); }
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); }
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]; }
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; }
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; }
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 }); }
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(); }
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; } }
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; } } } }
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); }
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; }
/// <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())); }
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); }
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; }
/// <summary> /// カラムを追加する /// </summary> /// <param name="cfm"></param> public void AddCellFormattingCallback(Hal.NCSPlugin.CellFormattingCallback callback) { if (callback != null) { _cellFormattingCallbacks.Add(callback); } }
/// <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(); }
/// <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(); }
static public void Show(Hal aHal) { XmlSerializer xml = new XmlSerializer(typeof(Hal)); xml.Serialize(Console.Out, aHal); }
public PersonListRepresentation(Hal <Person> personRepresentation) : base("/people", personRepresentation) { }
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); }
public new static DiscVolume Resolve (BlockDevice parent, Hal.Manager manager, Hal.Device device) { return device.QueryCapability ("volume.disc") ? new DiscVolume (parent, manager, device) : null; }
public int Compare(Hal.NCSPlugin.IChat x, Hal.NCSPlugin.IChat y) { return 0; }
public object OnCellValueNeeded(Hal.NCSPlugin.IChat chat) { if (!string.IsNullOrEmpty(chat.UserId) && _users.ContainsKey(chat.UserId)) { return _users[chat.UserId].Name; } return ""; }
public void OnComment(Hal.NCSPlugin.IChat chat) { if (!string.IsNullOrEmpty(chat.UserId) && !chat.Anonymity && !_users.ContainsKey(chat.UserId)) { AddNameTask(chat.UserId); } }
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(); }
public void AddColumnExtention(Hal.NCSPlugin.IColumnExtention columnExtention) { System.Diagnostics.Debug.Assert(_mainview != null, "フォームの初期化が完了していません。"); _mainview.RegisterColumnExtention(columnExtention); }
private bool IsIPod(Hal.Device device) { return device.PropertyExists ("org.podsleuth.version"); }
public void Initialise(Hal.Client client) { }
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); } } } }
public void OnCellFormatting(Hal.NCSPlugin.IChat chat, System.Windows.Forms.DataGridViewCellFormattingEventArgs e) { }
/// <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); } } }
public NCSChat(Hal.NicoApiSharp.Live.IChat chat) : base(chat) { }
public void AddCellFormattingCallBack(Hal.NCSPlugin.CellFormattingCallback callback) { System.Diagnostics.Debug.Assert(_mainview != null, "フォームの初期化が完了していません。"); _mainview.RegisterCellFormattingCallback(callback); }
private DiscVolume (BlockDevice parent, Hal.Manager manager, Hal.Device device) : base (parent, manager, device) { }
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; }
//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."); }