コード例 #1
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    static public int CompareDescending(UIListItemData a, UIListItemData b)
    {
        object A = (a != null) ? a.userDatas : null;

        object B = (b != null) ? b.userDatas : null;

        if ((A == null) && (B == null))
        {
            return(0);
        }

        if ((A == null) || (B == null))
        {
            return((A != null) ? -1 : 1);
        }

        if ((A is Site) ^ (B is Site))
        {
            return((A is Site) ? -1 : 1);
        }


        Localizable LocA = A as Localizable;

        Localizable LocB = B as Localizable;

        return(LocB.name.CompareTo(LocA.name));
    }
コード例 #2
0
ファイル: DBObjects.cs プロジェクト: lickey10/u_CrimeMapper
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void OnLocalizableDBDeleted(HTTPReq req, params object[] paramsList)
    {
        Localizable localizable = CORE.Params.Get <Localizable>(0, paramsList);

        if (localizable != null)
        {
            if ((req == null) || (req.result == QUERY_RESULT.SUCCESS))
            {
                if (localizable is Site)
                {
                    sites.Remove(localizable);
                }

                else if (localizable is Item)
                {
                    items.Remove(localizable);
                }

                localizable.id = -1L;

                localizable.SetParent(null);

                m_listeners.Notify(EVT.EVT_OBJECT_DELETED, localizable);
            }
        }
    }
コード例 #3
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void BackupUIContext()
    {
        if (m_items == null)
        {
            return;
        }

        m_context.selection = (m_items.selection != null) ? (m_items.selection as Localizable).id : -1L;

        Localizable root = DBObjects.instance.root;

        if (root != null)
        {
            List <Localizable> scope = new List <Localizable>(root.m_childs);

            for (int index = 0; index < scope.Count; ++index)
            {
                scope.AddRange(scope[index].m_childs);

                if ((scope[index].m_ListItemDatas != null) && (scope[index].m_ListItemDatas.expanded))
                {
                    m_context.expandeds.Add(scope[index].id);
                }
            }
        }
    }
コード例 #4
0
ファイル: DBObjects.cs プロジェクト: lickey10/u_CrimeMapper
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void OnLocalizableDBInserted(HTTPReq req, params object[] paramsList)
    {
        Localizable localizable = CORE.Params.Get <Localizable>(0, paramsList);

        if (localizable != null)
        {
            if (req.result == QUERY_RESULT.SUCCESS)
            {
                if (localizable is Site)
                {
                    sites.Add(localizable);
                }

                else if (localizable is Item)
                {
                    items.Add(localizable);
                }

                m_listeners.Notify(EVT.EVT_OBJECT_CREATED, localizable);
            }
            else
            {
                OnLocalizableDBDeleted(null, localizable);
            }
        }
    }
コード例 #5
0
 static private void Register(Localizable localizable)
 {
     if (localizable != null)
     {
         m_instances.Add(localizable.m_id, localizable);
     }
 }
コード例 #6
0
ファイル: ExceptionContext.cs プロジェクト: 15831944/Essence
        /// <summary>
        /// Deserialize <seealso cref="#msgPatterns"/> and <seealso cref="#msgArguments"/>.
        /// </summary>
        /// <param name="in"> Stream. </param>
        /// <exception cref="IOException"> This should never happen. </exception>
        /// <exception cref="ClassNotFoundException"> This should never happen. </exception>
        private void DeSerializeMessages(ObjectInputStream @in)
        {
            // Step 1.
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int len = in.readInt();
            int len = @in.readInt();

            msgPatterns  = new List <Localizable>(len);
            msgArguments = new List <object[]>(len);
            // Step 2.
            for (int i = 0; i < len; i++)
            {
                // Step 3.
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Localizable pat = (Localizable) in.readObject();
                Localizable pat = (Localizable)@in.readObject();
                msgPatterns.Add(pat);
                // Step 4.
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int aLen = in.readInt();
                int aLen = @in.readInt();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Object[] args = new Object[aLen];
                object[] args = new object[aLen];
                for (int j = 0; j < aLen; j++)
                {
                    // Step 5.
                    args[j] = @in.readObject();
                }
                msgArguments.Add(args);
            }
        }
