Here are the examples of the csharp api System.Enum.ToString() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4174 Examples
19
Source : PropertyInt.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static string GetDescription(this PropertyInt prop)
{
var description = prop.GetAttributeOfType<DescriptionAttribute>();
return description?.Description ?? prop.ToString();
}
19
Source : PropertyInt64.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static string GetDescription(this PropertyInt64 prop)
{
var description = prop.GetAttributeOfType<DescriptionAttribute>();
return description?.Description ?? prop.ToString();
}
19
Source : PropertyString.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static string GetDescription(this PropertyString prop)
{
var description = prop.GetAttributeOfType<DescriptionAttribute>();
return description?.Description ?? prop.ToString();
}
19
Source : AttributeExtensions.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static T GetAttributeOfType<T>(this System.Enum enumVal) where T : System.Attribute
{
var type = enumVal.GetType();
var memInfo = type.GetMember(enumVal.ToString());
var attributes = memInfo[0].GetCustomAttributes(typeof(T), false);
return (attributes.Length > 0) ? (T)attributes[0] : null;
}
19
Source : FactionBits.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static string ToSentence(this FactionBits factionBits)
{
return new string(factionBits.ToString().ToCharArray().SelectMany((c, i) => i > 0 && char.IsUpper(c) ? new char[] { ' ', c } : new char[] { c }).ToArray());
}
19
Source : HookGroupType.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static string ToSentence(this HookGroupType hookGroupType)
{
return new string(hookGroupType.ToString().ToCharArray().SelectMany((c, i) => i > 0 && char.IsUpper(c) ? new char[] { ' ', c } : new char[] { c }).ToArray());
}
19
Source : Skill.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static string ToSentence(this Skill skill)
{
return new string(skill.ToString().ToCharArray().SelectMany((c, i) => i > 0 && char.IsUpper(c) ? new char[] { ' ', c } : new char[] { c }).ToArray());
}
19
Source : ServerPerformanceMonitor.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public new static string ToString()
{
var sb = new StringBuilder();
sb.Append($"Monitoring Durations: ~5m {Monitors5mRunTime.TotalMinutes:N2} min, ~1h {Monitors1hRunTime.TotalMinutes:N2} min, ~24h {Monitors24hRunTime.TotalMinutes:N2} min{'\n'}");
sb.Append($"~5m Hits Avg Long Last Tot - ~1h Hits Avg Long Last Tot - ~24h Hits Avg Long Last Tot (s) - Name{'\n'}");
sb.Append($"Calls from WorldManager.UpdateWorld(){'\n'}");
for (int i = (int)MonitorType.PlayerManager_Tick; i <= (int)MonitorType.NetworkManager_DoSessionWork; i++)
AddMonitorOutputToStringBuilder(monitors5m[i].EventHistory, monitors1h[i].EventHistory, monitors24h[i].EventHistory, ((MonitorType)i).ToString(), sb);
sb.Append($"WorldManager.UpdateGameWorld() time not including throttled returns{'\n'}");
AddMonitorOutputToStringBuilder(monitors5m[(int)MonitorType.UpdateGameWorld_Entire].EventHistory, monitors1h[(int)MonitorType.UpdateGameWorld_Entire].EventHistory, monitors24h[(int)MonitorType.UpdateGameWorld_Entire].EventHistory, MonitorType.UpdateGameWorld_Entire.ToString(), sb);
sb.Append($"Calls from WorldManager.UpdateGameWorld(){'\n'}");
for (int i = (int)MonitorType.LandblockManager_TickPhysics; i <= (int)MonitorType.LandblockManager_TickSingleThreadedWork; i++)
AddMonitorOutputToStringBuilder(monitors5m[i].EventHistory, monitors1h[i].EventHistory, monitors24h[i].EventHistory, ((MonitorType)i).ToString(), sb);
sb.Append($"Calls from Landblock.TickPhysics() - replacedulative over a single UpdateGameWorld Tick{'\n'}");
for (int i = (int)replacedulativeEventHistoryType.Player_Tick_UpdateObjectPhysics; i <= (int)replacedulativeEventHistoryType.WorldObject_Tick_UpdateObjectPhysics; i++)
AddMonitorOutputToStringBuilder(replacedulative5m[i], replacedulative1h[i], replacedulative24h[i], ((replacedulativeEventHistoryType)i).ToString(), sb);
sb.Append($"Calls from Landblock.TickLandblockGroupThreadSafeWork() - replacedulative over a single UpdateGameWorld Tick{'\n'}");
for (int i = (int)replacedulativeEventHistoryType.Landblock_Tick_RunActions; i <= (int)replacedulativeEventHistoryType.Landblock_Tick_Database_Save; i++)
AddMonitorOutputToStringBuilder(replacedulative5m[i], replacedulative1h[i], replacedulative24h[i], ((replacedulativeEventHistoryType)i).ToString(), sb);
sb.Append($"Calls from Landblock.TickLandblockGroupThreadSafeWork() - Misc - replacedulative over a single UpdateGameWorld Tick{'\n'}");
for (int i = (int)replacedulativeEventHistoryType.Monster_Awareness_FindNextTarget; i <= (int)replacedulativeEventHistoryType.LootGenerationFactory_CreateRandomLootObjects; i++)
AddMonitorOutputToStringBuilder(replacedulative5m[i], replacedulative1h[i], replacedulative24h[i], ((replacedulativeEventHistoryType)i).ToString(), sb);
sb.Append($"Calls from Landblock.TickSingleThreadedWork() - replacedulative over a single UpdateGameWorld Tick{'\n'}");
for (int i = (int)replacedulativeEventHistoryType.Landblock_Tick_Player_Tick; i <= (int)replacedulativeEventHistoryType.Landblock_Tick_WorldObject_Heartbeat; i++)
AddMonitorOutputToStringBuilder(replacedulative5m[i], replacedulative1h[i], replacedulative24h[i], ((replacedulativeEventHistoryType)i).ToString(), sb);
sb.Append($"Calls from NetworkManager.DoSessionWork(){'\n'}");
for (int i = (int)MonitorType.DoSessionWork_TickOutbound; i <= (int)MonitorType.DoSessionWork_RemoveSessions; i++)
AddMonitorOutputToStringBuilder(monitors5m[i].EventHistory, monitors1h[i].EventHistory, monitors24h[i].EventHistory, ((MonitorType)i).ToString(), sb);
sb.Append($"Calls from NetworkManager.ProcessPacket(){'\n'}");
for (int i = (int)MonitorType.ProcessPacket_0; i <= (int)MonitorType.ProcessPacket_1; i++)
AddMonitorOutputToStringBuilder(monitors5m[i].EventHistory, monitors1h[i].EventHistory, monitors24h[i].EventHistory, ((MonitorType)i).ToString(), sb);
return sb.ToString();
}
19
Source : WorldManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static void Initialize()
{
var thread = new Thread(() =>
{
LandblockManager.PreloadConfigLandblocks();
UpdateWorld();
});
thread.Name = "World Manager";
thread.Priority = ThreadPriority.AboveNormal;
thread.Start();
log.DebugFormat("ServerTime initialized to {0}", Timers.WorldStartLoreTime);
log.DebugFormat($"Current maximum allowed sessions: {ConfigManager.Config.Server.Network.MaximumAllowedSessions}");
log.Info($"World started and is currently {WorldStatus.ToString()}{(PropertyManager.GetBool("world_closed", false).Item ? "" : " and will open automatically when server startup is complete.")}");
if (WorldStatus == WorldStatusState.Closed)
log.Info($"To open world to players, use command: world open");
}
19
Source : HostContext.cs
with MIT License
from actions
with MIT License
from actions
public void ShutdownRunner(ShutdownReason reason)
{
ArgUtil.NotNull(reason, nameof(reason));
_trace.Info($"Runner will be shutdown for {reason.ToString()}");
RunnerShutdownReason = reason;
_runnerShutdownTokenSource.Cancel();
}
19
Source : HostTraceListener.cs
with MIT License
from actions
with MIT License
from actions
private void WriteHeader(string source, TraceEventType eventType, int id)
{
string type = null;
switch (eventType)
{
case TraceEventType.Critical:
type = "CRIT";
break;
case TraceEventType.Error:
type = "ERR ";
break;
case TraceEventType.Warning:
type = "WARN";
break;
case TraceEventType.Information:
type = "INFO";
break;
case TraceEventType.Verbose:
type = "VERB";
break;
default:
type = eventType.ToString();
break;
}
Write(StringUtil.Format("[{0:u} {1} {2}] ", DateTime.UtcNow, type, source));
}
19
Source : RunnerServer.cs
with MIT License
from actions
with MIT License
from actions
private void CheckConnection(RunnerConnectionType connectionType)
{
switch (connectionType)
{
case RunnerConnectionType.Generic:
if (!_hasGenericConnection)
{
throw new InvalidOperationException($"SetConnection {RunnerConnectionType.Generic}");
}
break;
case RunnerConnectionType.JobRequest:
if (!_hasRequestConnection)
{
throw new InvalidOperationException($"SetConnection {RunnerConnectionType.JobRequest}");
}
break;
case RunnerConnectionType.MessageQueue:
if (!_hasMessageConnection)
{
throw new InvalidOperationException($"SetConnection {RunnerConnectionType.MessageQueue}");
}
break;
default:
throw new NotSupportedException(connectionType.ToString());
}
}
19
Source : CmdLineActions.cs
with MIT License
from action-bi-toolkit
with MIT License
from action-bi-toolkit
[ArgActionMethod, ArgShortcut("info"), ArgDescription("Collects diagnostic information about the local system and writes a JSON object to StdOut.")]
[ArgExample(
"pbi-tools.exe info check",
"Prints information about the active version of pbi-tools, all Power BI Desktop versions on the local system, any running Power BI Desktop instances, and checks the latest version of Power BI Desktop available from Microsoft Downloads.")]
public void Info(
[ArgDescription("When specified, checks the latest Power BI Desktop version available from download.microsoft.com.")] bool checkDownloadVersion
)
{
using (_appSettings.SetScopedLogLevel(LogEventLevel.Warning)) // Suppresses Informational logs
{
var jsonResult = new JObject
{
{ "version", replacedemblyVersionInformation.replacedemblyInformationalVersion },
{ "edition", _appSettings.Edition },
{ "build", replacedemblyVersionInformation.replacedemblyFileVersion },
{ "pbiBuildVersion", replacedemblyVersionInformation.replacedemblyMetadata_PBIBuildVersion },
{ "amoVersion", typeof(Microsoft.replacedysisServices.Tabular.Server).replacedembly
.GetCustomAttribute<replacedemblyInformationalVersionAttribute>()?.InformationalVersion },
{ "toolPath", Process.GetCurrentProcess().MainModule.FileName },
{ "settings", new JObject {
{ AppSettings.Environment.LogLevel, AppSettings.GetEnvironmentSetting(AppSettings.Environment.LogLevel) },
{ AppSettings.Environment.PbiInstallDir, AppSettings.GetEnvironmentSetting(AppSettings.Environment.PbiInstallDir) },
}},
{ "runtime", new JObject {
{ "platform", System.Runtime.InteropServices.RuntimeInformation.OSDescription },
{ "architecture", System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString() },
{ "framework", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription },
}},
#if NETFRAMEWORK
{ "pbiInstalls", JArray.FromObject(_dependenciesResolver.PBIInstalls) },
{ "effectivePbiInstallDir", _dependenciesResolver.GetEffectivePowerBiInstallDir() },
{ "pbiSessions", JArray.FromObject(PowerBIProcesses.EnumerateProcesses().ToArray()) },
#endif
};
if (checkDownloadVersion)
{
var downloadInfo = PowerBIDownloader.TryFetchInfo(out var info) ? info : new PowerBIDownloadInfo {};
jsonResult.Add("pbiDownloadVersion", JObject.FromObject(downloadInfo));
}
using (var writer = new JsonTextWriter(Console.Out))
{
writer.Formatting = Environment.UserInteractive ? Formatting.Indented : Formatting.None;
jsonResult.WriteTo(writer);
}
}
}
19
Source : Descriptors.cs
with GNU General Public License v3.0
from Acumatica
with GNU General Public License v3.0
from Acumatica
private static DiagnosticDescriptor Rule(string id, LocalizableString replacedle, Category category, DiagnosticSeverity defaultSeverity,
string diagnosticShortName, LocalizableString messageFormat = null, LocalizableString description = null,
string diagnosticDefaultJustification = null)
{
bool isEnabledByDefault = true;
messageFormat = messageFormat ?? replacedle;
string diagnosticLink = $"{DoreplacedentationLinkPrefix}/{id}.{DoreplacedentatonFileExtension}";
string[] customTags = diagnosticDefaultJustification.IsNullOrWhiteSpace()
? new[] { diagnosticShortName }
: new[] { diagnosticShortName, diagnosticDefaultJustification };
return new DiagnosticDescriptor(id, replacedle, messageFormat, _categoryMapping.GetOrAdd(category, c => c.ToString()), defaultSeverity,
isEnabledByDefault, description, diagnosticLink, customTags);
}
19
Source : SettingsTest.cs
with MIT License
from adams85
with MIT License
from adams85
[Fact]
public async Task ReloadOptionsSettingsMultipleProviders()
{
var fileProvider = new MemoryFileProvider();
var fileAppender = new MemoryFileAppender(fileProvider);
dynamic settings = new JObject();
dynamic globalFilters = settings[nameof(LoggerFilterRule.LogLevel)] = new JObject();
globalFilters[LogFileOptions.DefaultCategoryName] = LogLevel.None.ToString();
settings[FileLoggerProvider.Alias] = new JObject();
dynamic fileFilters = settings[FileLoggerProvider.Alias][nameof(LoggerFilterRule.LogLevel)] = new JObject();
fileFilters[LogFileOptions.DefaultCategoryName] = LogLevel.Warning.ToString();
dynamic oneFile = new JObject();
oneFile.Path = "one.log";
settings[FileLoggerProvider.Alias][nameof(FileLoggerOptions.Files)] = new JArray(oneFile);
settings[OtherFileLoggerProvider.Alias] = new JObject();
dynamic otherFileFilters = settings[OtherFileLoggerProvider.Alias][nameof(LoggerFilterRule.LogLevel)] = new JObject();
otherFileFilters[LogFileOptions.DefaultCategoryName] = LogLevel.Information.ToString();
dynamic otherFile = new JObject();
otherFile.Path = "other.log";
settings[OtherFileLoggerProvider.Alias][nameof(FileLoggerOptions.Files)] = new JArray(otherFile);
var configJson = ((JObject)settings).ToString();
fileProvider.CreateFile("config.json", configJson);
IConfigurationRoot config = new ConfigurationBuilder()
.AddJsonFile(fileProvider, "config.json", optional: false, reloadOnChange: true)
.Build();
var context = new TestFileLoggerContext(default, completionTimeout: Timeout.InfiniteTimeSpan);
var services = new ServiceCollection();
services.AddOptions();
services.AddLogging(lb =>
{
lb.AddConfiguration(config);
lb.AddFile(context, o => o.FileAppender ??= fileAppender);
lb.AddFile<OtherFileLoggerProvider>(context, o => o.FileAppender ??= fileAppender);
});
FileLoggerProvider[] providers;
using (ServiceProvider sp = services.BuildServiceProvider())
{
providers = context.GetProviders(sp).ToArray();
replacedert.Equal(2, providers.Length);
var resetTasks = new List<Task>();
foreach (FileLoggerProvider provider in providers)
provider.Reset += (s, e) => resetTasks.Add(e);
ILoggerFactory loggerFactory = sp.GetRequiredService<ILoggerFactory>();
ILogger logger = loggerFactory.CreateLogger("X");
logger.LogInformation("This is an info.");
logger.LogWarning("This is a warning.");
fileFilters[LogFileOptions.DefaultCategoryName] = LogLevel.Information.ToString();
otherFileFilters[LogFileOptions.DefaultCategoryName] = LogLevel.Warning.ToString();
configJson = ((JObject)settings).ToString();
replacedert.Equal(0, resetTasks.Count);
fileProvider.WriteContent("config.json", configJson);
// reload is triggered twice due to a bug in the framework (https://github.com/aspnet/Logging/issues/874)
replacedert.Equal(2 * 2, resetTasks.Count);
// ensuring that reset has been finished and the new settings are effective
await Task.WhenAll(resetTasks);
logger.LogInformation("This is another info.");
logger.LogWarning("This is another warning.");
}
replacedert.True(providers.All(provider => provider.Completion.IsCompleted));
var logFile = (MemoryFileInfo)fileProvider.GetFileInfo((string)oneFile.Path);
replacedert.True(logFile.Exists && !logFile.IsDirectory);
var lines = logFile.ReadAllText(out Encoding encoding).Split(new[] { Environment.NewLine }, StringSplitOptions.None);
replacedert.Equal(Encoding.UTF8, encoding);
replacedert.Equal(new[]
{
$"warn: X[0] @ {context.GetTimestamp().ToLocalTime():o}",
$" This is a warning.",
$"info: X[0] @ {context.GetTimestamp().ToLocalTime():o}",
$" This is another info.",
$"warn: X[0] @ {context.GetTimestamp().ToLocalTime():o}",
$" This is another warning.",
""
}, lines);
logFile = (MemoryFileInfo)fileProvider.GetFileInfo((string)otherFile.Path);
replacedert.True(logFile.Exists && !logFile.IsDirectory);
lines = logFile.ReadAllText(out encoding).Split(new[] { Environment.NewLine }, StringSplitOptions.None);
replacedert.Equal(Encoding.UTF8, encoding);
replacedert.Equal(new[]
{
$"info: X[0] @ {context.GetTimestamp().ToLocalTime():o}",
$" This is an info.",
$"warn: X[0] @ {context.GetTimestamp().ToLocalTime():o}",
$" This is a warning.",
$"warn: X[0] @ {context.GetTimestamp().ToLocalTime():o}",
$" This is another warning.",
""
}, lines);
}
19
Source : Job.cs
with MIT License
from AdemCatamak
with MIT License
from AdemCatamak
public void SetQueued()
{
ChangeJobStatus(JobStatus.Queued, JobStatus.Queued.ToString());
}
19
Source : Job.cs
with MIT License
from AdemCatamak
with MIT License
from AdemCatamak
public void SetInProgress()
{
ChangeJobStatus(JobStatus.InProgress, JobStatus.InProgress.ToString());
}
19
Source : Job.cs
with MIT License
from AdemCatamak
with MIT License
from AdemCatamak
public void SetCompleted()
{
ChangeJobStatus(JobStatus.Completed, JobStatus.Completed.ToString());
}
19
Source : MainPage.cs
with MIT License
from adospace
with MIT License
from adospace
private VisualNode RenderSwitchMode(ViewMode viewMode)
=> new RxStackLayout()
{
new RxLabel(viewMode.ToString()),
new RxSwitch()
.IsToggled(State.ViewMode == viewMode)
.OnToggled((s, e)=>SetState(_ => _.ViewMode = viewMode))
}
.WithHorizontalOrientation();
19
Source : CacheEventSource.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
[NonEvent]
public void OnRemovedCallback(CacheEntryRemovedArguments args)
{
CacheRemovedCallback(args.CacheItem.Key, args.CacheItem.RegionName, args.RemovedReason.ToString());
}
19
Source : ObjectCacheExtensions.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public static JObject GetJson<TKey>(
this ObjectCache cache,
Func<string, object, bool> filter,
Func<CacheItemDetail, TKey> orderBy,
string replacedle = null,
string description = null,
Uri feedAlternateLink = null,
Uri itemAlternateLink = null,
string regionName = null,
bool expanded = false)
{
var objectCacheElement = new JObject
{
{ "type", cache.ToString() },
{ "count", cache.GetCount(regionName).ToString() },
{ "defaultCacheCapabilities", cache.DefaultCacheCapabilities.ToString() }
};
var compositeCache = cache as CompositeObjectCache;
while (compositeCache != null && compositeCache.Cache is CompositeObjectCache)
{
compositeCache = compositeCache.Cache as CompositeObjectCache;
}
var memoryCache = compositeCache != null ? compositeCache.Cache as MemoryCache : cache as MemoryCache;
var memoryCacheElement = memoryCache != null
? new JObject
{
{ "cacheMemoryLimit", memoryCache.CacheMemoryLimit.ToString() },
{ "physicalMemoryLimit", memoryCache.PhysicalMemoryLimit.ToString() },
{ "pollingInterval", memoryCache.PollingInterval.ToString() }
}
: null;
var items = GetJsonItems(cache, filter, orderBy, itemAlternateLink, regionName, expanded);
var retval = CreateSerializableFeed(replacedle ?? cache.Name, description, feedAlternateLink, objectCacheElement, memoryCacheElement, items);
return retval;
}
19
Source : NotificationMessageTransformer.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private PluginMessage CreateMessage(IChangedItem changedItem, Dictionary<string, EnreplacedyRecordMessage> enreplacedyRecordMessages)
{
switch (changedItem.Type)
{
case ChangeType.NewOrUpdated:
var newOrUpdated = changedItem as NewOrUpdatedItem;
if (newOrUpdated == null || newOrUpdated.NewOrUpdatedEnreplacedy == null)
break;
if (!enreplacedyRecordMessages.ContainsKey(newOrUpdated.NewOrUpdatedEnreplacedy.LogicalName))
{
ADXTrace.Instance.TraceWarning(TraceCategory.Application, string.Format("Collection of enreplacedy name to EnreplacedyRecordMessages is not holding the changed item with enreplacedy name {0}, which shouldn't happen.", newOrUpdated.NewOrUpdatedEnreplacedy.LogicalName));
break;
}
return this.CreateMessageForNewOrUpdatedItem(newOrUpdated, enreplacedyRecordMessages[newOrUpdated.NewOrUpdatedEnreplacedy.LogicalName]);
case ChangeType.RemoveOrDeleted:
var removedOrDeleted = changedItem as RemovedOrDeletedItem;
if (removedOrDeleted == null || removedOrDeleted.RemovedItem == null)
break;
if (!enreplacedyRecordMessages.ContainsKey(removedOrDeleted.RemovedItem.LogicalName))
{
ADXTrace.Instance.TraceWarning(TraceCategory.Application, string.Format("Collection of enreplacedy name to EnreplacedyRecordMessages is not holding the the changed item with enreplacedy name {0} which shouldn't happen.", removedOrDeleted.RemovedItem.LogicalName));
break;
}
return this.CreateMessageForRemovedOrDeletedItem(removedOrDeleted, enreplacedyRecordMessages[removedOrDeleted.RemovedItem.LogicalName]);
default:
ADXTrace.Instance.TraceWarning(TraceCategory.Application, string.Format("While casting the changed item to specific type, found unhandled ChangeType: {0}", changedItem.Type.ToString()));
break;
}
return null;
}
19
Source : NotificationMessageTransformer.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private PluginMessage CreateMessageForNewOrUpdatedItem(NewOrUpdatedItem changedItem, EnreplacedyRecordMessage enreplacedyRecordMessage)
{
if (changedItem == null || enreplacedyRecordMessage == null)
return null;
PluginMessage message;
replacedociateDisreplacedociateMessage replacedociateDisreplacedociateMessage = enreplacedyRecordMessage as replacedociateDisreplacedociateMessage;
string name = this.TryGetTargetName(changedItem.NewOrUpdatedEnreplacedy);
ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Converting ChangedItem with EnreplacedyName: {0} and Type:{1} to Portal Cache Message ", changedItem.NewOrUpdatedEnreplacedy.LogicalName, changedItem.Type.ToString()));
if (replacedociateDisreplacedociateMessage == null || changedItem.NewOrUpdatedEnreplacedy.LogicalName == "adx_webpageaccesscontrolrule_webrole")
{
message = new PluginMessage
{
MessageName = Constants.CreatedOrUpdated,
Target = new PluginMessageEnreplacedyReference
{
Name = name,
Id = changedItem.NewOrUpdatedEnreplacedy.Id,
LogicalName = changedItem.NewOrUpdatedEnreplacedy.LogicalName,
},
RelatedEnreplacedies = null,
Relationship = null,
};
}
else
{
message = new PluginMessage
{
MessageName = Constants.replacedociate,
Target = new PluginMessageEnreplacedyReference
{
Name = name,
Id = (Guid)changedItem.NewOrUpdatedEnreplacedy.Attributes
[
CrmChangeTrackingManager.Instance.TryGetPrimaryKey(replacedociateDisreplacedociateMessage.RelatedEnreplacedy1Name)
],
LogicalName = replacedociateDisreplacedociateMessage.RelatedEnreplacedy1Name,
},
RelatedEnreplacedies = new List<PluginMessageEnreplacedyReference>
{
new PluginMessageEnreplacedyReference
{
Name = null,
Id = (Guid)changedItem.NewOrUpdatedEnreplacedy.Attributes
[
CrmChangeTrackingManager.Instance.TryGetPrimaryKey(replacedociateDisreplacedociateMessage.RelatedEnreplacedy2Name)
],
LogicalName = replacedociateDisreplacedociateMessage.RelatedEnreplacedy2Name,
}
},
Relationship = new PluginMessageRelationship
{
PrimaryEnreplacedyRole = null,
SchemaName = replacedociateDisreplacedociateMessage.RelationshipName,
},
};
}
return message;
}
19
Source : NotificationMessageTransformer.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private PluginMessage CreateMessageForRemovedOrDeletedItem(RemovedOrDeletedItem changedItem, EnreplacedyRecordMessage enreplacedyRecordMessage)
{
if (changedItem == null)
return null;
PluginMessage message;
replacedociateDisreplacedociateMessage replacedociateDisreplacedociateMessage = enreplacedyRecordMessage as replacedociateDisreplacedociateMessage;
ADXTrace.Instance.TraceWarning(TraceCategory.Application, string.Format("Converting ChangedItem/Deleted with EnreplacedyName: {0} and Type:{1} to Portal Cache Message", changedItem.RemovedItem.LogicalName, changedItem.Type.ToString()));
if (replacedociateDisreplacedociateMessage == null || changedItem.RemovedItem.LogicalName == "adx_webpageaccesscontrolrule_webrole")
{
message = new PluginMessage
{
MessageName = Constants.RemovedOrDeleted,
Target = new PluginMessageEnreplacedyReference
{
Name = null,
Id = changedItem.RemovedItem.Id,
LogicalName = changedItem.RemovedItem.LogicalName,
},
};
}
else
{
message = new PluginMessage
{
MessageName = Constants.Disreplacedociate,
Target = new PluginMessageEnreplacedyReference
{
// Special Handling : We want this information to preplaced to adx code for dissociate and message schema is fixed / nothing can be added, this name/guid would have been null/empty else .
Name = replacedociateDisreplacedociateMessage.EnreplacedyName,
Id = changedItem.RemovedItem.Id,
LogicalName = replacedociateDisreplacedociateMessage.RelatedEnreplacedy1Name,
},
RelatedEnreplacedies = new List<PluginMessageEnreplacedyReference>
{
new PluginMessageEnreplacedyReference
{
Name = null,
Id = Guid.Empty,
LogicalName = replacedociateDisreplacedociateMessage.RelatedEnreplacedy2Name,
}
},
Relationship = new PluginMessageRelationship
{
PrimaryEnreplacedyRole = null,
SchemaName = replacedociateDisreplacedociateMessage.RelationshipName,
},
};
}
return message;
}
19
Source : FetchXmlIndexDocumentFactory.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private static bool AttributeTypeEqualsOneOf(AttributeMetadata attributeMetadata, params string[] typeNames)
{
if (attributeMetadata == null || attributeMetadata.AttributeType == null)
{
return false;
}
var attributeTypeName = attributeMetadata.AttributeType.Value.ToString();
return typeNames.Any(name => string.Equals(attributeTypeName, name, StringComparison.InvariantCultureIgnoreCase));
}
19
Source : ExtendedAttributeSearchResultInfo.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private static bool AttributeTypeEqualsOneOf(AttributeMetadata attributeMetadata, params string[] typeNames)
{
var attributeTypeName = attributeMetadata.AttributeType.Value.ToString();
return typeNames.Any(name => string.Equals(attributeTypeName, name, StringComparison.InvariantCultureIgnoreCase));
}
19
Source : ManageController.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
{
if (ModelState.IsValid)
{
var userId = User.Idenreplacedy.GetUserId();
var result = await UserManager.ChangePhoneNumberAsync(userId, model.PhoneNumber, model.Code);
if (result.Succeeded)
{
var user = await UserManager.FindByIdAsync(userId);
if (user != null)
{
await SignInAsync(user, isPersistent: false);
}
return RedirectToProfile(ManageMessageId.ChangePhoneNumberSuccess);
}
}
// If we got this far, something failed, redisplay form
ViewBag.Message = ManageMessageId.ChangePhoneNumberFailure.ToString();
return await VerifyPhoneNumber(model.PhoneNumber);
}
19
Source : ManageController.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private static ActionResult RedirectToProfile(ManageMessageId? message)
{
var query = message != null ? new NameValueCollection { { "Message", message.Value.ToString() } } : null;
return new RedirectToSiteMarkerResult("Profile", query);
}
19
Source : EntityRecord.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
protected void ConvertToEnreplacedyRecord(Enreplacedy enreplacedy, EnreplacedyMetadata enreplacedyMetadata = null, OrganizationServiceContext serviceContext = null, OrganizationMoneyFormatInfo organizationMoneyFormatInfo = null, int? crmLcid = null)
{
var recordAttributes = new List<EnreplacedyRecordAttribute>();
var attributes = enreplacedy.Attributes;
var formattedAttributes = enreplacedy.FormattedValues;
if (serviceContext == null)
{
serviceContext = PortalCrmConfigurationManager.CreateServiceContext();
}
organizationMoneyFormatInfo = organizationMoneyFormatInfo ?? new OrganizationMoneyFormatInfo(serviceContext);
var recordMoneyFormatInfo = new EnreplacedyRecordMoneyFormatInfo(serviceContext, enreplacedy);
foreach (var attribute in attributes)
{
var aliasedValue = attribute.Value as AliasedValue;
var value = aliasedValue != null ? aliasedValue.Value : attribute.Value;
var type = value.GetType().ToString();
var formattedValue = string.Empty;
var displayValue = value;
DateTimeFormat format = DateTimeFormat.DateAndTime;
DateTimeBehavior behavior = null;
AttributeMetadata attributeMetadata = null;
if (formattedAttributes.Contains(attribute.Key))
{
formattedValue = formattedAttributes[attribute.Key];
displayValue = formattedValue;
}
if (aliasedValue != null)
{
var aliasedEnreplacedyMetadata = serviceContext.GetEnreplacedyMetadata(aliasedValue.EnreplacedyLogicalName, EnreplacedyFilters.Attributes);
if (aliasedEnreplacedyMetadata != null)
{
attributeMetadata = aliasedEnreplacedyMetadata.Attributes.FirstOrDefault(a => a.LogicalName == aliasedValue.AttributeLogicalName);
}
}
else
{
if (enreplacedyMetadata != null)
{
attributeMetadata = enreplacedyMetadata.Attributes.FirstOrDefault(a => a.LogicalName == attribute.Key);
}
}
if (attributeMetadata != null)
{
switch (attributeMetadata.AttributeType)
{
case AttributeTypeCode.State:
case AttributeTypeCode.Status:
case AttributeTypeCode.Picklist:
var optionSetValue = (OptionSetValue)value;
formattedValue = Adxstudio.Xrm.Core.OrganizationServiceContextExtensions.GetOptionSetValueLabel(attributeMetadata,
optionSetValue.Value, crmLcid.GetValueOrDefault(CultureInfo.CurrentCulture.LCID));
displayValue = formattedValue;
break;
case AttributeTypeCode.Customer:
case AttributeTypeCode.Lookup:
case AttributeTypeCode.Owner:
var enreplacedyReference = value as EnreplacedyReference;
if (enreplacedyReference != null)
{
displayValue = enreplacedyReference.Name ?? string.Empty;
}
break;
case AttributeTypeCode.DateTime:
var datetimeAttributeMetadata = attributeMetadata as DateTimeAttributeMetadata;
behavior = datetimeAttributeMetadata.DateTimeBehavior;
format = datetimeAttributeMetadata.Format.GetValueOrDefault(DateTimeFormat.DateAndTime);
if (datetimeAttributeMetadata != null)
{
if (format != DateTimeFormat.DateOnly && behavior == DateTimeBehavior.UserLocal)
{
// Don't use the formatted value, as the connection user's timezone is used to format the datetime value. Use the UTC value for display.
var date = (DateTime)value;
displayValue = date.ToString(DateTimeClientFormat);
}
if (behavior == DateTimeBehavior.TimeZoneIndependent || behavior == DateTimeBehavior.DateOnly)
{
// JSON serialization converts the time from server local to UTC automatically
// to avoid this we can convert to UTC before serialization
value = DateTime.SpecifyKind((DateTime)value, DateTimeKind.Utc);
}
}
break;
case AttributeTypeCode.BigInt:
case AttributeTypeCode.Integer:
displayValue = string.Format("{0}", value);
break;
case AttributeTypeCode.Decimal:
var decimalAttributeMetadata = attributeMetadata as DecimalAttributeMetadata;
if (decimalAttributeMetadata != null && value is decimal)
{
displayValue = ((decimal)value).ToString("N{0}".FormatWith(decimalAttributeMetadata.Precision.GetValueOrDefault(2)));
}
break;
case AttributeTypeCode.Money:
var moneyAttributeMetadata = attributeMetadata as MoneyAttributeMetadata;
if (moneyAttributeMetadata != null && value is Money)
{
var moneyFormatter = new MoneyFormatter(organizationMoneyFormatInfo, recordMoneyFormatInfo, moneyAttributeMetadata);
displayValue = string.Format(moneyFormatter, "{0}", (Money)value);
}
break;
}
}
else
{
if (attribute.Value is EnreplacedyReference)
{
var enreplacedyReference = (EnreplacedyReference)attribute.Value;
if (enreplacedyReference != null)
{
displayValue = enreplacedyReference.Name ?? string.Empty;
}
}
else if (attribute.Value is DateTime)
{
format = DateTimeFormat.DateAndTime;
var dtAttributeValue = (DateTime)attribute.Value;
// Don't use the formatted value, as the connection user's timezone is used to format the datetime value. Use the UTC value for display.
if (dtAttributeValue.Kind == DateTimeKind.Utc) // Indicates this is not a date only attribute
{
var date = (DateTime)value;
displayValue = date.ToString(DateTimeClientFormat);
behavior = DateTimeBehavior.UserLocal;
}
// This below logic fails in one condition: when DateTimeBehavior = TimeZoneIndependent and DateTimeFormat = DateAndTime with value having ex: 20-01-2017 12:00 AM
else if (dtAttributeValue.TimeOfDay.TotalSeconds == 0)
{
behavior = DateTimeBehavior.DateOnly;
format = DateTimeFormat.DateOnly;
value = DateTime.SpecifyKind((DateTime)value, DateTimeKind.Utc);
}
else
{
behavior = DateTimeBehavior.TimeZoneIndependent;
// JSON serialization converts the time from server local to UTC automatically
// to avoid this we can convert to UTC before serialization
value = DateTime.SpecifyKind((DateTime)value, DateTimeKind.Utc);
}
}
}
recordAttributes.Add(new EnreplacedyRecordAttribute
{
Name = attribute.Key,
Value = value,
FormattedValue = formattedValue,
DisplayValue = displayValue,
DateTimeBehavior = behavior,
DateTimeFormat = format.ToString(),
Type = type,
AttributeMetadata = attributeMetadata
});
}
Id = enreplacedy.Id;
EnreplacedyName = enreplacedy.LogicalName;
Attributes = recordAttributes;
}
19
Source : SetupController.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
[HttpPost]
[AjaxValidateAntiForgeryToken]
public ActionResult OrganizationConfiguration(Uri url)
{
ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("url={0}", url));
try
{
var serviceUri = GetOrganizationServiceUrl(url);
var authenticationType = GetAuthenticationType(serviceUri);
return Json(new { authenticationType = authenticationType.ToString() });
}
catch (ModelErrorException mee)
{
return ToJsonModelError(mee.Key, mee);
}
catch (Exception e)
{
return ToJsonModelError("OrganizationServiceUrl", e);
}
}
19
Source : SetupManager.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public override void Save(Uri organizationServiceUrl, AuthenticationProviderType authenticationType, string domain, string username, string preplacedword, Guid websiteId)
{
var xml = new XElement("settings");
xml.SetElementValue("organizationServiceUrl", organizationServiceUrl.OriginalString);
xml.SetElementValue("authenticationType", authenticationType.ToString());
xml.SetElementValue("domain", domain);
xml.SetElementValue("username", username);
xml.SetElementValue("preplacedword", Convert.ToBase64String(MachineKey.Protect(Encoding.UTF8.GetBytes(preplacedword), _machineKeyPurposes)));
xml.Save(_settingsPath.Value);
try
{
SaveWebsiteBinding(websiteId);
}
catch (Exception)
{
File.Delete(_settingsPath.Value);
}
}
19
Source : Settings.xaml.cs
with GNU General Public License v3.0
from adrianlungu
with GNU General Public License v3.0
from adrianlungu
private void ShortcutTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
UnregisterHotKey(_helper.Handle, HotkeyId);
// The text box grabs all input.
e.Handled = true;
// Fetch the actual shortcut key.
Key key = (e.Key == Key.System ? e.SystemKey : e.Key);
// Ignore modifier keys.
if (key == Key.LeftShift || key == Key.RightShift
|| key == Key.LeftCtrl || key == Key.RightCtrl
|| key == Key.LeftAlt || key == Key.RightAlt
|| key == Key.LWin || key == Key.RWin)
{
return;
}
// Build the shortcut key name.
StringBuilder shortcutText = new StringBuilder();
if ((Keyboard.Modifiers & ModifierKeys.Control) != 0)
{
shortcutText.Append("Ctrl+");
}
if ((Keyboard.Modifiers & ModifierKeys.Shift) != 0)
{
shortcutText.Append("Shift+");
}
if ((Keyboard.Modifiers & ModifierKeys.Alt) != 0)
{
shortcutText.Append("Alt+");
}
shortcutText.Append(key.ToString());
// Update the text box.
ShortcutTextBox.Text = shortcutText.ToString();
Properties.Settings.Default.SleepShortcut = shortcutText.ToString();
Properties.Settings.Default.Save();
SetupSleepShortcut(_helper);
}
19
Source : AbstractLogger.cs
with MIT License
from adrianmteo
with MIT License
from adrianmteo
public void Log(LogLevel level, string format, params object[] args)
{
if (level >= MinimumLevel && level <= MaximumLevel)
{
string date = DateTime.Now.ToString(DateFormat);
string log = string.Format(format, args);
string[] lines = log.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
{
string message = MessageFormat
.Replace(LogMessageToken.Date, date)
.Replace(LogMessageToken.Level, level.ToString().ToUpper())
.Replace(LogMessageToken.Message, line)
.Replace(LogMessageToken.Tag, Tag);
WriteMessage(message);
}
}
}
19
Source : HttpResponseMessageAssertions.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
private void ExecuteStatusreplacedertion(string because, object[] becauseArgs, HttpStatusCode expected, string? otherName = null)
{
Execute.replacedertion
.BecauseOf(because, becauseArgs)
.ForCondition(expected == Subject.StatusCode)
.FailWith("Expected HTTP {context:response} to be {0}{reason}, but found {1}.{2}"
, otherName ?? expected.ToString(), Subject.StatusCode, Subject);
}
19
Source : ExternalMembersTests.cs
with MIT License
from adrianoc
with MIT License
from adrianoc
[Test]
public void TestCallingConvention([Values] CallingConvention callingConvention)
{
var result = RunCecilifier($"using System.Runtime.InteropServices; public clreplaced C {{ [DllImport(\"Foo\", CallingConvention = CallingConvention.{callingConvention})] public static extern int M(); int Call() => M(); }}");
var cecilifiedCode = result.GeneratedCode.ReadToEnd();
replacedert.IsTrue(cecilifiedCode.Contains($"PInvokeAttributes.CallConv{callingConvention.ToString().ToLower()}", StringComparison.OrdinalIgnoreCase), cecilifiedCode);
}
19
Source : RTConstants.cs
with GNU General Public License v3.0
from Aekras1a
with GNU General Public License v3.0
from Aekras1a
public void InjectConstants(ModuleDef rtModule, VMDescriptor desc, RuntimeHelpers helpers)
{
var constants = rtModule.Find(RTMap.kraDConstants, true);
var cctor = constants.FindOrCreateStaticConstructor();
var instrs = cctor.Body.Instructions;
instrs.Clear();
for(var i = 0; i < (int) DarksVMRegisters.Max; i++)
{
var reg = (DarksVMRegisters) i;
var regId = desc.Architecture.Registers[reg];
var regField = reg.ToString();
AddField(regField, regId);
}
for(var i = 0; i < (int)DarksVMFlags.Max; i++)
{
var fl = (DarksVMFlags) i;
var flId = desc.Architecture.Flags[fl];
var flField = fl.ToString();
AddField(flField, 1 << flId);
}
for(var i = 0; i < (int) ILOpCode.Max; i++)
{
var op = (ILOpCode) i;
var opId = desc.Architecture.OpCodes[op];
var opField = op.ToString();
AddField(opField, opId);
}
for(var i = 0; i < (int) DarksVMCalls.Max; i++)
{
var vc = (DarksVMCalls) i;
var vcId = desc.Runtime.VMCall[vc];
var vcField = vc.ToString();
AddField(vcField, vcId);
}
AddField(ConstantFields.E_CALL.ToString(), (int) desc.Runtime.VCallOps.ECALL_CALL);
AddField(ConstantFields.E_CALLVIRT.ToString(), (int) desc.Runtime.VCallOps.ECALL_CALLVIRT);
AddField(ConstantFields.E_NEWOBJ.ToString(), (int) desc.Runtime.VCallOps.ECALL_NEWOBJ);
AddField(ConstantFields.E_CALLVIRT_CONSTRAINED.ToString(), (int) desc.Runtime.VCallOps.ECALL_CALLVIRT_CONSTRAINED);
AddField(ConstantFields.INIT.ToString(), (int) helpers.INIT);
AddField(ConstantFields.INSTANCE.ToString(), desc.Runtime.RTFlags.INSTANCE);
AddField(ConstantFields.CATCH.ToString(), desc.Runtime.RTFlags.EH_CATCH);
AddField(ConstantFields.FILTER.ToString(), desc.Runtime.RTFlags.EH_FILTER);
AddField(ConstantFields.FAULT.ToString(), desc.Runtime.RTFlags.EH_FAULT);
AddField(ConstantFields.FINALLY.ToString(), desc.Runtime.RTFlags.EH_FINALLY);
Conclude(desc.Random, instrs, constants);
instrs.Add(Instruction.Create(OpCodes.Ret));
cctor.Body.OptimizeMacros();
}
19
Source : TitanSkinPreset.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public override void Draw(SmartRect rect, Locale locale)
{
RandomizePairs = ToggleButton(rect, RandomizePairs, locale["forestRandomize"], true);
for (int i = 0; i < Length; i++)
{
rect.width = rect.width - 100f - Style.HorizontalMargin;
Hairs[i] = TextField(rect, Hairs[i], locale["replacedanHair"] + (i + 1).ToString() + ":", 80f, false);
rect.MoveX();
rect.width = 100;
if (Button(rect, HairTypes[i].ToString(), true))
{
int val = (int)HairTypes[i];
val++;
if (val >= (int)HairType.Count)
{
val = -1;
}
HairTypes[i] = (HairType)val;
}
rect.ResetX();
}
for (int i = 0; i < Length; i++)
{
Eyes[i] = TextField(rect, Eyes[i], locale["replacedanEye"] + (i + 1).ToString() + ":", 80f, true);
}
for (int i = 0; i < Length; i++)
{
Bodies[i] = TextField(rect, Bodies[i], locale["replacedanBody"] + (i + 1).ToString() + ":", 80f, true);
}
Annie = TextField(rect, Annie, locale["annie"], 80f, true);
Eren = TextField(rect, Eren, locale["eren"], 80f, true);
Colossal = TextField(rect, Colossal, locale["colossal"], 80f, true);
}
19
Source : custom_inputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void checDoubleAxis(string testAxisString, int o, int p)
{
if (!this.allowDuplicates)
{
for (int i = 0; i < this.DescriptionString.Length; i++)
{
if (testAxisString == this.joystickString[i] && (i != o || p == 2))
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
}
if (testAxisString == this.joystickString2[i] && (i != o || p == 1))
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.inputString2[i] = this.inputKey2[i].ToString();
this.joystickActive2[i] = false;
this.joystickString2[i] = "#";
this.saveInputs();
}
}
}
}
19
Source : custom_inputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void checDoubles(KeyCode testkey, int o, int p)
{
if (!this.allowDuplicates)
{
for (int i = 0; i < this.DescriptionString.Length; i++)
{
if (testkey == this.inputKey[i] && (i != o || p == 2))
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
}
if (testkey == this.inputKey2[i] && (i != o || p == 1))
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.inputString2[i] = this.inputKey2[i].ToString();
this.joystickActive2[i] = false;
this.joystickString2[i] = "#";
this.saveInputs();
}
}
}
}
19
Source : custom_inputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void drawButtons2()
{
float num = this.Boxes_Y;
float x = Input.mousePosition.x;
float y = Input.mousePosition.y;
Vector3 point = GUI.matrix.inverse.MultiplyPoint3x4(new Vector3(x, (float)Screen.height - y, 1f));
GUI.skin = this.OurSkin;
for (int i = 0; i < this.DescriptionString.Length; i++)
{
num += this.BoxesMargin_Y;
Rect position = new Rect(this.InputBox2_X, num, (float)this.buttonSize, this.buttonHeight);
GUI.Button(position, this.inputString2[i]);
if (!this.joystickActive2[i] && this.inputKey2[i] == KeyCode.None)
{
this.joystickString2[i] = "#";
}
if (this.inputBool2[i])
{
GUI.Toggle(position, true, string.Empty, this.OurSkin.button);
}
if (position.Contains(point) && Input.GetMouseButtonUp(0) && !this.tempbool)
{
this.tempbool = true;
this.inputBool2[i] = true;
this.lastInterval = Time.realtimeSinceStartup;
}
if (Event.current.type == EventType.KeyDown && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = Event.current.keyCode;
this.inputBool2[i] = false;
this.inputString2[i] = this.inputKey2[i].ToString();
this.tempbool = false;
this.joystickActive2[i] = false;
this.joystickString2[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey2[i], i, 2);
}
if (this.mouseButtonsOn)
{
int num2 = 323;
for (int j = 0; j < 6; j++)
{
if (Input.GetMouseButton(j) && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
num2 += j;
this.inputKey2[i] = (KeyCode)num2;
this.inputBool2[i] = false;
this.inputString2[i] = this.inputKey2[i].ToString();
this.joystickActive2[i] = false;
this.joystickString2[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey2[i], i, 2);
}
}
}
for (int k = 350; k < 409; k++)
{
if (Input.GetKey((KeyCode)k) && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = (KeyCode)k;
this.inputBool2[i] = false;
this.inputString2[i] = this.inputKey2[i].ToString();
this.tempbool = false;
this.joystickActive2[i] = false;
this.joystickString2[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey2[i], i, 2);
}
}
if (this.mouseAxisOn)
{
if (Input.GetAxis("MouseUp") == 1f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "MouseUp";
this.inputString2[i] = "Mouse Up";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("MouseDown") == 1f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "MouseDown";
this.inputString2[i] = "Mouse Down";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("MouseLeft") == 1f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "MouseLeft";
this.inputBool2[i] = false;
this.inputString2[i] = "Mouse Left";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("MouseRight") == 1f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "MouseRight";
this.inputString2[i] = "Mouse Right";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
}
if (this.mouseButtonsOn)
{
if (Input.GetAxis("MouseScrollUp") > 0f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "MouseScrollUp";
this.inputBool2[i] = false;
this.inputString2[i] = "Mouse scroll Up";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("MouseScrollDown") > 0f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "MouseScrollDown";
this.inputBool2[i] = false;
this.inputString2[i] = "Mouse scroll Down";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
}
if (Input.GetAxis("JoystickUp") > 0.5f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "JoystickUp";
this.inputString2[i] = "Joystick Up";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("JoystickDown") > 0.5f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "JoystickDown";
this.inputString2[i] = "Joystick Down";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("JoystickLeft") > 0.5f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "JoystickLeft";
this.inputBool2[i] = false;
this.inputString2[i] = "Joystick Left";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("JoystickRight") > 0.5f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "JoystickRight";
this.inputString2[i] = "Joystick Right";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_3a") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_3a";
this.inputString2[i] = "Joystick Axis 3 +";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_3b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_3b";
this.inputString2[i] = "Joystick Axis 3 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_4a") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_4a";
this.inputString2[i] = "Joystick Axis 4 +";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_4b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_4b";
this.inputString2[i] = "Joystick Axis 4 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_5b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_5b";
this.inputString2[i] = "Joystick Axis 5 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_6b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_6b";
this.inputString2[i] = "Joystick Axis 6 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_7a") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_7a";
this.inputString2[i] = "Joystick Axis 7 +";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_7b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_7b";
this.inputString2[i] = "Joystick Axis 7 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_8a") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_8a";
this.inputString2[i] = "Joystick Axis 8 +";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
if (Input.GetAxis("Joystick_8b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey2[i] = KeyCode.None;
this.inputBool2[i] = false;
this.joystickActive2[i] = true;
this.joystickString2[i] = "Joystick_8b";
this.inputString2[i] = "Joystick Axis 8 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString2[i], i, 2);
}
}
}
19
Source : custom_inputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void reset2defaults()
{
if (this.default_inputKeys.Length != this.DescriptionString.Length)
{
this.default_inputKeys = new KeyCode[this.DescriptionString.Length];
}
if (this.alt_default_inputKeys.Length != this.default_inputKeys.Length)
{
this.alt_default_inputKeys = new KeyCode[this.default_inputKeys.Length];
}
string text = string.Empty;
string text2 = string.Empty;
string text3 = string.Empty;
string text4 = string.Empty;
string text5 = string.Empty;
string text6 = string.Empty;
for (int i = this.DescriptionString.Length - 1; i > -1; i--)
{
text = (int)this.default_inputKeys[i] + "*" + text;
text2 += "#*";
text3 = this.default_inputKeys[i].ToString() + "*" + text3;
PlayerPrefs.SetString("KeyCodes", text);
PlayerPrefs.SetString("Joystick_input", text2);
PlayerPrefs.SetString("Names_input", text3);
text4 = (int)this.alt_default_inputKeys[i] + "*" + text4;
text5 += "#*";
text6 = this.alt_default_inputKeys[i].ToString() + "*" + text6;
PlayerPrefs.SetString("KeyCodes2", text4);
PlayerPrefs.SetString("Joystick_input2", text5);
PlayerPrefs.SetString("Names_input2", text6);
PlayerPrefs.SetInt("KeyLength", this.DescriptionString.Length);
}
}
19
Source : FengCustomInputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void reset2defaults()
{
if (this.default_inputKeys.Length != this.DescriptionString.Length)
{
this.default_inputKeys = new KeyCode[this.DescriptionString.Length];
}
string text = string.Empty;
string text2 = string.Empty;
string text3 = string.Empty;
for (int i = this.DescriptionString.Length - 1; i > -1; i--)
{
text = (int)this.default_inputKeys[i] + "*" + text;
text2 += "#*";
text3 = this.default_inputKeys[i].ToString() + "*" + text3;
PlayerPrefs.SetString("KeyCodes", text);
PlayerPrefs.SetString("Joystick_input", text2);
PlayerPrefs.SetString("Names_input", text3);
PlayerPrefs.SetInt("KeyLength", this.DescriptionString.Length);
}
}
19
Source : FengCustomInputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void checDoubleAxis(string testAxisString, int o, int p)
{
if (!this.allowDuplicates)
{
for (int i = 0; i < this.DescriptionString.Length; i++)
{
if (testAxisString == this.joystickString[i] && (i != o || p == 2))
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
}
}
}
}
19
Source : FengCustomInputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void drawButtons1()
{
bool flag = false;
for (int i = 0; i < this.DescriptionString.Length; i++)
{
if (!this.joystickActive[i] && this.inputKey[i] == KeyCode.None)
{
this.joystickString[i] = "#";
}
bool flag2 = this.inputBool[i];
if (Event.current.type == EventType.KeyDown && this.inputBool[i])
{
this.inputKey[i] = Event.current.keyCode;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey[i], i, 1);
}
if (this.mouseButtonsOn)
{
int num = 323;
for (int j = 0; j < 6; j++)
{
if (Input.GetMouseButton(j) && this.inputBool[i])
{
num += j;
this.inputKey[i] = (KeyCode)num;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey[i], i, 1);
}
}
}
for (int k = 350; k < 409; k++)
{
if (Input.GetKey((KeyCode)k) && this.inputBool[i])
{
this.inputKey[i] = (KeyCode)k;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey[i], i, 1);
}
}
if (this.mouseAxisOn)
{
if (Input.GetAxis("MouseUp") == 1f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseUp";
this.inputString[i] = "Mouse Up";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("MouseDown") == 1f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseDown";
this.inputString[i] = "Mouse Down";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("MouseLeft") == 1f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseLeft";
this.inputBool[i] = false;
this.inputString[i] = "Mouse Left";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("MouseRight") == 1f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseRight";
this.inputString[i] = "Mouse Right";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
}
if (this.mouseButtonsOn)
{
if (Input.GetAxis("MouseScrollUp") > 0f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseScrollUp";
this.inputBool[i] = false;
this.inputString[i] = "Mouse scroll Up";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("MouseScrollDown") > 0f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseScrollDown";
this.inputBool[i] = false;
this.inputString[i] = "Mouse scroll Down";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
}
if (Input.GetAxis("JoystickUp") > 0.5f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "JoystickUp";
this.inputString[i] = "Joystick Up";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("JoystickDown") > 0.5f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "JoystickDown";
this.inputString[i] = "Joystick Down";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("JoystickLeft") > 0.5f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "JoystickLeft";
this.inputString[i] = "Joystick Left";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("JoystickRight") > 0.5f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "JoystickRight";
this.inputString[i] = "Joystick Right";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_3a") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_3a";
this.inputString[i] = "Joystick Axis 3 +";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_3b") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_3b";
this.inputString[i] = "Joystick Axis 3 -";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_4a") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_4a";
this.inputString[i] = "Joystick Axis 4 +";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_4b") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_4b";
this.inputString[i] = "Joystick Axis 4 -";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_5b") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_5b";
this.inputString[i] = "Joystick Axis 5 -";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_6b") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_6b";
this.inputString[i] = "Joystick Axis 6 -";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_7a") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_7a";
this.inputString[i] = "Joystick Axis 7 +";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_7b") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_7b";
this.inputString[i] = "Joystick Axis 7 -";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_8a") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_8a";
this.inputString[i] = "Joystick Axis 8 +";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_8b") > 0.8f && this.inputBool[i])
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_8b";
this.inputString[i] = "Joystick Axis 8 -";
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (flag2 != this.inputBool[i])
{
flag = true;
}
}
if (flag)
{
this.showKeyMap();
}
}
19
Source : custom_inputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void drawButtons1()
{
float num = this.Boxes_Y;
float x = Input.mousePosition.x;
float y = Input.mousePosition.y;
Vector3 point = GUI.matrix.inverse.MultiplyPoint3x4(new Vector3(x, (float)Screen.height - y, 1f));
GUI.skin = this.OurSkin;
GUI.Box(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), string.Empty);
GUI.Box(new Rect(60f, 60f, (float)(Screen.width - 120), (float)(Screen.height - 120)), string.Empty, "window");
GUI.Label(new Rect(this.DescriptionBox_X, num - 10f, (float)this.DescriptionSize, this.buttonHeight), "name", "textfield");
GUI.Label(new Rect(this.InputBox1_X, num - 10f, (float)this.DescriptionSize, this.buttonHeight), "input", "textfield");
GUI.Label(new Rect(this.InputBox2_X, num - 10f, (float)this.DescriptionSize, this.buttonHeight), "alt input", "textfield");
for (int i = 0; i < this.DescriptionString.Length; i++)
{
num += this.BoxesMargin_Y;
GUI.Label(new Rect(this.DescriptionBox_X, num, (float)this.DescriptionSize, this.buttonHeight), this.DescriptionString[i], "box");
Rect position = new Rect(this.InputBox1_X, num, (float)this.buttonSize, this.buttonHeight);
GUI.Button(position, this.inputString[i]);
if (!this.joystickActive[i] && this.inputKey[i] == KeyCode.None)
{
this.joystickString[i] = "#";
}
if (this.inputBool[i])
{
GUI.Toggle(position, true, string.Empty, this.OurSkin.button);
}
if (position.Contains(point) && Input.GetMouseButtonUp(0) && !this.tempbool)
{
this.tempbool = true;
this.inputBool[i] = true;
this.lastInterval = Time.realtimeSinceStartup;
}
if (GUI.Button(new Rect(this.resetbuttonX, this.resetbuttonLocY, (float)this.buttonSize, this.buttonHeight), this.resetbuttonText) && Input.GetMouseButtonUp(0))
{
PlayerPrefs.DeleteAll();
this.reset2defaults();
this.loadConfig();
this.saveInputs();
}
if (Event.current.type == EventType.KeyDown && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = Event.current.keyCode;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.tempbool = false;
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey[i], i, 1);
}
if (this.mouseButtonsOn)
{
int num2 = 323;
for (int j = 0; j < 6; j++)
{
if (Input.GetMouseButton(j) && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
num2 += j;
this.inputKey[i] = (KeyCode)num2;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey[i], i, 1);
}
}
}
for (int k = 350; k < 409; k++)
{
if (Input.GetKey((KeyCode)k) && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = (KeyCode)k;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.tempbool = false;
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
this.checDoubles(this.inputKey[i], i, 1);
}
}
if (this.mouseAxisOn)
{
if (Input.GetAxis("MouseUp") == 1f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseUp";
this.inputString[i] = "Mouse Up";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("MouseDown") == 1f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseDown";
this.inputString[i] = "Mouse Down";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("MouseLeft") == 1f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseLeft";
this.inputBool[i] = false;
this.inputString[i] = "Mouse Left";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("MouseRight") == 1f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseRight";
this.inputString[i] = "Mouse Right";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
}
if (this.mouseButtonsOn)
{
if (Input.GetAxis("MouseScrollUp") > 0f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseScrollUp";
this.inputBool[i] = false;
this.inputString[i] = "Mouse scroll Up";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("MouseScrollDown") > 0f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "MouseScrollDown";
this.inputBool[i] = false;
this.inputString[i] = "Mouse scroll Down";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
}
if (Input.GetAxis("JoystickUp") > 0.5f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "JoystickUp";
this.inputString[i] = "Joystick Up";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("JoystickDown") > 0.5f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "JoystickDown";
this.inputString[i] = "Joystick Down";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("JoystickLeft") > 0.5f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "JoystickLeft";
this.inputString[i] = "Joystick Left";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("JoystickRight") > 0.5f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "JoystickRight";
this.inputString[i] = "Joystick Right";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_3a") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_3a";
this.inputString[i] = "Joystick Axis 3 +";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_3b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_3b";
this.inputString[i] = "Joystick Axis 3 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_4a") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_4a";
this.inputString[i] = "Joystick Axis 4 +";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_4b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_4b";
this.inputString[i] = "Joystick Axis 4 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_5b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_5b";
this.inputString[i] = "Joystick Axis 5 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_6b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_6b";
this.inputString[i] = "Joystick Axis 6 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_7a") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_7a";
this.inputString[i] = "Joystick Axis 7 +";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_7b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_7b";
this.inputString[i] = "Joystick Axis 7 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_8a") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_8a";
this.inputString[i] = "Joystick Axis 8 +";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
if (Input.GetAxis("Joystick_8b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.joystickActive[i] = true;
this.joystickString[i] = "Joystick_8b";
this.inputString[i] = "Joystick Axis 8 -";
this.tempbool = false;
this.saveInputs();
this.checDoubleAxis(this.joystickString[i], i, 1);
}
}
}
19
Source : FengCustomInputs.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void checDoubles(KeyCode testkey, int o, int p)
{
if (!this.allowDuplicates)
{
for (int i = 0; i < this.DescriptionString.Length; i++)
{
if (testkey == this.inputKey[i] && (i != o || p == 2))
{
this.inputKey[i] = KeyCode.None;
this.inputBool[i] = false;
this.inputString[i] = this.inputKey[i].ToString();
this.joystickActive[i] = false;
this.joystickString[i] = "#";
this.saveInputs();
}
}
}
}
19
Source : InvStat.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public static string GetName(InvStat.Identifier i)
{
return i.ToString();
}
19
Source : AEDPoSContract_GetMaximumBlocksCount.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
private int GetMaximumBlocksCount()
{
TryToGetCurrentRoundInformation(out var currentRound);
var libRoundNumber = currentRound.ConfirmedIrreversibleBlockRoundNumber;
var libBlockHeight = currentRound.ConfirmedIrreversibleBlockHeight;
var currentHeight = Context.CurrentHeight;
var currentRoundNumber = currentRound.RoundNumber;
Context.LogDebug(() =>
$"Calculating max blocks count based on:\nR_LIB: {libRoundNumber}\nH_LIB:{libBlockHeight}\nR:{currentRoundNumber}\nH:{currentHeight}");
if (libRoundNumber == 0)
{
return AEDPoSContractConstants.MaximumTinyBlocksCount;
}
var blockchainMiningStatusEvaluator = new BlockchainMiningStatusEvaluator(libRoundNumber,
currentRoundNumber, AEDPoSContractConstants.MaximumTinyBlocksCount);
blockchainMiningStatusEvaluator.Deconstruct(out var blockchainMiningStatus);
Context.LogDebug(() => $"Current blockchain mining status: {blockchainMiningStatus.ToString()}");
// If R_LIB + 2 < R < R_LIB + CB1, CB goes to Min(T(L2 * (CB1 - (R - R_LIB)) / A), CB0), while CT stays same as before.
if (blockchainMiningStatus == BlockchainMiningStatus.Abnormal)
{
var previousRoundMinedMinerList = State.MinedMinerListMap[currentRoundNumber.Sub(1)].Pubkeys;
var previousPreviousRoundMinedMinerList = State.MinedMinerListMap[currentRoundNumber.Sub(2)].Pubkeys;
var minersOfLastTwoRounds = previousRoundMinedMinerList
.Intersect(previousPreviousRoundMinedMinerList).Count();
var factor = minersOfLastTwoRounds.Mul(
blockchainMiningStatusEvaluator.SevereStatusRoundsThreshold.Sub(
(int) currentRoundNumber.Sub(libRoundNumber)));
var count = Math.Min(AEDPoSContractConstants.MaximumTinyBlocksCount,
Ceiling(factor, currentRound.RealTimeMinersInformation.Count));
Context.LogDebug(() => $"Maximum blocks count tune to {count}");
return count;
}
//If R >= R_LIB + CB1, CB goes to 1, and CT goes to 0
if (blockchainMiningStatus == BlockchainMiningStatus.Severe)
{
// Fire an event to notify miner not package normal transaction.
Context.Fire(new IrreversibleBlockHeightUnacceptable
{
DistanceToIrreversibleBlockHeight = currentHeight.Sub(libBlockHeight)
});
State.IsPreviousBlockInSevereStatus.Value = true;
return 1;
}
if (!State.IsPreviousBlockInSevereStatus.Value)
return AEDPoSContractConstants.MaximumTinyBlocksCount;
Context.Fire(new IrreversibleBlockHeightUnacceptable
{
DistanceToIrreversibleBlockHeight = 0
});
State.IsPreviousBlockInSevereStatus.Value = false;
return AEDPoSContractConstants.MaximumTinyBlocksCount;
}
19
Source : DeferredGBuffer.cs
with The Unlicense
from aeroson
with The Unlicense
from aeroson
internal void BindGBufferTexturesTo(Shader shader)
{
GL.Disable(EnableCap.DepthTest);
GL.DepthMask(false);
GL.CullFace(CullFaceMode.Back);
GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, frameBufferObjectHandle);
// draw to the one we are not reading
if(readFirstFinalTexture) GL.DrawBuffer(DrawBufferMode.ColorAttachment5);
else GL.DrawBuffer(DrawBufferMode.ColorAttachment4);
shader.SetUniform("gBufferUniform.depthBuffer", depthTexture);
shader.SetUniform("gBufferUniform.final", finalTextureToRead);
for (int i = 0; i < textures.Length - 2; i++)
{
shader.SetUniform("gBufferUniform." + ((GBufferTextures)i).ToString().ToLower(), textures[i]);
/* // !!!!! WASTED AROUND 10 HOURS, BEFOURE I FOUND THE BUG IS HERE OMFG !!!!!! old wrong code below, when used i could not make diffuse lighting in deferred lighting preplaced
if (shader.SetParam("G" + enums[i].ToLower(), texturingUnit))
{
var textureHandle = textures[i];
GL.ActiveTexture(TextureUnit.Texture0 + texturingUnit);
GL.BindTexture(TextureTarget.Texture2D, textureHandle);
texturingUnit++;
}*/
}
}
19
Source : Tokenizer.cs
with MIT License
from AgathokakologicalBit
with MIT License
from AgathokakologicalBit
private bool CheckErrors(Token lastToken)
{
if (state.IsErrorOccured())
{
ErrorHandler.LogError(state);
}
if (lastToken.Type == TokenType.EOF
&& state.PeekContext() != State.Context.Global)
{
state.ErrorCode = (uint)ErrorCodes.T_UnexpectedEndOfFile;
state.ErrorMessage = "Unexpected end of file\n" +
$"Context '{state.PeekContext().ToString()}' wasn't closed";
ErrorHandler.LogError(state);
return true;
}
return state.IsErrorOccured();
}
See More Examples