Exemplo n.º 1
0
        public static void Send(string email, string subject, string body)
        {
            string data = string.Format("mailto:{0}?subject={1}&body={2}",
                                        email, subject, body);

            data = data.Replace("\r\n", "%0D%0A");
            data = data.Replace(" ", "%20");
            if (data.Length > 2000)
            {
                data = data.Substring(0, 2000);
            }

            try
            {
                System.Diagnostics.Process.Start(data);
            }
            catch (Exception e)
            {
                ErrorMessageBox.Show(string.Format(LangPack.TranslateString(
                                                       "Error on sending email to : {0}\r\n" +
                                                       "Error message : {1}"),
                                                   email, e.Message),
                                     LangPack.TranslateString("Error on sending email"),
                                     e);
            }
        }
        void UpdateInfo()
        {
            lTranslatedBy.Text = LangPack.TranslateString("Translated by");

            string translator = "";
            string url        = "";

            string tmp = LangPack.TranslateString("TranslatedBy");

            if (tmp != "TranslatedBy")
            {
                translator = tmp;
            }

            tmp = LangPack.TranslateString("TranslatedByURL");
            if (tmp != "TranslatedByURL")
            {
                url = tmp;
            }

            if (!string.IsNullOrEmpty(url))
            {
                translator += Environment.NewLine + url;
            }

            if (!string.IsNullOrEmpty(translator))
            {
                tbData.Text   = translator;
                pInfo.Visible = true;
            }
            else
            {
                pInfo.Visible = false;
            }
        }
Exemplo n.º 3
0
        void OnLanguageChanged()
        {
            bOk.Text     = TranslateString("OK");
            bCancel.Text = LangPack.TranslateString("Cancel");
            aApply.Text  = LangPack.TranslateString("Apply");
            Text         = LangPack.TranslateString("Options");

            foreach (TreeNode rtn in tvItems.Nodes)
            {
                if (rtn.Tag.GetType() == typeof(string))
                {
                    string groupName = (string)rtn.Tag;
                    rtn.Text = LangPack.TranslateString(groupName);
                }
                else
                {
                    OptionControlInfo inf = (OptionControlInfo)rtn.Tag;
                    rtn.Text = LangPack.TranslateString(inf.Group);
                    inf.Instance.lCaption.Text = LangPack.TranslateString(inf.Group);
                }

                foreach (TreeNode tn in rtn.Nodes)
                {
                    OptionControlInfo inf = (OptionControlInfo)tn.Tag;
                    inf.Instance.lCaption.Text = LangPack.TranslateString(inf.Caption);
                    tn.Text = LangPack.TranslateString(inf.Caption);
                }
            }
        }
Exemplo n.º 4
0
        public void Save()
        {
            try
            {
                base.Save(OptionsFileName_);
            }
            catch (System.Exception e)
            {
                System.InvalidOperationException ioe = e as System.InvalidOperationException;
                if (ioe != null && ioe.Message.Contains("CS2001") && ioe.Message.Contains("CS2008"))
                {
                    //error with xml serialization
                    //Unhandled exception : System.InvalidOperationException
                    //Message : Unable to generate a temporary class (result=1).
                    //error CS2001: Source file 'C:\Windows\Temp\2cehzm2v.0.cs' could not be found
                    //error CS2008: No inputs specified

                    ErrorMessageBox.Show(string.Format(LangPack.TranslateString(
                                                           "Error on saving config file to {0}" +
                                                           "\r\nPossible reason - denyed write access to system TEMP directory."),
                                                       OptionsFileName_),
                                         LangPack.TranslateString("Error on saving config file"),
                                         e);
                }
                else
                {
                    ErrorMessageBox.Show(string.Format(LangPack.TranslateString(
                                                           "Error on saving config file to {0}"), OptionsFileName_),
                                         LangPack.TranslateString("Error on saving config file"),
                                         e);
                }
            }
        }
Exemplo n.º 5
0
 void MvcApplication_BeginRequest(object sender, EventArgs e)
 {
     if (!LangPack.ContainsKey(Thread.CurrentThread.CurrentUICulture.Name.ToLower()))
     {
         Thread.CurrentThread.CurrentCulture       =
             Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(LangPack.GetLanugage(LanguageKey.en));
     }
 }
