本文整理汇总了C#中System.Guid.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.Equals方法的具体用法?C# Guid.Equals怎么用?C# Guid.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Guid
的用法示例。
在下文中一共展示了Guid.Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public void Save(List<WidgetSettings> settings, Guid widgetID, Guid userID)
{
if (widgetID.Equals(BirthdayReminderWidget.WidgetID))
{
var widgetSettings = SettingsManager.Instance.LoadSettingsFor<BirthdayReminderWidgetSettings>(userID);
var data = settings[0].ConvertToNumber();
widgetSettings.DaysBeforeBirthday = data.Value;
SettingsManager.Instance.SaveSettingsFor<BirthdayReminderWidgetSettings>(widgetSettings, userID);
}
else if (widgetID.Equals(ProductActivity.WidgetID))
{
var widgetSettings = SettingsManager.Instance.LoadSettingsFor<ProductActivityWidgetSettings>(userID);
var data = settings[0].ConvertToNumber();
widgetSettings.CountActivities = data.Value;
SettingsManager.Instance.SaveSettingsFor<ProductActivityWidgetSettings>(widgetSettings, userID);
}
else if (widgetID.Equals(NewEmployeeWidget.WidgetID))
{
var widgetSettings = SettingsManager.Instance.LoadSettingsFor<NewEmployeeWidgetSettings>(userID);
var data = settings[0].ConvertToNumber();
widgetSettings.NewWorkerCount = data.Value;
SettingsManager.Instance.SaveSettingsFor<NewEmployeeWidgetSettings>(widgetSettings, userID);
}
}
示例2: GetService
private object GetService( Guid guid )
{
if ( serviceProvider == null )
return null;
// short circuit if possible
if ( guid.Equals( Guid.Empty ) )
return null;
else if ( guid.Equals( typeof( IOleServiceProvider ).GUID ) )
return serviceProvider;
var service = IntPtr.Zero;
var iid = IUnknownInterfaceId;
// query visual studio provider for service
if ( ( serviceProvider.QueryService( ref guid, ref iid, out service ) < 0 ) || ( service == IntPtr.Zero ) )
return null;
try
{
// unwrap unmanaged IUnknown to System.Object
return Marshal.GetObjectForIUnknown( service );
}
finally
{
// always release unmanaged resource
Marshal.Release( service );
}
}
示例3: IsValidGuidScheme
public static bool IsValidGuidScheme(Guid guid)
{
if (!guid.Equals(InstallReferenceGuid.UninstallSubkeyGuid) && !guid.Equals(InstallReferenceGuid.FilePathGuid) && !guid.Equals(InstallReferenceGuid.OpaqueGuid))
return guid.Equals(Guid.Empty);
else
return true;
}
示例4: IsValidInstallGuidScheme
public static bool IsValidInstallGuidScheme(Guid guid)
{
return (guid.Equals(UninstallSubkeyGuid) ||
guid.Equals(FilePathGuid) ||
guid.Equals(OpaqueGuid) ||
guid.Equals(Guid.Empty));
}
示例5: LogCommand
private static void LogCommand(LogCommandSource logCommandSource, Guid pguidCmdGroup, uint nCmdID)
{
#if DEBUG
string commandName = nCmdID.ToString();
string commandType = "unknown";
//if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.CSharpGroup_guid))
//{
//}
//else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.ShellMainMenu_guid))
//{
//}
//else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.SolutionExplorerPivotList_guid))
//{
//}
if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet11_guid))
{
var cmd = (Microsoft.VisualStudio.VSConstants.VSStd11CmdID)nCmdID;
commandName = cmd.ToString();
commandType = cmd.GetType().ToString();
}
else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet12_guid))
{
var cmd = (Microsoft.VisualStudio.VSConstants.VSStd12CmdID)nCmdID;
commandName = cmd.ToString();
commandType = cmd.GetType().ToString();
}
else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet2010_guid))
{
var cmd = (Microsoft.VisualStudio.VSConstants.VSStd2010CmdID)nCmdID;
commandName = cmd.ToString();
commandType = cmd.GetType().ToString();
}
else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet2K_guid))
{
var cmd = (Microsoft.VisualStudio.VSConstants.VSStd2KCmdID)nCmdID;
commandName = cmd.ToString();
commandType = cmd.GetType().ToString();
}
else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet97_guid))
{
var cmd = (Microsoft.VisualStudio.VSConstants.VSStd97CmdID)nCmdID;
commandName = cmd.ToString();
commandType = cmd.GetType().ToString();
}
else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.UIHierarchyWindowCommandSet_guid))
{
var cmd = (Microsoft.VisualStudio.VSConstants.VsUIHierarchyWindowCmdIds)nCmdID;
commandName = cmd.ToString();
commandType = cmd.GetType().ToString();
}
//else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.VsDocOutlinePackageCommandSet_guid))
//{
//}
Trace.WriteLine(String.Format("~~~* {0}: {1}{2}", logCommandSource.ToString(), commandType, commandName));
#endif
}
示例6: CheckPermissions
public bool CheckPermissions(Guid shortcutID, string currentUrl)
{
if (shortcutID.Equals(new Guid("98DB8D88-EDF2-4f82-B3AF-B95E87E3EE5C")) ||
shortcutID.Equals(new Guid("20673DF0-665E-4fc8-9B44-D48B2A783508")))
{
return ASC.Core.SecurityContext.CheckPermissions(new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(
SecurityContext.CurrentAccount.ID)), ASC.Blogs.Core.Constants.Action_AddPost);
}
return false;
}
示例7: CheckPermissions
public static bool CheckPermissions(Guid shortcutID)
{
if (shortcutID.Equals(new Guid("A04A7DBF-6B73-4579-BECE-3F6E346133DB")))
{
return ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null);
}
else if (shortcutID.Equals(new Guid("87A6B7FC-E872-49db-A327-CEA9CBA59CCC")))
{
return ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessTagEditor, null);
}
else if (shortcutID.Equals(new Guid("24CD48B2-C40F-43ec-B3A6-3212C51B8D34")) || shortcutID.Equals(new Guid("84DF7BE7-315B-4ba3-9BE1-1E348F6697A5")))
{
var ispool = shortcutID.Equals(new Guid("84DF7BE7-315B-4ba3-9BE1-1E348F6697A5"));
if (ForumManager.Instance.CurrentPage.Page == ForumPage.TopicList || ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost)
{
var threadID = GetThreadID();
if (threadID != 0)
{
return ValidateCreateTopicOrPoll(ispool, new Thread { ID = threadID });
}
if (ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost)
{
var topicID = GetTopicID();
if (topicID != 0)
{
return ValidateCreateTopicOrPoll(ispool, new Topic { ID = topicID });
}
}
}
else if (ForumManager.Instance.CurrentPage.Page == ForumPage.PostList || ForumManager.Instance.CurrentPage.Page == ForumPage.EditTopic)
{
var topicID = GetTopicID();
if (topicID != 0)
{
return ValidateCreateTopicOrPoll(ispool, new Topic { ID = topicID });
}
}
return ValidateCreateTopicOrPoll(ispool);
}
else if (shortcutID.Equals(new Guid("FA5C4BD5-25E7-41c8-A0DC-64DC2A977391")))
{
if (ForumManager.Instance.CurrentPage.Page == ForumPage.PostList || ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost || ForumManager.Instance.CurrentPage.Page == ForumPage.EditTopic)
{
var topicID = GetTopicID();
if (topicID != 0)
{
return ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.PostCreate, new Topic { ID = topicID });
}
}
}
return false;
}
示例8: PosTest1
public bool PosTest1()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest1: Call Equals with self instance");
try
{
Guid guid = Guid.Empty;
if (!guid.Equals(guid))
{
TestLibrary.TestFramework.LogError("001.1", "Calling Equals with self instance returns false");
retVal = false;
}
// double check
if (!guid.Equals(guid))
{
TestLibrary.TestFramework.LogError("001.2", "Calling Equals with self instance returns false");
retVal = false;
}
byte[] bytes = new byte[c_GUID_BYTE_ARRAY_SIZE];
TestLibrary.Generator.GetBytes(-55, bytes);
guid = new Guid(bytes);
if (!guid.Equals(guid))
{
TestLibrary.TestFramework.LogError("001.3", "Calling Equals with self instance returns false");
TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLES] guid = " + guid);
retVal = false;
}
// double check
if (!guid.Equals(guid))
{
TestLibrary.TestFramework.LogError("001.4", "Calling Equals with self instance returns false");
TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLES] guid = " + guid);
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
示例9: Check
public bool Check(List<WidgetSettings> settings, Guid widgetID, Guid userID, out string errorMessage)
{
errorMessage = "";
//bithdays
if (widgetID.Equals(BirthdayReminderWidget.WidgetID))
{
if (settings == null || settings.Count != 1)
return false;
var data = settings[0].ConvertToNumber();
if (data.Value > 0 && data.Value <= 30)
return true;
errorMessage = Resources.Resource.ErrorNotCorrectDaysBeforeBirthdaySettings;
return false;
}
//user activity
else if (widgetID.Equals(ProductActivity.WidgetID))
{
if (settings == null || settings.Count != 1)
return false;
var data = settings[0].ConvertToNumber();
if (data.Value > 0 && data.Value <= 30)
return true;
errorMessage = Resources.Resource.ErrorNotCorrectCountActivities;
return false;
}
//new employees
else if (widgetID.Equals(NewEmployeeWidget.WidgetID))
{
if (settings == null || settings.Count != 1)
return false;
var data = settings[0].ConvertToNumber();
if (data.Value > 0 && data.Value <= 20)
return true;
errorMessage = Resources.Resource.ErrorNotCorrectNewWorkerCountSettings;
return false;
}
return false;
}
示例10: BindDictionaryBranch
protected void BindDictionaryBranch(JsonTreeNode branch, Guid parentDict)
{
using (DictionaryProvider provider = new DictionaryProvider())
{
List<DictionaryTree> dicts = provider.GetDictionaryTreeList(parentDict, this.Roles);
foreach (DictionaryTree dict in dicts)
{
JsonTreeNode tempNode = new JsonTreeNode(dict.Name);
branch.children.Add(tempNode);
BindDictionaryBranch(tempNode, dict.ID);
}
if (!parentDict.Equals(Guid.Empty))
{
DictionaryTree entity = provider.DictionaryTrees.SingleOrDefault(d => d.ID == parentDict);
List<DictionaryProperty> source = provider.GetAvailableDictionaryProperties(this.Roles, entity.DictionaryID);
foreach (DictionaryProperty prop in source)
{
JsonTreeNode tempNode = new JsonTreeNode(prop.Name);
tempNode.uid = String.Format("{0}_{1}", prop.Dictionary.TableName, prop.ColumnName);
tempNode.leaf = true;
branch.children.Add(tempNode);
}
}
}
}
示例11: Exec
public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
{
if (pguidCmdGroup.Equals(Constants.guidStandardCommandSet2K) && nCmdID == (uint)VSConstants.VSStd2KCmdID.INCLUDEINPROJECT)
return IncludeItem();
return VSConstants.S_OK;
}
示例12: UploadFile
public JObject UploadFile(Guid documentId, string filename, string revision, string changeReason, DocumentCheckInState checkInState, List<KeyValuePair<string, string>> indexFields, byte[] file)
{
if (documentId.Equals(Guid.Empty))
{
throw new ArgumentException("DocumentId is required but was an empty Guid", "documentId");
}
if (string.IsNullOrWhiteSpace(filename))
{
throw new ArgumentException("filename is required but was empty", "filename");
}
var jobject = new JObject();
foreach (var indexField in indexFields)
{
jobject.Add(new JProperty(indexField.Key, indexField.Value));
}
var jobjectString = JsonConvert.SerializeObject(jobject);
var postData = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("documentId", documentId.ToString()),
new KeyValuePair<string, string>("filename", filename),
new KeyValuePair<string, string>("revision", revision),
new KeyValuePair<string, string>("changeReason", changeReason),
new KeyValuePair<string, string>("checkInDocumentState", checkInState.ToString()),
new KeyValuePair<string, string>("indexFields", jobjectString)
};
return HttpHelper.PostMultiPart(GlobalConfiguration.Routes.Files, "", GetUrlParts(), this.ApiTokens, postData, filename, file);
}
示例13: Delete
public void Delete(Guid id)
{
if (id.Equals(Guid.Empty))
throw new ArgumentException("Employee id cannot be empty!");
try
{
using (OpenPOSDbEntities ctx = new OpenPOSDbEntities())
{
var entity = GetEmployeeById(id);
if (entity != null)
{
ctx.Employees.Attach(entity);
ctx.Employees.DeleteObject(entity);
ctx.SaveChanges();
}
}
}
catch (Exception ex)
{
LogService.Error("Error while deleting Employee", ex);
throw ex;
}
}
示例14: CreateDocument
/// <summary>
/// create a new document
/// </summary>
/// <param name="folderId"></param>
/// <param name="name"></param>
/// <param name="description"></param>
/// <param name="revision"></param>
/// <param name="documentState"></param>
/// <returns></returns>
public Document CreateDocument(Guid folderId, string name, string description, string revision, DocumentState documentState)
{
if (folderId.Equals(Guid.Empty))
{
throw new ArgumentException("FolderId is required but was an empty Guid", "folderId");
}
dynamic postData = new ExpandoObject();
postData.folderId = folderId;
if (!String.IsNullOrWhiteSpace(name))
{
postData.Name = name;
}
if (!String.IsNullOrWhiteSpace(description))
{
postData.Description = description;
}
if (!String.IsNullOrWhiteSpace(revision))
{
postData.Revision = revision;
}
postData.documentState = documentState;
return HttpHelper.Post<Document>(GlobalConfiguration.Routes.Documents, string.Empty, GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData);
}
示例15: FindNode
public Node FindNode(Guid guid)
{
foreach (Node node in Nodes)
if (guid.Equals(node.Id))
return node;
return null;
}