Here are the examples of the csharp api System.Collections.Generic.Dictionary.Clear() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
6968 Examples
19
Source : CooldownManager.cs
with GNU Affero General Public License v3.0
from 0ceal0t
with GNU Affero General Public License v3.0
from 0ceal0t
public void ResetUI() {
ObjectIdToMember.Clear();
}
19
Source : HealthMonitor.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private string RebuildArgList(string argList, string extras)
{
if (string.IsNullOrEmpty(extras))
return argList;
StringBuilder sb = new StringBuilder();
string s;
Dictionary<string, string> eArgs = Helper.ParseOptions(argList);
Dictionary<string, string> extraDict = Helper.ParseOptions(extras);
foreach (var key in extraDict.Keys)
{
if (eArgs.ContainsKey(key))
{
eArgs[key] = extraDict[key];
}
else
{
eArgs.Add(key, extraDict[key]);
}
}
extraDict.Clear();
extraDict = null;
foreach (var key in eArgs.Keys)
{
sb.AppendFormat("{0} {1} ", key, eArgs[key]);
}
s = sb.ToString().TrimEnd();
eArgs.Clear();
eArgs = null;
sb.Clear();
sb = null;
return s;
}
19
Source : RequestObject.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public void Complete()
{
RequestBridge.RegisterRequestReceiver(this.serverIoPipe);
this.items.Clear();
this.items = null;
}
19
Source : InternalTalk.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
private void ReceiveData(IAsyncResult res)
{
byte[] buffer;
int readLen;
try
{
readLen = sock.EndReceiveFrom(res, ref ep);
}
catch (Exception e)
{
Log.Error(e.Message);
return;
}
buffer = (byte[])res.AsyncState;
var talkData = Parse(buffer,readLen);
if (OnTalk != null)
OnTalk(talkData);
talkData.Clear();
talkData = null;
buffer = null;
RegisterReceiver();
}
19
Source : InternalTalk.cs
with MIT License
from 0ffffffffh
with MIT License
from 0ffffffffh
public void DisposeTalkData(ref Dictionary<string, string> data)
{
data.Clear();
data = null;
}
19
Source : CelesteNetDebugMapComponent.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public void Cleanup() {
lock (Ghosts)
if (Ghosts.Count > 0)
Ghosts.Clear();
}
19
Source : CelesteNetDebugMapComponent.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public void Handle(CelesteNetConnection con, DataChannelMove move) {
if (LastArea == null)
return;
if (move.Player.ID == Client.PlayerInfo.ID) {
lock (Ghosts)
Ghosts.Clear();
return;
}
lock (Ghosts)
if (Ghosts.TryGetValue(move.Player.ID, out DebugMapGhost ghost))
Ghosts.Remove(move.Player.ID);
}
19
Source : CelesteNetChatComponent.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public void Handle(CelesteNetConnection con, DataChat msg) {
lock (Log) {
if (msg.Player?.ID == Client.PlayerInfo?.ID) {
foreach (DataChat pending in Pending.Values) {
Log.Remove(pending);
LogSpecial.Remove(pending);
}
Pending.Clear();
}
int index = Log.FindLastIndex(other => other.ID == msg.ID);
if (index != -1) {
Log[index] = msg;
} else {
Log.Add(msg);
}
if (msg.Color != Color.White) {
index = LogSpecial.FindLastIndex(other => other.ID == msg.ID);
if (index != -1) {
LogSpecial[index] = msg;
} else {
LogSpecial.Add(msg);
}
}
}
}
19
Source : SpamContext.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public void Dispose() {
// TODO: Actually cancel the remaining tasks.
lock (Timeouts) {
Timeouts.Clear();
}
}
19
Source : UIIconManager.cs
with GNU Affero General Public License v3.0
from 0ceal0t
with GNU Affero General Public License v3.0
from 0ceal0t
public void Reset() {
IconConfigs.Clear();
Icons.ForEach(x => x.Dispose());
Icons.Clear();
}
19
Source : DataContext.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public void RescreplacedlDataTypes() {
Logger.Log(LogLevel.INF, "data", "Rescanning all data types");
IDToDataType.Clear();
DataTypeToID.Clear();
RescanDataTypes(CelesteNetUtils.GetTypes());
}
19
Source : Disassembler.cs
with MIT License
from 0xd4d
with MIT License
from 0xd4d
public void Disreplacedemble(Formatter formatter, TextWriter output, DisasmInfo method) {
formatterOutput.writer = output;
targets.Clear();
sortedTargets.Clear();
bool uppercaseHex = formatter.Options.UppercaseHex;
output.Write(commentPrefix);
output.WriteLine("================================================================================");
output.Write(commentPrefix);
output.WriteLine(method.MethodFullName);
uint codeSize = 0;
foreach (var info in method.Code)
codeSize += (uint)info.Code.Length;
var codeSizeHexText = codeSize.ToString(uppercaseHex ? "X" : "x");
output.WriteLine($"{commentPrefix}{codeSize} (0x{codeSizeHexText}) bytes");
var instrCount = method.Instructions.Count;
var instrCountHexText = instrCount.ToString(uppercaseHex ? "X" : "x");
output.WriteLine($"{commentPrefix}{instrCount} (0x{instrCountHexText}) instructions");
void Add(ulong address, TargetKind kind) {
if (!targets.TryGetValue(address, out var addrInfo))
targets[address] = new AddressInfo(kind);
else if (addrInfo.Kind < kind)
addrInfo.Kind = kind;
}
if (method.Instructions.Count > 0)
Add(method.Instructions[0].IP, TargetKind.Unknown);
foreach (ref var instr in method.Instructions) {
switch (instr.FlowControl) {
case FlowControl.Next:
case FlowControl.Interrupt:
break;
case FlowControl.UnconditionalBranch:
Add(instr.NextIP, TargetKind.Unknown);
if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
Add(instr.NearBranchTarget, TargetKind.Branch);
break;
case FlowControl.ConditionalBranch:
case FlowControl.XbeginXabortXend:
if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
Add(instr.NearBranchTarget, TargetKind.Branch);
break;
case FlowControl.Call:
if (instr.Op0Kind == OpKind.NearBranch16 || instr.Op0Kind == OpKind.NearBranch32 || instr.Op0Kind == OpKind.NearBranch64)
Add(instr.NearBranchTarget, TargetKind.Call);
break;
case FlowControl.IndirectBranch:
Add(instr.NextIP, TargetKind.Unknown);
// Unknown target
break;
case FlowControl.IndirectCall:
// Unknown target
break;
case FlowControl.Return:
case FlowControl.Exception:
Add(instr.NextIP, TargetKind.Unknown);
break;
default:
Debug.Fail($"Unknown flow control: {instr.FlowControl}");
break;
}
var baseReg = instr.MemoryBase;
if (baseReg == Register.RIP || baseReg == Register.EIP) {
int opCount = instr.OpCount;
for (int i = 0; i < opCount; i++) {
if (instr.GetOpKind(i) == OpKind.Memory) {
if (method.Contains(instr.IPRelativeMemoryAddress))
Add(instr.IPRelativeMemoryAddress, TargetKind.Branch);
break;
}
}
}
else if (instr.MemoryDisplSize >= 2) {
ulong displ;
switch (instr.MemoryDisplSize) {
case 2:
case 4: displ = instr.MemoryDisplacement; break;
case 8: displ = (ulong)(int)instr.MemoryDisplacement; break;
default:
Debug.Fail($"Unknown mem displ size: {instr.MemoryDisplSize}");
goto case 8;
}
if (method.Contains(displ))
Add(displ, TargetKind.Branch);
}
}
foreach (var map in method.ILMap) {
if (targets.TryGetValue(map.nativeStartAddress, out var info)) {
if (info.Kind < TargetKind.BlockStart && info.Kind != TargetKind.Unknown)
info.Kind = TargetKind.BlockStart;
}
else
targets.Add(map.nativeStartAddress, info = new AddressInfo(TargetKind.Unknown));
if (info.ILOffset < 0)
info.ILOffset = map.ilOffset;
}
int labelIndex = 0, methodIndex = 0;
string GetLabel(int index) => LABEL_PREFIX + index.ToString();
string GetFunc(int index) => FUNC_PREFIX + index.ToString();
foreach (var kv in targets) {
if (method.Contains(kv.Key))
sortedTargets.Add(kv);
}
sortedTargets.Sort((a, b) => a.Key.CompareTo(b.Key));
foreach (var kv in sortedTargets) {
var address = kv.Key;
var info = kv.Value;
switch (info.Kind) {
case TargetKind.Unknown:
info.Name = null;
break;
case TargetKind.Data:
info.Name = GetLabel(labelIndex++);
break;
case TargetKind.BlockStart:
case TargetKind.Branch:
info.Name = GetLabel(labelIndex++);
break;
case TargetKind.Call:
info.Name = GetFunc(methodIndex++);
break;
default:
throw new InvalidOperationException();
}
}
foreach (ref var instr in method.Instructions) {
ulong ip = instr.IP;
if (targets.TryGetValue(ip, out var lblInfo)) {
output.WriteLine();
if (!(lblInfo.Name is null)) {
output.Write(lblInfo.Name);
output.Write(':');
output.WriteLine();
}
if (lblInfo.ILOffset >= 0) {
if (ShowSourceCode) {
foreach (var info in sourceCodeProvider.GetStatementLines(method, lblInfo.ILOffset)) {
output.Write(commentPrefix);
var line = info.Line;
int column = commentPrefix.Length;
WriteWithTabs(output, line, 0, line.Length, '\0', ref column);
output.WriteLine();
if (info.Partial) {
output.Write(commentPrefix);
column = commentPrefix.Length;
WriteWithTabs(output, line, 0, info.Span.Start, ' ', ref column);
output.WriteLine(new string('^', info.Span.Length));
}
}
}
}
}
if (ShowAddresses) {
var address = FormatAddress(bitness, ip, uppercaseHex);
output.Write(address);
output.Write(" ");
}
else
output.Write(formatter.Options.TabSize > 0 ? "\t\t" : " ");
if (ShowHexBytes) {
if (!method.TryGetCode(ip, out var nativeCode))
throw new InvalidOperationException();
var codeBytes = nativeCode.Code;
int index = (int)(ip - nativeCode.IP);
int instrLen = instr.Length;
for (int i = 0; i < instrLen; i++) {
byte b = codeBytes[index + i];
output.Write(b.ToString(uppercaseHex ? "X2" : "x2"));
}
int missingBytes = HEXBYTES_COLUMN_BYTE_LENGTH - instrLen;
for (int i = 0; i < missingBytes; i++)
output.Write(" ");
output.Write(" ");
}
formatter.Format(instr, formatterOutput);
output.WriteLine();
}
}
19
Source : MetroWaterfallFlow.cs
with MIT License
from 1217950746
with MIT License
from 1217950746
public void Refresh()
{
// 初始化参数
var maxHeight = 0.0;
var list = new Dictionary<int, Point>();
var nlist = new Dictionary<int, Dictionary<int, Point>>();
for (int i = 0; i < Children.Count; i++)
{
(Children[i] as FrameworkElement).UpdateLayout();
list.Add(i, new Point(i, (Children[i] as FrameworkElement).ActualHeight, 0.0));
}
for (int i = 0; i < column; i++)
{
nlist.Add(i, new Dictionary<int, Point>());
}
// 智能排序到 nlist
for (int i = 0; i < list.Count; i++)
{
if (i < column)
{
list[i].Buttom = list[i].Height;
nlist[i].Add(nlist[i].Count, list[i]);
}
else
{
var b = 0.0;
var l = 0;
for (int j = 0; j < column; j++)
{
var jh = nlist[j][nlist[j].Count - 1].Buttom + list[i].Height;
if (b == 0.0 || jh < b)
{
b = jh;
l = j;
}
}
list[i].Buttom = b;
nlist[l].Add(nlist[l].Count, list[i]);
}
}
// 开始布局
for (int i = 0; i < nlist.Count; i++)
{
for (int j = 0; j < nlist[i].Count; j++)
{
Children[nlist[i][j].Index].SetValue(LeftProperty, i * ActualWidth / column);
Children[nlist[i][j].Index].SetValue(TopProperty, nlist[i][j].Buttom - nlist[i][j].Height);
Children[nlist[i][j].Index].SetValue(WidthProperty, ActualWidth / column);
if (Children[nlist[i][j].Index] is Grid)
{
((Children[nlist[i][j].Index] as Grid).Children[0] as FrameworkElement).Margin = Margin;
}
}
// 不知道为什么如果不写这么一句会出错
if (nlist.ContainsKey(i))
{
if (nlist[i].ContainsKey(nlist[i].Count - 1))
{
var mh = nlist[i][nlist[i].Count - 1].Buttom;
maxHeight = mh > maxHeight ? mh : maxHeight;
}
}
}
Height = maxHeight;
list.Clear();
nlist.Clear();
}
19
Source : CacheBuilder.cs
with GNU General Public License v3.0
from 1330-Studios
with GNU General Public License v3.0
from 1330-Studios
public static void Flush() => built.Clear();
19
Source : DynamicProxyAbstract.cs
with MIT License
from 1100100
with MIT License
from 1100100
protected async Task InvokeAsync(object[] args, string route, string serviceName)
{
await RemotingInvoke.InvokeAsync(args, route, serviceName, Meta);
Meta?.Clear();
}
19
Source : DynamicProxyAbstract.cs
with MIT License
from 1100100
with MIT License
from 1100100
protected async Task<T> InvokeAsync<T>(object[] args, string route, string serviceName)
{
var result = await RemotingInvoke.InvokeAsync<T>(args, route, serviceName, Meta);
Meta?.Clear();
return result;
}
19
Source : BloonTaskRunner.cs
with GNU General Public License v3.0
from 1330-Studios
with GNU General Public License v3.0
from 1330-Studios
internal static void Quit() {
bloonQueue.Clear();
bloonTasks.Clear();
rand = new(System.DateTime.Now.Millisecond);
}
19
Source : BssomMap.cs
with MIT License
from 1996v
with MIT License
from 1996v
public void Clear()
{
_dict.Clear();
}
19
Source : ContextDataSlots.cs
with MIT License
from 1996v
with MIT License
from 1996v
public void ClearSlots()
{
if (storeSlots != null)
{
storeSlots.Clear();
}
}
19
Source : DbSetSync.cs
with MIT License
from 2881099
with MIT License
from 2881099
void DbContextExecCommand() {
_dicUpdateTimes.Clear();
_ctx.ExecCommand();
}
19
Source : DbContext.cs
with MIT License
from 2881099
with MIT License
from 2881099
public void Dispose() {
if (_isdisposed) return;
try {
_actions.Clear();
foreach (var set in _dicSet)
try {
set.Value.Dispose();
} catch { }
_dicSet.Clear();
AllSets.Clear();
_uow?.Rollback();
} finally {
_isdisposed = true;
GC.SuppressFinalize(this);
}
}
19
Source : DataFilterUtil.cs
with MIT License
from 2881099
with MIT License
from 2881099
internal static void SetRepositoryDataFilter(object repos, Action<FluentDataFilter> scopedDataFilter) {
if (scopedDataFilter != null) {
SetRepositoryDataFilter(repos, null);
}
if (scopedDataFilter == null) {
scopedDataFilter = _globalDataFilter;
}
if (scopedDataFilter == null) return;
using (var globalFilter = new FluentDataFilter()) {
scopedDataFilter(globalFilter);
var type = repos.GetType();
Type enreplacedyType = (repos as IBaseRepository).EnreplacedyType;
if (enreplacedyType == null) throw new Exception("FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository");
var notExists = _dicSetRepositoryDataFilterConvertFilterNotExists.GetOrAdd(type, t => new ConcurrentDictionary<string, bool>());
var newFilter = new Dictionary<string, LambdaExpression>();
foreach (var gf in globalFilter._filters) {
if (notExists.ContainsKey(gf.name)) continue;
LambdaExpression newExp = null;
var filterParameter1 = Expression.Parameter(enreplacedyType, gf.exp.Parameters[0].Name);
try {
newExp = Expression.Lambda(
typeof(Func<,>).MakeGenericType(enreplacedyType, typeof(bool)),
new ReplaceVisitor().Modify(gf.exp.Body, filterParameter1),
filterParameter1
);
} catch {
notExists.TryAdd(gf.name, true); //防止第二次错误
continue;
}
newFilter.Add(gf.name, newExp);
}
if (newFilter.Any() == false) return;
var del = _dicSetRepositoryDataFilterApplyDataFilterFunc.GetOrAdd(type, t => {
var reposParameter = Expression.Parameter(type);
var nameParameter = Expression.Parameter(typeof(string));
var expressionParameter = Expression.Parameter(
typeof(Expression<>).MakeGenericType(typeof(Func<,>).MakeGenericType(enreplacedyType, typeof(bool)))
);
return Expression.Lambda(
Expression.Block(
Expression.Call(reposParameter, type.GetMethod("ApplyDataFilter", BindingFlags.Instance | BindingFlags.NonPublic), nameParameter, expressionParameter)
),
new[] {
reposParameter, nameParameter, expressionParameter
}
).Compile();
});
foreach (var nf in newFilter) {
del.DynamicInvoke(repos, nf.Key, nf.Value);
}
newFilter.Clear();
}
}
19
Source : SerializableDictionary.cs
with MIT License
from 39M
with MIT License
from 39M
public void OnAfterDeserialize() {
Clear();
if (_keys != null && _values != null) {
int count = Mathf.Min(_keys.Count, _values.Count);
for (int i = 0; i < count; i++) {
TKey key = _keys[i];
TValue value = _values[i];
if (key == null) {
continue;
}
this[key] = value;
}
}
#if !UNITY_EDITOR
_keys.Clear();
_values.Clear();
#endif
}
19
Source : Water.cs
with MIT License
from 3deric
with MIT License
from 3deric
void OnDisable()
{
if (m_ReflectionTexture)
{
DestroyImmediate(m_ReflectionTexture);
m_ReflectionTexture = null;
}
if (m_RefractionTexture)
{
DestroyImmediate(m_RefractionTexture);
m_RefractionTexture = null;
}
foreach (var kvp in m_ReflectionCameras)
{
DestroyImmediate((kvp.Value).gameObject);
}
m_ReflectionCameras.Clear();
foreach (var kvp in m_RefractionCameras)
{
DestroyImmediate((kvp.Value).gameObject);
}
m_RefractionCameras.Clear();
}
19
Source : ASN1.cs
with BSD 3-Clause "New" or "Revised" License
from 3gstudent
with BSD 3-Clause "New" or "Revised" License
from 3gstudent
protected static void Init()
{
m_Fixup.Clear();
}
19
Source : HotKeys.cs
with MIT License
from 3RD-Dimension
with MIT License
from 3RD-Dimension
public static void LoadHotKeys()
{
hotkeyCode.Clear();
hotkeyDescription.Clear();
if (!File.Exists(HotKeyFile))
{
MainWindow.Logger.Error("Hotkey file not found, going to create default");
CheckCreateFile.CreateDefaultXML();
}
XmlReader r = XmlReader.Create(HotKeyFile); // "hotkeys.xml");
while (r.Read())
{
if (!r.IsStartElement())
continue;
switch (r.Name)
{
case "Hotkeys":
// Get Hotkey Version Number, used for modifying or updating to newer hotkey files (ie if new features are added)
if (r["HotkeyFileVer"].Length > 0)
{
CurrentHotKeyFileVersion = Convert.ToInt32(r["HotkeyFileVer"]); // Current Hotkey File Version
}
break;
case "bind":
if ((r["keyfunction"].Length > 0) && (r["keycode"] != null))
{
if (!hotkeyCode.ContainsKey(r["keyfunction"]))
hotkeyCode.Add(r["keyfunction"], r["keycode"]);
hotkeyDescription.Add(r["keyfunction"], r["key_description"]);
}
break;
}
}
r.Close();
// Check if CurrentFileVersion and NewFileVersion is different and if so, Update the file then reload by running ths process again.
MainWindow.Logger.Info("Hotkey file found, checking if needing update/modification");
if (CurrentHotKeyFileVersion < CheckCreateFile.HotKeyFileVer) // If CurrentHotKeyFileVersion does not equal HotKeyFileVer then update is required
{
CheckCreateFile.CheckAndUpdateXMLFile(CurrentHotKeyFileVersion);
}
}
19
Source : AObjectBase.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public virtual void Dispose()
{
if (IsDisposed)
{
return;
}
ObjectBaseEventSystem.Instance.Remove(this);
id = 0;
if (_componentDict.Count > 0)
{
foreach (AObjectBase item in _componentDict.Values)
{
item.Dispose();
}
_componentDict.Clear();
_componentDict = null;
}
OnDestroy();
if (Parent != null && !Parent.IsDisposed)
{
Parent.RemoveComponent(this);
}
}
19
Source : NetObjectCache.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
internal void Clear()
{
trapStartIndex = 0;
rootObject = null;
if (underlyingList != null) underlyingList.Clear();
if (stringKeys != null) stringKeys.Clear();
#if !CF && !PORTABLE
if (objectKeys != null) objectKeys.Clear();
#endif
}
19
Source : AssetManager.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public void UnloadAllreplacedets()
{
foreach (replacedetData item in replacedetDict.Values)
{
Unloadreplacedet(item);
}
Resources.UnloadUnusedreplacedets();
replacedetDict.Clear();
GC.Collect();
}
19
Source : SimulationDatabase.cs
with MIT License
from 5argon
with MIT License
from 5argon
internal static void Refresh()
{
if (db == null) db = new Dictionary<string, SimulationDevice>();
db.Clear();
var deviceDirectory = new System.IO.DirectoryInfo(NotchSimulatorUtility.DevicesFolder);
if (!deviceDirectory.Exists) return;
var deviceDefinitions = deviceDirectory.GetFiles("*.device.json");
foreach (var deviceDefinition in deviceDefinitions)
{
SimulationDevice deviceInfo;
using (var sr = deviceDefinition.OpenText())
{
deviceInfo = JsonUtility.FromJson<SimulationDevice>(sr.ReadToEnd());
}
db.Add(deviceInfo.Meta.friendlyName, deviceInfo);
}
KeyList = db.Keys.ToArray();
}
19
Source : UnityARAnchorManager.cs
with MIT License
from 734843327
with MIT License
from 734843327
public void Destroy()
{
foreach (ARPlaneAnchorGameObject arpag in GetCurrentPlaneAnchors()) {
GameObject.Destroy (arpag.gameObject);
}
planeAnchorMap.Clear ();
UnsubscribeEvents();
}
19
Source : ARFaceAnchor.cs
with MIT License
from 734843327
with MIT License
from 734843327
Dictionary<string, float> GetBlendShapesFromNative(IntPtr blendShapesPtr)
{
blendshapesDictionary.Clear ();
GetBlendShapesInfo (blendShapesPtr, AddElementToManagedDictionary);
return blendshapesDictionary;
}
19
Source : DialogueSystem.cs
with MIT License
from 7ark
with MIT License
from 7ark
void ClearIds()
{
Ids.Clear();
}
19
Source : AINavMeshGenerator.cs
with MIT License
from 7ark
with MIT License
from 7ark
private void FillOutGrid()
{
grid = new List<Node>();
positionNodeDictionary.Clear();
Vector2 currentPoint = new Vector2((size.x - size.width / 2) + pointDistributionSize, (size.y + size.height / 2) - pointDistributionSize);
int iteration = 0;
bool alternate = false;
bool cacheIteration = false;
int length = -1;
int yLength = 0;
while (true)
{
iteration++;
Node newNode = new Node(currentPoint);
Grid.Add(newNode);
positionNodeDictionary.Add(currentPoint, newNode);
currentPoint += new Vector2(pointDistributionSize * 2, 0);
if (currentPoint.x > size.x + size.width / 2)
{
if(length != -1)
{
while(iteration < length)
{
Node extraNode = new Node(currentPoint);
Grid.Add(extraNode);
iteration++;
}
}
else
{
Node extraNode = new Node(currentPoint);
Grid.Add(extraNode);
}
currentPoint = new Vector2((size.x - size.width / 2) + (alternate ? pointDistributionSize : 0), currentPoint.y - pointDistributionSize);
alternate = !alternate;
cacheIteration = true;
yLength++;
}
if (currentPoint.y < size.y - size.height / 2)
{
break;
}
if(cacheIteration)
{
if(length == -1)
{
length = iteration + 1;
}
iteration = 0;
cacheIteration = false;
}
}
for (int i = 0; i < Grid.Count; i++)
{
for (int direction = 0; direction < Grid[i].connections.Length; direction++)
{
Grid[i].connections[direction] = GetNodeFromDirection(i, (Directions)direction, length);
}
}
}
19
Source : VirtualizingWrapPanel .cs
with MIT License
from 944095635
with MIT License
from 944095635
protected override Size MeasureOverride(Size availableSize)
{
if (_itemsControl == null)
{
return availableSize;
}
_isInMeasure = true;
_childLayouts.Clear();
var extentInfo = GetExtentInfo(availableSize);
EnsureScrollOffsetIsWithinConstrains(extentInfo);
var layoutInfo = GetLayoutInfo(availableSize, ItemHeight, extentInfo);
RecycleItems(layoutInfo);
// Determine where the first item is in relation to previously realized items
var generatorStartPosition = _itemsGenerator.GeneratorPositionFromIndex(layoutInfo.FirstRealizedItemIndex);
var visualIndex = 0;
var currentX = layoutInfo.FirstRealizedItemLeft;
var currentY = layoutInfo.FirstRealizedLineTop;
using (_itemsGenerator.StartAt(generatorStartPosition, GeneratorDirection.Forward, true))
{
for (var itemIndex = layoutInfo.FirstRealizedItemIndex; itemIndex <= layoutInfo.LastRealizedItemIndex; itemIndex++, visualIndex++)
{
bool newlyRealized;
var child = (UIElement)_itemsGenerator.GenerateNext(out newlyRealized);
SetVirtualItemIndex(child, itemIndex);
if (newlyRealized)
{
InsertInternalChild(visualIndex, child);
}
else
{
// check if item needs to be moved into a new position in the Children collection
if (visualIndex < Children.Count)
{
if (!ReferenceEquals(Children[visualIndex], child))
{
var childCurrentIndex = Children.IndexOf(child);
if (childCurrentIndex >= 0)
{
RemoveInternalChildRange(childCurrentIndex, 1);
}
InsertInternalChild(visualIndex, child);
}
}
else
{
// we know that the child can't already be in the children collection
// because we've been inserting children in correct visualIndex order,
// and this child has a visualIndex greater than the Children.Count
AddInternalChild(child);
}
}
// only prepare the item once it has been added to the visual tree
_itemsGenerator.PrepareItemContainer(child);
child.Measure(new Size(ItemWidth, ItemHeight));
_childLayouts.Add(child, new Rect(currentX, currentY, ItemWidth, ItemHeight));
if (currentX + ItemWidth * 2 >= availableSize.Width)
{
// wrap to a new line
currentY += ItemHeight;
currentX = 0;
}
else
{
currentX += ItemWidth;
}
}
}
RemoveRedundantChildren();
UpdateScrollInfo(availableSize, extentInfo);
var desiredSize = new Size(double.IsInfinity(availableSize.Width) ? 0 : availableSize.Width,
double.IsInfinity(availableSize.Height) ? 0 : availableSize.Height);
_isInMeasure = false;
return desiredSize;
}
19
Source : ResourceRepository.cs
with MIT License
from 99x
with MIT License
from 99x
private PathExecutionParams GetExecutionParams(string method, string reqUrl)
{
PathExecutionParams executionParams = null;
bool isFound = false;
Dictionary<string, string> variables = null;
PathExecutionInfo executionInfo = null;
string[] urlSplit = reqUrl.Split('/');
if (pathExecutionInfo.ContainsKey(method))
{
variables = new Dictionary<string, string>();
foreach (KeyValuePair<string, PathExecutionInfo> onePath in pathExecutionInfo[method])
{
string[] definedPathSplit = onePath.Key.Split('/');
if (definedPathSplit.Length == urlSplit.Length)
{
variables.Clear();
isFound = true;
for (int i = 0; i < definedPathSplit.Length; i++)
{
if (definedPathSplit[i].StartsWith("@"))
variables.Add(definedPathSplit[i].Substring(1), urlSplit[i]);
else
{
if (definedPathSplit[i] != urlSplit[i])
{
isFound = false;
break;
}
}
}
}
if (isFound)
{
executionInfo = onePath.Value;
break;
}
}
}
if (isFound)
{
executionParams = new PathExecutionParams
{
ExecutionInfo = executionInfo,
Parameters = variables
};
}
return executionParams;
}
19
Source : Paradigm.cs
with MIT License
from 8T4
with MIT License
from 8T4
public void Clear() => Syntagmas.Clear();
19
Source : MicroVM.Assembler.cs
with MIT License
from a-downing
with MIT License
from a-downing
public void Reset() {
statements.Clear();
symbols.Clear();
errors.Clear();
programData.Clear();
instructions.Clear();
code.Clear();
memory = null;
isrs.Clear();
}
19
Source : IOPipeLine.cs
with MIT License
from a1q123456
with MIT License
from a1q123456
internal void OnHandshakeSuccessful()
{
_handshakeContext = null;
_bufferProcessors.Clear();
ChunkStreamContext = new ChunkStreamContext(this);
}
19
Source : AccelChartData.cs
with MIT License
from a1xd
with MIT License
from a1xd
public void Clear()
{
AccelPoints.Clear();
VelocityPoints.Clear();
GainPoints.Clear();
OutVelocityToPoints.Clear();
Array.Clear(LogToIndex, 0, LogToIndex.Length);
}
19
Source : DynamicOverlayLibrary.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public void Start()
{
if (Application.isPlaying)
{
replacedetBundlesUsedDict.Clear();
}
#if UNITY_EDITOR
if (Application.isPlaying)
{
ClearEditorAddedreplacedets();
}
#endif
}
19
Source : OverlayLibrary.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
override public void UpdateDictionary()
{
ValidateDictionary();
overlayDictionary.Clear();
for (int i = 0; i < overlayElementList.Length; i++)
{
if (overlayElementList[i])
{
var hash = UMAUtils.StringToHash(overlayElementList[i].overlayName);
if (!overlayDictionary.ContainsKey(hash))
{
overlayDictionary.Add(hash, overlayElementList[i]);
}
}
}
}
19
Source : RaceLibrary.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
override public void UpdateDictionary()
{
ValidateDictionary();
raceDictionary.Clear();
for (int i = 0; i < raceElementList.Length; i++){
if (raceElementList[i]){
raceElementList[i].UpdateDictionary();
if (!raceDictionary.ContainsKey(raceElementList[i].raceName)){
raceDictionary.Add(raceElementList[i].raceName, raceElementList[i]);
}
}
}
}
19
Source : SlotLibrary.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
override public void UpdateDictionary()
{
ValidateDictionary();
slotDictionary.Clear();
for (int i = 0; i < slotElementList.Length; i++)
{
if (slotElementList[i])
{
var hash = slotElementList[i].nameHash;
if (!slotDictionary.ContainsKey(hash))
{
slotDictionary.Add(hash, slotElementList[i]);
}
}
}
}
19
Source : UMABonePoseEditorContext.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
private void UpdateMirrors()
{
mirrors.Clear();
if ((umaData != null) && (umaData.umaRoot != null))
{
FindMirroredTransforms(umaData.umaRoot.transform, mirrors);
}
}
19
Source : DynamicCharacterSystem.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public override void Init()
{
if (initialized || isInitializing)
{
return;
}
if (context == null)
{
context = UMAContext.FindInstance();
}
isInitializing = true;
Recipes.Clear();
var possibleRaces = (context.raceLibrary as DynamicRaceLibrary).GetAllRaces();
for (int i = 0; i < possibleRaces.Length; i++)
{
//we need to check that this is not null- the user may not have downloaded it yet
if (possibleRaces[i] == null)
continue;
if (possibleRaces[i].raceName == "RaceDataPlaceholder")
continue;
if (Recipes.ContainsKey(possibleRaces[i].raceName))
{
Debug.LogWarning("Warning: multiple races found for key:" + possibleRaces[i].raceName);
}
else
{
Recipes.Add(possibleRaces[i].raceName, new Dictionary<string, List<UMATextRecipe>>());
}
}
GatherCharacterRecipes();
GatherRecipeFiles();
initialized = true;
isInitializing = false;
}
19
Source : DynamicRaceLibrary.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public void Start()
{
if (Application.isPlaying)
{
replacedetBundlesUsedDict.Clear();
}
#if UNITY_EDITOR
if (Application.isPlaying)
{
ClearEditorAddedreplacedets();
}
allStartingreplacedetsAdded = false;//make this false to that loading new scenes makes the library update
allreplacedetsAddedInEditor = false;
#endif
}
19
Source : DynamicSlotLibrary.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public void Start()
{
if (Application.isPlaying)
{
replacedetBundlesUsedDict.Clear();
}
#if UNITY_EDITOR
if (Application.isPlaying)
{
ClearEditorAddedreplacedets();
}
#endif
}
19
Source : UMAAssetIndexer.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
private void BuildStringTypes()
{
TypeFromString.Clear();
foreach (System.Type st in Types)
{
TypeFromString.Add(st.Name, st);
}
}
19
Source : RaceData.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public void UpdateDictionary()
{
raceDictionary.Clear();
for (int i = 0; i < dnaConverterList.Length; i++)
{
if (dnaConverterList[i])
{
dnaConverterList[i].Prepare();
if (!raceDictionary.ContainsKey(dnaConverterList[i].DNAType))
{
raceDictionary.Add(dnaConverterList[i].DNAType, dnaConverterList[i].ApplyDnaAction);
}
}
}
}
See More Examples