Example #1
0
    /// <summary>
    /// This function allow us to open a XML file stored on the computer, in the GAMENAME_Data folder created by the unity build.
    /// </summary>
    public void OpenLocalXML(string language)
    {
        //We're opening a file, so we reset all the states of this script
        langReader      = null;
        currentLanguage = null;

        //Switch for the "Language" (as parameter), foreach language present in the game we have a different name file, but the location of those is the same.
        //Despite from the Web opening, here we instantiate the LanguageReader instantaniely, because the file must be not loaded from the web cause we've got it on the hard-disk.
        switch (language)
        {
        case "English":
            langReader = new LanguageReader(Resources.Load("Lang/ENG") as TextAsset, "English");
            break;

        case "Finnish":
            langReader = new LanguageReader(Resources.Load("Lang/FIN") as TextAsset, "Finnish");
            break;

        default:
#if UNITY_EDITOR
            Debug.LogWarning("This language doesn't exist: " + language);
#endif
            langReader = new LanguageReader(Resources.Load("Lang/FIN") as TextAsset, "Finnish");
            break;
        }

        currentLanguage = language;
        if (OnLanguageChange != null)
        {
            OnLanguageChange();
        }
    }
        public void Test()
        {
            var data = new LanguageData(new LanguageType("tr", "test"))
            {
                OrthographyXml   = Resources.orthography,
                MorphotacticsXml = Resources.morphotactics,
                RootTxt          = Resources.root,
                SuffixTxt        = Resources.suffix
            };

            var reader = new LanguageReader("");
            var lang   = reader.Parse(data);

            var solutions = lang.Analyze("kitaplarım");

            Assert.AreEqual(1, solutions.Count);

            var analysis = "kitap/ISIM IC_COGUL_lAr IC_SAHIPLIK_BEN_(U)m";

            var surface = lang.GetWord(analysis).GetSurface();

            Assert.AreEqual("kitaplarım", surface);

            Assert.AreEqual(analysis, solutions.First().ToString());
        }
        public EmployeeProperty(string name, bool isSelected)
        {
            Name       = LanguageReader.GetValue(name);
            IsSelected = isSelected;

            WhereClause = _propertyClause.ContainsKey(name) ? _propertyClause[name] : (o, text) => true;
        }
Example #4
0
 protected override void Awake()
 {
     base.isDontDestroy = true;
     base.Awake();
     //Initialize and set a default language
     langReader = new LanguageReader(Path.Combine(Application.dataPath, langFilePath), lang.Value, false);
 }
Example #5
0
 protected void ValidateTermGapHasMatched()
 {
     if (!TermGapHasMatched)
     {
         Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_TermGapHasMatched"));
     }
 }
        public AssignmentBatchAlterModel(DateTime watchPoint, ITimeBoxRepository timeBoxRepository,
                                         ITermStyleRepository termStyleRepository)
            : base(watchPoint, timeBoxRepository, termStyleRepository)
        {
            _title   = LanguageReader.GetValue("BatchAlterExistsOfAssignemnt");
            _filters = new ICustomFilter[]
            {
                new CustomFilter("EqAssignmentType", this, (t) =>
                {
                    return(t.Start.Date == SearchDate.Date && t.Text.Equals(QueryType.Text));
                }),

                new CustomFilter("EqTermStart", this, (t) =>
                {
                    return(t.Start == SearchDate);
                }),

                new CustomFilter("EqTermEnd", this, (t) =>
                {
                    return(t.End == SearchDate);
                }),

                new CustomFilter("Any", this, (t) =>
                {
                    return(t.Start.Date == SearchDate.Date);
                })
            };
        }