コード例 #7
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void SetParent(long paramID)
    {
        if (paramID == m_id)
        {
            return;
        }

        if (paramID == m_parentID)
        {
            return;
        }


        Localizable parent = Get(paramID);

        if ((parent != null) && (parent.AcceptChild(this)))
        {
            if (m_parent != null)
            {
                m_parent.RemoveChild(this);
            }

            parent.AddChild(this);
        }
    }
コード例 #8
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void AddChild(Localizable child)
    {
        if (child == null)
        {
            return;
        }

        if (child == this)
        {
            return;
        }

        if (child.m_parent != null)
        {
            return;
        }

        m_childs.Add(child);

        child.m_parent = this;

        child.m_parentID = m_id;

        m_ListItemDatas.AddChild(child.m_ListItemDatas);
    }
コード例 #9
0
ファイル: Component.cs プロジェクト: S17L/iGP11
        public Component(
            TObject @object,
            Localizable name,
            IPropertyConfiguration configuration,
            IValidationContext validationContext,
            IEnumerable <IValidator <TObject> > validators,
            IEnumerable <IProperty> properties)
        {
            Object        = @object;
            Name          = name;
            Configuration = configuration;

            _validationContext = validationContext;
            _validators        = validators;
            _properties        = properties?.ToArray() ?? new IProperty[0];
            _properties        = _properties.Where(property => property.Configuration.GroupedBy == null)
                                 .OrderBy(property => property.Configuration.Order)
                                 .ThenBy(property => property.Name)
                                 .Union(_properties.Where(property => property.Configuration.GroupedBy != null)
                                        .OrderBy(property => property.Configuration.GroupedBy.Key)
                                        .GroupBy(property => property.Configuration.GroupedBy.Key)
                                        .SelectMany(group => group.OrderBy(property => property.Configuration.Order)
                                                    .ThenBy(property => property.Name)))
                                 .ToArray();

            _allProperties = GetProperties();
        }
コード例 #10
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void GoToSelection()
    {
        if ((DBObjects.instance != null) && (DBObjects.instance.busy))
        {
            return;
        }

        if (HUDSites.Instance != null)
        {
            object selection = HUDSites.Instance.items.selection;

            Localizable localizable = ((selection != null) && (selection is Localizable)) ? selection as Localizable : null;

            NavigationModeMap navModeMap = m_navModes[1] as NavigationModeMap;

            if ((localizable != null) && (navModeMap != null))
            {
                ScrFade.Begin(FADE_TYPE.FADE_OUT, 0.0f);

                TeleportTo(localizable.m_coord.latitude.deg, localizable.m_coord.longitude.deg, localizable.m_coord.altitude);

                navModeMap.MoveTo(localizable.m_coord.latitude.deg, localizable.m_coord.longitude.deg);

                SelectNavigationMode(NAVIGATION_MODE.MAP);
            }
        }
    }
コード例 #11
0
 static private void Unregister(Localizable localizable)
 {
     if (localizable != null)
     {
         m_instances.Remove(localizable.m_id);
     }
 }
コード例 #12
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public override bool AcceptDrop(IDragDrop drop)
    {
        if (drop is WebMapObjectBase)
        {
            WebMapObjectBase mapObject = drop as WebMapObjectBase;

            Localizable localizable = CreateMapObjectLocalizable((drop is WebMapFlag) ? OBJECT_TYPE.FLAG : OBJECT_TYPE.PIN);

            if (localizable != null)
            {
                localizable.m_coord.latitude = GetLatitudeFrom3DCoord(mapObject.transform.position);

                localizable.m_coord.longitude = GetLongitudeFrom3DCoord(mapObject.transform.position);

                localizable.m_coord.altitude = 0.0f;

                localizable.DBPush();
            }

            DeleteMapObject(mapObject);

            return(true);
        }

        return(false);
    }
