Here are the examples of the csharp api System.Collections.Generic.List.Find(System.Predicate) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2726 Examples
19
Source : JobBars.Party.cs
with GNU Affero General Public License v3.0
from 0ceal0t
with GNU Affero General Public License v3.0
from 0ceal0t
public static void UpdatePartyMembers() {
var order = GetPartyMemberOrder();
var members = GetPartyMembers();
PartyMembers = order.Select(objectId => objectId == 0 ? null : members.Find(member => member.ObjectId == objectId)).ToList();
}
19
Source : SqModelMeta.cs
with MIT License
from 0x1000000
with MIT License
from 0x1000000
public SqModelPropertyMeta AddPropertyCheckExistence(SqModelPropertyMeta candidate)
{
var result = this._properties.Find(p => p.Name == candidate.Name);
if (result != null)
{
if (result.Type != candidate.Type || result.CastType != candidate.CastType)
{
throw new SqExpressCodeGenException($"Property \"{this.Name}.{candidate.Name}\" was declared several times with different types.");
}
return result;
}
this._properties.Add(candidate);
return candidate;
}
19
Source : ExifValueCollection.cs
with MIT License
from 0xC0000054
with MIT License
from 0xC0000054
public MetadataEntry GetAndRemoveValue(MetadataKey key)
{
MetadataEntry value = exifMetadata.Find(p => p.Section == key.Section && p.TagId == key.TagId);
if (value != null)
{
exifMetadata.RemoveAll(p => p.Section == key.Section && p.TagId == key.TagId);
}
return value;
}
19
Source : Statistics.cs
with MIT License
from 1ZouLTReX1
with MIT License
from 1ZouLTReX1
private void StopSentTimer(int recvTickAck, long idleTime)
{
if (tickBuffer.Exists(x => x.tickNum == recvTickAck))
{
var item = tickBuffer.Find(x => x.tickNum == recvTickAck);
long now = m_StopWatch.ElapsedTicks;
m_currentRtt = (int) ((now - item.sentTime - idleTime) / m_FrequencyMS);
m_currentLag = (int) ((now - item.sentTime) / m_FrequencyMS);
// Debug printing
// Debug.Log("Pure RTT: " + m_currentRtt);
// Debug.Log("Over all Lag: " + m_currentLag);
// Since we got the Ack back we don't have to store the tick anymore and every tick until that tick (Because of tcp).
// A better approach would a 4 bytes mask where every bit is whether we got the tick or not.
tickBuffer.RemoveRange(0, tickBuffer.LastIndexOf(item));
}
}
19
Source : HandPool.cs
with MIT License
from 39M
with MIT License
from 39M
private IEnumerator toggleGroup(string groupName) {
yield return new WaitForEndOfFrame();
ModelGroup modelGroup = ModelPool.Find(i => i.GroupName == groupName);
if (modelGroup != null) {
if (modelGroup.IsEnabled == true) {
DisableGroup(groupName);
modelGroup.IsEnabled = false;
} else {
EnableGroup(groupName);
modelGroup.IsEnabled = true;
}
} else Debug.LogWarning("A group matching that name does not exisit in the modelPool");
}
19
Source : HandPool.cs
with MIT License
from 39M
with MIT License
from 39M
public void RemoveGroup(string groupName) {
while (ModelPool.Find(i => i.GroupName == groupName) != null) {
ModelGroup modelGroup = ModelPool.Find(i => i.GroupName == groupName);
if (modelGroup != null) {
ModelPool.Remove(modelGroup);
}
}
}
19
Source : DownloadingAssetsList.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public bool DownloadingItemsContains(List<string> itemsToCheck)
{
bool res = false;
for (int i = 0; i < itemsToCheck.Count; i++)
{
if (downloadingItems.Find(item => item.requiredreplacedetName == itemsToCheck[i]) != null)
{
res = true;
break;
}
}
return res;
}
19
Source : DownloadingAssetsList.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public T AddDownloadItem<T>(string requiredreplacedetName, int? requiredreplacedetNameHash, string containingBundle, Delegate callback = null) where T : UnityEngine.Object
{
T thisTempreplacedet = null;
if (downloadingItems.Find(item => item.requiredreplacedetName == requiredreplacedetName) == null)
{
if (requiredreplacedetNameHash == null)
{
requiredreplacedetNameHash = UMAUtils.StringToHash(requiredreplacedetName);
}
thisTempreplacedet = GetTempreplacedet<T>();
if (typeof(T) == typeof(RaceData))
{
(thisTempreplacedet as RaceData).raceName = requiredreplacedetName;
(thisTempreplacedet as RaceData).name = requiredreplacedetName;
}
else if (typeof(T) == typeof(SlotDatareplacedet))
{
(thisTempreplacedet as SlotDatareplacedet).name = requiredreplacedetName;
(thisTempreplacedet as SlotDatareplacedet).slotName = requiredreplacedetName;
(thisTempreplacedet as SlotDatareplacedet).nameHash = (int)requiredreplacedetNameHash;
}
else if (typeof(T) == typeof(OverlayDatareplacedet))
{
(thisTempreplacedet as OverlayDatareplacedet).name = requiredreplacedetName;
(thisTempreplacedet as OverlayDatareplacedet).overlayName = requiredreplacedetName;
(thisTempreplacedet as OverlayDatareplacedet).nameHash = (int)requiredreplacedetNameHash;
}
else if (typeof(T) == typeof(UMATextRecipe))
{
//now that wardrobeRecipes have their own type, we can replacedume an UMATextRecipe is a full character recipe
thisTempreplacedet.name = requiredreplacedetName;
}
else if (typeof(T) == typeof(UMAWardrobeRecipe))
{
(thisTempreplacedet as UMAWardrobeRecipe).recipeType = "Wardrobe";
(thisTempreplacedet as UMAWardrobeRecipe).wardrobeSlot = replacedetBundleManager.replacedetBundleIndexObject.replacedetWardrobeSlot(containingBundle, requiredreplacedetName);
(thisTempreplacedet as UMAWardrobeRecipe).Hides = replacedetBundleManager.replacedetBundleIndexObject.replacedetWardrobeHides(containingBundle, requiredreplacedetName);
(thisTempreplacedet as UMAWardrobeRecipe).compatibleRaces = replacedetBundleManager.replacedetBundleIndexObject.replacedetWardrobeCompatibleWith(containingBundle, requiredreplacedetName);
thisTempreplacedet.name = requiredreplacedetName;
}
else if (typeof(T) == typeof(UMAWardrobeCollection))
{
(thisTempreplacedet as UMAWardrobeCollection).recipeType = "WardrobeCollection";
(thisTempreplacedet as UMAWardrobeCollection).wardrobeSlot = replacedetBundleManager.replacedetBundleIndexObject.replacedetWardrobeCollectionSlot(containingBundle, requiredreplacedetName);
(thisTempreplacedet as UMAWardrobeCollection).compatibleRaces = replacedetBundleManager.replacedetBundleIndexObject.replacedetWardrobeCollectionCompatibleWith(containingBundle, requiredreplacedetName);
thisTempreplacedet.name = requiredreplacedetName;
}
else if (typeof(T) == typeof(RuntimeAnimatorController))
{
(thisTempreplacedet as RuntimeAnimatorController).name = requiredreplacedetName;
}
else
{
thisTempreplacedet.name = requiredreplacedetName;
}
var thisDlItem = new Downloadingreplacedereplacedem(requiredreplacedetName, thisTempreplacedet, containingBundle, callback);
downloadingItems.Add(thisDlItem);
}
else
{
Downloadingreplacedereplacedem dlItem = null;
if (downloadingItems.Find(item => item.requiredreplacedetName == requiredreplacedetName) != null)
dlItem = downloadingItems.Find(item => item.requiredreplacedetName == requiredreplacedetName);
if (dlItem != null)
{
//Debug.LogWarning("DownloadingreplacedetsList already had entry for " + requiredreplacedetName + " as type " + dlItem.tempreplacedet.GetType().ToString() + " new request wanted it as type " + typeof(T) + " and its callback was " + dlItem.dynamicCallback[0].Method.Name);
if (callback != null)
if (!dlItem.dynamicCallback.Contains(callback))
dlItem.dynamicCallback.Add(callback);
thisTempreplacedet = dlItem.tempreplacedet as T;
}
else
{
Debug.LogWarning("Could not get Tempreplacedet for " + requiredreplacedetName);
}
}
return thisTempreplacedet;
}
19
Source : DownloadingAssetsList.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public T Get<T>(string replacedetName) where T : UnityEngine.Object
{
T tempreplacedet = null;
if (downloadingItems.Find(item => item.requiredreplacedetName == replacedetName) != null)
{
if (downloadingItems.Find(item => item.requiredreplacedetName == replacedetName).tempreplacedet.GetType() == typeof(T))
tempreplacedet = downloadingItems.Find(item => item.requiredreplacedetName == replacedetName) as T;
}
return tempreplacedet;
}
19
Source : DownloadingAssetsList.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public float GetDownloadProgressOf(string replacedetName)
{
float progress = 0;
Downloadingreplacedereplacedem item = null;
item = downloadingItems.Find(aitem => aitem.requiredreplacedetName == replacedetName);
if (item != null)
{
progress = item.Progress;
}
else
{
Debug.Log(replacedetName + " was not downloading");
}
return progress;
}
19
Source : DownloadingAssetsList.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public bool DownloadingItemsContains(string itemToCheck)
{
bool res = false;
if (downloadingItems.Find(item => item.requiredreplacedetName == itemToCheck) != null)
{
res = true;
}
return res;
}
19
Source : VxFormGroup.cs
with MIT License
from Aaltuj
with MIT License
from Aaltuj
internal static void Add(string fieldIdentifier, VxFormGroup group, object modelInstance, VxFormLayoutOptions options)
{
// TODO: EXPANDO switch
var prop = modelInstance.GetType().GetProperty(fieldIdentifier);
var layoutAttr = prop.GetCustomAttribute<VxFormElementLayoutAttribute>();
var allRowLayoutAttributes = VxHelpers.GetAllAttributes<VxFormRowLayoutAttribute>(prop.DeclaringType);
// If no attribute is found use the name of the property
if (layoutAttr == null)
layoutAttr = new VxFormElementLayoutAttribute()
{
Label = GetLabel(fieldIdentifier, modelInstance)
};
PatchLayoutWithBuiltInAttributes(layoutAttr, prop);
// Check if row already exists
var foundRow = group.Rows.Find(value => value.Id == layoutAttr.RowId.ToString());
if (foundRow == null)
{
foundRow = VxFormRow.Create(layoutAttr, allRowLayoutAttributes.Find(x => x.Id == layoutAttr.RowId), options);
group.Rows.Add(foundRow); ;
}
var formColumn = VxFormElementDefinition.Create(fieldIdentifier, layoutAttr, modelInstance, options);
VxFormRow.AddColumn(foundRow, formColumn, options);
// WHen there is a VxFormRowLayout found use the name if specified, this also sets the row to combined labels
if (options.LabelOrientation == LabelOrientation.LEFT && foundRow.RowLayoutAttribute?.Label == null)
foundRow.Label = string.Join(", ", foundRow.Columns.ConvertAll(x => x.RenderOptions.Label));
}
19
Source : IntegrationEventLogService.cs
with MIT License
from Abdulrhman5
with MIT License
from Abdulrhman5
public async Task<IEnumerable<IntegrationEventLogEntry>> RetrieveEventLogsPendingToPublishAsync(Guid transactionId)
{
var tid = transactionId.ToString();
var result = await _integrationEventLogContext.IntegrationEventLogs
.Where(e => e.TransactionId == tid && e.State == EventStateEnum.NotPublished).ToListAsync();
if(result != null && result.Any()){
return result.OrderBy(o => o.CreationTime)
.Select(e => e.DeserializeJsonContent(_eventTypes.Find(t=> t.Name == e.EventTypeShortName)));
}
return new List<IntegrationEventLogEntry>();
}
19
Source : TransactionService.cs
with MIT License
from Abdulrhman5
with MIT License
from Abdulrhman5
private AllTransactionsDownstreamListDto AggregateAllTransactionWithObject8User(AllTransactionsUpstreamListDto trans, List<UserDto> users, List<TransactionObjectDto> objects)
{
var downstreamTransactions = _mapper.Map<AllTransactionsDownstreamListDto>(trans);
downstreamTransactions.Transactions.ForEach(t =>
{
var upTrans = trans.Transactions.FirstOrDefault(tt => tt.RegistrationId == t.RegistrationId);
t.Object = objects.Find(o => o.Id == upTrans.ObjectId);
t.Owner = users.Find(u => u.Id.EqualsIC(upTrans.OwnerId) || u.Id.EqualsIC(upTrans.ReceiverId));
t.Receiver = users.Find(u => u.Id.EqualsIC(upTrans.OwnerId) || u.Id.EqualsIC(upTrans.ReceiverId));
});
return downstreamTransactions;
}
19
Source : TransactionService.cs
with MIT License
from Abdulrhman5
with MIT License
from Abdulrhman5
private TransactionForUserDownstreamListDto AggregateTransactionWithObject8User(List<TransactionUpstreamDto> trans, List<UserDto> users, List<TransactionObjectDto> objects)
{
var downStreamTransactions = new List<TransactionDownstreamDto>();
foreach (var tran in trans)
{
downStreamTransactions.Add(new TransactionDownstreamDto
{
RegistrationId = tran.RegistrationId,
ReceivingId = tran.ReceivingId,
ReturnId = tran.ReturnId,
RegistredAtUtc = tran.RegistredAtUtc,
HourlyCharge = tran.HourlyCharge,
ReceivedAtUtc = tran.ReceivedAtUtc,
ReturenedAtUtc = tran.ReturenedAtUtc,
ShouldReturnAfter = tran.ShouldReturnAfter,
TransactionStatus = tran.TransactionStatus,
TranscationType = tran.TranscationType,
Object = objects.Find(o => o.Id == tran.ObjectId),
Owner = users.Find(u => u.Id.EqualsIC(tran.OwnerId) || u.Id.EqualsIC(tran.ReceiverId)),
Receiver = users.Find(u => u.Id.EqualsIC(tran.OwnerId) || u.Id.EqualsIC(tran.ReceiverId))
});
}
var userId = _httpContext.Request.Query["userId"].GetValue();
return new TransactionForUserDownstreamListDto()
{
Transactions = downStreamTransactions,
OtherUsersReservationsCount = downStreamTransactions.Count(t => t.Owner.Id.EqualsIC(userId)),
TheUserReservationsCount = downStreamTransactions.Count(t => t.Receiver.Id.EqualsIC(userId))
};
}
19
Source : CatalogAggregator.cs
with MIT License
from Abdulrhman5
with MIT License
from Abdulrhman5
private List<DownstreamObjectDto> ReplaceUserIdWithUser(List<UpstreamObjectDto> objects, List<UserDto> users)
{
var downstreamObjects = _mapper.Map<List<DownstreamObjectDto>>(objects);
downstreamObjects.ForEach(downObject =>
{
var upObject = objects.Find(o => o.Id == downObject.Id);
downObject.Owner = users.FirstOrDefault(u => u.Id.EqualsIC(upObject.OwnerId));
});
return downstreamObjects;
}
19
Source : CatalogAggregator.cs
with MIT License
from Abdulrhman5
with MIT License
from Abdulrhman5
private List<DownstreamObjectDtoV1_1> ReplaceUserIdWithUserV1_1(List<UpstreamObjectDtoV1_1> objects, List<UserDto> users)
{
var downstreamObjects = _mapper.Map<List<DownstreamObjectDtoV1_1>>(objects);
downstreamObjects.ForEach(downObject =>
{
var upObject = objects.Find(o => o.Id == downObject.Id);
downObject.Owner = users.FirstOrDefault(u => u.Id.EqualsIC(upObject.OwnerId));
});
return downstreamObjects;
}
19
Source : TransactionService.cs
with MIT License
from Abdulrhman5
with MIT License
from Abdulrhman5
private List<TransactionDownstreamDto> AggregateTransactionWithObject8User(List<TransactionUpstreamDto> trans, List<UserDto> users, List<TransactionObjectDto> objects)
{
var downStreamTransactions = new List<TransactionDownstreamDto>();
foreach (var tran in trans)
{
downStreamTransactions.Add(new TransactionDownstreamDto
{
RegistrationId = tran.RegistrationId,
ReceivingId = tran.ReceivingId,
ReturnId = tran.ReturnId,
RegistredAtUtc = tran.RegistredAtUtc,
HourlyCharge = tran.HourlyCharge,
ReceivedAtUtc = tran.ReceivedAtUtc,
ReturenedAtUtc = tran.ReturenedAtUtc,
ShouldReturnAfter = tran.ShouldReturnAfter,
TransactionStatus = tran.TransactionStatus,
TranscationType = tran.TranscationType,
Object = objects.Find(o => o.Id == tran.ObjectId),
Owner = users.Find(u => u.Id.EqualsIC(tran.OwnerId)),
Receiver = users.Find(u => u.Id.EqualsIC(tran.ReceiverId)),
});
}
return downStreamTransactions;
}
19
Source : OVRResources.cs
with MIT License
from absurd-joy
with MIT License
from absurd-joy
public static UnityEngine.Object Load(string path)
{
if (Debug.isDebugBuild)
{
if(resourceBundle == null)
{
Debug.Log("[OVRResources] Resource bundle was not loaded successfully");
return null;
}
var result = replacedetNames.Find(s => s.Contains(path.ToLower()));
return resourceBundle.Loadreplacedet(result);
}
return Resources.Load(path);
}
19
Source : OVRResources.cs
with MIT License
from absurd-joy
with MIT License
from absurd-joy
public static T Load<T>(string path) where T : UnityEngine.Object
{
if (Debug.isDebugBuild)
{
if (resourceBundle == null)
{
Debug.Log("[OVRResources] Resource bundle was not loaded successfully");
return null;
}
var result = replacedetNames.Find(s => s.Contains(path.ToLower()));
return resourceBundle.Loadreplacedet<T>(result);
}
return Resources.Load<T>(path);
}
19
Source : PowerManager.cs
with MIT License
from ABTSoftware
with MIT License
from ABTSoftware
public PowerPlan GetCurrentPlan()
{
Guid guid = GetActiveGuid();
var foundPlan = GetPlans().Find(p => (p.Guid == guid));
return foundPlan ?? new PowerPlan("Unknown", guid);
}
19
Source : OpenSheet.cs
with GNU Lesser General Public License v3.0
from acnicholas
with GNU Lesser General Public License v3.0
from acnicholas
private static void OpenSheetByOrder(UIDoreplacedent udoc, ViewSheet view, int offset)
{
List<OpenableView> list = ViewsInModel(udoc.Doreplacedent, false).OrderBy(o => o.SheetNumber).ToList();
int index = list.IndexOf(list.Find(ov => ov.SheetNumber == view.SheetNumber));
if (index > -1)
{
if (offset < 0 && index + offset < 0) {
return;
}
if (offset > 0 && index + offset >= list.Count) {
return;
}
list[index + offset].Open();
}
}
19
Source : SimpleGraphBackend.cs
with Apache License 2.0
from activey
with Apache License 2.0
from activey
public override AbstractGraphNode GetNodeById (long nodeId)
{
return AllGraphNodes.Find (node => {
return node.GetId() == nodeId;
});
}
19
Source : GraphSceneComponents.cs
with Apache License 2.0
from activey
with Apache License 2.0
from activey
public NodeComponent GetNodeComponent(long nodeId)
{
return nodeComponents.Find (node => {
return node.GetGraphNode().GetId() == nodeId;
});
}
19
Source : DacPrimaryAndUniqueKeyDeclarationAnalyzer.cs
with GNU General Public License v3.0
from Acumatica
with GNU General Public License v3.0
from Acumatica
private void CheckBigGroupOfKeysForPrimaryKeyAndUniqueKeysContainer(SymbolreplacedysisContext symbolContext, PXContext context, DacSemanticModel dac,
List<INamedTypeSymbol> keyDeclarations,
Dictionary<INamedTypeSymbol, List<ITypeSymbol>> dacFieldsByKey)
{
var primaryKey = keyDeclarations.Find(key => key.Name == ReferentialIntegrity.PrimaryKeyClreplacedName);
if (primaryKey == null)
{
//If there is no primary key - try to find suitable unique key and rename it. Otherwise report no primary key in DAC
ProcessDacWithoutPrimaryKeyAndWithSeveralUniqueKeys(symbolContext, context, dac, keyDeclarations, dacFieldsByKey);
return;
}
INamedTypeSymbol uniqueKeysContainer = dac.Symbol.GetTypeMembers(ReferentialIntegrity.UniqueKeyClreplacedName)
.FirstOrDefault();
//We can register code fix only if there is no UK nested type in DAC or there is a public static UK clreplaced. Otherwise we will break the code.
bool registerCodeFix = uniqueKeysContainer == null ||
(uniqueKeysContainer.DeclaredAccessibility == Accessibility.Public && uniqueKeysContainer.IsStatic);
List<INamedTypeSymbol> keysNotInContainer = GetKeysNotInContainer(keyDeclarations, uniqueKeysContainer, primaryKey);
if (keysNotInContainer.Count == 0)
return;
symbolContext.CancellationToken.ThrowIfCancellationRequested();
Location dacLocation = dac.Node.GetLocation();
var keysNotInContainerLocations = GetKeysLocations(keysNotInContainer, symbolContext.CancellationToken).ToList(capacity: keysNotInContainer.Count);
if (dacLocation == null || keysNotInContainerLocations.Count == 0)
return;
var dacLocationArray = new[] { dacLocation };
var diagnosticProperties = new Dictionary<string, string>
{
{ nameof(RefIntegrityDacKeyType), RefIntegrityDacKeyType.UniqueKey.ToString() },
{ nameof(UniqueKeyCodeFixType), UniqueKeyCodeFixType.MultipleUniqueKeys.ToString() },
{ DiagnosticProperty.RegisterCodeFix, registerCodeFix.ToString() }
}
.ToImmutableDictionary();
foreach (Location keyLocation in keysNotInContainerLocations)
{
var otherKeyLocations = keysNotInContainerLocations.Where(location => location != keyLocation);
var additionalLocations = dacLocationArray.Concat(otherKeyLocations);
symbolContext.ReportDiagnosticWithSuppressionCheck(
Diagnostic.Create(Descriptors.PX1036_WrongDacMultipleUniqueKeyDeclarations, keyLocation, additionalLocations, diagnosticProperties),
context.CodereplacedysisSettings);
}
}
19
Source : ModEntry.cs
with GNU General Public License v3.0
from aedenthorn
with GNU General Public License v3.0
from aedenthorn
private static void breakStone_Postfix(GameLocation __instance, ref bool __result, int indexOfStone, int x, int y, Farmer who, Random r)
{
SMonitor.Log($"Checking for custom ore in stone {indexOfStone}");
CustomOreNode node = customOreNodesList.Find(n => n.parentSheetIndex == indexOfStone);
if (node == null)
return;
SMonitor.Log($"Got custom ore in stone {indexOfStone}");
OreLevelRange gotRange = null;
foreach (OreLevelRange range in node.oreLevelRanges)
{
if (IsInRange(range, __instance, false))
{
gotRange = range;
break;
}
}
if (gotRange == null)
{
SMonitor.Log($"No range for {indexOfStone}!", LogLevel.Warn);
return;
}
int addedOres = who.professions.Contains(18) ? 1 : 0;
SMonitor.Log($"custom node has {node.dropItems.Count} potential items.");
foreach (DropItem item in node.dropItems)
{
if (Game1.random.NextDouble() < item.dropChance * gotRange.dropChanceMult/100)
{
SMonitor.Log($"dropping item {item.itemIdOrName}");
if(!int.TryParse(item.itemIdOrName, out int itemId))
{
foreach(KeyValuePair<int,string> kvp in Game1.objectInformation)
{
if (kvp.Value.StartsWith(item.itemIdOrName + "/"))
{
itemId = kvp.Key;
break;
}
}
}
Game1.createMultipleObjectDebris(itemId, x, y, addedOres + (int)Math.Round(r.Next(item.minAmount, (Math.Max(item.minAmount + 1, item.maxAmount + 1)) + ((r.NextDouble() < who.LuckLevel / 100f) ? item.luckyAmount : 0) + ((r.NextDouble() < who.MiningLevel / 100f) ? item.minerAmount : 0)) * gotRange.dropMult), who.UniqueMultiplayerID, __instance);
}
}
int experience = (int)Math.Round(node.exp * gotRange.expMult);
who.gainExperience(3, experience);
__result = experience > 0;
}
19
Source : ModEntry.cs
with GNU General Public License v3.0
from aedenthorn
with GNU General Public License v3.0
from aedenthorn
private static bool Object_draw_Prefix(Object __instance, SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
{
CustomOreNode node = customOreNodesList.Find(n => n.parentSheetIndex == __instance.ParentSheetIndex);
if (node == null)
return true;
if (__instance.Fragility != 2)
{
spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, y * 64 + 51 + 4)), new Rectangle?(Game1.shadowTexture.Bounds), Color.White * alpha, 0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, __instance.getBoundingBox(new Vector2(x, y)).Bottom / 15000f);
}
Vector2 position3 = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), y * 64 + 32 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0)));
Rectangle? sourceRectangle2 = new Rectangle(node.spriteX, node.spriteY, node.spriteW, node.spriteH);
Color color2 = Color.White * alpha;
float rotation2 = 0f;
Vector2 origin2 = new Vector2(8f, 8f);
Vector2 vector2 = __instance.scale;
spriteBatch.Draw(node.texture, position3, sourceRectangle2, color2, rotation2, origin2, (__instance.scale.Y > 1f) ? __instance.getScale().Y : 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.isPreplacedable() ? __instance.getBoundingBox(new Vector2(x, y)).Top : __instance.getBoundingBox(new Vector2(x, y)).Bottom) / 10000f);
return false;
}
19
Source : Weapon.cs
with GNU General Public License v3.0
from aenemenate
with GNU General Public License v3.0
from aenemenate
public void DetermineEnchantments()
{
int rand = Program.RNG.Next(0, 101);
if (rand <= 66) // 66% chance
maxEnchantments = 0;
else if (rand <= 81) // 15% chance
maxEnchantments = 1;
else if (rand <= 90) // 9% chance
maxEnchantments = 2;
else if (rand <= 96) // 6% chance
maxEnchantments = 3;
else // 4% chance
maxEnchantments = 4;
int enchantCount = 0;
rand = Program.RNG.Next(0, 101);
if (rand <= 78 && maxEnchantments >= 0) // 78% chance
enchantCount = 0;
else if (rand <= 90 && maxEnchantments >= 1) // 12% chance
enchantCount = 1;
else if (rand <= 96 && maxEnchantments >= 2) // 6% chance
enchantCount = 2;
else if (rand <= 99 && maxEnchantments >= 3) // 3% chance
enchantCount = 3;
else // 1% chance
enchantCount = maxEnchantments;
int i = 0;
while (i < enchantCount && i < maxEnchantments)
{
WeaponEnchantment enchantment = DataReader.GetNextWeaponEnchantment();
if (enchantments.Find(e => e.Name == enchantment.Name) == null)
{
enchantments.Add(enchantment);
i++;
}
}
}
19
Source : MapTile.cs
with GNU General Public License v3.0
from aenemenate
with GNU General Public License v3.0
from aenemenate
public void DrawCell(int x, int y, Player player, SadConsole.Console console, Window window)
{
Point startPoint = window.CalculateMapStartPoint();
int currentFloor = player.CurrentFloor;
Block[] blocks = currentFloor >= 0 ? Dungeon.Floors[currentFloor].Blocks : map;
Tile[] tiles = currentFloor >= 0 ? Dungeon.Floors[currentFloor].Floor : floor;
List<Projectile> projectiles = currentFloor >= 0 ? Program.WorldMap[worldIndex.X, worldIndex.Y].Dungeon.Floors[currentFloor].Projectiles : Program.WorldMap[worldIndex.X, worldIndex.Y].Projectiles;
Projectile p = projectiles.Find(pr => pr.Position.Equals(new Point(x, y)));
int width = Program.WorldMap.TileWidth;
float nonVisibleMultiplierFore, nonVisibleMultiplierBack, visibleMultiplierFore, visibleMultiplierBack, heightMultiplierFore, heightMultiplierBack;
if (player.CurrentFloor >= 0 == true) {
heightMultiplierFore = 0F;
heightMultiplierBack = 0F;
}
else {
float cellHeight = Program.WorldMap.HeightMap[x + 100 * player.WorldIndex.X, y + 100 * player.WorldIndex.Y];
heightMultiplierFore = ((90F - cellHeight) / 128F) * 0.25F;
heightMultiplierBack = ((90F - cellHeight) / 128F) * 0.1F;
}
nonVisibleMultiplierFore = 0.78F - heightMultiplierFore;
nonVisibleMultiplierBack = 0.89F - heightMultiplierBack;
visibleMultiplierFore = 0.96F - heightMultiplierFore;
visibleMultiplierBack = 1.02F - heightMultiplierBack;
Color floorForeColor = tiles[x * width + y].Splattered ? Color.DarkRed : tiles[x * width + y].ForeColor;
Color floorBackColor = tiles[x * width + y].BackColor;
Color blockForeColor = blocks[x * width + y].Splattered ? Color.DarkRed : blocks[x * width + y].ForeColor;
Color blockBackColor = blocks[x * width + y].BackColor;
void RenderFloorTile()
{
if (!tiles[x * width + y].Explored)
console.SetGlyph(x - startPoint.X, y - startPoint.Y, tiles[x * width + y].Graphic, Color.Black, Color.Black);
else
switch (tiles[x * width + y].Visible) {
case (false):
console.SetGlyph(x - startPoint.X, y - startPoint.Y, tiles[x * width + y].Graphic, floorForeColor * nonVisibleMultiplierFore, floorBackColor * nonVisibleMultiplierBack);
break;
case (true):
console.SetGlyph(x - startPoint.X, y - startPoint.Y, tiles[x * width + y].Graphic, floorForeColor * visibleMultiplierFore, floorBackColor * visibleMultiplierBack);
break;
}
}
void RenderBlock()
{
Block block = blocks[x * width + y];
bool blockIsUnseenCreature = block is Creature && block.Visible == false;
if (blockIsUnseenCreature) {
Creature creature = (Creature)block;
if (creature.Alive) {
bool creatureIsInEmptySpace = creature.CurrentBlock.Type == BlockType.Empty;
if (creatureIsInEmptySpace) {
RenderFloorTile();
return;
}
else
block = creature.CurrentBlock;
}
}
if (block.BackColor == Color.Pink) {
if (block.Type == BlockType.Creature) {
Creature creature = (Creature)block;
bool creatureIsOnColoredBlock = creature != null && creature.CurrentBlock.Type != BlockType.Empty && creature.CurrentBlock.BackColor != Color.Pink;
blockBackColor = creatureIsOnColoredBlock ? creature.CurrentBlock.BackColor : floorBackColor;
}
else
blockBackColor = floorBackColor;
}
if (block.Explored == false)
console.SetGlyph( x - startPoint.X, y - startPoint.Y, block.Graphic, Color.Black, Color.Black );
else
switch (block.Visible) {
case (false):
console.SetGlyph(x - startPoint.X, y - startPoint.Y, block.Graphic, blockForeColor * nonVisibleMultiplierFore, blockBackColor * nonVisibleMultiplierBack);
break;
case (true):
console.SetGlyph(x - startPoint.X, y - startPoint.Y, block.Graphic, blockForeColor * visibleMultiplierFore, blockBackColor * visibleMultiplierBack);
break;
}
}
void RenderProjectile()
{
console.SetGlyph(x - startPoint.X, y - startPoint.Y, p.Item.Graphic, p.Item.ForeColor * visibleMultiplierFore, floorBackColor * visibleMultiplierBack);
}
if (tiles[x * width + y].Visible && p != null)
RenderProjectile();
else if (blocks[x * width + y].Type == BlockType.Empty)
RenderFloorTile();
else
RenderBlock();
}
19
Source : EpubBuilder.cs
with GNU General Public License v3.0
from Aeroblast
with GNU General Public License v3.0
from Aeroblast
void ProcTextRef(XmlAttribute attr)
{
Regex reg_link = new Regex("kindle:flow:([0-9|A-V]+)\\?mime=.*?/(.*)");
Match m = reg_link.Match(attr.Value);
if (!m.Success)
{ Log.log("[Error]link unsolved"); return; }
int flowid = (int)Util.DecodeBase32(m.Groups[1].Value);
string mime = m.Groups[2].Value;
if (flowid < 0)
{
attr.Value = "flow" + (10000 + flowid);
Log.log("[Warn]placeholder link: " + m.Value);
return;
}
switch (mime)
{
case "css":
string name = "flow" + Util.Number(flowid) + ".css";
if (css_names.Find(s => s == name) == null)
{
string csstext = azw3.flows[flowid - 1];
csstext = ProcCSS(csstext);
csss.Add(csstext);
css_names.Add(name);
azw3.flowProcessLog[flowid - 1] = name;
}
attr.Value = "../Styles/" + name;
break;
case "svg+xml":
{
string text = azw3.flows[flowid - 1];
XmlElement svg = attr.OwnerDoreplacedent.CreateElement("temp");
svg.InnerXml = text;
foreach (XmlNode n in svg.ChildNodes)
{
if (n.Name == "svg")
{
attr.OwnerElement.ParentNode.InsertBefore(n, attr.OwnerElement);
attr.OwnerElement.ParentNode.RemoveChild(attr.OwnerElement);
ProcNodes(n);
}
if (n.Name == "xml-stylesheet")
{
Regex reg_link2 = new Regex("kindle:flow:([0-9|A-V]+)\\?mime=.*?/(.*?)\"");
Match ml = reg_link2.Match(n.OuterXml);
if (ml.Success && ml.Groups[2].Value == "css")
{
int flowid_ = (int)Util.DecodeBase32(ml.Groups[1].Value);
string name_ = "flow" + Util.Number(flowid_) + ".css";
bool alreadyHave = false;
foreach (XmlElement linktag in n.OwnerDoreplacedent.GetElementsByTagName("link"))
{
if (linktag.GetAttribute("href") == "../Styles/" + name_)
{ alreadyHave = true; break; }
}
if (!alreadyHave)
{
//rel="stylesheet" type="text/css"
XmlElement l = n.OwnerDoreplacedent.CreateElement("link");
l.SetAttribute("href", "../Styles/" + name_);
l.SetAttribute("type", "text/css");
l.SetAttribute("rel", "stylesheet");
n.OwnerDoreplacedent.GetElementsByTagName("head")[0].AppendChild(l);
if (css_names.Find(s => s == name_) == null)
{
string csstext = azw3.flows[flowid_ - 1];
csstext = ProcCSS(csstext);
csss.Add(csstext);
css_names.Add(name_);
azw3.flowProcessLog[flowid_ - 1] = name_;
}
}
}
else
{ Log.log("cannot find css link in xml-stylesheet"); }
}
}
azw3.flowProcessLog[flowid - 1] = "Flow" + Util.Number(flowid) + " svg has been put into xhtmls";
}
break;
}
}
19
Source : Creature.cs
with GNU General Public License v3.0
from aenemenate
with GNU General Public License v3.0
from aenemenate
public void PickWall( Wall wall )
{
Random rng = new Random();
if ( !(wall.Material == Material.Stone || wall.Material == Material.Coal) )
return;
if (Body.MainHand is Axe axe && axe.WeaponName == "pickaxe")
{
if (axe != null) axe.OnHit(wall);
Program.MsgConsole.WriteLine( $"{Name} struck the {wall.Name}" );
ApplyActionCost(axe.GetWeaponCost(this) );
if (rng.Next( 0, 100 ) < 30)
LvlWeaponSkill( axe, 10 );
ChangeResource( Resource.SP, -(int)( axe.Weight * 1.5 ) );
wall.HP -= (int)Physics.ImpactYields[axe.Material] - (int)Physics.ImpactYields[Material.Stone];
}
if (wall.HP <= 0) {
Item drop = new Stone( true );
if (wall.Material == Material.Coal)
drop = new CoalOre( true );
Point pos = new Point();
List<Point> potentialSpots = GetNearbyBlocksOfType( BlockType.Wall );
potentialSpots.AddRange( GetNearbyBlocksOfType( BlockType.OreWall ) );
Block[] blocks = currentFloor >= 0 ? Program.WorldMap[worldIndex.X, worldIndex.Y].Dungeon.Floors[currentFloor].Blocks : Program.WorldMap[worldIndex.X, worldIndex.Y].Blocks;
int width = Program.WorldMap.TileWidth;
pos = potentialSpots.Find( w => ( (Wall)blocks[w.X * width + w.Y] ).HP == wall.HP );
blocks[pos.X * width + pos.Y] = drop;
Program.MsgConsole.WriteLine( $"The {wall.Name} collapsed!" );
}
}
19
Source : Creature.cs
with GNU General Public License v3.0
from aenemenate
with GNU General Public License v3.0
from aenemenate
public void Gereplacedem(Point itemPos)
{
Block[] blocks = currentFloor >= 0 ? Program.WorldMap[worldIndex.X, worldIndex.Y].Dungeon.Floors[currentFloor].Blocks : Program.WorldMap[worldIndex.X, worldIndex.Y].Blocks;
int width = Program.WorldMap.TileWidth;
bool itemAdded = false;
string itemName = "";
string containerName = "inventory";
if (blocks[itemPos.X * width + itemPos.Y] is Item item) {
// handle various cases of items which must be managed uniquely
itemName = item.Name;
if (item is Arrow && inventory.Exists(i => i is Quiver)) {
Quiver q = (Quiver)inventory.Find(i => i is Quiver);
if (q.Arrows.Count <= 20) {
q.Arrows.Add(item);
itemAdded = true;
containerName = q.Name;
}
}
else if (item is Quiver q1 && inventory.Exists(i => i is Quiver)) {
Quiver q2 = (Quiver)inventory.Find(i => i is Quiver);
foreach (Arrow a in q1.Arrows) {
if (q2.Arrows.Count <= 20)
q2.Arrows.Add(a);
else inventory.Add(a);
}
itemAdded = true;
itemName += "'s arrows";
containerName = q2.Name;
}
else if (item is Blueprint && inventory.Exists(i => i is BlueprintPouch)) {
BlueprintPouch bp = (BlueprintPouch)inventory.Find(i => i is BlueprintPouch);
bp.Blueprints.Add(item);
itemAdded = true;
containerName = bp.Name;
}
else if (item is CraftingRecipe && inventory.Exists(i => i is RecipePouch))
{
RecipePouch rp = (RecipePouch)inventory.Find(i => i is RecipePouch);
rp.Recipes.Add(item);
itemAdded = true;
containerName = rp.Name;
}
// normal case
if (!itemAdded) itemAdded = AddItem(item);
// apply action cost, update map, write to msg console
if (itemAdded) {
Block replacementBlock = item.BlockPlacedOn ?? new Air();
blocks[itemPos.X * width + itemPos.Y] = replacementBlock;
if (currentFloor == Program.Player.CurrentFloor && worldIndex.Equals(Program.Player.WorldIndex))
Program.WorldMap[worldIndex.X, worldIndex.Y].DijkstraMaps.CallItemPosChanged(this);
if (this.Visible)
Program.MsgConsole.WriteLine($"{Name} put the {itemName} in their {containerName}.");
ApplyActionCost(6);
}
else if (this.Visible)
Program.MsgConsole.WriteLine($"{Name} tried to get the {itemName} but didn't have enough space.");
}
}
19
Source : Creature.cs
with GNU General Public License v3.0
from aenemenate
with GNU General Public License v3.0
from aenemenate
public void Eat()
{
Food food = (Food)inventory.Find(i => i.ItemType == ItemType.Food);
if (food == null)
return;
food.Activate(this);
inventory.Remove(food);
ApplyActionCost(6);
if (this.Visible)
Program.MsgConsole.WriteLine($"{Name} ate the {food.Name}");
}
19
Source : EpubBuilder.cs
with GNU General Public License v3.0
from Aeroblast
with GNU General Public License v3.0
from Aeroblast
string ProcCSS(string text)
{
string r = text;
Regex reg_link = new Regex("url\\(kindle:flow:([0-9|A-V]+)\\?mime=text/css\\)");
Regex reg_link2 = new Regex("url\\((kindle:embed:.+?)\\)");
foreach (Match m in reg_link.Matches(text))
{
int flowid = (int)Util.DecodeBase32(m.Groups[1].Value);
string name = "flow" + Util.Number(flowid) + ".css";
if (css_names.Find(s => s == name) == null)
{
string csstext = azw3.flows[flowid - 1];
csstext = ProcCSS(csstext);
csss.Add(csstext);
css_names.Add(name);
azw3.flowProcessLog[flowid - 1] = name;
}
r = r.Replace(m.Groups[0].Value, "url(" + name + ")");
}
foreach (Match m in reg_link2.Matches(text))
{
r = r.Replace(m.Groups[1].Value, ProcEmbed(m.Groups[1].Value));
}
return r;
}
19
Source : EpubBuilder.cs
with GNU General Public License v3.0
from Aeroblast
with GNU General Public License v3.0
from Aeroblast
string AddImage(int id, string message = "")
{
string name = null; byte[] data = null;
Section toComment = null;
if (azw6 != null)
{
int r = azw6.image_sections.Find(s => s == (id + 1));
if (r != 0)
{
CRES_Section sec = (CRES_Section)azw6.sections[r];
name = ImageNameHD(id, sec);
data = sec.img;
sec.comment = name;
toComment = azw3.sections[azw3.mobi_header.first_res_index + id];
}
}
if (name == null)
{
Image_Section section = (Image_Section)azw3.sections[azw3.mobi_header.first_res_index + id];
name = ImageName(id, section);
data = section.raw;
toComment = section;
}
if (img_names.Find(s => s == name) != null) return name;
imgs.Add(data);
img_names.Add(name);
toComment.comment = name + " | " + message;
return name;
}
19
Source : ClientViewModel.cs
with MIT License
from afxw
with MIT License
from afxw
private void Server_ClientDisconnected(object sender, ClientEventArgs e)
{
var list = new List<ClientInfo>(Clients);
var client = list.Find(c => c.Owner == e.Client);
if (client == SelectedClient)
{
SelectedClient = null;
}
Application.Current.Dispatcher.Invoke(() =>
{
Clients.Remove(client);
});
}
19
Source : XmlMember.cs
with Mozilla Public License 2.0
from agebullhu
with Mozilla Public License 2.0
from agebullhu
public static XmlMember Find(Type type)
{
if (!replacedemblys.ContainsKey(type.replacedembly))
{
Load(type.replacedembly);
}
return HelpXml.Find(p => p.Name == type.FullName);
}
19
Source : XmlMember.cs
with Mozilla Public License 2.0
from agebullhu
with Mozilla Public License 2.0
from agebullhu
public static XmlMember Find(string name)
{
return HelpXml.Find(p => p.Name == name);
}
19
Source : StickerPackEditor.cs
with MIT License
from agens-no
with MIT License
from agens-no
private void LoadIconsFromFolder()
{
var folder = EditorUtility.OpenFolderPanel("Select Sticker Icon Folder", string.Empty, string.Empty);
var files = Directory.GetFiles(folder, "*.*", SearchOption.TopDirectoryOnly)
.Where(StickerEditorUtility.HasValidFileExtension).ToList();
files.Sort();
overrideIcon.boolValue = true;
var texturesFound = new List<Texture2D>();
foreach (var file in files)
{
texturesFound.Add(LoadreplacedetFromPath<Texture2D>(file));
}
for (var i = 0; i < iconProperties.Length; i++)
{
iconProperties[i].objectReferenceValue = texturesFound.Find(t => t.width == (int)iconTextureSizes[i].x && t.height == (int)iconTextureSizes[i].y);
}
}
19
Source : frmEditCustomer.cs
with MIT License
from ahm3tcelik
with MIT License
from ahm3tcelik
private void LoadData()
{
stats = statisticService.GetAllByCustomerId(customer.CustomerID);
schedules = scheduleService.GetAllDistinct();
customer.Schedule = schedules.Find(e => e.ScheduleID == customer.ScheduleID);
SetData();
}
19
Source : PeriodTask.cs
with GNU General Public License v3.0
from aiportal
with GNU General Public License v3.0
from aiportal
private void ProcessMessage()
{
while (_messages.Count > 0)
{
string msg = _messages.Dequeue() as string;
var task = _tasks.Find(t => t.Name == msg);
if (task != null)
{
ExecuteTask(task);
}
}
}
19
Source : HttpRoute.cs
with GNU General Public License v3.0
from aiportal
with GNU General Public License v3.0
from aiportal
public void ProcessRequest(HttpListenerRequest Request, HttpListenerResponse Response, string prefix = null)
{
string url = Request.Url.AbsolutePath;
var rule = _rules.Find(r => Regex.IsMatch(url, r.Pattern));
url = Regex.Replace(url, rule.Pattern, rule.Replace);
Response.Redirect(url);
}
19
Source : ArrayUtilities.cs
with Apache License 2.0
from aivclab
with Apache License 2.0
from aivclab
public static T Find<T>(T[] array, Predicate<T> match)
{
var list = new List<T>(collection : array);
return list.Find(match : match);
}
19
Source : ProcessManager.cs
with MIT License
from Akaion
with MIT License
from Akaion
internal IntPtr GetFunctionAddress(string moduleName, string functionName)
{
var module = Modules.Find(m => m.Name.Equals(moduleName, StringComparison.OrdinalIgnoreCase));
if (module is null)
{
return IntPtr.Zero;
}
// Calculate the address of the function
var function = module.PeImage.Value.ExportedFunctions.Find(f => f.Name != null && f.Name == functionName);
var functionAddress = module.BaseAddress + function.Offset;
// Determine if the function is forwarded to another function
var exportDirectoryStartAddress = module.BaseAddress + module.PeImage.Value.Headers.PEHeader.ExportTableDirectory.RelativeVirtualAddress;
var exportDirectoryEndAddress = exportDirectoryStartAddress + module.PeImage.Value.Headers.PEHeader.ExportTableDirectory.Size;
if ((long) functionAddress < (long) exportDirectoryStartAddress || (long) functionAddress > (long) exportDirectoryEndAddress)
{
return functionAddress;
}
// Read the forwarded function
var forwardedFunctionBytes = new List<byte>();
while (true)
{
var currentByte = Memory.Read<byte>(functionAddress);
if (currentByte == byte.MinValue)
{
break;
}
forwardedFunctionBytes.Add(currentByte);
functionAddress += 1;
}
var forwardedFunction = Encoding.ASCII.GetString(forwardedFunctionBytes.ToArray()).Split(".");
return GetFunctionAddress(forwardedFunction[0] + ".dll", forwardedFunction[1]);
}
19
Source : ProcessManager.cs
with MIT License
from Akaion
with MIT License
from Akaion
internal IntPtr GetFunctionAddress(string moduleName, short functionOrdinal)
{
var module = Modules.Find(m => m.Name.Equals(moduleName, StringComparison.OrdinalIgnoreCase));
if (module is null)
{
return IntPtr.Zero;
}
// Determine the name of the function from its ordinal
var function = module.PeImage.Value.ExportedFunctions.Find(f => f.Ordinal == functionOrdinal);
return GetFunctionAddress(moduleName, function.Name);
}
19
Source : PeImage.cs
with MIT License
from Akaion
with MIT License
from Akaion
private List<ExportedFunction> ParseExportedFunctions()
{
var exportedFunctions = new List<ExportedFunction>();
// Read the export table
if (Headers.PEHeader.ExportTableDirectory.RelativeVirtualAddress == 0)
{
return exportedFunctions;
}
var exportTable = Unsafe.ReadUnaligned<ImageExportDirectory>(ref _peBytes[RvaToVa(Headers.PEHeader.ExportTableDirectory.RelativeVirtualAddress)]);
// Read the exported functions from the export table
var exportedFunctionOffsetsOffset = RvaToVa(exportTable.AddressOfFunctions);
for (var exportedFunctionIndex = 0; exportedFunctionIndex < exportTable.NumberOfFunctions; exportedFunctionIndex ++)
{
var exportedFunctionOffset = Unsafe.ReadUnaligned<int>(ref _peBytes[exportedFunctionOffsetsOffset + sizeof(int) * exportedFunctionIndex]);
exportedFunctions.Add(new ExportedFunction(null, exportedFunctionOffset, (short) (exportTable.Base + exportedFunctionIndex)));
}
// replacedociate names with the exported functions
var exportedFunctionNamesOffset = RvaToVa(exportTable.AddressOfNames);
var exportedFunctionOrdinalsOffset = RvaToVa(exportTable.AddressOfNameOrdinals);
for (var exportedFunctionIndex = 0; exportedFunctionIndex < exportTable.NumberOfNames; exportedFunctionIndex ++)
{
// Read the name of the exported function
var exportedFunctionNameOffset = RvaToVa(Unsafe.ReadUnaligned<int>(ref _peBytes[exportedFunctionNamesOffset + sizeof(int) * exportedFunctionIndex]));
var exportedFunctionNameLength = 0;
while (_peBytes[exportedFunctionNameOffset + exportedFunctionNameLength] != 0x00)
{
exportedFunctionNameLength += 1;
}
var exportedFunctionName = Encoding.ASCII.GetString(new ReadOnlySpan<byte>(_peBytes).Slice(exportedFunctionNameOffset, exportedFunctionNameLength));
// Read the ordinal of the exported function
var exportedFunctionOrdinal = exportTable.Base + Unsafe.ReadUnaligned<short>(ref _peBytes[exportedFunctionOrdinalsOffset + sizeof(short) * exportedFunctionIndex]);
exportedFunctions.Find(exportedFunction => exportedFunction.Ordinal == exportedFunctionOrdinal).Name = exportedFunctionName;
}
return exportedFunctions;
}
19
Source : AssetBundleFilesAnalyze.cs
with MIT License
from akof1314
with MIT License
from akof1314
public static replacedetBundleFileInfo GetreplacedetBundleFileInfo(string name)
{
return sreplacedetBundleFileInfos.Find(info => info.name == name);
}
19
Source : BaseGraph.cs
with MIT License
from alelievr
with MIT License
from alelievr
public PinnedElement OpenPinned(Type viewType)
{
var pinned = pinnedElements.Find(p => p.editorType.type == viewType);
if (pinned == null)
{
pinned = new PinnedElement(viewType);
pinnedElements.Add(pinned);
}
else
pinned.opened = true;
return pinned;
}
19
Source : MixtureGraph.cs
with MIT License
from alelievr
with MIT License
from alelievr
public Texture FindOutputTexture(string name, bool isMain)
{
return outputTextures.Find(t => t != null && (isMain ? t.name == mainOutputTexture.name : t.name == name));
}
19
Source : OutputNode.cs
with MIT License
from alelievr
with MIT License
from alelievr
[CustomPortInput(nameof(outputTextureSettings), typeof(Texture))]
protected void replacedignSubTextures(List< SerializableEdge > edges)
{
foreach (var edge in edges)
{
// Find the correct output texture:
var output = outputTextureSettings.Find(o => o.name == edge.inputPort.portData.identifier);
if (output != null)
{
output.inputTexture = edge.preplacedThroughBuffer as Texture;
}
}
}
See More Examples