Exemplo n.º 6
0
 public static void RegisterLanguageEvent(OnLanguageChangedEventHandler onLanguageChangedEventHandler)
 {
     LangPack.RegisterLanguageEvent(onLanguageChangedEventHandler);
     if (onLanguageChangedEventHandler != null)
     {
         onLanguageChangedEventHandler.Invoke();
     }
 }
Exemplo n.º 7
0
        public void Dispose()
        {
            StaticContent.SystemInfoInst = null;
            Bootstrapper.Container.Dispose();
            //LangPack.resDicts

            LangPack.ClearAll();
        }
Exemplo n.º 8
0
        public CommonFixture()
        {
            #region [ cool privilege control ]
            IList <ComposablePartCatalog> composableList = new List <ComposablePartCatalog>();

            composableList.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
            composableList.Add(new AssemblyCatalog(typeof(LanguageKey).Assembly));
            composableList.Add(new AssemblyCatalog(typeof(FunctionTypeVM).Assembly));
            //composableList.Add(new AssemblyCatalog(typeof(StaticContent).Assembly));
            composableList.Add(new AssemblyCatalog(typeof(LoginController).Assembly));

            Bootstrapper boot = new Bootstrapper(composableList);

            boot.RunTask();

            composableList = new List <ComposablePartCatalog>();
            composableList.Add(new AssemblyCatalog(typeof(PrivilegeFun).Assembly));
            WCFBootstrapper wcfBootStrapper = new WCFBootstrapper(composableList);

            SystemMgtHelper systemMgtHelper = new SystemMgtHelper(WCFBootstrapper.Container);

            Bootstrapper.Container.ComposeExportedValue <LoginUserMgtHelper>(new LoginUserMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <AuditLogMgtHelper>(new AuditLogMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <AuthHisMgtHelper>(new AuthHisMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <FunMgtHelper>(new FunMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <FunTypeMgtHelper>(new FunTypeMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <OrgMgtHelper>(new OrgMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <OrgDetailMgtHelper>(new OrgDetailMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <RoleMgtHelper>(new RoleMgtHelper(WCFBootstrapper.Container));
            Bootstrapper.Container.ComposeExportedValue <SystemMgtHelper>(systemMgtHelper);
            Bootstrapper.Container.ComposeExportedValue <CheckPrivilegeHelper>(new CheckPrivilegeHelper(WCFBootstrapper.Container));

            WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", "", "", "", LanguageKey.en.ToString(), "");

            StaticContent.SystemInfoInst = systemMgtHelper.GetSystemInfo(entity_WCFAuthInfoVM);
            #endregion

            #region [ Initialize Language Pack ]
            LangPack entity_LangPack = new LangPack();

            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.en));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.cn));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.tw));
            #endregion

            #region [ Set Route Table ]
            RouteTable.Routes.Clear();
            var areaRegistration        = new AccessControlAreaRegistration();
            var areaRegistrationContext = new AreaRegistrationContext(
                areaRegistration.AreaName, RouteTable.Routes);
            areaRegistration.RegisterArea(areaRegistrationContext);

            RouteConfig.RegisterRoutes(RouteTable.Routes);
            #endregion
        }
        public override void Init()
        {
            lbLanguage.Items.Clear();
            ReadOnlyCollection <string> list = LangPack.GetLanguages();

            foreach (string val in list)
            {
                lbLanguage.Items.Add(val);
            }
            initialLanguage         = LangPack.CurrentLanguage;
            lbLanguage.SelectedItem = LangPack.CurrentLanguage;
            UpdateInfo();
        }
Exemplo n.º 10
0
 public override void OnLoaded()
 {
     base.OnLoaded();
     LoadFileName();
     if (string.IsNullOrEmpty(language))
     {
         language = LangPack.CurrentLanguage;
     }
     else
     {
         LangPack.Load(language);
     }
 }
Exemplo n.º 11
0
        static Application()
        {
            System.Windows.Forms.Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(GlobalEventsThreadException);

            try
            {
                System.Windows.Forms.Application.EnableVisualStyles();
                System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            }
            catch {}
            LangPack.TranslateString("");             //init language
            SkipSplashForm = CommandLineHelper.IsCommandSwitchSet("skipsplash");
        }
Exemplo n.º 12
0
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Flags.ToStream(output);
     AppId.ToStream(output);
     DeviceModel.ToStream(output);
     SystemVersion.ToStream(output);
     AppVersion.ToStream(output);
     SystemLangCode.ToStream(output);
     LangPack.ToStream(output);
     LangCode.ToStream(output);
     ToStream(output, _proxy, _flags, (int)InitConnectionFlags.Proxy);
 }