コード例 #13
0
 /// <summary>
 /// Construct the exception with a specific context.
 /// </summary>
 /// <param name="specific"> Contextual information on what caused the exception. </param>
 /// <param name="lo"> Lower end of the interval. </param>
 /// <param name="hi"> Higher end of the interval. </param>
 /// <param name="fLo"> Value at lower end of the interval. </param>
 /// <param name="fHi"> Value at higher end of the interval. </param>
 /// <param name="args"> Additional arguments. </param>
 public NoBracketingException(Localizable specific, double lo, double hi, double fLo, double fHi, params object[] args) : base(specific, Convert.ToDouble(lo), Convert.ToDouble(hi), Convert.ToDouble(fLo), Convert.ToDouble(fHi), args)
 {
     this.lo  = lo;
     this.hi  = hi;
     this.fLo = fLo;
     this.fHi = fHi;
 }
コード例 #14
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public bool Show(OnButon onButon, Localizable target)
    {
        if ((gameObject.activeSelf == false) && (target != null))
        {
            m_onButon = onButon;

            BuildSitesList(target);

            ReflectTarget(target);


            m_fade.Begin(FADE_TYPE.FADE_IN, FADE_IN_DURATION, OnFadeFinished);

            Update();


            gameObject.SetActive(true);

            EnableButons(0);

            return(true);
        }

        return(false);
    }
コード例 #15
0
ファイル: ExceptionContext.cs プロジェクト: 15831944/Essence
        /// <summary>
        /// Builds a message string.
        /// </summary>
        /// <param name="locale"> Locale in which the message should be translated. </param>
        /// <param name="separator"> Message separator. </param>
        /// <returns> a localized message string. </returns>
        private string BuildMessage(Locale locale, string separator)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final StringBuilder sb = new StringBuilder();
            StringBuilder sb    = new StringBuilder();
            int           count = 0;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int len = msgPatterns.size();
            int len = msgPatterns.Count;

            for (int i = 0; i < len; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Localizable pat = msgPatterns.get(i);
                Localizable pat = msgPatterns[i];
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Object[] args = msgArguments.get(i);
                object[] args = msgArguments[i];
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.text.MessageFormat fmt = new java.text.MessageFormat(pat.getLocalizedString(locale), locale);
                MessageFormat fmt = new MessageFormat(pat.GetLocalizedString(locale), locale);
                sb.Append(fmt.format(args));
                if (++count < len)
                {
                    // Add a separator if there are other messages.
                    sb.Append(separator);
                }
            }

            return(sb.ToString());
        }
コード例 #16
0
        private static List <Localizable> GetLocalizables(string cfgPath)
        {
            List <Localizable> ret    = new();
            List <string>      region = new();

            string[] lines = File.ReadAllLines(cfgPath);

            foreach (string line in lines)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                region.Add(line);

                if (!line.StartsWith(";"))
                {
                    continue;
                }

                ret.Add(Localizable.Parse(region));
                region.Clear();
            }

            return(ret);
        }
コード例 #17
0
 /// <summary>
 /// Checks that an object is not null.
 /// </summary>
 /// <param name="o">Object to be checked.</param>
 /// <param name="pattern">Message pattern.</param>
 /// <param name="args">Arguments to replace the placeholders in <c>pattern</c>.</param>
 /// <exception cref="NullArgumentException">if <c>o</c> is <c>null</c>.</exception>
 public static void checkNotNull(Object o, Localizable pattern, params Object[] args)
 {
     if (o == null)
     {
         throw new NullArgumentException(pattern, args);
     }
 }
