Ejemplo n.º 1
0
        /// 普通资源,非bundle,直接拷贝 二进制文件组
        static void BuildNormalResource(BinaryPackInfo ResInfo, string ifsBuildDir)
        {
            if (ResInfo == null)
            {
                return;
            }

            for (int j = 0; j < ResInfo.Resources.Count; j++)
            {
                ResInfo res = ResInfo.Resources[j];

                string resourceFullPathInResources = res.Path + res.Ext;
                string resourceSrcFullPath         = JW.Res.FileUtil.CombinePaths(Application.dataPath, "Resources", resourceFullPathInResources);
                string resourceDstFullDirectory    = JW.Res.FileUtil.CombinePaths(
                    ifsBuildDir,
                    "",
                    JW.Res.FileUtil.GetFullDirectory(resourceFullPathInResources));

                if (!JW.Res.FileUtil.IsDirectoryExist(resourceDstFullDirectory))
                {
                    JW.Res.FileUtil.CreateDirectory(resourceDstFullDirectory);
                }

                string resourceDstFullPath = JW.Res.FileUtil.CombinePath(resourceDstFullDirectory, JW.Res.FileUtil.GetFullName(resourceFullPathInResources));
                if (JW.Res.FileUtil.IsFileExist(resourceSrcFullPath))
                {
                    JW.Res.FileUtil.CopyFile(resourceSrcFullPath, resourceDstFullPath);
                }
                else
                {
                    Terminate("CopyBinaryError:" + "File " + resourceFullPathInResources + " is not exist!");
                }
            }
        }
Ejemplo n.º 2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="onUpdate"></param>
    /// <returns></returns>
    IEnumerator LoadResourcesFromQueue(OnUpdateProgress onUpdate)
    {
        int total = m_loadingQueue.Count;
        LoadingProgressInfo prog = new LoadingProgressInfo(LoadingProgressType.Resource, m_loadingQueue.Count);

        onUpdate(prog);
        yield return(null);

        while (m_loadingQueue.Count > 0)
        {
            ResInfo res = m_loadingQueue.Dequeue();
            switch (res.type)
            {
            case DataType.UnitData:
                LoadUnit(res.path);
                break;

            case DataType.ProjectileData:
                LoadProjectile(res.path);
                break;
            }
            prog.value += 1.0f;
            ;
            onUpdate(prog);
            yield return(null);
        }
        // yield return *;
    }
Ejemplo n.º 3
0
//  QuestInfo fillQuestInfo(QuestInfo quest){
//    QHexBoard qBoard = new QHexBoard(BaseSaver.getBoardInfo().width, BaseSaver.getBoardInfo().height, HexCellPrefab);
//    HexCell[] cells = qBoard.getCells();
//    TileInfo[] tiles = BaseSaver.getTiles ();
//    UnitInfo[] units = BaseSaver.getUnits ();
//
//    for(int i = 0; i < cells.Length; i++){
//      cells [i].SetTile (tiles [i]);
//      cells [i].SetInfo (units[i]);
//    }
//
//    List<HexCell> dests = new List<HexCell> ();
//
//    int sIdx = 0;
//    for (int i = 0; i < units.Length; i++) {
//      if (units[i].human) {
//        quest.startIdx = cells[i].coordinates;
//        sIdx = i;
//        break;
//      }
//    }
//    Debug.Log ("Starting idx: " + quest.startIdx.ToString());
//    for (int i = 0; i < cells.Length; i++) {
//      if (cells[i].GetTile().type == quest.locType && !cells[i].GetTile().interaction) {
//        HexCell[] path = HexAI.aStar (cells,cells[sIdx],cells[i]);
//        if(path != null && path.Length < 10){
//          dests.Add (cells[i]);
//        }
//      }
//    }
//
//    if (dests.Count > 0) {
//      HexCell[] theseDests = dests.ToArray ();
//      HexUtilities.ShuffleArray (theseDests);
//
//      theseDests [0].GetTile().interaction = true;
//      quest.endIdx = theseDests [0].coordinates;
//      Debug.Log ("Destination Set: " + quest.endIdx.ToString ());
//      BaseSaver.setTiles (tiles);
//      Debug.Log ("Tiles saved");
//    } else {
//      Debug.Log ("No destinations! Quest invalid...");
//    }
//
//    return quest;
//  }

    QuestInfo[] returnValidQ(ResInfo resI, GameInfo gameI)
    {
        List <string> playerQuestTitles = new List <String> ();

        QuestInfo.QuestGroup thisQ       = QuestInfo.QuestGroup.None;
        String[]             names       = Enum.GetNames(typeof(QuestInfo.QuestGroup));
        List <QuestInfo>     validQuests = new List <QuestInfo> ();

        foreach (QuestInfo quest in gameI.quests)
        {
            playerQuestTitles.Add(quest.title);
        }
        for (int i = 0; i < names.Length; i++)
        {
            if (names[i].Equals(resI.name))
            {
                thisQ = (QuestInfo.QuestGroup)Enum.GetValues(typeof(QuestInfo.QuestGroup)).GetValue(i);
                break;
            }
        }
        if (thisQ != QuestInfo.QuestGroup.None)
        {
            foreach (QuestInfo quest in availableQuests)
            {
                if (quest.questGroup == thisQ && !playerQuestTitles.Contains(quest.title))
                {
                    validQuests.Add(quest);
                }
            }
        }
        return(validQuests.ToArray());
    }
Ejemplo n.º 4
0
        //-------------------------------------------------------------
        // 概要:スレッドデータ解析
        // 詳細:datからレス一覧情報を作成する
        //-------------------------------------------------------------
        override protected List <ResInfo> AnalyzeDatText(string[] lines, bool isHtmlDecode)
        {
            Logger.Instance.DebugFormat("AnalyzeDatText(isHtmlDecode:{0})", isHtmlDecode);

            List <ResInfo> resList = new List <ResInfo>();

            foreach (var line in lines.Select((v, i) => new { v, i }))
            {
                if (String.IsNullOrEmpty(line.v))
                {
                    continue;
                }

                String[] data = line.v.Split(new[] { "<>" }, StringSplitOptions.None);

                string  mail    = data[(int)DatIndex.Mail];
                string  message = data[(int)DatIndex.Message];
                string  name    = data[(int)DatIndex.Name];
                ResInfo resInfo = new ResInfo
                {
                    ResNo   = (line.i + 1).ToString(),
                    Date    = data[(int)DatIndex.DateAndId],
                    Id      = "",                             // TODO IDを取得する
                    Mail    = isHtmlDecode ? HttpUtility.HtmlDecode(mail) : mail,
                    Message = isHtmlDecode ? HttpUtility.HtmlDecode(message) : message,
                    Name    = isHtmlDecode ? HttpUtility.HtmlDecode(name) : name,
                };
                resList.Add(resInfo);
            }

            return(resList);
        }
        public string AddExistFileAtSubDirectory(string subDirToRoot, string pathToSub)
        {
            if (!this.subDirectoriesMap.ContainsKey(subDirToRoot))
            {
                AddSubDirectory(subDirToRoot);
            }

            var sub = this.subDirectoriesMap[subDirToRoot];

            var res = new ResInfo()
            {
                src         = "existed",
                dst         = Path.Combine(sub.FullName, pathToSub),
                hashCheck   = false,
                isDirectory = false
            };

            if (this.subDirectoriesFilesMap.ContainsKey(sub))
            {
                var m = this.subDirectoriesFilesMap[sub];
                if (!m.ContainsKey(pathToSub))
                {
                    m.Add(pathToSub, res);
                }
            }
            else
            {
                var map = new Dictionary <string, ResInfo> ();
                map.Add(pathToSub, res);
                this.subDirectoriesFilesMap.Add(sub, map);
            }

            return(res.dst);
        }
