예제 #1
0
    public void SaveLoadResourceList()
    {
        // var pJsonData = new JsonData();

        // foreach (var kvp in m_pDicResourceLoadInfo)
        // {
        //     foreach (var pValue in kvp.Value)
        //     {
        //         pJsonData[string.Format("Scene : {0}", kvp.Key)].Add(pValue);
        //     }
        // }

        // var pJsonWriter = new JsonWriter();
        // pJsonWriter.PrettyPrint = true;
        // JsonMapper.ToJson(pJsonData, pJsonWriter);

        // string strSavePath = string.Format("{0}/{1}.json", SHPath.GetAssets(), "RealTimeResourceLoadInfo");
        // SHUtils.SaveFile(pJsonWriter.ToString(), strSavePath);

        string strBuff = string.Empty;

        foreach (var kvp in m_pDicResourceLoadInfo)
        {
            foreach (var pValue in kvp.Value)
            {
                strBuff += string.Format("Scene : {0}\n{1}\n", kvp.Key, pValue);
            }
        }

        string strSavePath = string.Format("{0}/{1}.txt", SHPath.GetRoot(), "RealTimeResourceLoadInfo");

        SHUtils.SaveFile(strBuff, strSavePath);
        Process.Start(strSavePath);
    }
예제 #2
0
    // 인터페이스 : 번들 리스트를 Json형태로 번들정보파일포맷으로 쓰기
    //public static void SaveToAssetBundleInfo(Dictionary<string, AssetBundleInfo> dicTable, string strSaveFilePath)
    //{
    //    if (0 == dicTable.Count)
    //        return;

    //    var pBundleListJsonData = new JsonData();
    //    SHUtils.ForToDic(dicTable, (pKey, pValue) =>
    //    {
    //        var pBundleJsonData = new JsonData();
    //        pBundleJsonData["s_BundleName"] = pValue.m_strBundleName;
    //        pBundleJsonData["s_BundleSize"] = pValue.m_lBundleSize;
    //        pBundleJsonData["s_BundleHash"] = pValue.m_pHash128.ToString();

    //        SHUtils.ForToDic(pValue.m_dicResources, (pResKey, pResValue) =>
    //        {
    //            pBundleJsonData["p_Resources"].Add(MakeResourceJsonData(pResValue));
    //        });

    //        pBundleListJsonData.Add(pBundleJsonData);
    //    });

    //    var pJsonWriter = new JsonWriter();
    //    pJsonWriter.PrettyPrint = true;
    //    JsonMapper.ToJson(pBundleListJsonData, pJsonWriter);

    //    SHUtils.SaveFile(pJsonWriter.ToString(), strSaveFilePath);
    //}

    // 인터페이스 : 중복파일 리스트 내보내기
    public static void SaveToDuplicationList(Dictionary <string, List <string> > dicDuplications, string strSaveFilePath)
    {
        if (0 == dicDuplications.Count)
        {
            return;
        }

        var pDuplicationJsonData = new JsonData();

        foreach (var kvp in dicDuplications)
        {
            var pFilesJsonData = new JsonData();
            foreach (var strPath in kvp.Value)
            {
                pFilesJsonData.Add(strPath);
            }
            pDuplicationJsonData[string.Format("FileName_{0}", kvp.Key)] = pFilesJsonData;
        }

        var pJsonWriter = new JsonWriter();

        pJsonWriter.PrettyPrint = true;
        JsonMapper.ToJson(pDuplicationJsonData, pJsonWriter);

        SHUtils.SaveFile(pJsonWriter.ToString(), strSaveFilePath);
    }
