예제 #1
0
        public static void ExportLanguages()
        {
            string path = EditorUtility.SaveFilePanel("Export Languages", "", "", "xls");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            using (Stream writer = File.Create(path))
            {
                LanguageItem[] allLanguageItems =
                    TypeHelper.GetAllTypes(AllTypeCategory.All)
                    .Where(type => typeof(IInfo).IsAssignableFrom(type))
                    .Select(type => TypeHelper.FindType(InfoResolver.Resolve(type), typeof(LanguageItem <string>)))
                    .SelectMany(objects => objects)
                    .Cast <LanguageItem>()
                    .ToArray();
                LanguageEditorInfo languageEditorInfo = EditorInfoResolver.Resolve <LanguageEditorInfo>();
                string[]           languageNames      = languageEditorInfo.Languages.Select(info => info.Name).ToArray();

                HSSFWorkbook workbook = new HSSFWorkbook();

                HSSFSheet sheet    = (HSSFSheet)workbook.CreateSheet("Languages");
                HSSFRow   header   = (HSSFRow)sheet.CreateRow(0);
                HSSFCell  hssfCell = (HSSFCell)header.CreateCell(0);
                hssfCell.SetCellValue("Item Id");
                for (int i = 0; i < languageNames.Length; i++)
                {
                    HSSFCell cell = (HSSFCell)header.CreateCell(i + 1);
                    cell.SetCellValue(languageNames[i]);
                }
                for (int i = 0; i < allLanguageItems.Length; i++)
                {
                    HSSFRow  row        = (HSSFRow)sheet.CreateRow(i + 1);
                    HSSFCell itemIdcell = (HSSFCell)row.CreateCell(0);
                    itemIdcell.SetCellValue(allLanguageItems[i].Id);
                    for (int j = 0; j < languageNames.Length; j++)
                    {
                        HSSFCell cell = (HSSFCell)row.CreateCell(j + 1);
                        if (languageEditorInfo.Languages[j].LanguageDatas.ContainsKey(allLanguageItems[i].Id))
                        {
                            object languageData = languageEditorInfo.Languages[j].LanguageDatas[allLanguageItems[i].Id];
                            cell.SetCellValue(languageData == null?string.Empty:languageData.ToString());
                        }
                        else
                        {
                            cell.SetCellValue(string.Empty);
                        }
                    }
                }
                for (int i = 0; i < languageNames.Length + 1; i++)
                {
                    sheet.AutoSizeColumn(i);
                }
                workbook.Write(writer);
            }
        }
예제 #2
0
        private void InternalTargetChanged(IInfo targetObject)
        {
            InfoAttribute infoAttribute = targetObject.GetType().GetCustomAttribute <InfoAttribute>();

            if (!infoAttribute.Editor)
            {
                InfoResolver.UpdateInfo(targetObject.GetType(), (IInfo)targetObject);
            }
            else
            {
                EditorInfoResolver.UpdateInfo(targetObject.GetType(), (IInfo)targetObject);
            }
            OnTargetChanged(targetObject);
        }
예제 #3
0
        public static void FixLanguage()
        {
            LanguageItem[]     languageItems      = TypeHelper.FindType(InfoResolver.Resolve <FortInfo>(), typeof(LanguageItem)).Cast <LanguageItem>().ToArray();
            List <string>      removedItems       = new List <string>();
            LanguageEditorInfo languageEditorInfo = EditorInfoResolver.Resolve <LanguageEditorInfo>();

            foreach (LanguageInfo languageInfo in languageEditorInfo.Languages)
            {
                foreach (KeyValuePair <string, object> pair in languageInfo.LanguageDatas)
                {
                    if (languageItems.All(item => item.Id != pair.Key))
                    {
                        removedItems.Add(pair.Key);
                    }
                }
            }
            FortInfo fortInfo = InfoResolver.Resolve <FortInfo>();

            foreach (string removedItem in removedItems)
            {
                foreach (LanguageInfo activeLanguage in fortInfo.Language.ActiveLanguages)
                {
                    if (activeLanguage.LanguageDatas.ContainsKey(removedItem))
                    {
                        activeLanguage.LanguageDatas.Remove(removedItem);
                    }
                }
                foreach (LanguageInfo languageInfo in languageEditorInfo.Languages)
                {
                    if (languageInfo.LanguageDatas.ContainsKey(removedItem))
                    {
                        languageInfo.LanguageDatas.Remove(removedItem);
                    }
                }
            }
            fortInfo.Save();
            languageEditorInfo.Save();
        }
