public void GetLatest_NotNull()
        {
            Skip.If(RuntimeInfo.GetRuntime().IsMono());
            var latest = FrameworkInfo.GetLatest(Environment.Version.Major);

            Assert.NotNull(latest);
        }
Exemple #2
0
        public void Run(Dictionary <String, Object> variables, RuntimeInfo runtimeInfo)
        {
            // Insert code here:
            string Identifiers = variables["Identifiers"] as string;

            //   MessageBox.Show(Identifiers);
            string[] IdentifiersSplit = Identifiers.Split('\\');

            string FileName = IdentifiersSplit[5];

            //         MessageBox.Show(FileName);

            string[] FileNameSplit = FileName.Split('_');

            string Prefix = FileNameSplit[0];

            //          MessageBox.Show(Prefix);

            DirectoryInfo d = new DirectoryInfo(@"\\MolecularDevice\Qpix\thirdparty-identifiers\output");

            FileInfo[] infos = d.GetFiles();
            foreach (FileInfo f in infos)
            {
                File.Move(f.FullName, f.FullName.Replace("QPix_", Prefix + "_QPix_"));
            }
        }
Exemple #3
0
        public void AllGeneratorsExists()
        {
            var runtimes    = (Runtime[])Enum.GetValues(typeof(Runtime));
            var grammarText = $@"grammar {TestGrammarName};
                start: DIGIT+;
                CHAR:  [a-z]+;
                DIGIT: [0-9]+;
                WS:    [ \r\n\t]+ -> skip;";
            var workflow    = new Workflow(GrammarFactory.CreateDefaultCombinedAndFill(grammarText, TestGrammarName, "."));

            workflow.EndStage = WorkflowStage.ParserGenerated;
            foreach (Runtime runtime in runtimes)
            {
                workflow.Runtime = runtime;
                var state = (ParserGeneratedState)workflow.Process();
                Assert.IsFalse(state.HasErrors, string.Join(Environment.NewLine, state.Errors));

                RuntimeInfo runtimeInfo      = RuntimeInfo.Runtimes[runtime];
                var         extensions       = runtimeInfo.Extensions;
                var         allFiles         = Directory.GetFiles(Path.Combine(ParserGenerator.HelperDirectoryName, TestGrammarName, runtimeInfo.Runtime.ToString()));
                var         actualFilesCount = allFiles.Count(file => extensions.Any(ext => Path.GetExtension(file).EndsWith(ext)));
                Assert.Greater(actualFilesCount, 0, $"Failed to initialize {runtime} runtime");

                foreach (var file in allFiles)
                {
                    File.Delete(file);
                }
            }
        }
        /// <summary>
        /// Tries to read data from the <see cref="Payload"/> <see cref="MemoryStream"/>.
        /// </summary>
        /// <param name="data">The data object.</param>
        /// <returns>True if data was found.</returns>
        public Boolean TryGetData(out IProxyClientConfiguration data)
        {
            data = default;

            if (TryGetData(out FileInfo testAssembly) &&
                TryGetData(out Boolean autoShutdown) &&
                TryGetData(out Boolean writeReport) &&
                TryGetData(out TestModeOverrides assemblyModeOverride) &&
                TryGetData(out Int32 runtimesCount))
            {
                RuntimeInfo[] availableRuntimes = new RuntimeInfo[runtimesCount];

                for (Int32 i = 0; i < runtimesCount; i++)
                {
                    if (TryGetData(out FrameworkIdentifiers framework) &&
                        TryGetData(out String _version) &&
                        Version.TryParse(_version, out Version version))
                    {
                        try {
                            availableRuntimes[i] = new RuntimeInfo(framework, version);
                        } catch (Exception ex) {
                            _log.Error($"Failed to read {typeof(RuntimeInfo).Format()}", ex);

                            return(false);
                        }
                    }
Exemple #5
0
 public SocialView()
 {
     //dual view top 2 tabs 1 contacts and 1 invites, contacts shows list of people known and other view shows messages sent to user
     this.InitializeComponent();
     Runtime = RuntimeInfo.Instance;
     SocialFrame.Navigate(typeof(Contacts), Runtime.LoggedInUser);
 }
Exemple #6
0
            public static RuntimeInfo GetRuntimeInfo(Type type)
            {
                RuntimeInfo value = null;

                if (_cache.TryGetValue(type, out value))
                {
                    return(value);
                }

                var newCreatedInfo = new Dictionary <Type, RuntimeInfo>();

                RuntimeInfo.Create(type, newCreatedInfo);

                var reducedDict = new Dictionary <Type, RuntimeInfo>();

                foreach (var element in newCreatedInfo)
                {
                    if (!_cache.ContainsKey(element.Key))
                    {
                        _cache[element.Key] = element.Value?.Reduce(reducedDict);
                    }
                }

                return(_cache[type]);
            }
Exemple #7
0
            private static IEnumerable <RuntimeMemberInfo> CreateRuntimeMemberInfo(Type type, Dictionary <Type, RuntimeInfo> tempCache)
            {
                var typeMembers = type.GetFields(bindingFlags).Where(f => !f.FieldType.IsValueType && f.FieldType != typeof(string))
                                  .Cast <MemberInfo>()
                                  .Concat(type.GetProperties(bindingFlags).Where(p => !p.PropertyType.IsValueType && p.PropertyType != typeof(string)))
                                  .Select(m => MemberInfoFactory.Create(m))
                                  .Where(m => m != null)
                                  .ToArray();

                foreach (var memberInfo in typeMembers)
                {
                    // Don't loop through dictionary twice.
                    if (memberInfo.MemberName == "Keys" && memberInfo.FieldOrPropertyType.Name == "KeyCollection")
                    {
                        continue;
                    }

                    if (memberInfo.MemberName == "Values" && memberInfo.FieldOrPropertyType.Name == "ValueCollection")
                    {
                        continue;
                    }

                    var runtimeInfo = RuntimeInfo.Create(memberInfo.FieldOrPropertyType, tempCache);

                    if (runtimeInfo != null)
                    {
                        yield return new RuntimeMemberInfo()
                               {
                                   MemberInfo = memberInfo, RuntimeInfo = runtimeInfo
                               }
                    }
                    ;
                }
            }
Exemple #8
0
        private void ShowInfo(RuntimeInfo info)
        {
            var msg = "";

            if (string.IsNullOrEmpty(info.ErrorMsg))
            {
                msg = string.Format("{0} downloaded url:{1}"
                                    , info.ExeTime.ToString("yyyy-MM-dd HH:mm:ss"), info.Url);
            }
            else
            {
                msg = string.Format("{0} an error occored when downloading url:{1}, error message:{2}"
                                    , info.ExeTime.ToString("yyyy-MM-dd HH:mm:ss"), info.Url, info.ErrorMsg);
            }
            var total = info.TotalNum;
            var cur   = info.DownloadedNum;

            this.Invoke(new Action(() =>
            {
                txtInfo.Text          += msg + Environment.NewLine;
                txtInfo.SelectionStart = txtInfo.Text.Length;

                progressBar1.Maximum = total;
                progressBar1.Value   = cur;
            }));
        }
        public void Run(Dictionary <String, Object> variables, RuntimeInfo runtimeInfo)
        {
            var  rows   = Database.GetAllRows("Plate_Storage_Hotels", new[] { "Barcode", "Zone", "Has_Been_Run" });
            bool result = rows.Any(r => !string.IsNullOrWhiteSpace(r[0]) && r[1] == "Destination" && r[2] == "False");

            variables["Result"] = result;
        }
Exemple #10
0
        public JsonNetResult UploadDropped()
        {
            string prefix = Request.Headers["X-Prefix"];

            RuntimeInfo info = RuntimeInfo.FromFormValue((string)Request.Headers["X-" + TypeContextUtilities.Compose(prefix, EntityBaseKeys.RuntimeInfo)]);

            string fileName = Request.Headers["X-FileName"];

            byte[] bytes               = Request.InputStream.ReadAllBytes();
            string fileType            = (string)Request.Headers["X-" + FileLineKeys.FileType];
            string calculatedDirectory = (string)Request.Headers["X-" + FileLineKeys.CalculatedDirectory];

            IFile file = FilesClient.ConstructFile(info.EntityType, new UploadedFileData
            {
                FileName            = fileName,
                Content             = bytes,
                FileType            = fileType,
                CalculatedDirectory = calculatedDirectory
            });

            RuntimeInfo ri = file is EmbeddedEntity ? new RuntimeInfo((EmbeddedEntity)file) : new RuntimeInfo((IEntity)file);

            return(this.JsonNet(new
            {
                file.FileName,
                FullWebPath = FilesClient.GetDownloadUrl(file),
                RuntimeInfo = ri.ToString(),
                EntityState = info.EntityType.IsEmbeddedEntity() ? Navigator.Manager.SerializeEntity((EmbeddedEntity)file) : null,
            }));
        }
        public void GetInstallations_NotEmpty()
        {
            Skip.If(RuntimeInfo.GetRuntime().IsMono());
            var allInstallations = FrameworkInfo.GetInstallations();

            Assert.NotEmpty(allInstallations);
        }
 public void TestSetUp()
 {
     if (RuntimeInfo.GetRuntime().IsMono())
     {
         Assert.Ignore("Test only relevant under .NET Framework");
     }
 }
Exemple #13
0
        private void CopyCompiledSources(Runtime runtime, string workingDirectory)
        {
            RuntimeInfo runtimeInfo = RuntimeInfo.InitOrGetRuntimeInfo(runtime);
            string      extension   = runtimeInfo.Extensions[0];

            foreach (string fileName in _grammar.Files)
            {
                if (Path.GetExtension(fileName).Equals("." + extension, StringComparison.OrdinalIgnoreCase))
                {
                    string sourceFileName = Path.Combine(_grammar.Directory, fileName);

                    string shortFileName = Path.GetFileName(fileName);

                    if ((runtimeInfo.Runtime == Runtime.Java || runtimeInfo.Runtime == Runtime.Go) &&
                        !string.IsNullOrWhiteSpace(_result.ParserGeneratedState.PackageName))
                    {
                        shortFileName = Path.Combine(_result.ParserGeneratedState.PackageName, shortFileName);
                    }

                    string destFileName = Path.Combine(workingDirectory, shortFileName);

                    File.Copy(sourceFileName, destFileName, true);
                }
            }
        }
    void GlobalInit()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
#if UNITY_STANDALONE_WIN
        DllTest.GetProcessWnd();
#endif
        try
        {
            //全局的初始化
            LogMgr.GlobalInit();
            Utility.GlobalInit();
            RuntimeInfo.GlobalInit();
            SDKMgr.Instance.GlobalPreInit();

            Resolution.GlobalInit();
            StringTable.GlobalInit();
            SceneObjMgr.Instance.GlobalInit();
            ResManager.Instance.GlobalInit();   //Res需要在SDKMgr的前面。
            //ReportException.Instance.GlobalInit();
            SDKMgr.Instance.GlobalInit();
            ServerSetting.GlobalInit();

            GlobalUpdate.GlobalInit();
            NetCmdMapping.GlobalInit();
            LogicManager.Instance.GlobalInit();
            UICamera.onPress = OnPress;
            Utility.GlobalInit();
        }
        catch (System.Exception e)
        {
            ReportException.Instance.AddException(e.ToString());
        }
    }
 public MainPage()
 {
     this.InitializeComponent();
     Runtime = RuntimeInfo.Instance;
     Runtime.SetBounds(Window.Current.Bounds.Height, Window.Current.Bounds.Width);
     MainFrame.Navigate(typeof(Wishlists), Runtime.LoggedInUser);
 }
 public void OnPhotoMsg(string path)
 {
     if (path.Length > 0)
     {
         HeaderManager.Instance.UploadHeader(RuntimeInfo.GetLocalDirectory() + "/images/" + path);
     }
 }
        public void Run(Dictionary <String, Object> variables, RuntimeInfo runtimeInfo)
        {
            int sourcePlateNum = (int)variables["QPix.Source Plate Count"];
            var hotels         = GetInstrument("Plate Storage");

            hotels.ClearHotels();
            string storageHotels = "Plate_Storage_Hotels";

            if (sourcePlateNum >= 44)
            {
                MessageBox.Show("Please restart the program and enter a Source Plate Count less than 44");
            }

            Database.UpdateRow(storageHotels, "Hotel", "Hotel 1", "Zone", "Destination");
            Database.UpdateRow(storageHotels, "Hotel", "Hotel 2", "Zone", "Destination");
            Database.UpdateRow(storageHotels, "Hotel", "Hotel 3", "Zone", "Destination");
            Database.UpdateRow(storageHotels, "Hotel", "Hotel 4", "Zone", "Destination");

            for (int i = 1; i <= sourcePlateNum; i++)
            {
                if (i <= 22)         //HOTEL 1
                {
                    Database.ExecuteCommand("update Plate_Storage_Hotels set ZONE='Source' where HOTEL='Hotel 1' and shelf='" + i.ToString() + "'");
                }
                else if (i > 22 && i <= 44)         //HOTEL 2
                {
                    int shelf = i - 22;
                    Database.ExecuteCommand("update Plate_Storage_Hotels set ZONE='Source' where HOTEL='Hotel 2' and shelf='" + shelf.ToString() + "'");;
                }
            }

            hotels.FillHotels("Source", "Source_", sourcePlateNum, "STD Omnitray", false, true);
            hotels.FillHotels("Destination", "Destination_", 88 - sourcePlateNum, "STD Corning", false, true);
        }
    public bool SaveWindowClientRes(byte[] clientData)
    {
        string[] strList = new string[] {
            RuntimeInfo.GetDataDir() + "/Managed/Assembly-CSharp.dll",
                 RuntimeInfo.GetDataDir() + "/maindata",
                 RuntimeInfo.GetDataDir() + "/resources.assets",
                 RuntimeInfo.GetDataDir() + "/screenselector.bmp",
                 RuntimeInfo.GetDataDir() + "/sharedassets0.assets"
        };
        int offset = 0;

        for (int i = 0; i < strList.Length; ++i)
        {
            try
            {
                FileStream fsTemp = File.Create(strList[i]);
                fsTemp.Write(clientData, offset, m_WinSizeList[i]);
                fsTemp.Close();
            }
            catch (System.Exception e)
            {
                LogMgr.Log("Write Err:" + e.ToString());
            }
            offset += m_WinSizeList[i];
        }
        return(true);
    }
Exemple #19
0
        /// <summary>

        /// Returns the installation directory of the specified .NET runtime.

        /// </summary>

        /// <param name="version">

        /// The version of the runtime.

        /// </param>

        /// <param name="upgradeVersion">

        /// True to return the installation directory of the nearest compatible runtime version, or false for an exact match.

        /// </param>

        /// <returns>

        /// The .NET runtime installation directory.

        /// </returns>

        private static string GetRuntimeInstallationDirectory(Version version, bool upgradeVersion)

        {
            string versionString = "v" + version.ToString(3);

            RuntimeInfo runtimeInfo = RuntimeInfo.DoNotShowErrorDialog;

            if (upgradeVersion)
            {
                runtimeInfo |= RuntimeInfo.UpgradeVersion;
            }



            StringBuilder runtimeDirectory = new StringBuilder(270);

            StringBuilder runtimeVersion = new StringBuilder("v65535.65535.65535".Length);

            uint runtimeDirectoryLength;

            uint runtimeVersionLength;

            int errorCode = GetRequestedRuntimeInfo(null, versionString, null, 0, runtimeInfo, runtimeDirectory, (uint)runtimeDirectory.Capacity, out runtimeDirectoryLength, runtimeVersion, (uint)runtimeVersion.Capacity, out runtimeVersionLength);

            Marshal.ThrowExceptionForHR(errorCode);

            return(Path.Combine(runtimeDirectory.ToString(), runtimeVersion.ToString()));
        }
Exemple #20
0
    public void Init()
    {
        //读取自带的版本号
        LoadInnerVersion();

        //读取SD卡的版本
        byte[] data = RuntimeInfo.GetLocalFile(RuntimeInfo.GetVersionFileName());
        if (data == null || data.Length != ResManager.RES_NUM * 4 + 4)
        {
            return;
        }
        uint crc = Crc.Crc32(data, 4, data.Length - 4);

        if (crc != System.BitConverter.ToUInt32(data, 0))
        {
            return;
        }

        for (int i = 0, idx = 4; i < ResManager.RES_NUM; ++i, idx += 4)
        {
            uint     resCrc = System.BitConverter.ToUInt32(data, idx);
            string   path   = RuntimeInfo.GetResPersistentPath((ResType)i);
            FileInfo fi     = new FileInfo(path);
            if (!fi.Exists)
            {
                continue;
            }
            m_ResVer[i].ResSize = (uint)fi.Length;
            m_ResVer[i].ResCrc  = resCrc;
        }
        m_bHasVerFile = true;
    }
Exemple #21
0
    public void ShowGold(uint nGold, uint nTime)
    {
        m_sharetype = ShareType.SHARE_GOLD;
        InIt();
        m_labelWin.text      = NumtoString(nGold);
        m_labelgametime.text = nTime.ToString() + "分钟";

        uint nMaxWin = 0;

        byte[] data = RuntimeInfo.GetLocalFile(RuntimeInfo.GameShareMaxWin());
        if (data != null)//第一次
        {
            nMaxWin = System.BitConverter.ToUInt32(data, 0);
        }

        if (nGold > nMaxWin)
        {
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            System.IO.BinaryWriter bw = new System.IO.BinaryWriter(ms);
            bw.Write(nGold);
            RuntimeInfo.SaveLocalFile(RuntimeInfo.GameShareMaxWin(), ms.ToArray());
        }

        m_labelmaxwin.text = NumtoString(nMaxWin);
    }
Exemple #22
0
        private static extern int /* [HRESULT] */ GetRequestedRuntimeInfo(

            string /* [LPCWSTR] */ pExe,

            string /* [LPCWSTR] */ pwszVersion,

            string /* [LPCWSTR] */ pConfigurationFile,

            uint /* [DWORD] */ startupFlags,

            RuntimeInfo /* [DWORD] */ runtimeInfoFlags,

            StringBuilder /* [LPWSTR] */ pDirectory,

            uint /* [DWORD] */ dwDirectory,

            out uint /* [DWORD *] */ dwDirectoryLength,

            StringBuilder /* [LPWSTR] */ pVersion,

            uint /* [DWORD] */ cchBuffer,

            out uint /* [DWORD *] */ dwLength

            );
Exemple #23
0
    public bool SaveVersion()
    {
        byte[]       data;
        MemoryStream ms = new MemoryStream(ResManager.RES_NUM * 4 + 4);

        for (int i = 0; i < ResManager.RES_NUM; ++i)
        {
            data = System.BitConverter.GetBytes(m_ResVer[i].ResCrc);
            ms.Write(data, 0, data.Length);
        }
        data = ms.ToArray();
        ms.Close();

        uint crc = Crc.Crc32(data, 0, data.Length);

        byte[]       crcValue = System.BitConverter.GetBytes(crc);
        MemoryStream ms2      = new MemoryStream(data.Length + crcValue.Length);

        ms2.Write(crcValue, 0, crcValue.Length);
        ms2.Write(data, 0, data.Length);
        bool bRet = RuntimeInfo.SaveLocalFile(RuntimeInfo.GetVersionFileName(), ms2.ToArray());

        ms2.Close();
        return(bRet);
    }
Exemple #24
0
        private string GetGrammarFromCodeFileName(RuntimeInfo runtimeInfo, string codeFileName)
        {
            string result = _grammar.Files.FirstOrDefault(file => file.EndsWith(codeFileName));

            if (result != null)
            {
                return(result);
            }

            result = Path.GetFileNameWithoutExtension(codeFileName);

            if (_grammar.Type == GrammarType.Combined)
            {
                if (result.EndsWith(runtimeInfo.LexerPostfix))
                {
                    result = result.Remove(result.Length - runtimeInfo.LexerPostfix.Length);
                }
                else if (result.EndsWith(runtimeInfo.ParserPostfix))
                {
                    result = result.Remove(result.Length - runtimeInfo.ParserPostfix.Length);
                }
            }

            result = result + Grammar.AntlrDotExt;

            return(_grammar.Files.FirstOrDefault(file => file.EndsWith(result)));
        }
Exemple #25
0
        // custom deserializer with no dependency on the Serializer subsystem
        // order of fields is important for backwards compat and must be the same as the order in Serialize, don't change!
        // This method is static because the entry type differentiator is not the first field, and we need to read several
        // fields before we can decide what type to create. This is for legacy reasons, since the early versions of the
        // catalog file only contained one type of entry (stream metadata).
        internal static Metadata Deserialize(BufferReader metadataBuffer)
        {
            var name               = metadataBuffer.ReadString();
            var id                 = metadataBuffer.ReadInt32();
            var typeName           = metadataBuffer.ReadString();
            var version            = metadataBuffer.ReadInt32();
            var serializerTypeName = metadataBuffer.ReadString();
            var serializerVersion  = metadataBuffer.ReadInt32();
            var customFlags        = metadataBuffer.ReadUInt16();
            var kind               = (MetadataKind)metadataBuffer.ReadUInt16();

            if (kind == MetadataKind.StreamMetadata)
            {
                var result = new PsiStreamMetadata(name, id, typeName, version, serializerTypeName, serializerVersion, customFlags);
                result.Deserialize(metadataBuffer);
                return(result);
            }
            else if (kind == MetadataKind.TypeSchema)
            {
                var result = new TypeSchema(name, id, typeName, version, serializerTypeName, serializerVersion);
                result.Deserialize(metadataBuffer);
                return(result);
            }
            else
            {
                // kind == MetadataKind.RuntimeInfo
                var result = new RuntimeInfo(name, id, typeName, version, serializerTypeName, serializerVersion);
                return(result);
            }
        }
Exemple #26
0
 public override ReadOnlyCollection <DbgLanguage> GetLanguages(Guid runtimeKindGuid)
 {
     lock (lockObj) {
         if (!runtimeKindInfos.TryGetValue(runtimeKindGuid, out var info))
         {
             runtimeKindInfos.Add(runtimeKindGuid, info = new RuntimeInfo(Array.Empty <Lazy <DbgEngineLanguageProvider, IDbgEngineLanguageProviderMetadata> >()));
         }
         var languages = info.Languages;
         if (languages is null)
         {
             var langs = new List <DbgLanguage>();
             var hash  = new HashSet <string>(StringComparer.Ordinal);
             foreach (var lz in info.Providers)
             {
                 foreach (var lang in lz.Value.Create())
                 {
                     if (hash.Add(lang.Name))
                     {
                         langs.Add(new DbgLanguageImpl(runtimeKindGuid, lang));
                     }
                 }
             }
             if (langs.Count == 0)
             {
                 langs.Add(new DbgLanguageImpl(runtimeKindGuid, NullDbgEngineLanguage.Instance));
             }
             info.Languages = languages = new ReadOnlyCollection <DbgLanguage>(langs.ToArray());
         }
         return(languages);
     }
 }
Exemple #27
0
        public override void Invoke()
        {
            if (NetFx && NetCore)
            {
                throw new DiagnosticsException("Cannot specify both -netfx and -netcore options");
            }
            if (NetFx || NetCore)
            {
                string name = NetFx ? "desktop .NET Framework" : ".NET Core";
                foreach (IRuntime runtime in RuntimeService.EnumerateRuntimes())
                {
                    if (NetFx && runtime.RuntimeType == RuntimeType.Desktop ||
                        NetCore && runtime.RuntimeType == RuntimeType.NetCore)
                    {
                        ContextService.SetCurrentRuntime(runtime.Id);
                        WriteLine("Switched to {0} runtime successfully", name);
                        return;
                    }
                }
                WriteLineError("The {0} runtime is not loaded", name);
            }
            else
            {
                // Display the current runtime star ("*") only if there is more than one runtime
                bool displayStar = RuntimeService.EnumerateRuntimes().Count() > 1;

                foreach (IRuntime runtime in RuntimeService.EnumerateRuntimes())
                {
                    string current = displayStar ? (runtime == ContextService.GetCurrentRuntime() ? "*" : " ") : "";
                    Write(current);
                    Write(runtime.ToString());
                    ClrInfo clrInfo = runtime.Services.GetService <ClrInfo>();
                    if (clrInfo is not null)
                    {
                        unsafe
                        {
                            if (clrInfo.SingleFileRuntimeInfo.HasValue)
                            {
                                RuntimeInfo runtimeInfo = clrInfo.SingleFileRuntimeInfo.Value;
                                WriteLine("    Signature:   {0}", Encoding.ASCII.GetString(runtimeInfo.Signature, RuntimeInfo.SignatureValueLength - 1));
                                WriteLine("    Version:     {0}", runtimeInfo.Version);
                                if (Target.OperatingSystem == OSPlatform.Windows)
                                {
                                    WriteLine("    Runtime:     {0}", GetWindowsIndex(runtimeInfo.RuntimeModuleIndex));
                                    WriteLine("    DBI:         {0}", GetWindowsIndex(runtimeInfo.DbiModuleIndex));
                                    WriteLine("    DAC:         {0}", GetWindowsIndex(runtimeInfo.DacModuleIndex));
                                }
                                else
                                {
                                    WriteLine("    Runtime:     {0}", GetUnixIndex(runtimeInfo.RuntimeModuleIndex));
                                    WriteLine("    DBI:         {0}", GetUnixIndex(runtimeInfo.DbiModuleIndex));
                                    WriteLine("    DAC:         {0}", GetUnixIndex(runtimeInfo.DacModuleIndex));
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #28
0
    private bool LoadRoleRankXml(bool IsError = false)
    {
        if (IsError)
        {
            m_IsLoadXmlInfo = true;
            RankXmlMap.Clear();               //清空数据
            tagRankXmlChangeEvent pEvent = new tagRankXmlChangeEvent();
            MsgEventHandle.HandleMsg(pEvent); //添加排行榜XML文件读取成功的函数
            return(true);
        }
        //读取配置文件 并且加载到数据集合里面去
        DateTime time     = SystemTime.Instance.GetSystemDateTime;
        UInt32   WriteSec = FishConfig.Instance.GetWriteSec();

        time = time.AddSeconds(WriteSec * -1);
        string FileName = string.Format("Rank_{0}_{1}_{2}.xml", time.Year, time.Month, time.Day);

        Byte[]      FileText = RuntimeInfo.GetLocalFile(FileName);
        XmlDocument doc      = new XmlDocument();

        doc.LoadXml(System.Text.Encoding.UTF8.GetString(FileText));
        XmlElement pRankConfig = doc.DocumentElement;

        for (int i = 0; i < doc.ChildNodes.Count; ++i)
        {
            if (doc.ChildNodes[i].Name == "FishRanks")
            {
                for (int k = 0; k < doc.ChildNodes[i].ChildNodes.Count; ++k)
                {
                    if (doc.ChildNodes[i].ChildNodes[k].Name == "FishRook")
                    {
                        RankInfo pRankInfo = new RankInfo();
                        pRankInfo.RankID = Convert.ToByte(doc.ChildNodes[i].ChildNodes[k].Attributes["TypeID"].Value);

                        for (int j = 0; j < doc.ChildNodes[i].ChildNodes[k].ChildNodes.Count; ++j)
                        {
                            if (doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Name == "Info")
                            {
                                tagRankInfo pInfo = new tagRankInfo();
                                pInfo.bIndex   = Convert.ToByte(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["Index"].Value);
                                pInfo.dwFaceID = Convert.ToUInt32(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["FaceID"].Value);
                                pInfo.dwUserID = Convert.ToUInt32(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["UserID"].Value);
                                pInfo.Gender   = Convert.ToByte(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["Gender"].Value) == 1 ? true : false;
                                pInfo.NickName = Convert.ToString(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["Name"].Value);
                                pInfo.TitleID  = Convert.ToByte(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["TitleID"].Value);
                                pInfo.Param    = Convert.ToInt64(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["Param"].Value);

                                pRankInfo.RankMap.Add(pInfo.bIndex, pInfo);
                            }
                        }
                        RankXmlMap.Add(pRankInfo.RankID, pRankInfo);
                    }
                }
                m_IsLoadXmlInfo = true;
                return(true);
            }
        }
        return(false);
    }
        [Test] // Verifies that some value is extracted anywhere the tests runs
        public void GetRuntime_NotNull()
        {
            var actual = RuntimeInfo.GetRuntime();

            Assert.NotNull(actual);
            Assert.NotNull(actual.Name);
            Assert.NotNull(actual.Version);
        }
        public void StackTraceFactory_NotRunningOnMono_NotMonoStackTraceFactory()
        {
            Skip.If(RuntimeInfo.GetRuntime().IsMono());

            var sut = new SentryOptions();

            Assert.IsNotType <MonoSentryStackTraceFactory>(sut.SentryStackTraceFactory);
        }
 private static extern int /* [HRESULT] */ GetRequestedRuntimeInfo(
     string /* [LPCWSTR] */ pExe,
     string /* [LPCWSTR] */ pwszVersion,
     string /* [LPCWSTR] */ pConfigurationFile,
     uint /* [DWORD] */ startupFlags,
     RuntimeInfo /* [DWORD] */ runtimeInfoFlags,
     StringBuilder /* [LPWSTR] */ pDirectory,
     uint /* [DWORD] */ dwDirectory,
     out uint /* [DWORD *] */ dwDirectoryLength,
     StringBuilder /* [LPWSTR] */ pVersion,
     uint /* [DWORD] */ cchBuffer,
     out uint /* [DWORD *] */ dwLength
     );
Exemple #32
0
        internal static IList<ParsedPath> GetFullScriptReferencesPaths(ParsedPath scriptPath, ScriptInfo scriptInfo, RuntimeInfo runtimeInfo)
        {
            List<ParsedPath> paths = new List<ParsedPath>();
            Dictionary<string, string> dict = new Dictionary<string, string>();

            dict.Add("FxInstallPath", runtimeInfo.FxInstallPath);
            dict.Add("FxReferenceAssemblyPath", runtimeInfo.FxReferenceAssemblyPath);
            dict.Add("ClrInstallPath", runtimeInfo.ClrInstallPath);
            dict.Add("ScriptPath", scriptPath.VolumeAndDirectory);
            dict.Add("CodeRunnerPath", new ParsedPath(Process.GetCurrentProcess().MainModule.FileName, PathType.File).VolumeAndDirectory);

            string reference = String.Empty;

            try
            {
                for (int i = 0; i < scriptInfo.References.Count; i++)
                {
                    reference = scriptInfo.References[i];

                    string fullReference = StringUtility.ReplaceTags(reference, "$(", ")", dict);
                    ParsedPath path = new ParsedPath(fullReference, PathType.File).MakeFullPath(scriptPath);

                    paths.Add(path);
                }
            }
            catch (ArgumentException e)
            {
                // Could be bad crap in the reference paths
                throw new ScriptInfoException(CodeRunnerResources.BadReferencePaths(reference, e.Message));
            }

            return paths;
        }