Ejemplo n.º 6
0
        public float m_headPos;        // 头顶位置,因为外部逻辑,这个位置会变动


        public Entity(int handle, Action <Entity> notity, eEntityType tpye, EntityBaseInfo baseInfo)
        {
            if (baseInfo.m_resID == 0)
            {
                Debug.LogError("资源id为0,请检查配置");
                return;
            }
            m_entityInitNofity = notity;
            m_hid            = handle;
            m_entityType     = tpye;
            m_entityInfo     = baseInfo;
            m_LoadingDestory = false;
            //Debug.LogError("请求加载资源。。。。。。。。。。。。"+ m_entityInfo.m_resID);
            if (!string.IsNullOrEmpty(m_entityInfo.m_strName))
            {
                m_res = ResourceFactory.Inst.LoadResource(m_entityInfo.m_strName, ResourceLoaded);
            }
            else
            {
                ResInfo resInfo = ResInfosResource.GetResInfo(m_entityInfo.m_resID);
                if (resInfo != null && resInfo.strUrl != null)
                {
                    m_entityInfo.m_strName = resInfo.strName;
                    m_res = ResourceFactory.Inst.LoadResource(m_entityInfo.m_resID, ResourceLoaded);
                }
                else
                {
                    Debug.LogError("创建失败,无资源id:" + m_entityInfo.m_resID + " 现用灰色盒子代替,请注意更换!");
                    m_res = ResourceFactory.Inst.LoadResource(4, ResourceLoaded);
                }
            }
        }
Ejemplo n.º 7
0
    void Update()
    {
        while (_loading.Count < AsyncLimit && _waitToLoad.Count > 0)
        {
            var resInfo = _waitToLoad.Dequeue();
            _loading.Add(resInfo);
            resInfo.LoadAsync();
        }

        for (int i = 0; i < _loading.Count; i++)
        {
            if (_loading[i].IsDone)
            {
                ResInfo resInfo = _loading[i];
                _loading.RemoveAt(i);
                AssetInfo assetInfo = new AssetInfo()
                {
                    resName      = resInfo.resName,
                    asset        = resInfo.Asset,
                    keepInMemory = resInfo.keepInMemory
                };
                AddToCache(assetInfo);
                resInfo.onLoadFinish(resInfo.Asset);
            }
        }
    }
Ejemplo n.º 8
0
    private static void GenerateABConfigeFile(string dir)
    {
        ABConfig abConfig = new ABConfig();

        abConfig.ListABRelation.Clear();
        foreach (var item in DicABRelation)
        {
            foreach (var abAndType in item.Value)
            {
                var resInfo = new ResInfo()
                {
                    abName = abAndType.Value, TypeRes = abAndType.Key.FullName, assetName = item.Key
                };
                abConfig.ListABRelation.Add(resInfo);
            }
        }
        using (FileStream fileStream = new FileStream($"{dir}/ABConfig.txt", FileMode.Create))
        {
            string json  = JsonUtility.ToJson(abConfig);
            byte[] bytes = JsonUtility.ToJson(abConfig, true).ToByteArray();
            fileStream.Write(bytes, 0, bytes.Length);
        }
        //设置bundle
        ETEditor.BuildEditor.SetBundle(abConfigPath, "ABConfig", true);
        AssetDatabase.Refresh();
        AssetDatabase.SaveAssets();
    }
Ejemplo n.º 9
0
        private void OnStartUpdate(ref List <string> updateList)
        {
            int totalSize = 0;

            ResInfo[] templist = new ResInfo[updateList.Count];
            for (int i = 0; i < updateList.Count; i++)
            {
                ResInfo resInfo = new ResInfo();
                resInfo.m_bDepend = false;
                resInfo.strName   = updateList[i];
                resInfo.strUrl    = updateList[i];
                resInfo.iType     = ResType.None;
                resInfo.m_size    = GetFileSize(resInfo.strUrl);
                templist[i]       = resInfo;

                totalSize += resInfo.m_size;
            }

            Client.Inst().m_uiResInitDialog.OpenPanel(true);
            Client.Inst().m_uiResInitDialog.Open("继续", "退出", "需要更新文件大小:" + MathEx.GetSize(totalSize), (bOk, a) =>
            {
                if (bOk)
                {
                    for (int i = 0; i < templist.Length; i++)
                    {
                        Resource res = ResourceFactory.Inst.LoadResource(templist[i], OnNewResLoaded);
                        m_updateList.Add(res);
                    }
                }
                else
                {
                    Application.Quit();
                }
            });
        }
Ejemplo n.º 10
0
    public List <ResInfo> GetResInfoList(String path)
    {
        var pathlist = ResInfo.GetPathList(path);

        //Debug.Log("************* pathlist[0]:" + pathlist[0]);
        if (!groups.ContainsKey(pathlist[0]))
        {
            Debug.Log("path err" + path);
        }
        var            GroudList = groups[pathlist[0]].listfiles;
        List <ResInfo> RetList   = new List <ResInfo>();

        foreach (var rif in GroudList.Values)
        {
            Boolean flag = true;
            if (pathlist.Length > 1)
            {
                for (int i = 1; i < pathlist.Length; i++)
                {
                    if (rif.PathList[i - 1] != pathlist[i])
                    {
                        flag = false;
                        break;
                    }
                }
            }
            if (flag)
            {
                RetList.Add(rif);
            }
        }

        return(RetList);
    }