Example #7
0
        public bool Ask(RoutedEventArgs e, IQuestionPresenter p)
        {
            var source        = new Luna.Core.Reflector(e.OriginalSource);
            var newPlacement  = source.Property <ITerm>("DropedPlacement");
            var agent         = (IAgent)BindableAgents[source.Property <int>("PointOutDataRowIndex")];
            var pointOutBlock = source.Property <ITerm>("PointOutBlock");

            var newStart = newPlacement.Start;
            var newEnd   = newPlacement.End;

            if (pointOutBlock.Start == newStart && pointOutBlock.End == newEnd)
            {
                return(false);
            }

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShift");
            p.Editable    = true;

            pointOutBlock.SaftyInvoke <Term>(x =>
            {
                p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShiftText"),
                                       agent.Profile.Name, x.Start, x.Text);
                p.Comments = x.Tag;
            });
            return(true);
        }
Example #8
0
        public void Execute(IRoutedMessage message, IInteractionNode handlingNode, MessageProcessingOutcome outcome)
        {
            var content = LanguageKey.IsNullOrEmpty() ? Message : LanguageReader.GetValue(LanguageKey);

            ServiceLocator.Current.GetInstance <IAuditLogModel>().Write(new AuditLog {
                Action = content, CurrentUser = ApplicationCache.Get <string>(Global.LoggerId)
            });
        }
Example #9
0
        //private static void LoadDefaultTrayIcon()
        //{
        //    var bi = new BitmapImage();
        //    bi.BeginInit();
        //    bi.UriSource = new Uri(@"pack://application:,,,/Resources/Images/WMSLogo.ico", UriKind.RelativeOrAbsolute);
        //    bi.EndInit();
        //    App.Current.TrayIcon.Icon = bi;
        //}

        public static void LoadCultureInfo()
        {
            var language = ConfigurationManager.AppSettings["Language"];

            LanguageReader.Load(language);

            Country.Local = new Country(Application.Current.Dispatcher.Thread.CurrentCulture, new string[0]).ToString();
            ApplicationCache.Set(Global.GlobalCalendar, new Dictionary <DateTime, Dictionary <string, bool> >(365));
        }
Example #10
0
 protected void ValidateHasAbsentEvent()
 {
     if (Applier.HasAbsentEvent)
     {
         Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasAbsentEvent"));
     }
     if (Replier.HasAbsentEvent)
     {
         Replier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasAbsentEvent"));
     }
 }
Example #11
0
 protected void ValidateHasTimeOff()
 {
     if (Applier.HasTimeOff)
     {
         Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasTimeOff"));
     }
     if (Replier.HasTimeOff)
     {
         Replier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasTimeOff"));
     }
 }
Example #12
0
 public void ChangePassword(Employee employee, bool needLog)
 {
     employee.Password = Cryptographer.CreateHash("SHA512Managed", employee.Password);
     _loginRepository.MakePersistent(employee);
     if (needLog)
     {
         AuditLoginLog(new AuditLog {
             Action = LanguageReader.GetValue("Administration_Login_ChangePassword"), CurrentUser = employee.AgentId
         });
     }
 }
Example #13
0
 protected void ValidateHasLocked()
 {
     if (Applier.Lockeds.Count != 0)
     {
         Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasLocked"));
     }
     if (Replier.Lockeds.Count != 0)
     {
         Replier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasLocked"));
     }
 }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            TimeSpan timeSpan = (TimeSpan)value;

            if (timeSpan.TotalMinutes < 60)
            {
                return(string.Format("{0:00}:{1:00}", timeSpan.Minutes, timeSpan.Seconds));
            }

            return(string.Format("{0:00}{1}", (int)timeSpan.TotalMinutes, LanguageReader.GetValue("Minute")));
        }
Example #15
0
        public string Submit()
        {
            var session = ServiceLocator.Current.GetInstance <ISessionFactory>().GetCurrentSession();

            if (Applier.Message.Length == 0 && Replier.Message.Length == 0)
            {
                Applier.Submit();
                Replier.Submit();
                return(LanguageReader.GetValue("Shifts_BoxPairSwap_Success"));
            }
            session.Transaction.Rollback();
            return(WithMessage());
        }