예제 #4
0
 public static void ShowLanguageSettings()
 {
     EditorInfoResolver.ShowInfo <LanguageEditorInfo>();
 }
        private static Change ApplyNotOvveriededLanguageItem(PresentationParamater parameter, LanguageItem languageItem,
                                                             Type itemType, PresentationSite presentationSite, PresentationData presentationData)
        {
            GUIStyle           guiStyle           = new GUIStyle();
            Change             change             = new Change();
            List <Change>      changes            = new List <Change>();
            LanguageEditorInfo languageEditorInfo = EditorInfoResolver.Resolve <LanguageEditorInfo>();

            LanguageInfo[] languageInfos = languageEditorInfo.Languages.Where(info => info != null).ToArray();
            if (languageInfos.Length == 1)
            {
                ApplyLanguagePrenetation(parameter, languageInfos[0], languageItem, itemType, presentationSite, presentationData,
                                         changes, parameter.Title);
                Change last = changes.Last();
                if (last.IsAnyDataChanged())
                {
                    for (int i = 0; i < InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages.Length; i++)
                    {
                        if (InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages[i].Id == languageInfos[0].Id)
                        {
                            InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages[i] = languageInfos[0];
                        }
                    }
                    if (InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage != null &&
                        InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage.Id == languageInfos[0].Id)
                    {
                        InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage = languageInfos[0];
                    }
                    languageEditorInfo.Save();
                    InfoResolver.Resolve <FortInfo>().Save();
                }
            }
            else
            {
                bool oldFoldout = presentationData.IsFoldout;
                presentationData.IsFoldout   = EditorGUILayout.Foldout(presentationData.IsFoldout, parameter.Title);
                change.IsPresentationChanged = oldFoldout != presentationData.IsFoldout;
                if (presentationData.IsFoldout)
                {
                    EditorGUILayout.BeginHorizontal(guiStyle);
                    GUILayout.Space(FortInspector.ItemSpacing);
                    EditorGUILayout.BeginVertical(guiStyle);
                    foreach (LanguageInfo languageInfo in languageInfos)
                    {
                        ApplyLanguagePrenetation(parameter, languageInfo, languageItem, itemType, presentationSite,
                                                 presentationData, changes, languageInfo.Name);
                        Change last = changes.Last();
                        if (last.IsAnyDataChanged())
                        {
                            for (int i = 0; i < InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages.Length; i++)
                            {
                                if (InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages[i].Id == languageInfo.Id)
                                {
                                    InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages[i] = languageInfo;
                                }
                            }
                            if (InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage != null &&
                                InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage.Id == languageInfo.Id)
                            {
                                InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage = languageInfo;
                            }
                        }
                    }
                    if (changes.Any(change1 => change1.IsAnyDataChanged()))
                    {
                        languageEditorInfo.Save();
                        InfoResolver.Resolve <FortInfo>().Save();
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
            }
            change.ChildrenChange = changes.ToArray();
            return(change);
        }
        private static Change ApplyOvveriededLanguageItem(PresentationParamater parameter, LanguageItem languageItem,
                                                          Type itemType, PresentationSite presentationSite, PresentationData presentationData)
        {
            GUIStyle           guiStyle           = new GUIStyle();
            Change             change             = new Change();
            List <Change>      changes            = new List <Change>();
            LanguageEditorInfo languageEditorInfo = EditorInfoResolver.Resolve <LanguageEditorInfo>();

            LanguageInfo[]    languageInfos    = languageEditorInfo.Languages.Where(info => info != null).ToArray();
            IInfoLanguageItem infoLanguageItem = (IInfoLanguageItem)languageItem;

            if (languageInfos.Length == 1)
            {
                if (!infoLanguageItem.UseOverridedValue)
                {
                    change.IsDataChanged = true;
                    //Remove Item From Languages
                    foreach (LanguageInfo languageInfo in languageEditorInfo.Languages)
                    {
                        if (languageInfo.LanguageDatas.ContainsKey(languageItem.Id))
                        {
                            languageInfo.LanguageDatas.Remove(languageItem.Id);
                        }
                    }
                }
                infoLanguageItem.UseOverridedValue = true;

                Presentation presentation =
                    parameter.FortInspector.GetResolver()
                    .Resolve(new PresentationResolverParameter(itemType, infoLanguageItem.GetOvverideValue(), presentationSite));
                PresentationResult presentationResult =
                    presentation.OnInspectorGui(new PresentationParamater(infoLanguageItem.GetOvverideValue(),
                                                                          presentationData.OvverideItemPresentationData, parameter.Title, itemType, presentationSite,
                                                                          parameter.FortInspector));
                infoLanguageItem.SetOvverideValue(presentationResult.Result);
                presentationData.OvverideItemPresentationData = presentationResult.PresentationData;
                change.ChildrenChange = new[] { presentationResult.Change };
                languageEditorInfo.SyncFortAndSave(false);
            }
            else
            {
                bool oldFoldout = presentationData.IsFoldout;
                presentationData.IsFoldout   = EditorGUILayout.Foldout(presentationData.IsFoldout, parameter.Title);
                change.IsPresentationChanged = oldFoldout != presentationData.IsFoldout;
                if (presentationData.IsFoldout)
                {
                    EditorGUILayout.BeginHorizontal(guiStyle);
                    GUILayout.Space(FortInspector.ItemSpacing);
                    EditorGUILayout.BeginVertical(guiStyle);
                    bool oldUseOverridedValue = infoLanguageItem.UseOverridedValue;
                    infoLanguageItem.UseOverridedValue = EditorGUILayout.Toggle("Ovveride", infoLanguageItem.UseOverridedValue);
                    change.IsDataChanged |= oldUseOverridedValue != infoLanguageItem.UseOverridedValue;
                    if (infoLanguageItem.UseOverridedValue)
                    {
                        Presentation presentation =
                            parameter.FortInspector.GetResolver()
                            .Resolve(new PresentationResolverParameter(itemType, infoLanguageItem.GetOvverideValue(), presentationSite));
                        PresentationResult presentationResult =
                            presentation.OnInspectorGui(new PresentationParamater(infoLanguageItem.GetOvverideValue(),
                                                                                  presentationData.OvverideItemPresentationData, parameter.Title, itemType, presentationSite,
                                                                                  parameter.FortInspector));
                        infoLanguageItem.SetOvverideValue(presentationResult.Result);
                        presentationData.OvverideItemPresentationData = presentationResult.PresentationData;
                        change.ChildrenChange = new[] { presentationResult.Change };
                        languageEditorInfo.SyncFortAndSave(false);
                    }
                    else
                    {
                        infoLanguageItem.SetOvverideValue(itemType.GetDefault());
                        foreach (LanguageInfo languageInfo in languageInfos)
                        {
                            ApplyLanguagePrenetation(parameter, languageInfo, languageItem, itemType, presentationSite,
                                                     presentationData, changes, languageInfo.Name);
                            Change last = changes.Last();
                            if (last.IsAnyDataChanged())
                            {
                                for (int i = 0; i < InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages.Length; i++)
                                {
                                    if (InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages[i].Id == languageInfo.Id)
                                    {
                                        InfoResolver.Resolve <FortInfo>().Language.ActiveLanguages[i] = languageInfo;
                                    }
                                }
                                if (InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage != null &&
                                    InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage.Id == languageInfo.Id)
                                {
                                    InfoResolver.Resolve <FortInfo>().Language.DefaultLanguage = languageInfo;
                                }
                            }
                        }
                        if (changes.Any(change1 => change1.IsAnyDataChanged()))
                        {
                            languageEditorInfo.Save();
                            InfoResolver.Resolve <FortInfo>().Save();
                        }
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
                change.ChildrenChange = changes.ToArray();
            }

            return(change);
        }
예제 #7
0
 public static void ShowFortSettings()
 {
     EditorInfoResolver.ShowInfo <FortInfo>();
 }
예제 #8
0
 public static void ShowSetting()
 {
     EditorInfoResolver.ShowInfo <TaplighInfo>();
 }
예제 #9
0
 public static void ShowSetting()
 {
     EditorInfoResolver.ShowInfo <BacktoryInfo>();
 }
예제 #10
0
        public Promise <T, ICallError> Call <T>(string methodName, object requestBody)
        {
            Deferred <T, ICallError> deferred = new Deferred <T, ICallError>();
            IDispatcher dispatcher            = EditorDispatcher.Dispatcher;
            string      url = string.Format("https://api.backtory.com/cloud-code/{0}/{1}", InfoResolver.Resolve <BacktoryInfo>().CloudId, methodName);

            if (!string.IsNullOrEmpty(BacktoryCloudUrl.Url))
            {
                url = new Uri(new Uri(BacktoryCloudUrl.Url), new Uri(string.Format("/{0}", methodName), UriKind.Relative)).ToString();
            }
            string authenticationId        = InfoResolver.Resolve <BacktoryInfo>().AuthenticationId;
            string authenticationMasterKey = EditorInfoResolver.Resolve <BacktoryEditorInfo>().AuthenticationMasterKey;
            string body = JsonConvert.SerializeObject(requestBody);

            if (body == "null")
            {
                body = "{}";
            }
            ThreadPool.QueueUserWorkItem(state =>
            {
                MasterLogin(authenticationId, authenticationMasterKey).Then(response =>
                {
                    string authorization = string.Format("{0} {1}", response.TokenType, response.AccessToken);
                    try
                    {
                        string iUrl = url;
                        HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(iUrl));
                        webRequest.KeepAlive      = true;
                        webRequest.Method         = "POST";
                        webRequest.ContentType    = "application/json; charset=utf-8";
                        if (!string.IsNullOrEmpty(authorization))
                        {
                            webRequest.Headers.Add("Authorization", authorization);
                        }


                        byte[] resoponse         = Encoding.UTF8.GetBytes(body);
                        webRequest.ContentLength = resoponse.Length;
                        using (System.IO.Stream requestStream = webRequest.GetRequestStream())
                        {
                            requestStream.Write(resoponse, 0, resoponse.Length);
                        }
                        using (WebResponse webResponse = webRequest.GetResponse())
                        {
                            using (System.IO.Stream responseStream = webResponse.GetResponseStream())
                            {
                                using (StreamReader reader = new StreamReader(responseStream))
                                {
                                    string readToEnd = reader.ReadToEnd();
                                    dispatcher.Dispach(() =>
                                    {
                                        try
                                        {
                                            T result = JsonConvert.DeserializeObject <T>(readToEnd);
                                            deferred.Resolve(result);
                                        }
                                        catch (Exception)
                                        {
                                            deferred.Reject(new BactkoryCallError(HttpStatusCode.Continue,
                                                                                  CallErrorType.MethodConversionFailed));
                                        }
                                    });
                                }
                            }
                        }
                    }
                    catch (WebException we)
                    {
                        Debug.LogException(we);
                        dispatcher.Dispach(() =>
                        {
                            HttpWebResponse httpWebResponse = we.Response as HttpWebResponse;
                            if (httpWebResponse != null)
                            {
                                deferred.Reject(new BacktoryEditorCallError(CallErrorType.Other, false,
                                                                            httpWebResponse.StatusCode));
                            }
                            deferred.Reject(new BacktoryEditorCallError(CallErrorType.Other, false,
                                                                        HttpStatusCode.Continue));
                        });
                    }
                    catch (Exception)
                    {
                        deferred.Reject(new BacktoryEditorCallError(CallErrorType.Other, false, HttpStatusCode.Continue));
                    }
                }, () =>
                {
                    dispatcher.Dispach(() =>
                    {
                        deferred.Reject(new BacktoryEditorCallError(CallErrorType.Other, true, HttpStatusCode.Continue));
                    });
                });
            });
            return(deferred.Promise());
        }
예제 #11
0
        public ComplitionPromise <string[]> SendFilesToStorage(StorageFile[] storageFiles, Action <float> progress)
        {
            ComplitionDeferred <string[]> deferred = new ComplitionDeferred <string[]>();

            if (storageFiles.Length == 0)
            {
                deferred.Resolve(new string[0]);
                return(deferred.Promise());
            }
            string boundary = "----WebKitFormBoundaryS3pOJgmMVoMmQZ9Y";
            MultiPartFormDataStream dataStream = new MultiPartFormDataStream(boundary, storageFiles.Select((file, i) =>
            {
                MultiPartParameter[] multiPartParameters = new MultiPartParameter[4];
                multiPartParameters[0] = new StreamMultiPartParameter(boundary, string.Format("fileItems[{0}].fileToUpload", i), file.FileName, file.Stream);
                multiPartParameters[1] = new StringMultiPartParameter(boundary, string.Format("fileItems[{0}].path", i), file.Path);
                multiPartParameters[2] = new StringMultiPartParameter(boundary, string.Format("fileItems[{0}].replacing", i), "true");
                multiPartParameters[3] = new StringMultiPartParameter(boundary, string.Format("fileItems[{0}].extract", i), "false");
                return(multiPartParameters);
            }).SelectMany(parameters => parameters).ToArray());

/*            using (FileStream test = File.Create(@"d:\1.log"))
 *          {
 *              dataStream.CopyTo(test);
 *
 *          }
 *          return null;*/
            string      authenticationId        = InfoResolver.Resolve <BacktoryInfo>().AuthenticationId;
            string      authenticationMasterKey = EditorInfoResolver.Resolve <BacktoryEditorInfo>().AuthenticationMasterKey;
            string      storageId  = EditorInfoResolver.Resolve <BacktoryEditorInfo>().StorageId;
            string      url        = "https://storage.backtory.com/files";
            IDispatcher dispatcher = EditorDispatcher.Dispatcher;

            ThreadPool.QueueUserWorkItem(state =>
            {
                MasterLogin(authenticationId, authenticationMasterKey).Then(response =>
                {
                    try
                    {
                        string authorization      = string.Format("{0} {1}", response.TokenType, response.AccessToken);
                        HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(url));
                        webRequest.KeepAlive      = true;
                        webRequest.Method         = "POST";

                        webRequest.ContentType = "multipart/form-data; boundary=" + boundary;
                        webRequest.Headers.Add("x-backtory-storage-id", storageId);
                        webRequest.Headers.Add("Authorization", authorization);
                        webRequest.ContentLength = dataStream.Length;
                        using (System.IO.Stream requestStream = webRequest.GetRequestStream())
                        {
                            int bytesRead;
                            byte[] buffer  = new byte[2048];
                            long wroteSize = 0;
                            while ((bytesRead = dataStream.Read(buffer, 0, buffer.Length)) != 0)
                            {
                                requestStream.Write(buffer, 0, bytesRead);
                                wroteSize           += bytesRead;
                                float normalPosition = (float)wroteSize / dataStream.Length;
                                dispatcher.Dispach(() =>
                                {
                                    progress(normalPosition);
                                });
                            }
                            using (WebResponse webResponse = webRequest.GetResponse())
                            {
                                using (System.IO.Stream responseStream = webResponse.GetResponseStream())
                                {
                                    using (StreamReader reader = new StreamReader(responseStream))
                                    {
                                        string readToEnd = reader.ReadToEnd();
                                        BacktoryStorageResoponce backtoryStorageResoponce = JsonConvert.DeserializeObject <BacktoryStorageResoponce>(readToEnd);
                                        foreach (StorageFile storageFile in storageFiles)
                                        {
                                            storageFile.Stream.Close();
                                        }
                                        dispatcher.Dispach(() => deferred.Resolve(backtoryStorageResoponce.SavedFilesUrls));
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        foreach (StorageFile storageFile in storageFiles)
                        {
                            storageFile.Stream.Close();
                        }
                        Debug.LogException(e);
                        dispatcher.Dispach(() => deferred.Reject());
                    }
                }, () =>
                {
                    foreach (StorageFile storageFile in storageFiles)
                    {
                        storageFile.Stream.Close();
                    }
                    dispatcher.Dispach(() => deferred.Reject());
                });
            });
            return(deferred.Promise());
        }
예제 #12
0
        public static void ExportIapPackages()
        {
            string path = EditorUtility.SaveFilePanel("Export Iap packages", "", "", "xls");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            using (Stream writer = File.Create(path))
            {
                ExportData exportData = new ExportData();
                foreach (IapPackageInfo iapPackageInfo in InfoResolver.Resolve <FortInfo>().Package.Packages)
                {
                    ExportRow exportRow = new ExportRow();
                    exportRow.AddParameter("Sku", new Parameter
                    {
                        Value = iapPackageInfo.Sku,
                        Type  = typeof(string)
                    });
                    LanguageInfo[] languageInfos = EditorInfoResolver.Resolve <LanguageEditorInfo>().Languages;
                    if (languageInfos.Length == 1)
                    {
                        if (iapPackageInfo.DisplayName != null)
                        {
                            if (languageInfos[0].LanguageDatas.ContainsKey(iapPackageInfo.DisplayName.Id))
                            {
                                exportRow.AddParameter("DisplayName", new Parameter
                                {
                                    Value = languageInfos[0].LanguageDatas[iapPackageInfo.DisplayName.Id],
                                    Type  = typeof(string)
                                });
                            }
                        }
                    }
                    else
                    {
                        foreach (LanguageInfo languageInfo in EditorInfoResolver.Resolve <LanguageEditorInfo>().Languages)
                        {
                            if (iapPackageInfo.DisplayName != null)
                            {
                                if (languageInfo.LanguageDatas.ContainsKey(iapPackageInfo.DisplayName.Id))
                                {
                                    exportRow.AddParameter(string.Format("DisplayName-{0}", languageInfo.Name), new Parameter
                                    {
                                        Value = languageInfo.LanguageDatas[iapPackageInfo.DisplayName.Id],
                                        Type  = typeof(string)
                                    });
                                }
                            }
                        }
                    }
                    exportRow.AddParameter("Price", new Parameter
                    {
                        Value = iapPackageInfo.Price,
                        Type  = typeof(int)
                    });
                    exportRow.AddCustomExportParameter(iapPackageInfo);
                    exportData.AddRow(exportRow);
                }
                HSSFWorkbook workbook = new HSSFWorkbook();

                HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet("Iap packages");
                exportData.SerializeToSheet(sheet);
                workbook.Write(writer);
            }
        }
예제 #13
0
        public static void ImportLanguages()
        {
            string path = EditorUtility.OpenFilePanel("Import Languages", "", "xls");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            using (Stream reader = File.OpenRead(path))
            {
                HSSFWorkbook       workbook           = new HSSFWorkbook(reader);
                ISheet             sheet              = workbook.GetSheetAt(0);
                int                index              = 0;
                List <string>      languageNames      = new List <string>();
                LanguageEditorInfo languageEditorInfo = EditorInfoResolver.Resolve <LanguageEditorInfo>();
                LanguageItem[]     allLanguageItems   =
                    TypeHelper.GetAllTypes(AllTypeCategory.All)
                    .Where(type => typeof(IInfo).IsAssignableFrom(type))
                    .Select(type => TypeHelper.FindType(InfoResolver.Resolve(type), typeof(LanguageItem <string>)))
                    .SelectMany(objects => objects)
                    .Cast <LanguageItem>()
                    .ToArray();
                while (true)
                {
                    IRow row = sheet.GetRow(index);
                    if (row == null)
                    {
                        break;
                    }
                    if (index == 0)
                    {
                        List <string> headers   = new List <string>();
                        int           cellIndex = 0;
                        while (true)
                        {
                            ICell cell = row.GetCell(cellIndex++);
                            if (cell == null)
                            {
                                break;
                            }
                            headers.Add(cell.ToString());
                        }
                        for (int i = 1; i < headers.Count; i++)
                        {
                            languageNames.Add(headers[i]);
                        }
                    }
                    else
                    {
                        string itemId = string.Empty;
                        for (int i = 0; i < languageNames.Count + 1; i++)
                        {
                            if (i == 0)
                            {
                                ICell cell = row.GetCell(i);
                                if (cell == null)
                                {
                                    break;
                                }
                                itemId = cell.ToString();
                                if (allLanguageItems.All(item => item.Id != itemId))
                                {
                                    break;
                                }
                            }
                            else
                            {
                                ICell cell = row.GetCell(i);
                                if (cell == null)
                                {
                                    break;
                                }
                                LanguageInfo languageInfo = languageEditorInfo.Languages.FirstOrDefault(info => info.Name == languageNames[i - 1]);
                                if (languageInfo == null)
                                {
                                    continue;
                                }
                                languageInfo.LanguageDatas[itemId] = cell.ToString();
                            }
                        }
                    }
                    index++;
                }
                languageEditorInfo.SyncFortAndSave(true);
            }
        }