Ejemplo n.º 11
0
 public bool AddFile(string key, string contentMd5, bool isFirstDown)
 {
     if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(contentMd5))
     {
         return(false);
     }
     key        = key.Trim();
     contentMd5 = contentMd5.Trim();
     if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(contentMd5))
     {
         return(false);
     }
     if (m_FileMd5Map.ContainsKey(key))
     {
         ResInfo info = m_FileMd5Map[key];
         m_ContentMd5ToNameMd5Map.Remove(info.fileContentMd5);
         info.fileContentMd5 = contentMd5;
         info.isFirstDown    = isFirstDown;
         m_FileMd5Map[key]   = info;
         m_ContentMd5ToNameMd5Map.Add(info.fileContentMd5, key);
     }
     else
     {
         ResInfo info = new ResInfo();
         info.fileContentMd5 = contentMd5;
         info.isFirstDown    = isFirstDown;
         m_FileMd5Map.Add(key, info);
         m_ContentMd5ToNameMd5Map.Add(info.fileContentMd5, key);
     }
     return(true);
 }
Ejemplo n.º 12
0
        private static byte[] LoadFile(ResInfo resInfo)
        {
            byte[] fileData;

            if (resInfo.CachedFile == null)
            {
                fileData = LoadFile(resInfo.ResFile, resInfo.Offset, resInfo.Size);

#if true
                {
                    Func <string> a_makeLocalName = () => "$" + SCommon.CRandom.GetRange(1, 3);
                    string        dir             = Path.Combine(WD.GetPath(a_makeLocalName()), a_makeLocalName(), a_makeLocalName(), a_makeLocalName());
                    SCommon.CreateDir(dir);
                    resInfo.CachedFile = Path.Combine(dir, "$" + CachedFileCounter++);
                }
#else // シンプル
                resInfo.CachedFile = WD.MakePath();
#endif

                File.WriteAllBytes(resInfo.CachedFile, fileData);
            }
            else
            {
                fileData = File.ReadAllBytes(resInfo.CachedFile);
            }
            return(fileData);
        }
Ejemplo n.º 13
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            ri = new ResInfo()
            {
                Nd   = comboBox1.Text,
                Xmlx = comboBox2.Text,
                Xmmc = textBox1.Text,
                Khlb = khlb.Text,
                Dy   = dy.Text,
                Ywlx = ywlx.Text,
                Zblx = zblx.Text,
                Ssqx = ssqx.Text,
                Ywnr = textBox2.Text,
                Rmb  = textBox3.Text,
                My   = textBox4.Text,
                Xj   = textBox5.Text,
                Qtsj = qtsj.Text,
                Bz   = textBox6.Text
            };
            string messageStr = null;

            if (rm.Add(ri, out messageStr))
            {
                MessageBox.Show("添加成功");
                this.Hide();
            }
            else
            {
                MessageBox.Show(messageStr);
            }
        }
Ejemplo n.º 14
0
 public PROTOCOL_BATTLE_RESPAWN_ACK(ResInfo info, Account p, Room room)
 {
     base.makeme();
     this._info = info;
     this._room = room;
     this._p    = p;
 }
Ejemplo n.º 15
0
    public List <ResInfo> GetServerResInfoList()
    {
        List <ResInfo> resInfoList = new List <ResInfo>();

        m_LocalVersionInfo = GetLocalVersionInfo();

        if (m_serverVersionInfo != null && m_LocalVersionInfo != null)
        {
            foreach (var item in m_serverVersionInfo.dictRes)
            {
                if (!m_LocalVersionInfo.dictRes.ContainsKey(item.Key))
                {
                    resInfoList.Add(item.Value);
                }
                else
                {
                    ResInfo localResInfo = m_LocalVersionInfo.dictRes[item.Key];
                    Debug.Log(item.Value.resMD5 + "----" + localResInfo.resMD5);
                    if (string.Compare(item.Value.resMD5, localResInfo.resMD5, true) != 0)
                    {
                        resInfoList.Add(item.Value);
                    }
                }
            }
        }
        return(resInfoList);
    }
Ejemplo n.º 16
0
        private void OnResInfoLoaded(Resource res)
        {
            ResourceFactory.Inst.UnLoadResource(res, true);

            // 读取CSV之前,初始化CSV管理器,把CSV信息传给DLL,进行CSV构建
            LogicSystem.Inst.InitCsv(ref CsvManager.Inst);
            // 给mapCsv赋值,编辑器状态读取本地配置,运行状态读取二进制数据
            if (Application.isEditor)
            {
                LoadCsvInEditor();
                OnCsvInfoLoaded(null);
                return;
            }

            //LogicSystem.Inst.InitCsv(ref CsvManager.Inst);
            CsvListResource.SetCsvList(CsvManager.Inst.m_mapCSV);
            ResInfo resInfo = new ResInfo();

            resInfo.m_bDepend = false;
            resInfo.strName   = "allcsvinfo";
            resInfo.strUrl    = "config/allcsvinfo";
            resInfo.iType     = ResType.CsvListResource;
            ResourceFactory.Inst.LoadResource(resInfo, OnCsvInfoLoaded);

            SceneManager.Inst.GetMapLoadProcess().strCurInfo = "正在加载配置表:";
            SceneManager.Inst.GetMapLoadProcess().fPercent   = 0.2f;
        }
Ejemplo n.º 17
0
    public void DownLoadSingleResItem(ResInfo info, Action <bool> onLoad)
    {
        List <ResInfo> list = new List <ResInfo>();

        list.Add(info);
        DownLoadRes(list, onLoad);
    }
Ejemplo n.º 18
0
    public bool LoadBuffer(byte[] bytes, int size)
    {
        MemoryStream ms       = new MemoryStream(bytes);
        BinaryReader br       = new BinaryReader(ms);
        int          version  = br.ReadInt32();
        int          resCount = br.ReadInt32();

        if (resCount < 0 || resCount > 9999)
        {
            ServerRoomManager.Instance.Log($"ResManager - LoadBuffer Error - count of resources is invalid: {resCount} - should between:{0}~{9999}");
            return(false);
        }

        AllRes.Clear();
        for (int i = 0; i < resCount; ++i)
        {
            int cellIndex = br.ReadInt32();

            ResInfo res = new ResInfo();
            res.LoadBuffer(br, version);
            AddRes(cellIndex, res);
        }
        ServerRoomManager.Instance.Log($"ResManager LoadBuffer OK - Count of Res :{AllRes.Count}"); // 资源个数

        return(true);
    }
Ejemplo n.º 19
0
    public ResInfo AddResInfo(ResInfo resInfo)
    {
        if (resInfoDict == null || resInfo == null)
        {
            return(null);
        }

        return(resInfoDict[resInfo.bundleName] = resInfo);
    }
Ejemplo n.º 20
0
 public void BindPipe(int pipe, long time, int emitter, long emitTime)
 {
     Debug.Assert(!_resTable[pipe].ContainsKey(time));
     _resTable[pipe][time] = new ResInfo()
     {
         depTime = emitTime,
         emitter = emitter
     };
 }
Ejemplo n.º 21
0
 // 逻辑初始化
 public void InitLayout()
 {
     foreach (KeyValuePair <int, Widget> item in m_dicGameAllPanel)
     {
         ResInfo resInfo = ResInfosResource.GetResInfo(1000 + (int)item.Key);
         if (resInfo != null)
         {
             m_dicWidgetByName.Add(resInfo.strName, item.Value);
         }
     }
 }
