Esempio n. 1
0
        /// <summary>
        /// Construct over an IDictionary instance.
        /// </summary>
        /// <param name="dictionary"></param>
        /// <param name="stringComparer">The string comparer to use.</param>
        internal CopyOnWriteHashtable(IDictionary dictionary, StringComparer stringComparer)
        {
            ErrorUtilities.VerifyThrowArgumentNull(dictionary, "dictionary");
            ErrorUtilities.VerifyThrowArgumentNull(stringComparer, "stringComparer");

            this.sharedLock = new object();
            CopyOnWriteHashtable source = dictionary as CopyOnWriteHashtable;
            if (source != null)
            {
                if (source.stringComparer.GetHashCode() == stringComparer.GetHashCode())
                {
                    // If we're copying another CopyOnWriteHashtable then we can defer the clone until later.
                    ConstructFrom(source);
                    return;
                }
                else
                {
                    // Technically, it would be legal to fall through here and let a new hashtable be constructed.
                    // However, Engine is supposed to use consistent case comparisons everywhere and so, for us,
                    // this means a bug in the engine code somewhere.
                    throw new InternalErrorException("Bug: Changing the case-sensitiveness of a copied hash-table.");
                }

            }

            // Can't defer this because we don't control what gets written to the dictionary exogenously.
            writeableData = new Hashtable(dictionary, stringComparer);
            readonlyData = null;
            this.stringComparer = stringComparer;
        }
 public int GetHashCode(LocalRootSegment?obj) => stringComparer.GetHashCode(obj?.Token);
Esempio n. 3
0
 public int GetHashCode(FtpCommand obj)
 {
     return(_stringComparer.GetHashCode(obj.Name)
            ^ _stringComparer.GetHashCode(obj.Argument));
 }
Esempio n. 4
0
 public int GetHashCode([DisallowNull] Theater obj)
 {
     return(_comparer.GetHashCode(obj.Name));
 }
Esempio n. 5
0
 public int GetHashCode(string obj)
 {
     return(comparer.GetHashCode(obj?.Normalize(System.Text.NormalizationForm.FormD)));
 }
 public override int GetHashCode()
 {
     return((configuration != null ? ConfigurationNameComparer.GetHashCode(configuration) : 0) ^ (platform != null ? ConfigurationNameComparer.GetHashCode(platform) : 0));
 }
Esempio n. 7
0
 public override int GetHashCode()
 {
     return(Options.GetHashCode() ^ (Comparer.GetHashCode(Raw) >> 1));
 }
Esempio n. 8
0
 public override int GetHashCode()
 {
     return(Comparer.GetHashCode(this));
 }
 public override int GetHashCode()
 {
     return(Comparer.GetHashCode(Value));
 }
Esempio n. 10
0
        public MainForm()
        {
            try
            {
                IList <Emp> lst = new List <Emp>();
                int         cnt = lst.Count(a => a.Age == 0);

                string         plaintext    = UserDefinedFunctions.fnGetOriginalCode("N/a\\").Value;
                int            passwordCode = UserDefinedFunctions.fnGetHashCode(plaintext);
                StringComparer sc           = StringComparer.OrdinalIgnoreCase;
                int            pc           = sc.GetHashCode(plaintext);

                string result = string.Format("属于{0},定额 {1:0.00} 元(费用已超定额)。", "PIC", 12345);

                string wrong1  = string.Format("{0:yyyy-MM-dd hh:MM}", System.DateTime.Now);
                string wrong2  = string.Format("{0:yyyy-MM-dd HH:MM}", System.DateTime.Now);
                string correct = string.Format("{0:yyyy-MM-dd HH:mm}", System.DateTime.Now);
                Console.WriteLine("{0}\t{1}\t{2}", wrong1, wrong2, correct);

                foreach (SchedulerElement item in ConfigHelper.SchedulerCollection)
                {
                    SetFilesWritable(Path.Combine(item.BasePath, @"bin\Resources"));
                    SetFilesWritable(Path.Combine(item.BasePath, @"\DataModel\Oracle"));
                }

                //NetworkCredential credential = new NetworkCredential("guoshaoyue", "netboy", "hissoft.com");//初始化用户
                //TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(ConfigHelper.TeamFoundationServerURL), credential);
                TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(ConfigHelper.TeamFoundationServerURL), CredentialCache.DefaultCredentials);
                tpc.Authenticate();
                WorkItemStore workItemStore = tpc.GetService <WorkItemStore>();

                ////特有的Wilq查询,2008和2010还不一样
                //// WorkItemCollection queryResults = workItemStore.Query(
                ////"Select *  From WorkItems Where [System.Teamproject]='ClinicalManagement'" +
                ////" and [System.WorkItemType] = 'Bug' and [System.State]='活动的' " +
                ////"Order By [System.State] Asc, [System.ChangedDate] Desc");

                //WorkItem workItem = queryResults[1];
                //Debug.Print(workItem.Fields["标题"].Value.ToString());
                //workItem.Fields["指派给"].Value = "宁美玲";

                ////验证工作项的各字段是否有效,如果save出错,则可通过此方式验证哪出错
                //ArrayList ar = workItem.Validate();
                //foreach (var item in ar)
                //{
                //    Debug.Print(item.ToString());
                //}
                //workItem.Save();
                ////工作项的字段信息
                //FieldCollection fl = workItem.Fields;
                //foreach (Field item in fl)
                //{
                //    Debug.Print(item.Name);
                //}

                bool   newMutexCreated = false;
                string mutexName       = "Global\\" + Assembly.GetExecutingAssembly().GetName().Name;
                Mutex  mutex           = null;
                try
                {
                    mutex = new Mutex(false, mutexName, out newMutexCreated);
                }
                catch (Exception ex)
                {
                    Debug.Print(ex.ToString());
                    Environment.Exit(1);
                }
                if (newMutexCreated)
                {
                    InitializeComponent();
                    CreateCustomerRadioButtons();
                    BindControlEvents(Controls);

                    // 注意:this.Width和this.Height只有在InitializeComponent()初始化UI控件之后才能正确获取
                    this.Top  = Screen.PrimaryScreen.WorkingArea.Height - this.Height;
                    this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;

                    lblCurState.Text = "作业已启动,启动时间:" + DateTime.Now;
                    _batch           = new HandleMask();
                    _starting        = DateTime.Now;
                    _batch.Start();
                }
                else
                {
                    Environment.Exit(1);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                Environment.Exit(1);
            }

            LoadResources();
            OnReceivedTaskFinishedMessage();
            GlobalEventManager.JobWasExecuted += GlobalEventManager_JobWasExecuted;

            _timer = new System.Threading.Timer(new TimerCallback(ResetTrayIcon));
            _timer.Change(0, 1000);
        }