Example #16
0
        public bool AskDeleteShift(IQuestionPresenter p)
        {
            if (SelectedTerm == null)
            {
                return(false);
            }

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskDeleteShift");
            p.Editable    = false;
            p.Text        = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskDeleteShiftText"),
                                          SelectedAgent.Profile.Name, SelectedTerm.Start, SelectedTerm.Text);
            return(true);
        }
Example #17
0
        public ModSettingModel(ModSetting modSetting, string currentValue, LanguageReader language)
        {
            this.language   = language;
            this.modSetting = modSetting;
            Name            = modSetting.Name;
            Description     = modSetting.Description;
            NewValue        = currentValue;
            AvailableValues = modSetting.AvailableValues;
            if (AvailableValues != null)
            {
                UpdateSelectedIndexByNewValue();
            }

            if (modSetting is Int32ModSetting)
            {
                var int32ModSetting = (Int32ModSetting)modSetting;
                var otherValues     = GetOtherValues(int32ModSetting);
                if (!String.IsNullOrEmpty(otherValues))
                {
                    OtherValues = otherValues;
                }
            }
            else if (modSetting is FloatModSetting)
            {
                var floatModSetting = (FloatModSetting)modSetting;
                var otherValues     = GetOtherValues(floatModSetting);
                if (!String.IsNullOrEmpty(otherValues))
                {
                    OtherValues = otherValues;
                }
            }
            else if (modSetting is DoubleModSetting)
            {
                var doubleModSetting = (DoubleModSetting)modSetting;
                var otherValues      = GetOtherValues(doubleModSetting);
                if (!String.IsNullOrEmpty(otherValues))
                {
                    OtherValues = otherValues;
                }
            }
            else if (modSetting is StringModSetting)
            {
                var stringModSetting = (StringModSetting)modSetting;
                if (!stringModSetting.IsMaxLengthClassMaxLength)
                {
                    OtherValues = String.Format("{0}:{1}}", language["MaxLength"], stringModSetting.MaxLength);
                }
            }
            DefaultValue = modSetting.GetStringValue(modSetting.Default);
        }
Example #18
0
 private void ShowDialog(Exception exception)
 {
     if (Message.IsNotNullOrEmpty())
     {
         ServiceLocator.Current.GetInstance <IMessagePresenter>()
         .Self(q =>
         {
             //q.DisplayName = LanguageReader.GetValue(Title);
             q.Text    = LanguageReader.GetValue(Message);
             q.Details = string.Format("{0}:{1}\r\n{2}", exception.GetType(), exception.Message, exception.StackTrace);
             ServiceLocator.Current.GetInstance <IWindowManager>().ShowDialog(q);
         });
     }
 }
Example #19
0
 protected internal void SetTimeOff(Term timeOff, Term term)
 {
     if (TimeOff != null)
     {
         TimeBox.SetTime(timeOff, term.Start.Date, term.Start.AddDays(1).Date, (terms, success) =>
         {
             if (!success)
             {
                 Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_SetTimeOff"));
                 return;
             }
         }, true);
     }
 }
Example #20
0
        public void Login(Employee employee, string role)
        {
            ApplicationCache.Set(Global.LoginEmployee, employee);
            ApplicationCache.Set(Global.LoggerId, employee.AgentId);

            if (role.IsNotNullOrEmpty())
            {
                //Set Rules
                SetFunctionKeys(role);
            }
            //Log
            AuditLoginLog(new AuditLog {
                Action = LanguageReader.GetValue("Logging_Admin_Login"), CurrentUser = employee.AgentId
            });
        }
Example #21
0
        private static void ExternalLanguageReading()
        {
            var tr        = new LanguageReader(@"C:\Users\harun_000\Dropbox\nuve\nuve-studio\lang\tr-TR").Read();
            var solutions = tr.Analyze("yolsuzu");

            Console.WriteLine(tr.Type.CultureCode);

            foreach (var solution in solutions)
            {
                Console.WriteLine("\t{0}", solution);
                Console.WriteLine("\toriginal:{0} stem:{1} root:{2}\n",
                                  solution.GetSurface(),
                                  solution.GetStem().GetSurface(),
                                  solution.Root); //Stemming
            }
        }