Ejemplo n.º 22
0
        //转换
        public static ResInfo ResFlag2Info(long resFlag)
        {
            ResInfo tmpResInfo = Game.ObjectPool.Fetch <ResInfo>();

            tmpResInfo.FileHash    = (uint)resFlag;
            tmpResInfo.FileHashStr = tmpResInfo.FileHash.ToString();
            tmpResInfo.ResPos      = (EResPos)((resFlag >> 32) & 0xff);
            tmpResInfo.ResSize     = (ushort)((resFlag >> 40) & 0xffff);

            return(tmpResInfo);
        }
Ejemplo n.º 23
0
    void DownLoadResItemFinish(bool result, string errorInfo, ResInfo item)
    {
        if (result)
        {
            //更新版本信息
            if (m_LocalVersionInfo.dictRes.ContainsKey(item.resName))
            {
                m_LocalVersionInfo.dictRes[item.resName].resMD5 = item.resMD5;
            }
            else
            {
                m_LocalVersionInfo.dictRes.Add(item.resName, item);
            }

            //保存版本信息
            SaveLocalVersionInfo(m_LocalVersionInfo);

            ++m_Current;
            if (m_Current == m_ListResInfo.Count)
            {
                m_UpdateFinish(true);
            }
            else
            {
                DownLoadResItem();
            }
        }
        else
        {
            System.Action <bool> onClick = delegate(bool isClickOK)
            {
                if (isClickOK)
                {
                    if (Application.internetReachability == NetworkReachability.NotReachable)
                    {
                        //更新失败,先检查网络
                        UITextTips.Instance.ShowText(LanguageConfig.GetText(12));
                    }
                    else
                    {
                        UIMsgBox.Instance.HideMsgBox();
                        DownLoadResItem();
                    }
                }
                else
                {
                    Application.Quit();
                }
            };

            //错误提示
            UIMsgBox.Instance.ShowMsgBoxOKCancel(LanguageConfig.WordUpdate, errorInfo, LanguageConfig.GetText(13), LanguageConfig.GetText(14), onClick, false);
        }
    }
 /// <summary>
 /// レスデータの置換
 /// </summary>
 private static string ReplaceResData(string documentText, ResInfo res)
 {
     return(documentText
            .Replace("<NUMBER/>", res.ResNo)
            .Replace("<PLAINNUMBER/>", res.ResNo)
            .Replace("<NAME/>", res.Name.Replace("<b>", ""))
            .Replace("<MAILNAME/>", string.Format("{0} : {1}", res.Mail, res.Name))
            .Replace("<MAIL/>", res.Mail)
            .Replace("<DATE/>", res.Date)
            .Replace("<MESSAGE/>", res.Message)
            .Replace("<ID/>", res.Id));
 }
Ejemplo n.º 25
0
 private void DestroyPackage(ResInfo resPkg, bool unloadAllObjects = false)
 {
     //if (resPkg != null)
     //{
     //    if (resPkg.assetBundle != null)
     //    {
     //        resPkg.assetBundle.Unload(unloadAllObjects);
     //        resPkg.assetBundle = null;
     //    }
     //    resInfoDict.Remove(resPkg.pkgName);
     //}
 }
Ejemplo n.º 26
0
 void DownLoadResItem()
 {
     if (m_Current < m_ListResInfo.Count)
     {
         ResInfo item = m_ListResInfo[m_Current];
         ScriptThread.Instance.StartCoroutine(DownLoadResItemImp(item, m_ListResInfo.Count, m_Current, DownLoadResItemFinish));
     }
     else
     {
         m_UpdateFinish(true);
     }
 }
Ejemplo n.º 27
0
Archivo: jsc.cs Proyecto: ydunk/masters
 private void AddResourceFile(ResInfo resinfo){
   if (!File.Exists(resinfo.fullpath))
     throw new CmdLineException(CmdLineError.ManagedResourceNotFound, resinfo.filename, JScriptCompiler.GetCultureInfo());
   // duplicate resource references are an error - either linking and embedding the same
   // file, naming two resources the same, or linking or embedding a file more than once
   if (this.currentTarget.ManagedResourceFileNames[resinfo.fullpath] != null)
     throw new CmdLineException(CmdLineError.DuplicateResourceFile, resinfo.filename, JScriptCompiler.GetCultureInfo());
   if (this.currentTarget.ManagedResources[resinfo.name] != null)
     throw new CmdLineException(CmdLineError.DuplicateResourceName, resinfo.name, JScriptCompiler.GetCultureInfo());
   this.currentTarget.ManagedResources[resinfo.name] = resinfo;
   this.currentTarget.ManagedResourceFileNames[resinfo.fullpath] = resinfo;
 }
Ejemplo n.º 28
0
 public static ResInfo[] ListResInfo <ATOM>(this IList <ATOM> atoms, bool skipNullAtom)
     where ATOM : IAtom
 {
     ResInfo[] resinfos = new ResInfo[atoms.Count];
     for (int i = 0; i < atoms.Count; i++)
     {
         if (atoms[i] != null && skipNullAtom)
         {
             resinfos[i] = atoms[i].GetResInfo();
         }
     }
     return(resinfos.ToArray());
 }
Ejemplo n.º 29
0
        public int AddRes(ResInfo ri)
        {
            con.Open();
            string sql = String.Format("INSERT INTO qtqk VALUES ('{0}', '{1}', '{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')",
                                       null, ri.Nd, ri.Xmlx, ri.Xmmc, ri.Khlb, ri.Dy, ri.Ywlx, ri.Zblx, ri.Ssqx, ri.Ywnr, ri.Rmb, ri.My, ri.Xj, ri.Qtsj, ri.Bz);

            Console.WriteLine(sql);
            MySqlCommand cmd  = new MySqlCommand(sql, con);
            int          iRet = cmd.ExecuteNonQuery();//这里返回的是受影响的行数,为int值。可以根据返回的值进行判断是否插入成功。

            con.Close();
            return(iRet);
        }