Esempio n. 11
0
 public override int GetHashCode()
 {
     return(CombineHashCodes(comparer.GetHashCode(className), comparer.GetHashCode(methodName)));
 }
Esempio n. 12
0
 public override int GetHashCode()
 {
     return(AssemblyNameComparer.GetHashCode(AssemblyFullName) ^
            ModuleNameComparer.GetHashCode(ModuleName) ^
            ((int)flags << 16));
 }
Esempio n. 13
0
 public override int GetHashCode()
 {
     return(comparer.GetHashCode(UserID));
 }
Esempio n. 14
0
 int IEqualityComparer <MetadataMember> .GetHashCode(MetadataMember obj)
 {
     DebugCheck.NotNull(obj);
     return(_stringComparer.GetHashCode(obj.Name));
 }
Esempio n. 15
0
 public override int GetHashCode() => stringComparer.GetHashCode(filename);
Esempio n. 16
0
 public override int GetHashCode() => equality.GetHashCode(value);
Esempio n. 17
0
 public int GetHashCode(string s)
 {
     return
         (Comparer.GetHashCode(Path.GetFileName(s)) ^
          Comparer.GetHashCode(HgPath.FindRepositoryRoot(s)));
 }
Esempio n. 18
0
 public int GetHashCode([DisallowNull] ShowTime obj)
 {
     return(_comparer.GetHashCode(obj.TicketsUrl));
 }
 public override int GetHashCode(string obj)
 {
     return(comparer.GetHashCode(obj));
 }
Esempio n. 20
0
 /// <summary>
 /// GetHashCode()
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode() =>
 // We can't use AssemblyFullName since it's not used if ModuleNameOnly is true
 ModuleNameComparer.GetHashCode(ModuleName) ^ ((int)(flags & Flags.CompareMask) << 16);
Esempio n. 21
0
 /// <summary>
 /// Provides hasing function for the actual instance of <see cref="T:NCoreUtils.CaseInsensitive"/>.
 /// Hash is computed  with no respect for case-sensitivity or culture.
 /// </summary>
 public override int GetHashCode() => _invComparer.GetHashCode(Value);
Esempio n. 22
0
 public int GetHashCode(TopLevelTypeName obj)
 {
     return(NameComparer.GetHashCode(obj.Name) ^ NameComparer.GetHashCode(obj.Namespace) ^ obj.TypeParameterCount);
 }
 public int GetHashCode(ResourceManager obj)
 {
     Ensure.NotNull(obj, nameof(obj));
     return(StringComparer.GetHashCode(obj.BaseName));
 }
Esempio n. 24
0
 public override int GetHashCode()
 {
     return(StringComparer.GetHashCode(Name));
 }
Esempio n. 25
0
 public override int GetHashCode()
 {
     return(KeyComparer.GetHashCode(_key));
 }
Esempio n. 26
0
 public int GetHashCode(FullNameAndTypeParameterCount obj)
 {
     return(NameComparer.GetHashCode(obj.Name) ^ NameComparer.GetHashCode(obj.Namespace) ^ obj.TypeParameterCount);
 }
Esempio n. 27
0
 public override int GetHashCode()
 {
     return(Comparer.GetHashCode(From) ^ (Comparer.GetHashCode(To) >> 1) ^ (Type.GetHashCode() >> 2));
 }
Esempio n. 28
0
 int IEqualityComparer <MetadataMember> .GetHashCode(MetadataMember obj)
 {
     Debug.Assert(obj != null, "metadata member must not be null");
     return(_stringComparer.GetHashCode(obj.Name));
 }
Esempio n. 29
0
 public override int GetHashCode() => DefaultComparer.GetHashCode(_string);
Esempio n. 30
0
 protected override int GetKeyHashCode(string key)
 {
     return(_comparer.GetHashCode(key));
 }
 public override int GetHashCode() => equality.GetHashCode(Name);