Exemplo n.º 13
0
        public string GetMultiLingualResSer(string str_LangKey)
        {
            LanguageKey languageKey_Input = LanguageKey.en;

            Enum.TryParse <LanguageKey>(str_LangKey, out languageKey_Input);

            IDictionary <string, string> dic_AllKey = LangPack.GetAllByLangKey(LangPack.GetLanugage(languageKey_Input));

            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();

            return(jsonSerializer.Serialize(dic_AllKey));
            //return dic_AllKey;
        }
Exemplo n.º 14
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Flags.ToBytes(),
                AppId.ToBytes(),
                DeviceModel.ToBytes(),
                SystemVersion.ToBytes(),
                AppVersion.ToBytes(),
                SystemLangCode.ToBytes(),
                LangPack.ToBytes(),
                LangCode.ToBytes(),
                ToBytes(_proxy, _flags, (int)InitConnectionFlags.Proxy),
                Data.ToBytes()));
 }
Exemplo n.º 15
0
        public void ConvertLangPack()
        {
            var newLangPack = new LangPack(_Global.TestDirectory + "Arabic x64.exe");
            var outDir      = _Global.TestDirectory + "Output" + Misc.RandomString() + "\\";

            FileHandling.DeleteDirectory(outDir, true);

            var result = newLangPack.Convert(outDir);

            FileHandling.DeleteDirectory(outDir);

            if (result != Status.Success)
            {
                Assert.Fail();
            }
        }
Exemplo n.º 16
0
 public static void StartIE(string fileName)
 {
     try
     {
         InitIE();
         System.Diagnostics.Process.Start(iePath, fileName);
     }
     catch (Exception e)
     {
         ErrorMessageBox.Show(string.Format(LangPack.TranslateString(
                                                "Error on opening url : {0}\r\n" +
                                                "Error message : {1}"),
                                            fileName, e.Message),
                              LangPack.TranslateString("Error on opening url"),
                              e);
     }
 }