Ejemplo n.º 30
0
        public static PPdbSiteInfo[] GetSiteInfos(this IList <Site> sites)
        {
            /// SITE     1 AC1  3 HIS A  94  HIS A  96  HIS A 119
            /// SITE     1 AC2  5 ASN A  62  GLY A  63  HIS A  64  HOH A 328
            /// SITE     2 AC2  5 HOH A 634
            //HDebug.ToDo();
            PPdbSiteInfo[] siteinfos = new PPdbSiteInfo[0];
            string[]       IDs       = sites.HListSiteID();
            foreach (var ID in IDs)
            {
                Site[]    lsites   = sites.HSelectBySiteID(ID);
                ResInfo[] resinfos = new ResInfo[0];
                foreach (Site lsite in lsites)
                {
                    HDebug.Assert(lsites[0].numRes == lsite.numRes);
                    if (lsite.resName1.Trim().Length != 0)
                    {
                        resinfos = resinfos.HAdd(new ResInfo {
                            resName = lsite.resName1, chainID = lsite.chainID1, resSeq = lsite.seq1, iCode = lsite.iCode1
                        });
                    }
                    if (lsite.resName2.Trim().Length != 0)
                    {
                        resinfos = resinfos.HAdd(new ResInfo {
                            resName = lsite.resName2, chainID = lsite.chainID2, resSeq = lsite.seq2, iCode = lsite.iCode2
                        });
                    }
                    if (lsite.resName3.Trim().Length != 0)
                    {
                        resinfos = resinfos.HAdd(new ResInfo {
                            resName = lsite.resName3, chainID = lsite.chainID3, resSeq = lsite.seq3, iCode = lsite.iCode3
                        });
                    }
                    if (lsite.resName4.Trim().Length != 0)
                    {
                        resinfos = resinfos.HAdd(new ResInfo {
                            resName = lsite.resName4, chainID = lsite.chainID4, resSeq = lsite.seq4, iCode = lsite.iCode4
                        });
                    }
                }
                HDebug.Assert(lsites[0].numRes == resinfos.Length);

                siteinfos = siteinfos.HAdd(new PPdbSiteInfo
                {
                    siteID   = ID,
                    resinfos = resinfos
                });
            }

            return(siteinfos);
        }
