void InitializeExtension(bool needToWriteMemory) { if (needToWriteMemory) { WriteMemory(0x04A400F0, 0x55); WriteMemory(0x04A400FB, 0x00); } // 接続されているExtensionの読み取り ReadMemory(0x04A400FA, 6, data => { long type = ((long)data[0] << 40) | ((long)data[1] << 32) | ((long)data[2]) << 24 | ((long)data[3]) << 16 | ((long)data[4]) << 8 | data[5]; switch ((ExtensionType)type) { case ExtensionType.None: case ExtensionType.Error: connectedExtension = ExtensionType.None; SetReportType(ReportType.B2A3I12, true); break; case ExtensionType.MotionPlus: case ExtensionType.MotionPlusEx: connectedExtension = (ExtensionType)type; SetReportType(ReportType.B2A3I10E6, true); break; default: // unkown connectedExtension = (ExtensionType)type; SetReportType(ReportType.B2A3I12, true); Debug.WriteLine("Unknown extension controller connected: " + connectedExtension.ToString("x")); break; } }); }
public string toJson() { return("{\"Extension\":\"" + ExtensionType.ToString() + "\"" + ",\"Title\":\"" + Base64.encode(Title) + "\"" + ",\"Disabled\":" + (Disabled.HasValue ? Disabled : true).ToString().ToLower() + ",\"Initialized\":" + (Initialized.HasValue ? Initialized : false).ToString().ToLower() + "}"); }
/// <summary> /// Sets the type of the extension. /// </summary> /// <param name="guid">The GUID.</param> /// <param name="extensionType">Type of the extension.</param> /// <remarks>Documented by Dev08, 2009-07-02</remarks> public void SetExtensionType(Guid guid, ExtensionType extensionType) { using (SqlCeCommand cmd = MSSQLCEConn.CreateCommand(parent.CurrentUser)) { cmd.CommandText = "UPDATE \"Extensions\" SET type=@type WHERE guid=@guid;"; cmd.Parameters.Add("@guid", guid.ToString()); cmd.Parameters.Add("@type", extensionType.ToString()); MSSQLCEConn.ExecuteNonQuery(cmd); } }
public override int GetHashCode() { int hash = 17; hash = hash * 33 + ((ExtensionType == null) ? 0 : ExtensionType.ToString().GetHashCode()); hash = hash * 33 + DiscoveryMethodType.GetHashCode(); hash = hash * 33 + ((ExecutionCommandLine == null) ? 0 : ExecutionCommandLine.ToString().GetHashCode()); return(hash); }
/// <summary> /// Sets the type of the extension. /// </summary> /// <param name="guid">The GUID.</param> /// <param name="extensionType">Type of the extension.</param> public void SetExtensionType(Guid guid, ExtensionType extensionType) { using (NpgsqlConnection con = PostgreSQLConn.CreateConnection(Parent.CurrentUser)) { using (NpgsqlCommand cmd = con.CreateCommand()) { cmd.CommandText = "UPDATE \"Extensions\" SET type=:type WHERE guid=:guid"; cmd.Parameters.Add("guid", guid.ToString()); cmd.Parameters.Add("type", extensionType.ToString()); PostgreSQLConn.ExecuteNonQuery(cmd, Parent.CurrentUser); } } }
//--------------------------------------------------------------------- public static void SiteDisturbed(object sender, Landis.Library.BiomassCohorts.DisturbanceEventArgs eventArgs) { ExtensionType disturbanceType = eventArgs.DisturbanceType; if (disturbanceType.ToString() == "disturbance:fire") { return; } PoolPercentages poolReductions = Module.Parameters.PoolReductions[disturbanceType]; ActiveSite site = eventArgs.Site; SiteVars.SurfaceDeadWood[site].ReduceMass(poolReductions.Wood); SiteVars.SurfaceStructural[site].ReduceMass(poolReductions.Foliar); SiteVars.SurfaceMetabolic[site].ReduceMass(poolReductions.Foliar); }
public static string AdGroupExtensionSetting(long customerId, long adGroupId, ExtensionType extensionType) { return($"customers/{customerId}/adGroupExtensionSettings/{adGroupId}~{extensionType.ToString().ToUpper()}"); }
public static string CustomerExtensionSetting(long customerId, ExtensionType extensionType) { return($"customers/{customerId}/customerExtensionSettings/{extensionType.ToString().ToUpper()}"); }
public static string CampaignExtensionSetting(long customerId, long campaignId, ExtensionType extensionType) { return($"customers/{customerId}/campaignExtensionSettings/{campaignId}~{extensionType.ToString().ToUpper()}"); }
public bool Equals(ExternalBoostTestRunnerSettings other) { return((other != null) && ((ExtensionType == other.ExtensionType) || ((ExtensionType != null) && (ExtensionType.ToString() == other.ExtensionType.ToString()))) && (DiscoveryMethodType == other.DiscoveryMethodType) && ((ExecutionCommandLine == other.ExecutionCommandLine) || ((ExecutionCommandLine != null) && (ExecutionCommandLine.ToString() == other.ExecutionCommandLine.ToString())))); }
//here we go, thats the method called by vvvv each frame //all data handling should be in here // WiiMote is not spreadable (mostly due to the IR thingy and by now also because of the extension architecture public void Evaluate(int SpreadMax) { //if any of the inputs has changed //recompute the outputs if (FPinInputEnable.PinIsChanged || FPinInputID.PinIsChanged) { Enable(); FInvalidate = true; } if (FWorking && (FPinInputMode.PinIsChanged || FPinInputEnable.PinIsChanged)) { FPinInputMode.GetOrd(0, out FIRMode); if (FIRMode == 0) { FIRMode = 1; } switch (FIRMode) { case 3: FRemote.WiimoteState.IRState.Mode = IRMode.Off; break; case 2: FRemote.WiimoteState.IRState.Mode = IRMode.Basic; break; case 1: FRemote.WiimoteState.IRState.Mode = IRMode.Extended; break; case 0: FRemote.WiimoteState.IRState.Mode = IRMode.Full; break; } FRemote.GetStatus(); FInvalidate = true; } FPinOutputWorking.SetString(0, FWorking?"OK: " + FRemote.WiimoteState.IRState.Mode.ToString():FMessage); if (!FWorking) { return; } if (FPinForceReset.PinIsChanged) { double reset; FPinForceReset.GetValue(0, out reset); if (reset == 1d) { if (FRemote.WiimoteState.Extension) { FRemote.SetReportType(InputReport.IRExtensionAccel, true); } else { FRemote.SetReportType(InputReport.IRAccel, true); } } } if (FPinInputRumble.PinIsChanged || FPinInputEnable.PinIsChanged) { double rumble; FPinInputRumble.GetValue(0, out rumble); FRemote.SetRumble(rumble == 1d?true:false); } if (FPinInputLED.PinIsChanged || FPinInputEnable.PinIsChanged) { double[] dLed = new double[4]; bool[] led = new bool[4]; for (int i = 0; i < 4; i++) { FPinInputLED.GetValue(i, out dLed[i]); led[i] = (dLed[i] == 1d)?true:false; } FRemote.SetLEDs(led[0], led[1], led[2], led[3]); } // careful with this... it will permanently override all factory calibration of your wiimote. if ((FPinInputEnable.PinIsChanged || FPinInputCalibrate.PinIsChanged) && (FPinInputCalibrate.PinIsChanged)) { byte[,] data = new byte[3, 2]; double output; for (int i = 0; i < 3; i++) { FPinInputCalibrationOneG.GetValue(i, out output); data[i, 0] = (byte)(output); FPinInputCalibrationZeroG.GetValue(i, out output); data[i, 1] = (byte)(output); } double calibrate; FPinInputCalibrate.GetValue(0, out calibrate); if (calibrate == 1d) { FRemote.WiimoteState.AccelCalibrationInfo.X0 = data[0, 0]; FRemote.WiimoteState.AccelCalibrationInfo.Y0 = data[1, 0]; FRemote.WiimoteState.AccelCalibrationInfo.Z0 = data[2, 0]; FRemote.WiimoteState.AccelCalibrationInfo.XG = data[0, 1]; FRemote.WiimoteState.AccelCalibrationInfo.YG = data[1, 1]; FRemote.WiimoteState.AccelCalibrationInfo.ZG = data[2, 1]; } FInvalidate = true; } if (FInvalidate) { FPinOutputCursor.SliceCount = 1; FPinOutputCursor.SetValue(0, FRemote.WiimoteState.ButtonState.Up?1d:0d); FPinOutputCursor.SetValue(1, FRemote.WiimoteState.ButtonState.Down?1d:0d); FPinOutputCursor.SetValue(2, FRemote.WiimoteState.ButtonState.Left?1d:0d); FPinOutputCursor.SetValue(3, FRemote.WiimoteState.ButtonState.Right?1d:0d); FPinOutputControls.SliceCount = 1; FPinOutputControls.SetValue(0, FRemote.WiimoteState.ButtonState.Plus?1d:0d); FPinOutputControls.SetValue(1, FRemote.WiimoteState.ButtonState.Minus?1d:0d); FPinOutputControls.SetValue(2, FRemote.WiimoteState.ButtonState.Home?1d:0d); FPinOutputButtons.SliceCount = 1; FPinOutputButtons.SetValue(0, FRemote.WiimoteState.ButtonState.A?1d:0d); FPinOutputButtons.SetValue(1, FRemote.WiimoteState.ButtonState.B?1d:0d); FPinOutputButtons.SetValue(2, FRemote.WiimoteState.ButtonState.One?1d:0d); FPinOutputButtons.SetValue(3, FRemote.WiimoteState.ButtonState.Two?1d:0d); FPinOutputTilt.SliceCount = 1; FPinOutputTilt.SetValue3D(0, FRemote.WiimoteState.AccelState.Values.X, FRemote.WiimoteState.AccelState.Values.Y, FRemote.WiimoteState.AccelState.Values.Z); double[] normalizedA = new double[3]; normalizedA[0] = (double)((FRemote.WiimoteState.AccelState.RawValues.X - 128)) / 128d; normalizedA[1] = (double)((FRemote.WiimoteState.AccelState.RawValues.Y - 128)) / 128d; normalizedA[2] = (double)((FRemote.WiimoteState.AccelState.RawValues.Z - 128)) / 128d; FPinOutputAccelleration.SliceCount = 1; FPinOutputAccelleration.SetValue3D(0, normalizedA[0], normalizedA[1], normalizedA[2]); FPinOutputBattery.SetValue(0, (double)FRemote.WiimoteState.Battery / 0xFF); int irCount = 0; if (FIRMode == 0) { irCount = 4; // Full } if (FIRMode == 1) { irCount = 4; // Extended } if (FIRMode == 2) { irCount = 2; // Basic } if (FIRMode == 3) { irCount = 0; // Of } FPinOutputInfraredBlobs.SliceCount = irCount; for (int i = 0; i < irCount; i++) { FPinOutputInfraredBlobs.SetValue3D(i, FRemote.WiimoteState.IRState.IRSensors[i].RawPosition.X, FRemote.WiimoteState.IRState.IRSensors[i].RawPosition.Y, FRemote.WiimoteState.IRState.IRSensors[i].Size); } // MotionPlus if (FUseMotionPlus) { // MotionPlus(); } FInvalidate = false; ExtensionType ext = FRemote.WiimoteState.ExtensionType; string enabledExt = FRemote.WiimoteState.Extension?" disabled":""; if (ext == ExtensionType.Nunchuk && FExtension == 1) { Nunchuk(); enabledExt = " enabled"; } if (ext == ExtensionType.ClassicController && FExtension == 2) { Classic(); enabledExt = " enabled"; } if (ext == ExtensionType.BalanceBoard && FExtension == 3) { BalanceBoard(); enabledExt = " enabled"; } if (ext == ExtensionType.Guitar && FExtension == 4) { Guitar(); enabledExt = " enabled"; } FPinOutputExtensionFound.SetString(0, ext.ToString() + enabledExt); } }