Exemplo n.º 1
0
		private static void EnsureFactories()
		{
			if(g_lFacs != null) return;

			TsrFactory fKP = new KeePassTsrFactory();
			TsrFactory f81 = new Win81TsrFactory();
			TsrFactory f10 = new Win10TsrFactory();
			TsrFactory fP = new ProExtTsrFactory();

			TsrFactory fS;
			try { fS = new SystemTsrFactory(); }
			catch(Exception) { Debug.Assert(false); fS = fP; }

			// https://sourceforge.net/p/keepass/discussion/329220/thread/fab85f1d/
			// http://keepass.info/help/kb/tsrstyles_survey.html
			TsrFactory[] vPref;
			if(WinUtil.IsAtLeastWindows10)
				vPref = new TsrFactory[] { f10, f81, fKP, fP, fS };
			else if(WinUtil.IsAtLeastWindows8)
				vPref = new TsrFactory[] { f81, f10, fKP, fP, fS };
			else if(NativeLib.IsUnix())
				vPref = new TsrFactory[] { f81, f10, fKP, fP, fS };
			else // Older Windows systems
				vPref = new TsrFactory[] { fKP, f10, f81, fP, fS };

			List<TsrFactory> l = new List<TsrFactory>(vPref);

#if DEBUG
			for(int i = 0; i < l.Count; ++i)
			{
				TsrFactory f1 = l[i];
				if(f1 == null) { Debug.Assert(false); continue; }
				if(f1.Uuid == null) { Debug.Assert(false); continue; }

				for(int j = i + 1; j < l.Count; ++j)
				{
					TsrFactory f2 = l[j];
					if(f2 == null) { Debug.Assert(false); continue; }
					if(f2.Uuid == null) { Debug.Assert(false); continue; }

					Debug.Assert(!f1.Uuid.Equals(f2.Uuid));
				}
			}
#endif

			g_lFacs = l;
			g_nStdFac = l.Count;
		}
Exemplo n.º 2
0
        private static void EnsureFactories()
        {
            if (g_lFacs != null)
            {
                return;
            }

            TsrFactory fKP = new KeePassTsrFactory();
            TsrFactory f81 = new Win81TsrFactory();
            TsrFactory f10 = new Win10TsrFactory();
            TsrFactory fP  = new ProExtTsrFactory();

            TsrFactory fS;

            try { fS = new SystemTsrFactory(); }
            catch (Exception) { Debug.Assert(false); fS = fP; }

            // https://sourceforge.net/p/keepass/discussion/329220/thread/fab85f1d/
            // https://keepass.info/help/kb/tsrstyles_survey.html
            TsrFactory[] vPref;
            if (WinUtil.IsAtLeastWindows10)
            {
                vPref = new TsrFactory[] { f10, f81, fKP, fP, fS }
            }
            ;
            else if (WinUtil.IsAtLeastWindows8)
            {
                vPref = new TsrFactory[] { f81, f10, fKP, fP, fS }
            }
            ;
            else if (NativeLib.IsUnix())
            {
                vPref = new TsrFactory[] { f81, f10, fKP, fP, fS }
            }
            ;
            else             // Older Windows systems
            {
                vPref = new TsrFactory[] { fKP, f10, f81, fP, fS }
            };

            List <TsrFactory> l = new List <TsrFactory>(vPref);

#if DEBUG
            for (int i = 0; i < l.Count; ++i)
            {
                TsrFactory f1 = l[i];
                if (f1 == null)
                {
                    Debug.Assert(false); continue;
                }
                if (f1.Uuid == null)
                {
                    Debug.Assert(false); continue;
                }

                for (int j = i + 1; j < l.Count; ++j)
                {
                    TsrFactory f2 = l[j];
                    if (f2 == null)
                    {
                        Debug.Assert(false); continue;
                    }
                    if (f2.Uuid == null)
                    {
                        Debug.Assert(false); continue;
                    }

                    Debug.Assert(!f1.Uuid.Equals(f2.Uuid));
                }
            }
#endif

            g_lFacs   = l;
            g_nStdFac = l.Count;
        }