예제 #3
0
    // 인터페이스 : 리소스 리스트를 Json형태로 쓰기
    public static void SaveToResources(Dictionary <string, SHResourcesTableInfo> dicTable, string strSaveFilePath)
    {
        if (0 == dicTable.Count)
        {
            return;
        }

        string strNewLine = "\r\n";
        string strBuff    = "{" + strNewLine;

        // 테이블별 내용작성
        strBuff += string.Format("\t\"{0}\": [{1}", "ResourcesList", strNewLine);
        SHUtils.ForToDic(dicTable, (pKey, pValue) =>
        {
            strBuff += "\t\t{" + strNewLine;
            strBuff += SHResourcesLister.MakeSaveFormat(pValue, "\t\t");
            strBuff += "\t\t}," + strNewLine;
        });
        strBuff  = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
        strBuff += string.Format("\t]{0}", strNewLine);
        strBuff += "}";

        // 저장
        SHUtils.SaveFile(strBuff, strSaveFilePath);
    }
    static void SelectFiles()
    {
        // 시작팝업
        if (false == ShowDialog("[SHTools] Prefab Dependency Check",
                                "리소스 폴더 내에 있는 원본 리소스들이\n선택한 프리팹에 종속되어 있는지 체크합니다.",
                                "확인", "취소"))
        {
            return;
        }

        // 선택 오브젝트 체크
        var pObjects = new List <UnityEngine.Object>(Selection.objects);

        if (0 == pObjects.Count)
        {
            ShowDialog("[SHTools] Resources Listing", "선택된 프리팹이 없습니다.", "확인");
            return;
        }

        // 알리아싱
        var pChecker = new SHPrefabDependencyChecker();

        // 절대경로처리
        var strAbsolutePath = SHPath.GetPathToAssets();

        strAbsolutePath = strAbsolutePath.Substring(0, (strAbsolutePath.IndexOf("Assets") - 1)).Replace("\\", "/");

        // 종속체크
        string strBuff = string.Empty;

        SHUtils.ForToList(pObjects, (pObject) =>
        {
            string strSearchPath = string.Format("{0}/{1}", strAbsolutePath, AssetDatabase.GetAssetPath(pObject));
            SHUtils.Search(strSearchPath, (pFileInfo) =>
            {
                var pDependencys = pChecker.GetDependency(pFileInfo.FullName);
                if (null == pDependencys)
                {
                    return;
                }

                strBuff += string.Format("< Prefab : {0} >\n", Path.GetFileNameWithoutExtension(pFileInfo.FullName));
                SHUtils.ForToList(pDependencys, (pDependency) =>
                {
                    strBuff += string.Format("    Dependency : {0}\n", pDependency);
                });
            });
        });

        string strSavePath = string.Format("{0}/{1}", strAbsolutePath, "DependencyList.txt");

        SHUtils.SaveFile(strBuff, strSavePath);
        System.Diagnostics.Process.Start(strSavePath);
    }
예제 #5
0
    // 인터페이스 : 번들 리스트를 Json형태로 번들정보파일포맷으로 쓰기
    public static void SaveToAssetBundleInfo(Dictionary <string, AssetBundleInfo> dicTable, string strSaveFilePath)
    {
        if (0 == dicTable.Count)
        {
            return;
        }

        string strNewLine = "\r\n";
        string strBuff    = "{" + strNewLine;

        // 테이블별 내용작성
        strBuff += string.Format("\t\"{0}\": [{1}", "AssetBundleInfo", strNewLine);
        SHUtils.ForToDic(dicTable, (pKey, pValue) =>
        {
            strBuff += "\t\t{" + strNewLine;

            strBuff += string.Format("\t\t\t\"s_BundleName\": \"{0}\",{1}",
                                     pValue.m_strBundleName,
                                     strNewLine);

            strBuff += string.Format("\t\t\t\"s_BundleSize\": \"{0}\",{1}",
                                     pValue.m_lBundleSize,
                                     strNewLine);

            strBuff += string.Format("\t\t\t\"s_BundleHash\": \"{0}\",{1}",
                                     pValue.m_pHash128.ToString(),
                                     strNewLine);

            strBuff += string.Format("\t\t\t\"p_Resources\": {0}", strNewLine);
            strBuff += "\t\t\t[" + strNewLine;

            SHUtils.ForToDic(pValue.m_dicResources, (pResKey, pResValue) =>
            {
                strBuff += "\t\t\t\t{" + strNewLine;
                strBuff += MakeSaveFormat(pResValue, "\t\t\t\t");
                strBuff += "\t\t\t\t}," + strNewLine;
            });
            strBuff = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);

            strBuff += "\t\t\t]" + strNewLine;
            strBuff += "\t\t}," + strNewLine;
        });
        strBuff  = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
        strBuff += string.Format("\t]{0}", strNewLine);
        strBuff += "}";

        // 저장
        SHUtils.SaveFile(strBuff, strSaveFilePath);
    }