コード例 #18
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void RemoveChild(Localizable child)
    {
        if (child == null)
        {
            return;
        }

        if (child == this)
        {
            return;
        }

        if (child.m_parent != this)
        {
            return;
        }

        m_childs.Remove(child);

        child.m_parent = null;

        child.m_parentID = -1L;

        m_ListItemDatas.RemoveChild(child.m_ListItemDatas);
    }
コード例 #19
0
 /// <summary>
 /// Construct the exception with a specific context.
 /// </summary>
 /// <param name="specific">Contextual information on what caused the exception.</param>
 /// <param name="lo">Lower end of the interval.</param>
 /// <param name="hi">Higher end of the interval.</param>
 /// <param name="fLo">Value at lower end of the interval.</param>
 /// <param name="fHi">Value at higher end of the interval.</param>
 /// <param name="args">Additional arguments.</param>
 public NoBracketingException(Localizable specific, double lo, double hi, double fLo, double fHi, params Object[] args)
     : base(specific, lo, hi, fLo, fHi, args)
 {
     this.lo  = lo;
     this.hi  = hi;
     this.fLo = fLo;
     this.fHi = fHi;
 }
コード例 #20
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    static public Localizable Get(long id)
    {
        Localizable instance = null;

        m_instances.TryGetValue(id, out instance);

        return(instance);
    }
コード例 #21
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void CollapseAll()
    {
        Localizable root = DBObjects.instance.root;

        if (root != null)
        {
            root.m_ListItemDatas.Expand(false, UIListItemData.RECURSE.YES);
        }
    }
コード例 #22
0
        public void LikeWithMatchMode()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            var c = Localizable.Like("Description", "pi__a", MatchMode.Anywhere);

            c.Should().Be.OfType <LikeExpression>()
            .And.ValueOf.ToString()
            .Should().Be.EqualTo("Description like %~en-US~~%pi__a%~%");
        }
コード例 #23
0
 public IEnumerable <Localizable> Validate(IComponentContext <float> context, IValidationContext validationContext, float value)
 {
     if ((value < _min) || (value > _max))
     {
         yield return(new Localizable(
                          "ValueOutsideRange",
                          Localizable.NotLocalizable(_min),
                          Localizable.NotLocalizable(_max)));
     }
 }
コード例 #24
0
        /// <summary>
        /// Add two long integers, checking for overflow.
        /// </summary>
        /// <param name="a">Addend.</param>
        /// <param name="b">Addend.</param>
        /// <param name="pattern">Pattern to use for any thrown exception.</param>
        /// <returns>the sum <c>a + b</c>.</returns>
        /// <exception cref="MathArithmeticException"> if the result cannot be represented
        /// as a <c>long</c>.</exception>
        private static long addAndCheck(long a, long b, Localizable pattern)
        {
            long result = a + b;

            if (!((a ^ b) < 0 | (a ^ result) >= 0))
            {
                throw new MathArithmeticException(pattern, a, b);
            }
            return(result);
        }
