Ejemplo n.º 1
0
        private void ImportLanguagePack()
        {
            try
            {
                string path       = Path.Combine(this.DataDirectory, importedLocale);
                string sourceFile = Path.Combine(this.DataDirectory, @"en-US\Resources.xml");
                string destFile   = Path.Combine(path, "Resources.xml");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                if (!File.Exists(destFile))
                {
                    File.Copy(sourceFile, destFile);
                }

                ClearTmpDir();
                SetStatusBarText("Extracting language pack...");
                ZipUtils.Unzip("Tmp", importedFileName);

                Resources ds = new Resources();
                ds.ReadXml(destFile);
                int count = ImportFiles(importedLocale, ds, this.TmpDirectory, this.TmpDirectory);
                ds.AcceptChanges();
                ds.WriteXml(destFile);
                DeleteTmpDir();
                LoadLocales();
                SetCurrentLocale(importedLocale);
                FinishProgress();

                string message = string.Format("{0} record(s) imported successfully.", count);
                MessageBox.Show(this, message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                if (IsThreadAbortException(ex))
                {
                    return;
                }
                throw;
            }
        }
Ejemplo n.º 2
0
        private void BindResourcesGrid()
        {
            try
            {
                if (string.IsNullOrEmpty(cbSupportedLocales.Text))
                {
                    grdResources.DataMember = null;
                    grdResources.DataSource = null;
                    return;
                }
                string      localeName = null;
                DataRowView row        = cbSupportedLocales.SelectedValue as DataRowView;
                if (row != null)
                {
                    localeName = (string)row["Name"];
                }
                else
                {
                    localeName = cbSupportedLocales.SelectedValue as string;
                }

                if (!string.IsNullOrEmpty(localeName))
                {
                    dsResources = new Resources();
                    string fileName = Path.Combine(this.DataDirectory, localeName + "\\resources.xml");
                    dsResources.ReadXml(fileName);
                    dsResources.AcceptChanges();
                    grdResources.DataSource = dsResources;
                    grdResources.DataMember = this.dsResources.Tables[0].TableName;
                }
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
        }
Ejemplo n.º 3
0
		private void ImportLanguagePack()
		{
			try
			{
				string path = Path.Combine(this.DataDirectory, importedLocale);
				string sourceFile = Path.Combine(this.DataDirectory, @"en-US\Resources.xml");
				string destFile = Path.Combine(path, "Resources.xml");
				if (!Directory.Exists(path))
				{
					Directory.CreateDirectory(path);
				}
				
				if (!File.Exists(destFile))
				{
					File.Copy(sourceFile, destFile);
				}
					
				ClearTmpDir();
				SetStatusBarText("Extracting language pack...");
				ZipUtils.Unzip("Tmp", importedFileName);

				Resources ds = new Resources();
				ds.ReadXml(destFile);
				int count = ImportFiles(importedLocale, ds, this.TmpDirectory, this.TmpDirectory);
				ds.AcceptChanges();
				ds.WriteXml(destFile);
				DeleteTmpDir();
				LoadLocales();
				SetCurrentLocale(importedLocale);
				FinishProgress();

				string message = string.Format("{0} record(s) imported successfully.", count);
				MessageBox.Show(this, message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
			}
			catch (Exception ex)
			{
				if (IsThreadAbortException(ex))
					return;
				throw;
			}
		}
Ejemplo n.º 4
0
		private void BindResourcesGrid()
		{
			try
			{
				if (string.IsNullOrEmpty(cbSupportedLocales.Text))
				{
					grdResources.DataMember = null;
					grdResources.DataSource = null;
					return;
				}
				string localeName = null;
				DataRowView row = cbSupportedLocales.SelectedValue as DataRowView;
				if (row != null)
				{
					localeName = (string)row["Name"];
				}
				else
				{
					localeName = cbSupportedLocales.SelectedValue as string;
				}

				if (!string.IsNullOrEmpty(localeName))
				{
					dsResources = new Resources();
					string fileName = Path.Combine(this.DataDirectory, localeName + "\\resources.xml");
					dsResources.ReadXml(fileName);
					dsResources.AcceptChanges();
					grdResources.DataSource = dsResources;
					grdResources.DataMember = this.dsResources.Tables[0].TableName;
				}
			}
			catch (Exception ex)
			{
				ShowError(ex);
			}
		}