E
elfenliedtopfan2
Guest
ok what i want to do is create a regex class wich i have done only issue i have is i not sure if its the best way of doing it so what i want to do is the following
the file is in this kind of format.
{
"zm_p90" ( "bulletweapon.gdf" )
{
"activate_mode" "hold"
"activate_with_primed_delay" "0"
"activatesSlam" "0"
"activatesSlamAsMelee" "0"
"activatesSlamAsPowerMelee" "0"
"activatesSlamAsPowerMeleeLeft" "0"
"acv_acog" ""
"acv_damage" ""
"acv_dualclip" ""
"acv_dualoptic" ""
"acv_dw" ""
"acv_dynzoom" ""
"acv_extbarrel" ""
"acv_extclip" ""
"acv_fastads" ""
"acv_fastreload" ""
"acv_fmj" ""
"acv_gl" ""
"acv_gmod0" ""
"acv_gmod1" ""
"acv_gmod2" ""
"acv_gmod3" ""
"acv_gmod4" ""
"acv_gmod5" ""
"acv_gmod6" ""
"acv_gmod7" ""
"acv_grip" ""
"acv_holo" ""
"acv_ir" ""
"acv_is" ""
"acv_mk" ""
"acv_mms" ""
"acv_none" ""
"acv_notracer" ""
"acv_precision" ""
"acv_quickdraw" ""
"acv_rangefinder" ""
"acv_recon" ""
"acv_reddot" ""
"acv_reflex" ""
"acv_rf" ""
"acv_sf" ""
"acv_stackfire" ""
"acv_stalker" ""
"acv_steadyaim" ""
"acv_supply" ""
"acv_suppressed" ""
"acv_swayreduc" ""
"acv_tacknife" ""
"acv_vzoom" ""
"additionalTracesOffset" "0"
"adsAdditiveFallScalar" "0.5"
"adsAdditiveJumpLandScalar" "0.5"
"adsAdditiveJumpScalar" "0.5"
"adsAimPitch" "0"
"adsAltDropAnim" ""
"adsAltDropTime" "0"
"adsAltRaiseAnim" ""
"adsAltRaiseTime" "0"
"adsBobFactor" "0"
"adsCrosshairInFrac" "0.5"
"adsCrosshairOutFrac" "0.2"
"adsDofEnd" "7.5"
"adsDofStart" "0"
"adsDownAnim" "jzob_kf2_p90_ads_down"
"adsFire" "0"
"adsFireAnim" "jzob_kf2_p90_ads_fire"
"adsFireDelayAnim" ""
"adsFireIntroAnim" ""
"adsFiringFlinchScalar" "0.55"
"adsFiringSpeedScale" "0"
"adsFlinchScalar" "0.55"
"adsGunKickAccel" "700"
"adsGunKickPitchMax" "15"
"adsGunKickPitchMin" "5"
"adsGunKickReducedKickBullets" "0"
"adsGunKickReducedKickPercent" "75"
"adsGunKickSpeedDecay" "35"
"adsGunKickSpeedMax" "2000"
"adsGunKickStaticDecay" "10"
"adsGunKickYawMax" "10"
"adsGunKickYawMin" "-5"
"adsIdleAmount" "30"
"adsIdleSpeed" "1.5"
"adsLastShotAnim" "jzob_kf2_p90_ads_fire"
"adsLowerSoundPlayer" "fly_generic_ads_lower_plr"
"adsMoveSpeedScale" "2"
"adsMoveSpeedTransitionTimeIn" "0.2"
"adsMoveSpeedTransitionTimeOut" "0"
"adsOnly" "0"
"adsOverlayAlphaScale" "1"
"adsOverlayHeight" "220"
"adsOverlayReticle" "none"
"adsOverlayShader" ""
"adsOverlayShaderLowRes" ""
"adsOverlayWidth" "220"
"adsProneMove" "0"
"adsRaiseSoundPlayer" "fly_generic_ads_plr"
"adsRechamberAnim" ""
"adsRecoilReductionLimit" "0"
"adsRecoilReductionRate" "0"
"adsRecoilReturnRate" "1"
"adsReloadTransTime" "0.175"
"adsScopeBlurAmount" "0"
"adsScopeBlurRadius" "0"
"adsScopeBlurStart" "0"
"adsSpread" "0.4"
"adsSwayHorizScale" "0.25"
"adsSwayLerpSpeed" "6"
"adsSwayMaxAngle" "4"
"adsSwayPitchScale" "0.1"
"adsSwayTransitionLerpSpeed" "20"
"adsSwayVertScale" "0.25"
"adsSwayViewInsteadOfGun" "0"
"adsSwayYawScale" "0.1"
"adsTransBlendTime" "0.1"
"adsTransInTime" "0.25"
"adsTransOutTime" "0.25"
"adsTurnRateScalar" "1"
"adsUpAnim" "jzob_kf2_p90_ads_up"
"adsUpOtherScopeAnim" ""
"adsViewBobMult" "0.25"
"adsViewErrorMax" "0"
"adsViewErrorMin" "0"
"adsViewKickCenterDuckedScale" "1"
"adsViewKickCenterProneScale" "1"
"adsViewKickCenterSpeed" "1700"
"adsViewKickMinMagnitude" "10"
i want to find the the key witch for this example i say is "Activemode" < and i want to display the value witch would be > "hold"
but the issue i am having is i cant use dictunary due to the fact there are multible occorances of the value
so i thought going though and trying to get regex to find the key and value via group might work but not sure how i would implment it so what i want to achive
is have key witch is on the left and value to be the right and display value only in a text box and the user can make changes and hit save and it only edit the value and save back but not sure how to get this to work without dictunary
this code not currently working but what i have tryied to do
// this is where we going to get patterns
public static string pattern = "[a-zA-Z+]/s [a-zA-Z0-9+] ";
public string TAToolsPath = Environment.GetEnvironmentVariable("TA_TOOLS_PATH");
public void readfile()
{
Regex regex = new Regex(pattern);
using (StreamReader reader = new StreamReader(TAToolsPath + @"share\raw\behavior\zm_factory_zombie_dog.ai_bt"))
{
string line;
while ((line = reader.ReadLine()) != null)
{
// Try to match each line against the Regex.
Match match = regex.Match(line);
if (match.Success)
{
// Write original line and the value.
string v = match.Groups[1].Value;
MessageBox.Show(line);
MessageBox.Show("..." + v);
// Console.WriteLine(line);
}
}
}
}
thanks in advance elfenliedtopfan5
Continue reading...
the file is in this kind of format.
{
"zm_p90" ( "bulletweapon.gdf" )
{
"activate_mode" "hold"
"activate_with_primed_delay" "0"
"activatesSlam" "0"
"activatesSlamAsMelee" "0"
"activatesSlamAsPowerMelee" "0"
"activatesSlamAsPowerMeleeLeft" "0"
"acv_acog" ""
"acv_damage" ""
"acv_dualclip" ""
"acv_dualoptic" ""
"acv_dw" ""
"acv_dynzoom" ""
"acv_extbarrel" ""
"acv_extclip" ""
"acv_fastads" ""
"acv_fastreload" ""
"acv_fmj" ""
"acv_gl" ""
"acv_gmod0" ""
"acv_gmod1" ""
"acv_gmod2" ""
"acv_gmod3" ""
"acv_gmod4" ""
"acv_gmod5" ""
"acv_gmod6" ""
"acv_gmod7" ""
"acv_grip" ""
"acv_holo" ""
"acv_ir" ""
"acv_is" ""
"acv_mk" ""
"acv_mms" ""
"acv_none" ""
"acv_notracer" ""
"acv_precision" ""
"acv_quickdraw" ""
"acv_rangefinder" ""
"acv_recon" ""
"acv_reddot" ""
"acv_reflex" ""
"acv_rf" ""
"acv_sf" ""
"acv_stackfire" ""
"acv_stalker" ""
"acv_steadyaim" ""
"acv_supply" ""
"acv_suppressed" ""
"acv_swayreduc" ""
"acv_tacknife" ""
"acv_vzoom" ""
"additionalTracesOffset" "0"
"adsAdditiveFallScalar" "0.5"
"adsAdditiveJumpLandScalar" "0.5"
"adsAdditiveJumpScalar" "0.5"
"adsAimPitch" "0"
"adsAltDropAnim" ""
"adsAltDropTime" "0"
"adsAltRaiseAnim" ""
"adsAltRaiseTime" "0"
"adsBobFactor" "0"
"adsCrosshairInFrac" "0.5"
"adsCrosshairOutFrac" "0.2"
"adsDofEnd" "7.5"
"adsDofStart" "0"
"adsDownAnim" "jzob_kf2_p90_ads_down"
"adsFire" "0"
"adsFireAnim" "jzob_kf2_p90_ads_fire"
"adsFireDelayAnim" ""
"adsFireIntroAnim" ""
"adsFiringFlinchScalar" "0.55"
"adsFiringSpeedScale" "0"
"adsFlinchScalar" "0.55"
"adsGunKickAccel" "700"
"adsGunKickPitchMax" "15"
"adsGunKickPitchMin" "5"
"adsGunKickReducedKickBullets" "0"
"adsGunKickReducedKickPercent" "75"
"adsGunKickSpeedDecay" "35"
"adsGunKickSpeedMax" "2000"
"adsGunKickStaticDecay" "10"
"adsGunKickYawMax" "10"
"adsGunKickYawMin" "-5"
"adsIdleAmount" "30"
"adsIdleSpeed" "1.5"
"adsLastShotAnim" "jzob_kf2_p90_ads_fire"
"adsLowerSoundPlayer" "fly_generic_ads_lower_plr"
"adsMoveSpeedScale" "2"
"adsMoveSpeedTransitionTimeIn" "0.2"
"adsMoveSpeedTransitionTimeOut" "0"
"adsOnly" "0"
"adsOverlayAlphaScale" "1"
"adsOverlayHeight" "220"
"adsOverlayReticle" "none"
"adsOverlayShader" ""
"adsOverlayShaderLowRes" ""
"adsOverlayWidth" "220"
"adsProneMove" "0"
"adsRaiseSoundPlayer" "fly_generic_ads_plr"
"adsRechamberAnim" ""
"adsRecoilReductionLimit" "0"
"adsRecoilReductionRate" "0"
"adsRecoilReturnRate" "1"
"adsReloadTransTime" "0.175"
"adsScopeBlurAmount" "0"
"adsScopeBlurRadius" "0"
"adsScopeBlurStart" "0"
"adsSpread" "0.4"
"adsSwayHorizScale" "0.25"
"adsSwayLerpSpeed" "6"
"adsSwayMaxAngle" "4"
"adsSwayPitchScale" "0.1"
"adsSwayTransitionLerpSpeed" "20"
"adsSwayVertScale" "0.25"
"adsSwayViewInsteadOfGun" "0"
"adsSwayYawScale" "0.1"
"adsTransBlendTime" "0.1"
"adsTransInTime" "0.25"
"adsTransOutTime" "0.25"
"adsTurnRateScalar" "1"
"adsUpAnim" "jzob_kf2_p90_ads_up"
"adsUpOtherScopeAnim" ""
"adsViewBobMult" "0.25"
"adsViewErrorMax" "0"
"adsViewErrorMin" "0"
"adsViewKickCenterDuckedScale" "1"
"adsViewKickCenterProneScale" "1"
"adsViewKickCenterSpeed" "1700"
"adsViewKickMinMagnitude" "10"
i want to find the the key witch for this example i say is "Activemode" < and i want to display the value witch would be > "hold"
but the issue i am having is i cant use dictunary due to the fact there are multible occorances of the value
so i thought going though and trying to get regex to find the key and value via group might work but not sure how i would implment it so what i want to achive
is have key witch is on the left and value to be the right and display value only in a text box and the user can make changes and hit save and it only edit the value and save back but not sure how to get this to work without dictunary
this code not currently working but what i have tryied to do
// this is where we going to get patterns
public static string pattern = "[a-zA-Z+]/s [a-zA-Z0-9+] ";
public string TAToolsPath = Environment.GetEnvironmentVariable("TA_TOOLS_PATH");
public void readfile()
{
Regex regex = new Regex(pattern);
using (StreamReader reader = new StreamReader(TAToolsPath + @"share\raw\behavior\zm_factory_zombie_dog.ai_bt"))
{
string line;
while ((line = reader.ReadLine()) != null)
{
// Try to match each line against the Regex.
Match match = regex.Match(line);
if (match.Success)
{
// Write original line and the value.
string v = match.Groups[1].Value;
MessageBox.Show(line);
MessageBox.Show("..." + v);
// Console.WriteLine(line);
}
}
}
}
thanks in advance elfenliedtopfan5
Continue reading...