예제 #6
0
    public void SaveLoadResourceList()
    {
        string strBuff = string.Empty;
        SHUtils.ForToDic(m_dicRealLoadInfo, (pKey, pValue) =>
        {
            strBuff += string.Format("Scene : {0}\n", pKey);
            SHUtils.ForToList(pValue, (pInfo) =>
            {
                strBuff += string.Format("\t{0}\n", pInfo);
            });
        });

        string strSavePath = string.Format("{0}/{1}", SHPath.GetPathToAssets(), "RealTimeLoadResource.txt");
        SHUtils.SaveFile(strBuff, strSavePath);
        System.Diagnostics.Process.Start(strSavePath);
    }
예제 #7
0
    // 인터페이스 : 리소스 리스트를 Json형태로 쓰기
    public static void SaveToResourcesInfo(Dictionary <string, SHResourcesInfo> dicTable, string strSaveFilePath)
    {
        if (0 == dicTable.Count)
        {
            return;
        }

        var pResourcesJsonData = new JsonData();

        foreach (var kvp in dicTable)
        {
            pResourcesJsonData.Add(MakeResourceJsonData(kvp.Value));
        }

        var pJsonWriter = new JsonWriter();

        pJsonWriter.PrettyPrint = true;
        JsonMapper.ToJson(pResourcesJsonData, pJsonWriter);

        SHUtils.SaveFile(pJsonWriter.ToString(), strSaveFilePath);
    }
예제 #8
0
    // 인터페이스 : 중복파일 리스트 내보내기
    public static void SaveToDuplicationList(Dictionary <string, List <string> > dicDuplications, string strSaveFilePath)
    {
        if (0 == dicDuplications.Count)
        {
            return;
        }

        string strNewLine = "\r\n";
        string strBuff    = string.Empty;

        SHUtils.ForToDic(dicDuplications, (pKey, pValue) =>
        {
            strBuff += string.Format("FileName : {0}{1}", pKey, strNewLine);
            SHUtils.ForToList(pValue, (strPath) =>
            {
                strBuff += string.Format("\tPath : Resources/{0}{1}", strPath, strNewLine);
            });
            strBuff += string.Format("{0}", strNewLine);
        });

        SHUtils.SaveFile(strBuff, strSaveFilePath);
    }
    public void SaveJsonFile(string strSavePath)
    {
        string strNewLine = "\r\n";
        string strBuff    = "{" + strNewLine;

        strBuff += string.Format("\t\"{0}\": {1}", "ClientConfiguration", strNewLine);
        strBuff += "\t{" + strNewLine;
        {
            strBuff += string.Format("\t\t\"ServerConfigurationCDN\": \"{0}\",{1}",
                                     m_strConfigurationCDN,
                                     strNewLine);

            strBuff += string.Format("\t\t\"ServiceMode\": \"{0}\",{1}",
                                     m_strServiceMode,
                                     strNewLine);

            strBuff += string.Format("\t\t\"Version\": \"{0}\",{1}",
                                     m_strVersion,
                                     strNewLine);

            strBuff += string.Format("\t\t\"VSyncCount\": {0},{1}",
                                     m_iVSyncCount,
                                     strNewLine);

            strBuff += string.Format("\t\t\"FrameRate\": {0},{1}",
                                     m_iFrameRate,
                                     strNewLine);

            strBuff += string.Format("\t\t\"CacheSize(MB)\": {0}{1}",
                                     m_iCacheSize,
                                     strNewLine);
        }
        strBuff += "\t}";
        strBuff += string.Format("{0}", strNewLine);
        strBuff += "}";

        // 저장
        SHUtils.SaveFile(strBuff, string.Format("{0}/{1}.json", strSavePath, m_strFileName));
    }
