本文整理汇总了C#中IConnectionInfo.Decrypt方法的典型用法代码示例。如果您正苦于以下问题:C# IConnectionInfo.Decrypt方法的具体用法?C# IConnectionInfo.Decrypt怎么用?C# IConnectionInfo.Decrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConnectionInfo
的用法示例。
在下文中一共展示了IConnectionInfo.Decrypt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DallasCxForm
public DallasCxForm(IConnectionInfo cxInfo)
{
this._cxInfo = cxInfo;
this.InitializeComponent();
this.cboServer.Text = this._cxInfo.DatabaseInfo.Server ?? "";
this.txtDisplayName.Text = this._cxInfo.DisplayName;
this.txtKey.Text = this._cxInfo.Decrypt((string) this._cxInfo.DriverData.Element("AccountKey"));
if (this.txtKey.Text.Length == 0)
{
Repository repository = Repository.FromDisk().LastOrDefault<Repository>(r => r.DriverLoader.InternalID == "DallasAuto");
if (repository != null)
{
string str = (string) repository.DriverData.Element("AccountKey");
if (!string.IsNullOrEmpty(str))
{
this._lastKey = cxInfo.Decrypt(str);
}
}
}
this.llCopyLast.Enabled = !string.IsNullOrEmpty(this._lastKey);
string[] names = MRU.DallasUriNames.GetNames();
if (this.cboServer.Text.Length == 0)
{
this.cboServer.Text = (names.Length == 0) ? "https://" : names[0];
this.chkRemember.Checked = true;
}
this.cboServer.Items.AddRange(names);
this.chkRemember.Checked = this._cxInfo.Persist;
try
{
this.lblWarning.Font = new Font(this.Font, FontStyle.Bold);
}
catch
{
}
this.panWarning.Dispose();
this.EnableControls();
}
示例2: InitializeContext
internal static void InitializeContext(IConnectionInfo r, object context, bool dallas)
{
DataServiceContext context2 = (DataServiceContext) context;
context2.ResolveType = name => Type.GetType("LINQPad.User." + name.Split(new char[] { '.' }).Last<string>());
if (dallas)
{
string str = (string) r.DriverData.Element("AccountKey");
if (!string.IsNullOrEmpty(str))
{
str = r.Decrypt(str);
}
if (!string.IsNullOrEmpty(str))
{
context2.Credentials = new NetworkCredential("accountkey", str);
}
}
else if (r.DatabaseInfo.UserName.Length > 0)
{
context2.Credentials = new NetworkCredential(r.DatabaseInfo.UserName, r.DatabaseInfo.Password);
}
else
{
context2.Credentials = CredentialCache.DefaultNetworkCredentials;
}
context2.SendingRequest += delegate (object sender, SendingRequestEventArgs e) {
WebProxy webProxy = Util.GetWebProxy();
if (webProxy != null)
{
e.Request.Proxy = webProxy;
}
DataContextBase.SqlLog.WriteLine(e.Request.RequestUri);
};
}
示例3: Load
public static RavenConnectionDialogViewModel Load(IConnectionInfo cxInfo)
{
var xe = cxInfo.DriverData.Element(RavenConnectionInfoKey);
if (xe == null) return null;
var json = xe.Value;
var rvnConn = JsonConvert.DeserializeObject<RavenConnectionDialogViewModel>(json);
rvnConn.CxInfo = cxInfo;
if (!string.IsNullOrWhiteSpace(rvnConn.Password))
rvnConn.Password = cxInfo.Decrypt(rvnConn.Password);
return rvnConn;
}