Ejemplo n.º 31
0
        public bool ReadLocal(string filename)
        {
            try
            {
                string txt = null;
                using (var s = System.IO.File.OpenRead(filename))
                {
                    byte[] bs = new byte[s.Length];
                    s.Read(bs, 0, bs.Length);
                    txt = System.Text.Encoding.UTF8.GetString(bs, 0, bs.Length);
                }
                //string txt = System.IO.File.ReadAllText(filename);
                string[] lines = txt.Split(new string[] { "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);
                if (lines.Length == 0) return false;
                foreach (var l in lines)
                {
                    if (l.IndexOf("Ver:") == 0)
                    {
                        var sp = l.Split(new string[] { "Ver:", "|FileCount:" }, StringSplitOptions.RemoveEmptyEntries);
                        int mver = int.Parse(sp[0]);
                        int mcount = int.Parse(sp[1]);
                        this.groupfilecount = mcount;
                        this.listverid = mver;

                    }
                    else
                    {
                        var sp = l.Split('|');
                        listfiles[sp[0]] = new ResInfo(this.group, sp[0], sp[1], int.Parse(sp[2]));
                        int spp = int.Parse(sp[3]);
                        listfiles[sp[0]].state = (ResState)(spp % 16);
                        int spneedupadte = spp / 16;
                        listfiles[sp[0]].needupdate = spneedupadte > 0;
                    }
                }
                if (listfiles.Count == 0) return false;
            }
            catch
            {
                return false;
            }
            return true;
        }
Ejemplo n.º 32
0
 private void AddResourceFile(ResInfo resinfo){
   if (!File.Exists(resinfo.fullpath))
     throw new CmdLineException(CmdLineError.ManagedResourceNotFound, resinfo.filename, JScriptCompiler.GetCultureInfo());
   // duplicate resource references are an error - either linking and embedding the same
   // file, naming two resources the same, or linking or embedding a file more than once
   if (this.currentTarget.ManagedResourceFileNames[resinfo.fullpath] != null)
     throw new CmdLineException(CmdLineError.DuplicateResourceFile, resinfo.filename, JScriptCompiler.GetCultureInfo());
   if (this.currentTarget.ManagedResources[resinfo.name] != null)
     throw new CmdLineException(CmdLineError.DuplicateResourceName, resinfo.name, JScriptCompiler.GetCultureInfo());
   this.currentTarget.ManagedResources[resinfo.name] = resinfo;
   this.currentTarget.ManagedResourceFileNames[resinfo.fullpath] = resinfo;
 }
Ejemplo n.º 33
0
        // Возвращает количество введенных утверждений
        public long ConstructStore()
        {
            log("Начало ConstructStore()");

            table_ri = new Dictionary<string, ResInfo>();
            long counter = 0;
            foreach (var ff in fogfiles)
            {
                XElement xfog = XElement.Load(ff);
                foreach (XElement xelement in xfog.Elements())
                {
                    if (xelement.Name == "delete")
                    {
                        XAttribute att = xelement.Attribute("id");
                        if (att == null) continue;
                        string id = CorrectId(att.Value);
                        if (id == "") continue;
                        if (table_ri.ContainsKey(id))
                        {
                            var ri = table_ri[id];
                            if (!ri.removed) // Если признак уже есть, то действия уже произведены
                            {
                                // проверим, что уничтожается оригинал цепочки
                                if (!(id == ri.id))
                                {
                                    err("Уничтожается не оригинал цепочки. fog=" +
                                        ff + " id=" + id);
                                }
                                else ri.removed = true;
                            }
                        }
                        else
                        {
                            table_ri.Add(id, new ResInfo(id) { removed = true });
                        }
                    }
                    else if (xelement.Name == "substitute")
                    {
                        XAttribute att_old = xelement.Attribute("old-id");
                        XAttribute att_new = xelement.Attribute("new-id");
                        if (att_old == null || att_new == null) continue;
                        string id_old = CorrectId(att_old.Value);
                        string id_new = CorrectId(att_new.Value);
                        if (id_old == "" || id_new == "") continue;

                        // Добудем старый и новый ресурсы
                        ResInfo old_res, new_res;
                        if (!table_ri.TryGetValue(id_old, out old_res))
                        {
                            old_res = new ResInfo(id_old);
                            table_ri.Add(id_old, old_res);
                        }
                        if (!table_ri.TryGetValue(id_new, out new_res))
                        {
                            new_res = new ResInfo(id_new);
                            table_ri.Add(id_new, new_res);
                        }
                        // Проверим, что old-id совпадает с оригиналом локальной цепочки
                        if (id_old != old_res.id)
                        {
                            //LogFile.WriteLine("Разветвление на идентификаторе: " + id_old);
                        }
                        // Перенесем тип из старой цепочки в новый ресурс
                        if (new_res.typeid == null) new_res.typeid = old_res.typeid;
                        else
                        {
                            // Проверим, что цепочки одинакового типа
                            if (old_res.typeid != null && old_res.typeid != new_res.typeid)
                            {
                                err("Err: сливаются цепочки разных типов");
                            }
                        }

                        // добавляем список слитых старых идентификаторов в новый ресурс
                        new_res.merged_ids.AddRange(old_res.merged_ids);
                        // пробегаем по списку старых идентификаторов и перекидываем ссылку на новый ресурс
                        foreach (string oid in old_res.merged_ids) table_ri[oid] = new_res;
                        // перекидываем признак removed из старого ресурса, если он там true.
                        if (old_res.removed)
                        {
                            // Похоже, следующий оператор ошибка. Мы "протягиваем" условие removed
                            //new_res.removed = true;
                            err("Протяжка удаления по цепочке. id=" + id_old);
                        }
                    }
                    else
                    {
                        XAttribute idAtt = xelement.Attribute(ONames.rdfabout);
                        if (idAtt == null) continue;
                        string id = CorrectId(idAtt.Value);
                        if (id == "") continue;

                        //
                        if (table_ri.ContainsKey(id))
                        {
                            var ri = table_ri[id];
                            DateTime modificationTime = DateTime.MinValue;
                            XAttribute mt = xelement.Attribute(ONames.AttModificationTime);
                            if (mt != null &&
                                DateTime.TryParse(mt.Value, out modificationTime) &&
                                modificationTime > ri.timestamp)
                            {
                                // Установим эту временную отметку
                                ri.timestamp = modificationTime;
                            }
                            if (ri.typeid == null) ri.typeid = xelement.Name.ToString();
                            else
                            {
                                // проверка на одинаковость типов
                                if (xelement.Name != ri.typeid)
                                {
                                    err("Err: тип " + xelement.Name + " для ресурса " + idAtt + " не соответствует ранее определенному типу");
                                }
                            }
                        }
                        else
                        { // Это вариант, когда входа еще нет в таблице
                            DateTime modificationTime = DateTime.MinValue;
                            XAttribute mt = xelement.Attribute(ONames.AttModificationTime);
                            if (mt != null)
                                DateTime.TryParse(mt.Value, out modificationTime);
                            table_ri.Add(id, new ResInfo(id) { removed = false, timestamp = modificationTime, typeid = xelement.Name.ToString() });
                        }
                        counter++;

                        // Если это документ, то проверим его на предмет наличия iisstore и возможности включения его в словарь iisstores
                        string nm = xelement.Name.ToString();
                        XElement iisst = xelement.Element("iisstore");
                        if (iisst != null &&
                            (nm == "document" || nm == "photo-doc" || nm == "video-doc" || nm == "audio-doc") &&
                            !iisstores.ContainsKey(id))
                        {
                            XAttribute uri_att = iisst.Attribute("uri");
                            if (uri_att != null)
                            {
                                string uri = uri_att.Value;
                                //TODO: Надо вернуть проверку на принадлежность кассете, когда данные будут согласованы
                                if (true) // || di.Value.uri.ToLower() == uri.Substring(0, uri.Length - 15).ToLower() + "/meta")
                                {
                                    iisstores.Add(id, iisst);
                                }
                            }
                        }
                    }
                }
            }

            log("Конец ConstructStore()");

            return counter;
        }
Ejemplo n.º 34
0
        public void AppendXflowToRiTable(IEnumerable<XElement> xflow, string ff, sema2012m.LogLine err)
        {
            foreach (XElement xelement in xflow)
            {
                if (xelement.Name == ONames.TagDelete)
                {
                    XAttribute att = xelement.Attribute("id");
                    if (att == null) continue;
                    string id = att.Value;
                    if (id == "") continue;
                    if (table_ri.ContainsKey(id))
                    {
                        var ri = table_ri[id];
                        if (!ri.removed) // Если признак уже есть, то действия уже произведены
                        {
                            // проверим, что уничтожается оригинал цепочки
                            if (!(id == ri.id))
                            {
                                err("Уничтожается не оригинал цепочки. fog=" +
                                    ff + " id=" + id);
                            }
                            else ri.removed = true;
                        }
                    }
                    else
                    {
                        table_ri.Add(id, new ResInfo(id) { removed = true });
                    }
                }
                else if (xelement.Name == ONames.TagSubstitute)
                {
                    XAttribute att_old = xelement.Attribute("old-id");
                    XAttribute att_new = xelement.Attribute("new-id");
                    if (att_old == null || att_new == null) continue;
                    string id_old = att_old.Value;
                    string id_new = att_new.Value;
                    if (id_old == "" || id_new == "") continue;

                    // Добудем старый и новый ресурсы
                    ResInfo old_res, new_res;
                    if (!table_ri.TryGetValue(id_old, out old_res))
                    {
                        old_res = new ResInfo(id_old);
                        table_ri.Add(id_old, old_res);
                    }
                    if (!table_ri.TryGetValue(id_new, out new_res))
                    {
                        new_res = new ResInfo(id_new);
                        table_ri.Add(id_new, new_res);
                    }
                    // Проверим, что old-id совпадает с оригиналом локальной цепочки
                    if (id_old != old_res.id)
                    {
                        //LogFile.WriteLine("Разветвление на идентификаторе: " + id_old);
                    }
                    // Перенесем тип из старой цепочки в новый ресурс
                    if (new_res.typeid == null) new_res.typeid = old_res.typeid;
                    else
                    {
                        // Проверим, что цепочки одинакового типа
                        if (old_res.typeid != null && old_res.typeid != new_res.typeid)
                        {
                            err("Err: сливаются цепочки разных типов");
                        }
                    }

                    // добавляем список слитых старых идентификаторов в новый ресурс
                    new_res.merged_ids.AddRange(old_res.merged_ids);
                    // пробегаем по списку старых идентификаторов и перекидываем ссылку на новый ресурс
                    foreach (string oid in old_res.merged_ids) table_ri[oid] = new_res;
                    // перекидываем признак removed из старого ресурса, если он там true.
                    if (old_res.removed)
                    {
                        // Похоже, следующий оператор ошибка. Мы "протягиваем" условие removed
                        //new_res.removed = true;
                        err("Протяжка удаления по цепочке. id=" + id_old);
                    }
                }
                else
                {
                    XAttribute idAtt = xelement.Attribute(ONames.rdfabout);
                    if (idAtt == null) continue;
                    string id = idAtt.Value;
                    if (id == "") continue;

                    //
                    if (table_ri.ContainsKey(id))
                    {
                        var ri = table_ri[id];
                        DateTime modificationTime = DateTime.MinValue;
                        XAttribute mt = xelement.Attribute(ONames.AttModificationTime);
                        if (mt != null &&
                            DateTime.TryParse(mt.Value, out modificationTime) &&
                            modificationTime.ToUniversalTime() > ri.timestamp)
                        {
                            // Установим эту временную отметку
                            ri.timestamp = modificationTime.ToUniversalTime();
                        }
                        if (xelement.Name != sema2012m.ONames.rdfdescription) // rdf:Description не несет информации о типе записи
                        {
                            if (ri.typeid == null) ri.typeid = xelement.Name.NamespaceName + xelement.Name.LocalName;
                            else
                            {
                                // проверка на одинаковость типов
                                if (xelement.Name.NamespaceName + xelement.Name.LocalName != ri.typeid)
                                {
                                    err("Err: тип " + xelement.Name + " для ресурса " + idAtt + " не соответствует ранее определенному типу");
                                }
                            }
                        }
                    }
                    else
                    { // Это вариант, когда входа еще нет в таблице
                        DateTime modificationTime = DateTime.MinValue;
                        XAttribute mt = xelement.Attribute(ONames.AttModificationTime);
                        if (mt != null)
                            DateTime.TryParse(mt.Value, out modificationTime);
                        var n_resinfo = new ResInfo(id) {
                            removed = false,
                            timestamp = modificationTime.ToUniversalTime()
                            //, typeid = xelement.Name.NamespaceName + xelement.Name.LocalName
                        };
                        if (xelement.Name != sema2012m.ONames.rdfdescription)
                            n_resinfo.typeid = xelement.Name.NamespaceName + xelement.Name.LocalName;
                        table_ri.Add(id, n_resinfo);
                    }

                }
            }
        }
Ejemplo n.º 35
0
  private int ParseOptions(string[] args, int start, bool fromResponseFile){
    // Process per-target options
    int i;
    for (i = start; i < args.Length; i++){
      object argument;
      string option;

      string arg = args[i];
      if (arg == null || arg.Length == 0) continue;

      // Process response file option
      if ('@' == arg[0]){
        if (fromResponseFile)
          throw new CmdLineException(CmdLineError.NestedResponseFiles, JScriptCompiler.GetCultureInfo());
        option = arg.Substring(1);
        if (option.Length == 0)
          throw new CmdLineException(CmdLineError.NoFileName, args[i], JScriptCompiler.GetCultureInfo());
        if (!File.Exists(option))
          throw new CmdLineException(CmdLineError.SourceNotFound, option, JScriptCompiler.GetCultureInfo());
        string[] rgstrFileArgs = ReadResponseFile(option);
        if (rgstrFileArgs != null)
          this.ParseArguments(rgstrFileArgs, true);
        continue;
      }

      // slash ('/') character is a valid filename character on UNIX, so we can't use it as a switch
      if ('-' != arg[0] && ('/' != arg[0] || '/' == Path.DirectorySeparatorChar))
        break;
      option = arg.Substring(1);

      if (option.Length >= 1){
        switch (option[0]){
        case '?':
        case 'h':
        case 'H':
          if (CmdLineOptionParser.IsSimpleOption(option, "?") || CmdLineOptionParser.IsSimpleOption(option, "help")){
            this.fHelp = true;
            continue;
          }
          break;
        case 'a':
        case 'A':
          argument = CmdLineOptionParser.IsBooleanOption(option, "autoref");
          if (argument != null){
            if ((bool)argument){
              this.currentTarget.autoRef = true;
              this.currentTarget.autoRefSetExplicitly = true;
            }else
              this.currentTarget.autoRef = false;
            continue;
          }
          argument = CmdLineOptionParser.IsArgumentOption(option, "a.version", "assembly.version");
          if (argument != null){
            if (((String)argument).Length == 0)
              throw new CmdLineException(CmdLineError.MissingVersionInfo, JScriptCompiler.GetCultureInfo());
            try {
              this.currentTarget.versionInfo = new Version((string)argument);
            }catch{
              throw new CmdLineException(CmdLineError.InvalidVersion, (string)argument, JScriptCompiler.GetCultureInfo());
            }
            continue;
          }
          break;
        case 'c':
        case 'C':
          argument = CmdLineOptionParser.IsArgumentOption(option, "codepage");
          if (argument != null){
            if (((string)argument).Length == 0){
              throw new CmdLineException(CmdLineError.NoCodePage, args[i], JScriptCompiler.GetCultureInfo());
            }else{
              try{
                this.currentTarget.codepage = Int32.Parse((string)argument, CultureInfo.InvariantCulture);
                this.currentTarget.fForceCodepage = true;
              }catch{
                throw new CmdLineException(CmdLineError.InvalidCodePage, (string)argument, JScriptCompiler.GetCultureInfo());
              }
              continue;
            }
          }
          break;
        case 'd':
        case 'D':
          argument = CmdLineOptionParser.IsBooleanOption(option, "debug");
          if (argument != null){
            this.currentTarget.fDebug = (bool)argument;
            continue;                        
          }
          argument = CmdLineOptionParser.IsArgumentOption(option, "d", "define");
          if (argument != null){
            Hashtable newDefines = GetAllDefines((string)argument);
            foreach (DictionaryEntry newDef in newDefines)
              this.currentTarget.Defines[newDef.Key] = newDef.Value;
            continue;
          }
          break;
        case 'f':
        case 'F':
          argument = CmdLineOptionParser.IsBooleanOption(option, "fast");
          if (argument != null){
            this.currentTarget.fFast = (bool)argument;
            continue;
          }
          break;
        case 'l':
        case 'L':
          argument = CmdLineOptionParser.IsArgumentOption(option, "lcid");
          if (argument != null){
            if (((string)argument).Length == 0)
              throw new CmdLineException(CmdLineError.NoLocaleID, args[i], JScriptCompiler.GetCultureInfo());
            try{
              int lcid = Int32.Parse((string)argument, CultureInfo.InvariantCulture);
              CultureInfo culture = new CultureInfo(lcid);
              JScriptCompiler.LCID = lcid;
            }catch{
              throw new CmdLineException(CmdLineError.InvalidLocaleID, (string)argument, JScriptCompiler.GetCultureInfo());
            }
            continue;
          }
          argument = CmdLineOptionParser.IsArgumentOption(option, "lib");
          if (argument != null){
            string newPaths = (string)argument;
            if (newPaths.Length == 0)
              throw new CmdLineException(CmdLineError.MissingLibArgument, JScriptCompiler.GetCultureInfo());
            newPaths = newPaths.Replace(',', Path.PathSeparator);
            this.currentTarget.libpath = newPaths + Path.PathSeparator + this.currentTarget.libpath;
            continue;
          }
          argument = CmdLineOptionParser.IsArgumentOption(option, "linkres", "linkresource");
          if (argument != null){
            ResInfo resinfo = new ResInfo((string)argument, true /* isLinked */);
            this.AddResourceFile(resinfo);
            continue;
          }
          break;
        case 'n':
        case 'N':
          if (CmdLineOptionParser.IsSimpleOption(option, "nologo")){
            this.fPrintBanner = false;
            continue;
          }
          argument = CmdLineOptionParser.IsBooleanOption(option, "nostdlib");
          if (argument != null){
            this.currentTarget.fNoStdlib = (bool)argument;
            if ((bool)argument && !this.currentTarget.autoRefSetExplicitly)
              this.currentTarget.autoRef = false;
            continue;
          }
          break;
        case 'o':
        case 'O':
          argument = CmdLineOptionParser.IsArgumentOption(option, "out");
          if (argument != null){
            try{
              if (Path.GetFileName((string)argument) == "")
                throw new CmdLineException(CmdLineError.NoFileName, args[i], JScriptCompiler.GetCultureInfo());
            }catch(System.ArgumentException){
              throw new CmdLineException(CmdLineError.NoFileName, args[i], JScriptCompiler.GetCultureInfo());
            }
            if (Path.GetExtension((string)argument) == "")
              throw new CmdLineException(CmdLineError.MissingExtension, args[i], JScriptCompiler.GetCultureInfo());
            if (this.currentTarget.strOutputFileName != null)
              throw new CmdLineException(CmdLineError.MultipleOutputNames, JScriptCompiler.GetCultureInfo());
            this.currentTarget.strOutputFileName = (string)argument;
            continue;
          }
          break;
        case 'p':
        case 'P':
          argument = CmdLineOptionParser.IsBooleanOption(option, "print");
          if (argument != null){
            this.currentTarget.fPrint = (bool)argument;
            this.currentTarget.fPrintSetExplicitly = (bool)argument;
            continue;
          }
          argument = CmdLineOptionParser.IsArgumentOption(option, "platform");
          if (argument != null){
            string platform = (string)argument;
            PortableExecutableKinds PEKindFlags;
            ImageFileMachine PEMachineArchitecture;
            if (String.Compare(platform, "x86", StringComparison.OrdinalIgnoreCase) == 0) {
              PEKindFlags = PortableExecutableKinds.ILOnly | PortableExecutableKinds.Required32Bit;
              PEMachineArchitecture = ImageFileMachine.I386;
            } else if (String.Compare(platform, "Itanium", StringComparison.OrdinalIgnoreCase) == 0) {
              PEKindFlags = PortableExecutableKinds.ILOnly | PortableExecutableKinds.PE32Plus;
              PEMachineArchitecture = ImageFileMachine.IA64;
            } else if (String.Compare(platform, "x64", StringComparison.OrdinalIgnoreCase) == 0) {
              PEKindFlags = PortableExecutableKinds.ILOnly | PortableExecutableKinds.PE32Plus;
              PEMachineArchitecture = ImageFileMachine.AMD64;            
            } else if (String.Compare(platform, "anycpu", StringComparison.OrdinalIgnoreCase) == 0) {
              PEKindFlags = PortableExecutableKinds.ILOnly;
              PEMachineArchitecture = ImageFileMachine.I386;
            } else
              throw new CmdLineException(CmdLineError.InvalidPlatform, (string)argument, JScriptCompiler.GetCultureInfo());
            this.currentTarget.PEKindFlags = PEKindFlags;
            this.currentTarget.PEMachineArchitecture = PEMachineArchitecture;
            continue;
          }
          break;
        case 'r':
        case 'R':
          argument = CmdLineOptionParser.IsArgumentOption(option, "r", "reference");
          if (argument != null){
            if (((string)argument).Length == 0)
              throw new CmdLineException(CmdLineError.NoFileName, args[i], JScriptCompiler.GetCultureInfo());
            foreach (string referenceName in GetAllReferences((string)argument)){
              bool duplicate = false;
              foreach (string assemblyName in this.currentTarget.ImportFileNames){
                if (String.Compare(assemblyName, referenceName, StringComparison.OrdinalIgnoreCase) == 0){
                  duplicate = true;
                  break;
                }
              }
              if (!duplicate)
                this.currentTarget.ImportFileNames.Add(referenceName);
            }
            continue;
          }
          argument = CmdLineOptionParser.IsArgumentOption(option, "res", "resource");
          if (argument != null){
            ResInfo resinfo = new ResInfo((string)argument, false /* isLinked */);
            this.AddResourceFile(resinfo);
            continue;
          }
          break;
        case 't':
        case 'T':
          argument = CmdLineOptionParser.IsArgumentOption(option, "t", "target");
          if (argument != null){
            if (this.currentTarget.fTargetSpecified){
              throw new CmdLineException(CmdLineError.MultipleTargets, JScriptCompiler.GetCultureInfo());
            }
            if (String.Compare((string)argument, "exe", StringComparison.OrdinalIgnoreCase) == 0){
              this.currentTarget.fTargetSpecified = true;
              this.currentTarget.PEFileKind = PEFileKinds.ConsoleApplication;
              continue;
            }
            if (String.Compare((string)argument, "winexe", StringComparison.OrdinalIgnoreCase) == 0){
              this.currentTarget.fTargetSpecified = true;
              this.currentTarget.PEFileKind = PEFileKinds.WindowApplication;
              this.currentTarget.fPrint = this.currentTarget.fPrintSetExplicitly;
              continue;
            }
            if (String.Compare((string)argument, "library", StringComparison.OrdinalIgnoreCase) == 0){
              this.currentTarget.fTargetSpecified = true;
              this.currentTarget.PEFileKind = PEFileKinds.Dll;
              continue;
            }
            throw new CmdLineException(CmdLineError.InvalidTarget, (string)argument, JScriptCompiler.GetCultureInfo());
          }
          break;
        case 'u':
        case 'U':
          argument = CmdLineOptionParser.IsBooleanOption(option, "utf8output");
          if (argument != null){
            this.fUtf8Output = (bool)argument;
            continue;
          }
          break;
        case 'v':
        case 'V':
          argument = CmdLineOptionParser.IsBooleanOption(option, "VersionSafe");
          if (argument != null){
            this.currentTarget.fVersionSafe = (bool)argument;
            continue;
          }
          break;
        case 'w':
        case 'W':
          argument = CmdLineOptionParser.IsArgumentOption(option, "w", "warn");
          if (argument != null){
            if (((string)argument).Length == 0){
              throw new CmdLineException(CmdLineError.NoWarningLevel, args[i], JScriptCompiler.GetCultureInfo());
            }
            if (1 == ((string)argument).Length){
              switch (((string)argument)[0]){
              case '0': this.currentTarget.nWarningLevel = 0; continue;
              case '1': this.currentTarget.nWarningLevel = 1; continue;
              case '2': this.currentTarget.nWarningLevel = 2; continue;
              case '3': this.currentTarget.nWarningLevel = 3; continue;
              case '4': this.currentTarget.nWarningLevel = 4; continue;
              }
            }
            throw new CmdLineException(CmdLineError.InvalidWarningLevel, args[i], JScriptCompiler.GetCultureInfo());
          }
          argument = CmdLineOptionParser.IsBooleanOption(option, "warnaserror");
          if (argument != null){
            this.currentTarget.fTreatWarningsAsErrors = (bool)argument;
            continue;
          }
          break;
        default:
          break;
        }
      }
      throw new CmdLineException(CmdLineError.UnknownOption, args[i], JScriptCompiler.GetCultureInfo());
    }
    return i;
  }