コード例 #25
0
ファイル: XliffParser.cs プロジェクト: mteece/I18N
        /// <summary>
        /// Reads an XLIFF file as input and generates a properties file for
        /// the language contained in the input file. If the input target
        /// language is zh-CN, the output file will be named
        /// ApplicationResources_zh-CN.properties. The output file is generated
        /// in the same directory as the input file
        /// </summary>
        /// <param name="args">Arguments are '--help', and '--xliff=' as the fully qualified input filename like C:\Test\XliffParser\TestXliff.xml</param>
        static void Main(string[] args)
        {
            try
            {
                // Command line parsing routine.
                Argument commandLine = new Argument(args);

                if (!String.IsNullOrEmpty(commandLine["help"]) || args.Length == 0)
                {
                    Help();
                }
                else
                {
                    if (!String.IsNullOrEmpty(commandLine["xliff"]))
                    {
                        XDocument doc = XDocument.Load(commandLine["xliff"]);
                        //NEED TO GET THE LANGUAGE FOR THE OUTPUT FILE NAME
                        string nameSpace = doc.Root.GetDefaultNamespace().NamespaceName;
                        XName  xfile     = XName.Get(NODE_FILE, nameSpace);
                        string language  = doc.Descendants(xfile).FirstOrDefault().Attribute("target-language").Value.ToString();

                        XName xname   = XName.Get(NODE_TRANS_UNIT, nameSpace);
                        XName xtarget = XName.Get(NODE_TARGET, nameSpace);

                        string outputPath = args[0].Substring(0, args[0].LastIndexOf("\\") + 1);

                        Resource    res = new Resource();
                        Property    pro = new Property();
                        Localizable loc = new Localizable();

                        // Write the resource file.
                        if (res.Write(ref doc, outputPath, language, ref FILENAME_PREFIX, ref ATTRIBUTE_ID, ref xname, ref xtarget))
                        {
                            Console.WriteLine("[INFO]	Generated {0} resource file", language);
                        }

                        // Write the properties file.
                        if (pro.Write(ref doc, outputPath, language, ref FILENAME_PREFIX, ref ATTRIBUTE_ID, ref xname, ref xtarget))
                        {
                            Console.WriteLine("[INFO]	Generated {0} properties file", language);
                        }

                        // Write the Localizable.strings file.
                        if (loc.Write(ref doc, outputPath, language, ref FILENAME_PREFIX, ref ATTRIBUTE_ID, ref xname, ref xtarget))
                        {
                            Console.WriteLine("[INFO]	Generated {0} strings file", language);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #26
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void UpdateMapObjectPosition(Vector2 bounds, WebMapObjectBase mapObject)
    {
        Localizable loc = (mapObject != null) ? mapObject.localizable : null;

        if (loc != null)
        {
            Vector3 pos = GetRelativePositionFromGeoCoords(bounds, loc.m_coord.longitude.deg, loc.m_coord.latitude.deg);

            mapObject.transform.position = new Vector3(pos.x, 0.0f, pos.z);
        }
    }
コード例 #27
0
ファイル: LocalizationExtensions.cs プロジェクト: S17L/iGP11
        public static string Localize(this Localizable localizable)
        {
            if (localizable == null)
            {
                return(string.Empty);
            }

            return(localizable.LocalizeEnabled
                       ? string.Format(Localization.Current.Get(localizable.Key), LocalizeArguments(localizable.Arguments).ToArray())
                       : string.Format(localizable.Key, LocalizeArguments(localizable.Arguments)));
        }
コード例 #28
0
ファイル: DBObjects.cs プロジェクト: lickey10/u_CrimeMapper
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void CreateRoot()
    {
        if (root == null)
        {
            root = new Localizable();

            root.name = "ROOT";

            root.id = 0L;
        }
    }
コード例 #29
0
		/* === MANAGING LOCALIZABLE OBSERVERS === */
		
		/// <summary> Register a Localizable to receive updates when the locale is changed. If the Localizable is already
		/// registered, nothing happens. If a locale is currently set, the new Localizable will receive an
		/// immediate 'locale changed' event.
		/// 
		/// </summary>
		/// <param name="l">Localizable to register.
		/// </param>
		public virtual void  registerLocalizable(Localizable l)
		{
			if (!observers.Contains(l))
			{
				observers.Add(l);
				if (currentLocale != null)
				{
					l.localeChanged(currentLocale, this);
				}
			}
		}
コード例 #30
0
 public void SafeParameterSetWithCriteria()
 {
     FillDb();
     using (ISession s = OpenSession())
     {
         s.CreateCriteria <EntityWithLocalizableProperty>()
         .Add(Localizable.Like("LocalizableDescriptions", "en-US", "H_ll_"))
         .List <EntityWithLocalizableProperty>().Count
         .Should().Be.EqualTo(1);
     }
     Cleanup();
 }