Example #22
0
        public bool BeforeAssignSeat(IQuestionPresenter p)
        {
            var shift = SelectedTerm;

            if (shift == null)
            {
                return(false);
            }
            var selectedSeat = _seatDispatcherPresenter.Property <SeatBox>("SelectedSeat");

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskAssignSeat");
            p.Editable    = false;
            p.Text        = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskAssignSeatText"),
                                          selectedSeat.Seat.Area.Name, selectedSeat.Seat.Number, SelectedAgent.Profile.Name, shift.Start, shift.Text);
            return(true);
        }
Example #23
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(value);
            }

            if (parameter != null && parameter.ToString() == "obj")
            {
                return(LanguageReader.GetValue(value));
            }

            var text = LanguageReader.GetValue(value.ToString());

            return(string.IsNullOrEmpty(text) ? value : text);
        }
        // The setup constructor will be called each time this plugin's setup is opened from the CF Setting Page
        // This setup is opened as a dialog from the CF_pluginShowSetup() call into the main plugin application form.
        public Setup(ICFMain mForm, ConfigReader config, LanguageReader lang)
        {
            // MainForm must be set before calling any Centrafuse API functions
            this.MainForm = mForm;

            // pluginConfig and pluginLang should be set before calling CF_initSetup() so this CFSetup instance
            // will internally save any changed settings.
            this.pluginConfig = config;
            this.pluginLang = lang;

            // When CF_initSetup() is called, the CFPlugin layer will call back into CF_setupReadSettings() to read the page
            // Note that this.pluginConfig and this.pluginLang must be set before making this call
            CF_initSetup(1, 1);

            // Update the Settings page title
            this.CF_updateText("TITLE", this.pluginLang.ReadField("/APPLANG/SETUP/TITLE"));
        }
Example #25
0
        // The setup constructor will be called each time this plugin's setup is opened from the CF Setting Page
        // This setup is opened as a dialog from the CF_pluginShowSetup() call into the main plugin application form.
        public Setup(ICFMain mForm, ConfigReader config, LanguageReader lang)
        {
            // MainForm must be set before calling any Centrafuse API functions
            this.MainForm = mForm;

            // pluginConfig and pluginLang should be set before calling CF_initSetup() so this CFSetup instance
            // will internally save any changed settings.
            this.pluginConfig = config;
            this.pluginLang   = lang;

            // When CF_initSetup() is called, the CFPlugin layer will call back into CF_setupReadSettings() to read the page
            // Note that this.pluginConfig and this.pluginLang must be set before making this call
            CF_initSetup(1, 1);

            // Update the Settings page title
            this.CF_updateText("TITLE", this.pluginLang.ReadField("/APPLANG/SETUP/TITLE"));
        }
Example #26
0
        public void Login(string agentId, Guid roleId)
        {
            var employee = _loginRepository.FirstOrDefault(o => o.AgentId == agentId);

            ApplicationCache.Set(Global.LoginEmployee, employee);
            ApplicationCache.Set(Global.LoggerId, employee.AgentId);

            if (roleId != Guid.Empty)
            {
                //Set Rules
                SetFunctionKeys(roleId);
            }
            //Log
            AuditLoginLog(new AuditLog {
                Action = LanguageReader.GetValue("Logging_Admin_Login"), CurrentUser = employee.AgentId
            });
        }
Example #27
0
 protected void VaildateSwapMessage()
 {
     if (Applier.FailedTerm.Count > 0)
     {
         Applier.HasExchanged = true;
         Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_CreateTermFail"));
         //foreach (var term in Applier.FailedTerm)
         //{
         //    Applier.Message.Append(term).Append(",");
         //}
     }
     if (Replier.FailedTerm.Count > 0)
     {
         Replier.HasExchanged = true;
         Replier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_CreateTermFail"));
         //foreach (var term in Replier.FailedTerm)
         //{
         //    Replier.Message.Append(term).Append(",");
         //}
     }
 }
