本文整理汇总了C#中IOption.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IOption.GetType方法的具体用法?C# IOption.GetType怎么用?C# IOption.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOption
的用法示例。
在下文中一共展示了IOption.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadOption
private static void LoadOption(IOption targetOpt, OptionBaseType opt)
{
targetOpt.CanOverride = opt.IsOverrideAllowed;
if (targetOpt is BoolOption)
{
(targetOpt as BoolOption).Value = Boolean.Parse(opt.Text[0]);
}
else if (targetOpt is StringOption)
{
(targetOpt as StringOption).Value = opt.Text[0];
}
else if (targetOpt is IntegerOption)
{
// If Int32.TryParse fails because the string value is null or not in the correct format the (uninitialized) result is zero which is also the default value for options of type integer.
int result;
Int32.TryParse(opt.Text[0], out result);
(targetOpt as IntegerOption).Value = result;
}
else if (targetOpt is EncryptionOption)
{
(targetOpt as EncryptionOption).Value = Workshare.Interop.Options.OptionApi.GetRawString(opt.Name, opt.Text[0], _entropy);
}
else if (targetOpt is EnumOption)
{
EnumOption eo = targetOpt as EnumOption;
int index = Int32.Parse(opt.Text[0]);
eo.Value = eo.GetValue(index);
}
else if (targetOpt is RangeOption)
{
(targetOpt as RangeOption).Value = Int32.Parse(opt.Text[0]);
}
else if (targetOpt is ColorOption)
{
(targetOpt as ColorOption).Value = OptionMapper.GetColor(opt.Text[0]);
}
else
{
Workshare.Interop.Logging.Logger.LogError("Option not loaded from WSO due to unknown type : " + targetOpt.Name + " " + targetOpt.GetType().ToString());
}
if (opt is UIOptionType)
{
targetOpt.Deploy = (opt as UIOptionType).Deploy;
}
}