예제 #10
0
    // 인터페이스 : DataSet을 Json으로 쓰기
    public void Write(string strFileName, Dictionary <string, List <SHTableDataSet> > dicData)
    {
        #if UNITY_EDITOR
        if (null == dicData)
        {
            Debug.LogError(string.Format("Json으로 저장할 데이터가 없습니다!!"));
            return;
        }

        string strNewLine = "\r\n";
        string strBuff    = "{" + strNewLine;
        SHUtils.ForToDic(dicData, (pKey, pValue) =>
        {
            strBuff += string.Format("\t\"{0}\": [{1}", pKey, strNewLine);
            SHUtils.ForToList(pValue, (pData) =>
            {
                strBuff += "\t\t{" + strNewLine;
                SHUtils.For(0, pData.m_iMaxCol, (iCol) =>
                {
                    strBuff += string.Format("\t\t\t\"{0}\": {1},{2}",
                                             pData.m_ColumnNames[iCol],
                                             pData.m_pDatas[iCol],
                                             strNewLine);
                });
                strBuff  = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
                strBuff += "\t\t}," + strNewLine;
            });
            strBuff  = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
            strBuff += string.Format("\t],{0}", strNewLine);
        });
        strBuff  = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
        strBuff += "}";

        SHUtils.SaveFile(strBuff, string.Format("{0}/{1}.json", SHPath.GetPathToJson(), Path.GetFileNameWithoutExtension(strFileName)));
        #endif
    }
    // 인터페이스 : 데이터 내용 Json파일로 저장하기
    public void SaveJsonFile(string strSavePath)
    {
        string strNewLine = "\r\n";
        string strBuff    = "{" + strNewLine;

        strBuff += string.Format("\t\"{0}\": {1}", "ServerConfiguration", strNewLine);
        strBuff += "\t{" + strNewLine;
        {
            strBuff += string.Format("\t\t\"AOS_MarketURL\": \"{0}\",{1}",
                                     m_strAOSMarketURL,
                                     strNewLine);

            strBuff += string.Format("\t\t\"IOS_MarketURL\": \"{0}\",{1}",
                                     m_strIOSMarketURL,
                                     strNewLine);

            // 모드별 정보
            SHUtils.ForToEnum <eServiceMode>((eMode) =>
            {
                if (eServiceMode.None == eMode)
                {
                    return;
                }

                strBuff += string.Format("\t\t\"{0}\":{1}",
                                         eMode.ToString(),
                                         strNewLine);
                strBuff += "\t\t{" + strNewLine;
                {
                    var pData = m_dicServerInfo[eMode];

                    strBuff += string.Format("\t\t\t\"ClientVersion\": \"{0}\",{1}",
                                             pData.m_strClientVersion,
                                             strNewLine);

                    strBuff += string.Format("\t\t\t\"GameServerURL\": \"{0}\",{1}",
                                             pData.m_strGameServerURL,
                                             strNewLine);

                    strBuff += string.Format("\t\t\t\"BundleCDN\": \"{0}\",{1}",
                                             pData.m_strBundleCDN,
                                             strNewLine);

                    strBuff += string.Format("\t\t\t\"CheckMessage\": \"{0}\",{1}",
                                             pData.m_strCheckMessage,
                                             strNewLine);

                    strBuff += string.Format("\t\t\t\"ServiceState\": \"{0}\"{1}",
                                             pData.m_strServiceState,
                                             strNewLine);
                }
                strBuff += "\t\t}," + strNewLine;
            });

            strBuff = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
        }
        strBuff += "\t}";
        strBuff += string.Format("{0}", strNewLine);
        strBuff += "}";

        // 저장
        SHUtils.SaveFile(strBuff, string.Format("{0}/{1}.json", strSavePath, m_strFileName));
    }