Example #28
0
        internal static string GenerateDisplay(IList list)
        {
            var display = new StringBuilder();

            if (list.Count == 0)
            {
                return(LanguageReader.GetValue("ApplicationFramework_Controls_PopupButtonBehavior_Text"));
            }

            for (int i = 0; i < list.Count; i++)
            {
                var item = list[i];

                var itemText = new Reflector(item).Property <string>("Name") ?? item.ToString();
                display.Append(itemText);
                if (i != list.Count - 1)
                {
                    display.Append(", ");
                }
            }
            return(display.ToString());
        }
Example #29
0
        public EventBatchAlterModel(DateTime watchPoint, ITimeBoxRepository timeBoxRepository,
                                    ITermStyleRepository termStyleRepository)
            : base(watchPoint, timeBoxRepository, termStyleRepository)
        {
            _title = LanguageReader.GetValue("BatchAlterExistsOfSubEvent");

            OptionalFilters = new ICustomFilter[]
            {
                new CustomFilter("EqEventType", this, (t) =>
                {
                    return(t.Text.Equals(QueryType.Text));
                }),

                new CustomFilter("EqParentType", this, (t) =>
                {
                    var bottomStyle = t.GetBottomStyle();
                    if (bottomStyle == null)
                    {
                        return(false);
                    }
                    return(bottomStyle.Equals(QueryParentType.Text));
                })
            };

            _filters = new ICustomFilter[] {
                new CustomFilter("InTermRange", this, (t) =>
                {
                    return(t.IsInTheRange(SearchDate, End));
                }),

                new CustomFilter("EqTermStart", this, (t) => t.Start == SearchDate),

                new CustomFilter("EqTermEnd", this, (t) => t.End == SearchDate)
            };

            End = _searchDate.Date.AddDays(1).AddMinutes(-5);
        }
Example #30
0
        private static void SetActriproResource()
        {
            Application.Current.Dispatcher.BeginInvoke(
                () => ThemeManager.CurrentTheme = CommonThemeName.AeroNormalColor.ToString(),
                DispatcherPriority.ApplicationIdle);


            if (!ConfigurationManager.AppSettings["Language"].Contains("en"))
            {
                //Docking
                Resources.Culture = CultureInfo.CurrentCulture;

                string[] names = Enum.GetNames(typeof(SRName));
                foreach (string name in names)
                {
                    string fullKeyName = string.Format(ActriproLanguageKey, "Docking", name);
                    if (LanguageReader.ContainsKey(fullKeyName))
                    {
                        SR.SetCustomString(name, LanguageReader.GetValue(fullKeyName));
                    }
                }

                //Editors
                ActiproSoftware.Products.Editors.Resources.Culture = CultureInfo.CurrentCulture;

                names = Enum.GetNames(typeof(ActiproSoftware.Products.Editors.SRName));
                foreach (string name in names)
                {
                    string fullKeyName = string.Format(ActriproLanguageKey, "Editors", name);
                    if (LanguageReader.ContainsKey(fullKeyName))
                    {
                        ActiproSoftware.Products.Editors.SR.SetCustomString(name, LanguageReader.GetValue(fullKeyName));
                    }
                }
            }
        }
Example #31
0
 public DayOffException(string agentId, DateTime start, DateTime end, double dayOffDays, LaborRuleCategory category)
     : base(agentId, start, end, category, string.Format(LanguageReader.GetValue("Shifts_DayOffException"), dayOffDays))
 {
     _dayOffDays          = dayOffDays;
     TimeRangeDisplayText = string.Format("{0:yyyy MM/dd} - {1:yyyy MM/dd}", start, end);
 }