Exemplo n.º 17
0
        protected void Application_Start()
        {
            #region [ Cool Privilege Control ]
            AreaRegistration.RegisterAllAreas();

            var myassembly1 = new DirectoryCatalog("bin");
            IList <ComposablePartCatalog> composableList = new List <ComposablePartCatalog>();
            composableList.Add(myassembly1);

            Bootstrapper boot = new Bootstrapper(composableList);

            boot.RunTask();

            IPostOffice postOffice = new PostOffice();

            #region [ Compose Service Helper ]
            SystemMgtHelper systemMgtHelper = new SystemMgtHelper(postOffice.SystemMgtSerPath);

            Bootstrapper.Container.ComposeExportedValue <LoginUserMgtHelper>(new LoginUserMgtHelper(postOffice.LoginUserMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <AuditLogMgtHelper>(new AuditLogMgtHelper(postOffice.AuditLogMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <AuthHisMgtHelper>(new AuthHisMgtHelper(postOffice.AuthHisMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <FunMgtHelper>(new FunMgtHelper(postOffice.FunMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <FunTypeMgtHelper>(new FunTypeMgtHelper(postOffice.FunTypeMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <OrgMgtHelper>(new OrgMgtHelper(postOffice.OrgMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <OrgDetailMgtHelper>(new OrgDetailMgtHelper(postOffice.OrgDetailMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <RoleMgtHelper>(new RoleMgtHelper(postOffice.RoleMgtSerPath));
            Bootstrapper.Container.ComposeExportedValue <SystemMgtHelper>(systemMgtHelper);
            Bootstrapper.Container.ComposeExportedValue <CheckPrivilegeHelper>(new CheckPrivilegeHelper(postOffice.CheckPrivilegeSerPath));
            #endregion

            WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", "", "", "", LanguageKey.en.ToString(), "");

            StaticContent.SystemInfoInst = systemMgtHelper.GetSystemInfo(entity_WCFAuthInfoVM);

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            LangPack entity_LangPack = new LangPack();

            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.en));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.cn));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.tw));
            entity_LangPack.CacheLanguages(StaticContent.LangPackProjectName, LangPack.GetLanugage(LanguageKey.esve));
            #endregion
        }
Exemplo n.º 18
0
        public static BaseOptions Load(BaseOptions source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            BaseOptions result = source;

            try
            {
                if (System.IO.File.Exists(source.OptionsFileName_))
                {
                    FileStream FStream = new FileStream(source.OptionsFileName_, FileMode.Open, FileAccess.Read, FileShare.Read);
                    if (FStream.Length > 0)
                    {
                        result = (BaseOptions)XmlSerializableObject.Load(FStream, source.GetType(), source.UseSoapSerialization);
                    }
                }
            }
            catch (System.Exception e)
            {
                ErrorMessageBox.Show(
                    string.Format(LangPack.TranslateString(
                                      "Error on opening config file from {0}" +
                                      ".\r\nPossible reason - error in options file format" +
                                      ".\r\nThe configuration will be reset to default values."
                                      ), source.OptionsFileName_),
                    LangPack.TranslateString("Error on opening config file"),
                    e);
            }
            if (result == source)
            {
                result.OnLoaded();
            }

            return(result);
        }
Exemplo n.º 19
0
 public static void Start(string fileName)
 {
     try
     {
         System.Diagnostics.Process.Start(fileName);
     }
     catch (Exception e)
     {
         if (fileName.ToLowerInvariant().StartsWith("http://"))
         {
             StartIE(fileName);
         }
         else
         {
             ErrorMessageBox.Show(string.Format(LangPack.TranslateString(
                                                    "Error on start process : {0}\r\n" +
                                                    "Error message : {1}"),
                                                fileName, e.Message),
                                  LangPack.TranslateString("Error on start process"),
                                  e);
         }
     }
 }
Exemplo n.º 20
0
        void OnLanguageChanged()
        {
            aEditDelete.Hint = LangPack.TranslateString("Delete selection");
            aEditDelete.Text = LangPack.TranslateString("&Delete");
            aEditUndo.Hint   = LangPack.TranslateString("Undo last operation");
            aEditUndo.Text   = LangPack.TranslateString("&Undo");

            aEditPaste.Hint = LangPack.TranslateString("Paste from clipboard");
            aEditPaste.Text = LangPack.TranslateString("&Paste");

            miFile.Text = LangPack.TranslateString("&File");

            aExit.Hint = LangPack.TranslateString("Exit from application");
            aExit.Text = LangPack.TranslateString("E&xit");

            aEditRedo.Hint = LangPack.TranslateString("Redo last operation");
            aEditRedo.Text = LangPack.TranslateString("&Redo");

            aEditCopy.Hint = LangPack.TranslateString("Copy selection to clipboard");
            aEditCopy.Text = LangPack.TranslateString("&Copy");

            aEditCut.Hint = LangPack.TranslateString("Cut selection to clipboard");
            aEditCut.Text = LangPack.TranslateString("Cu&t");



            aEditSelectAll.Hint = LangPack.TranslateString("Select All");
            aEditSelectAll.Text = LangPack.TranslateString("&Select All");

            miEdit.Text = LangPack.TranslateString("&Edit");

            miHelp.Text = LangPack.TranslateString("&Help");
            aAbout.Text = LangPack.TranslateString("&About ...");

            miService.Text = LangPack.TranslateString("&Tools");
            aOptions.Text  = LangPack.TranslateString("O&ptions...");
        }
Exemplo n.º 21
0
        void InitControls()
        {
            if (!controlsAdded)
            {
                tvItems.Nodes.Clear();
                foreach (OptionControlInfo inf in OptionsControlsManager.OptionsControls)
                {
                    inf.Instance               = (BaseOptionsControl)Activator.CreateInstance(inf.ControlType);
                    inf.Instance.Parent        = pMain;
                    inf.Instance.Dock          = DockStyle.Fill;
                    inf.Instance.Visible       = false;
                    inf.Instance.lCaption.Text = LangPack.TranslateString(inf.Caption);
                    TreeNode rootNode = null;
                    foreach (TreeNode tn in tvItems.Nodes)
                    {
                        if (inf.Group == (string)tn.Tag)
                        {
                            rootNode = tn;
                            break;
                        }
                    }
                    if (rootNode == null)
                    {
                        rootNode     = new TreeNode(LangPack.TranslateString(inf.Group));
                        rootNode.Tag = inf.Group;
                        tvItems.Nodes.Insert(inf.GroupOrder, rootNode);
                    }
                    TreeNode childNode = new TreeNode(LangPack.TranslateString(inf.Caption));
                    childNode.Tag = inf;

                    if (inf.Order < rootNode.Nodes.Count)                    //monobug. Insert does not work
                    {
                        rootNode.Nodes.Insert(inf.Order, childNode);
                    }
                    else
                    {
                        rootNode.Nodes.Add(childNode);
                    }
                }

                //when one item in group remove subitems
                foreach (TreeNode tn in tvItems.Nodes)
                {
                    if (tn.Nodes.Count == 1)
                    {
                        tn.Tag = tn.Nodes[0].Tag;
                        tn.Nodes.RemoveAt(0);
                        OptionControlInfo inf = (OptionControlInfo)tn.Tag;
                        inf.Instance.lCaption.Text = LangPack.TranslateString(inf.Group);
                    }
                }
                controlsAdded = true;
                tvItems.ExpandAll();
                tvItems.SelectedNode = tvItems.Nodes[0];
            }

            foreach (OptionControlInfo inf in OptionsControlsManager.OptionsControls)
            {
                inf.Instance.Init();
            }
        }
Exemplo n.º 22
0
 public static string TranslateString(string data)
 {
     return(LangPack.TranslateString(data));
 }
Exemplo n.º 23
0
 void OnLanguageChanged()
 {
     bOk.Text      = TranslateString("OK");
     lVersion.Text = LangPack.TranslateString("Version") + " " + ApplicationInfo.ProductVersion;
     Text          = LangPack.TranslateString("About") + " " + lAppTitle.Text;
 }
Exemplo n.º 24
0
 public NoteList(string voiceSource)
 {
     this.lang        = Global.lang;
     this.voiceSource = voiceSource;
     this.oto         = new Oto(voiceSource, lang);
 }
Exemplo n.º 25
0
        // GET: AccessControl/Login
        public ActionResult Index(string str_Language = "en")
        {
            ClearSelectionCriteriaFromViewData();

            LanguageKey temp = LanguageKey.en;

            Enum.TryParse <LanguageKey>(str_Language, out temp);

            TempData[StaticContent.LanguageKey] = temp;

            Thread.CurrentThread.CurrentCulture       =
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(LangPack.GetLanugage(temp));

            if (TempData[ActionMessageKey] != null)
            {
                ViewBag.ActionMessage = TempData[ActionMessageKey];
            }

            initLanguageComboBox(str_Language);

            return(View());
        }
Exemplo n.º 26
0
 void OnLanguageChanged()
 {
     lVersion.Text = LangPack.TranslateString("Version") + " " + ApplicationInfo.ProductVersion;
 }
Exemplo n.º 27
0
 public BatParser(string batFile)
 {
     this.lang    = Global.lang;
     this.batData = Utils.file_get_contents(batFile);
     this.parse();
 }
Exemplo n.º 28
0
        private void AddList(IEnumerable <string> fileList)
        {
            foreach (
                var myClass in
                fileList.Where(
                    myClass =>
                    _conversionList.Any(c => c.Location.EqualsIgnoreCase(myClass)) ||
                    _conversionList.Any(c => c.Name.EqualsIgnoreCase(Path.GetFileNameWithoutExtension(myClass))))
                )
            {
                fileList = fileList.Where(u => u.EqualsIgnoreCase(myClass)).ToList();
            }


            var getMD5 = chkGetMD5.IsChecked == true;

            Parallel.ForEach(fileList,
                             new ParallelOptions {
                MaxDegreeOfParallelism = Options.MaxThreads
            },
                             currentFile =>
            {
                if (currentFile.EndsWithIgnoreCase(".MSU"))
                {
                    var newItem = new MsuUpdate(currentFile);
                    lock (_conversionList)
                    {
                        _conversionList.Add(newItem);
                    }
                    return;
                }

                if (Office.ValidOfficeFile(currentFile))
                {
                    var newItem = new Office(currentFile);
                    lock (_conversionList)
                    {
                        _conversionList.Add(newItem);
                    }
                    return;
                }

                if (LangPack.IsValidLangPack(currentFile))
                {
                    var newItem = new LangPack(currentFile);
                    lock (_conversionList)
                    {
                        _conversionList.Add(newItem);
                    }
                }
            });


            _conversionList = _conversionList.GroupBy(x => x.Name.ToLowerInvariant()).Select(x => x.First()).ToList();

            //Updates status
            dgUpdates.ItemsSource = _conversionList;
            lblStatus.Text        = _conversionList.Count + " " + Localization.GetString("Global", 54);

            dgUpdates.Update();
        }