System.Collections.IEnumerator AsyncLoadRes(LogicRuntimeData ld) { if (ld.Type != LogicType.LOGIC_INIT) { if (GlobalLoading.Instance.IsShow == false) { GlobalEffectMgr.Instance.ShowLoadingMessage(); } } if (ResType.GlobalRes == ld.LogicRes) { bool bret = ResManager.Instance.BeginLoadRes(ResType.GlobalRes, true); yield return(new WaitForEndOfFrame()); bret &= ResManager.Instance.BeginLoadRes(ResType.FishRes, true); yield return(new WaitForEndOfFrame()); bret &= ResManager.Instance.BeginLoadRes(ResType.PathRes, true); yield return(new WaitForEndOfFrame()); bret &= ResManager.Instance.BeginLoadRes(ResType.ExtraRes, true); yield return(new WaitForEndOfFrame()); bret &= ResManager.Instance.BeginLoadRes(ResType.LogonRes, true); yield return(new WaitForEndOfFrame()); bret &= ResManager.Instance.BeginLoadRes(ResType.SceneRes, true); yield return(new WaitForEndOfFrame()); bret &= ResManager.Instance.BeginLoadRes(ResType.GameRes, true); if (!bret) { NativeInterface.ShowMsgAndExit("res_load_err", 200); GlobalEffectMgr.Instance.CloseLoadingMessage(); yield break; } } else if (ld.LogicRes != ResType.MAX) { yield return(new WaitForEndOfFrame()); bool bret = ResManager.Instance.BeginLoadRes(ld.LogicRes, true); if (!bret) { NativeInterface.ShowMsgAndExit("res_load_err", 201); GlobalEffectMgr.Instance.CloseLoadingMessage(); yield break; } } yield return(new WaitForEndOfFrame()); bool bRet = ld.LogicObj.Init(ld.LogicUIObj, m_Params); yield return(new WaitForEndOfFrame()); bRet &= ld.LogicUIObj.Init(ld.LogicObj, m_Params); if (!bRet) { //逻辑和UI初始化失败 NativeInterface.ShowMsgAndExit("res_load_err", 202); GlobalEffectMgr.Instance.CloseLoadingMessage(); InitCompletion(); yield break; } m_LogicData = ld; m_Params = null; yield break; }
public override void Resume() { NativeInterface.RunWithConfig(m_config); }
public void Update(float delta) { if (m_bError) { NativeInterface.ShowMsgAndExit("res_save_error", 109); return; } if (m_ActiveDown != null) { if (m_ActiveDown.Type == DownloadType.DOWNLOAD_MULTI_FILE && m_ActiveDown.DownloadBytes != 0) { } else { m_UpdateUI.SetIsQueue(m_ActiveDown.IsQueue, m_ActiveDown.Type == DownloadType.DOWNLOAD_CHECK_VER); } if (m_ActiveDown.IsQueue) { m_UpdateTick = Utility.GetTickCount(); } } switch (m_State) { case UpdateState.UPDATE_CHECK_LOCALVER: CheckLocalFile(); break; case UpdateState.UPDATE_UNZIPING_FILE: CheckUnzipping(); break; case UpdateState.UPDATE_INIT: m_UpdateTick = Utility.GetTickCount(); string ftpurl = RuntimeInfo.GetFTPVersionURL(); m_ActiveDown = FTPClient.Instance.AddDownload(DownloadType.DOWNLOAD_CHECK_VER, ftpurl, null); m_State = UpdateState.UPDATE_DOWNLOAD_VERSION; break; case UpdateState.UPDATE_DOWNLOAD_VERSION: if (m_ActiveDown.IsOK) { m_RetryCount = 0; string xml = m_ActiveDown.Text; m_ActiveDown = null; if (!CheckVersion(xml)) { NativeInterface.ShowMsgAndExit("update_error", 101); } } else if (m_ActiveDown.HasError) { //出错了 if (++m_RetryCount > MAX_RETRY_COUNT) { NativeInterface.ShowMsgAndExit("res_connect_error", 102); } else { m_State = UpdateState.UPDATE_INIT; m_ActiveDown = null; } } else { if (m_ActiveDown.IsQueue == false && Utility.GetTickCount() - m_UpdateTick > UPDATE_VERSION_TIME_OUT) { NativeInterface.ShowMsgAndExit("res_connect_error", 103); } } break; case UpdateState.UPDATE_DOWNLOAD_RES: if (m_ActiveDown == null) { if (m_DownList.Count > 0) { m_DownloadBytes = 0; m_UpdateTick = Utility.GetTickCount(); m_UpdateUI.BeginDown(ResType.FishRes); m_ActiveDown = FTPClient.Instance.AddMultiResDownload(DownloadType.DOWNLOAD_MULTI_FILE, m_ResFtpList, m_DownList); m_RecvFileCount = m_DownList.Count; m_DownList.Clear(); } else { m_State = UpdateState.UPDATE_COMPLETE; } } else if (m_ActiveDown.IsOK) { m_RetryCount = 0; m_CurrentDownloadBytes += m_ActiveDown.DownloadBytes; m_DownloadBytes = 0; //m_ThreadList.AddItem(m_ActiveDown); SaveDownloadData(m_ActiveDown); m_ActiveDown = null; } else if (m_ActiveDown.HasError) { NativeInterface.ShowMsgAndExit("update_error", 105); } else { if (m_ActiveDown.IsQueue) { //排队中 } else if (m_DownloadBytes != m_ActiveDown.DownloadBytes) { m_DownloadBytes = m_ActiveDown.DownloadBytes; m_UpdateTick = Utility.GetTickCount(); MultiFileDownData mfdd = (MultiFileDownData)m_ActiveDown.Data; if (mfdd.OutsideRecvIndex < mfdd.RecvCount) { SaveDownloadData(m_ActiveDown); } } else if (Utility.GetTickCount() - m_UpdateTick > UPDATE_RES_TIME_OUT) { NativeInterface.ShowMsgAndExit("update_error", 106); } } break; case UpdateState.UPDATE_COMPLETE: //if (m_DownloadCompletionCount != m_DownloadOrgCount) //{ // m_UpdateUI.SetUnzipping(); // return; //} //更新完成,进入下一个逻辑 if (m_SaveCount != m_RecvFileCount) { return; } if (m_bNewClient) { if (RuntimeInfo.GetPlatform() == PlatformType.Android) { NativeInterface.DownNewClientVersion(GetClientPath()); } else if (RuntimeInfo.GetPlatform() == PlatformType.Windows) { NativeInterface.ShowMsgAndExit("update_restart", 0); } else { NativeInterface.DownNewClientVersion(m_NewClientURL); } } else { LogicManager.Instance.Forward(null); } break; case UpdateState.UPDATE_NEW_CLIENT: LogicManager.Instance.Shutdown(); break; } }
void OnApplicationQuit() { NativeInterface.iQuitCore(); }
public bool ChangeSecPassword(string OldPassword, string NewPassword) { //修改二级密码 CL_Cmd_ChangeSecondPassword ncb = new CL_Cmd_ChangeSecondPassword(); ncb.SetCmdType(NetCmdType.CMD_CL_ChangeSecondPassword); if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.PasswordMinLength, FishDataInfo.PasswordLength, OldPassword, StringCheckType.SCT_Password)) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_1); MsgEventHandle.HandleMsg(pUOM); return(false); } if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.PasswordMinLength, FishDataInfo.PasswordLength, NewPassword, StringCheckType.SCT_Password)) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_2); MsgEventHandle.HandleMsg(pUOM); return(false); } if (NewPassword.CompareTo(OldPassword) == 0) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_3); MsgEventHandle.HandleMsg(pUOM); return(false); } NormalAccountInfo ad1 = new NormalAccountInfo(); if (!NativeInterface.ComputeCrc("", OldPassword, out ad1.CRC1, out ad1.CRC2, out ad1.CRC3)) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_4); MsgEventHandle.HandleMsg(pUOM); return(false); } NormalAccountInfo ad2 = new NormalAccountInfo(); if (!NativeInterface.ComputeCrc("", NewPassword, out ad2.CRC1, out ad2.CRC2, out ad2.CRC3)) { tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_5); MsgEventHandle.HandleMsg(pUOM); return(false); } GlobalLogon.Instance.AccountData.SaveAccountData(); ncb.dwOldCrc1 = ad1.CRC1; ncb.dwOldCrc2 = ad1.CRC2; ncb.dwOldCrc3 = ad1.CRC3; ncb.dwNewCrc1 = ad2.CRC1; ncb.dwNewCrc2 = ad2.CRC2; ncb.dwNewCrc3 = ad2.CRC3; GlobalLogon.Instance.AccountData.TempPhoneInfo.Clear(); GlobalLogon.Instance.AccountData.TempAccountInfo.Clear(); GlobalLogon.Instance.AccountData.TempAccountInfo.UID = GlobalLogon.Instance.AccountData.AccountInfo.UID; GlobalLogon.Instance.AccountData.TempAccountInfo.CRC1 = ad2.CRC1; GlobalLogon.Instance.AccountData.TempAccountInfo.CRC2 = ad2.CRC2; GlobalLogon.Instance.AccountData.TempAccountInfo.CRC3 = ad2.CRC3; NetServices.Instance.Send <CL_Cmd_ChangeSecondPassword>(ncb); return(true); }
protected override void OnCharAdded(CharAddedEventArgs e) { int pos = this.CurrentPos; if (Context.IsCloseBracket(e.Ch) && e.Ch == this.NativeInterface.GetCharAt(pos)) { this.NativeInterface.CharRight(); this.NativeInterface.DeleteBack(); } char matchChar = char.MinValue; switch (e.Ch) { case '(': { if (m_context.IsCommentOrString(CurrentPos) == false) { // TODO implement this //CodeComplete(); } matchChar = ')'; break; } case '[': { matchChar = ']'; break; } case '{': { m_context.AutoIndent(e.Ch); matchChar = '}'; break; } case ':': { m_context.AutoIndent(e.Ch); goto case '.'; } // fall through... case '.': case '>': { if (m_context.IsCommentOrString(CurrentPos) == false) { //CodeComplete(); } break; } case '}': { m_context.AutoIndent(e.Ch); break; } case '\n': { // in case ENTER was hit immediately after we inserted '{' into the code if (m_lastCharAdded == '{' && m_autoAddMatchedBrace) { matchChar = '}'; InsertText(pos, matchChar.ToString()); UndoRedo.BeginUndoAction(); NativeInterface.CharRight(); m_context.AutoIndent('}'); InsertText(pos, Environment.NewLine); NativeInterface.CharRight(); SetCaretAt(pos); base.OnCharAdded(e); UndoRedo.EndUndoAction(); } else { m_context.AutoIndent(e.Ch); } break; } default: { break; } } if (matchChar != char.MinValue && m_autoAddMatchedBrace && !m_context.IsCommentOrString(pos)) { if (matchChar == ')') { // avoid adding close brace if the next char is not a whitespace // character int nextChar = SafeGetChar(pos); switch (nextChar) { case ' ': case '\t': case '\n': case '\r': InsertText(pos, matchChar.ToString()); //SetIndicatorCurrent(MATCH_INDICATOR); // use grey colour rather than black, otherwise this indicator is invisible when using the // black theme //NativeInterface.IndicatorFillRange(pos, 1); break; } } else if (matchChar != '}') { InsertText(pos, matchChar.ToString()); //SetIndicatorCurrent(MATCH_INDICATOR); // use grey colour rather than black, otherwise this indicator is invisible when using the // black theme //NativeInterface.IndicatorFillRange(pos, 1); } } if (e.Ch != '\r') { m_lastCharAdded = e.Ch; } }
public TypeInfo(ObjectModel objects, NativeInterface ni, NativeMethod method) { Native = method.ReturnType; string type = objects.MapResult(ni.Name, method.Name, method.ReturnType); Managed = MapType(objects, type); if (Managed == "IBAction") Managed = "void"; }
public static void PauseDownload(long id) { NativeInterface.PauseDownload(id); }
public static void ResumeDownload(long id) { NativeInterface.ResumeDownload(id); }
public void OnQuit() { m_tick = false; NativeInterface.iQuitCore(); }
public void Start() { m_tick = true; NativeInterface.iStartCore(); }
public void SetCaretAt(int pos) { NativeInterface.SetCurrentPos(pos); NativeInterface.SetSelectionStart(pos); NativeInterface.SetSelectionEnd(pos); }
public bool MatchBraceForward(char chOpenBrace, int pos, ref int matchedPos) { if (pos <= 0) { return(false); } char chCloseBrace; switch (chOpenBrace) { case '{': { chCloseBrace = '}'; break; } case '(': { chCloseBrace = ')'; break; } case '[': { chCloseBrace = ']'; break; } case '<': { chCloseBrace = '>'; break; } default: { return(false); } } int nNextPos = pos; char ch; int depth = 1; while (true) { if (nNextPos >= this.TextLength) { break; } nNextPos = NativeInterface.PositionAfter(nNextPos); // Make sure we are not in a comment if (m_context.IsCommentOrString(nNextPos)) { continue; } ch = NativeInterface.GetCharAt(nNextPos); if (ch == chCloseBrace) { // Dec the depth level depth--; if (depth == 0) { matchedPos = nNextPos; return(true); } } else if (ch == chOpenBrace) { // Inc depth level depth++; } } return(false); }
public bool MatchBraceBack(char chCloseBrace, int pos, ref int matchedPos) { if (pos <= 0) { return(false); } char chOpenBrace; switch (chCloseBrace) { case '}': { chOpenBrace = '{'; break; } case ')': { chOpenBrace = '('; break; } case ']': { chOpenBrace = '['; break; } case '>': { chOpenBrace = '<'; break; } default: { return(false); } } int nPrevPos = pos; char ch; int depth = 1; // We go backward while (true) { if (nPrevPos == 0) { break; } nPrevPos = NativeInterface.PositionBefore(nPrevPos); // Make sure we are not in a comment if (m_context.IsCommentOrString(nPrevPos)) { continue; } ch = NativeInterface.GetCharAt(nPrevPos); if (ch == chOpenBrace) { // Dec the depth level depth--; if (depth == 0) { matchedPos = nPrevPos; return(true); } } else if (ch == chCloseBrace) { // Inc depth level depth++; } } return(false); }
// InterfaceSig := Identifier BaseClass C ProtocolList ProtocolList; # for NSWindow // InterfaceSig := Identifier BaseClass C ProtocolList C; // InterfaceSig := Identifier BaseClass C; // InterfaceSig := Identifier C ProtocolList; // InterfaceSig := Identifier Category ProtocolList; // InterfaceSig := Identifier Category; // // BaseClass := ':' S Identifier; // // Category := '(' S Identifier ')' S; private NativeInterface DoAnalyzeInterfaceSig(XmlNode node) { NativeInterface ni; string name = node.ChildNodes[0].InnerText; XmlNode category = DoFind(node, "Category"); XmlNode protocolsNode = DoFind(node, "IdentifierList"); // the ProtocolList returns the IdentifierList instead of itself string[] protocols = protocolsNode != null ? DoAnalyzeIdentifierList(protocolsNode) : new string[0]; if (category != null) { ni = new NativeInterface{Name = name, Protocols = protocols, Category = category.ChildNodes[1].InnerText}; } else { XmlNode baseNode = DoFind(node, "BaseClass"); string baseName = baseNode != null ? baseNode.ChildNodes[1].InnerText : null; ni = new NativeInterface{Name = name, BaseName = baseName, Protocols = protocols}; } return ni; }
public static void Initialize() { NativeInterface.Initialize(); }
public uint GetPipePolicyUInt(int ifaceIndex, byte pipeID, NativeInterface.POLICY_TYPE policyType) { uint result; uint length = 4; bool success = NativeInterface.WinUsb_GetPipePolicy(_InterfaceHandle(ifaceIndex), pipeID, (uint)policyType, ref length, out result); if (!success || length != 4) { throw new Win32Exception("Failed to get WinUSB pipe policy."); } return result; }
public static void Dispose() { Instance.Clear(); NativeInterface.Uninitialize(); }
public MethodInfo(ObjectModel objects, NativeInterface ni, NativeMethod method) { Name = method.Name; ResultType = new TypeInfo(objects, ni, method); var argNames = new List<NameInfo>(); var argTypes = new List<ArgTypeInfo>(); for (int i = 0; i < method.ArgNames.Length; ++i) { argNames.Add(new NameInfo(method.ArgNames[i])); argTypes.Add(new ArgTypeInfo(objects, method.ArgTypes[i])); if (argTypes[argTypes.Count - 1].ManagedOut.Length > 0) HasOutArgs = true; } ArgNames = argNames.ToArray(); ArgTypes = argTypes.ToArray(); }
public HidReadResult Read(int timeout) { var overlapTimeout = timeout <= 0 ? NativeInterface.WAIT_INFINITE : timeout; var status = HidReadResult.ReadStatus.NoDataRead; uint bytesRead = 0; if (!_readPending) { _readPending = true; _buffer = new byte[_capabilities.InputReportByteLength]; _pinnedBuffer = GCHandle.Alloc(_buffer, GCHandleType.Pinned); NativeInterface.ResetEvent(_overlapped.EventHandle); if (!NativeInterface.ReadFile(_handle, _buffer, (uint)_buffer.Length, out bytesRead, ref _overlapped)) { var err = Marshal.GetLastWin32Error(); if (err != NativeInterface.ERROR_IO_PENDING) { throw new IOException(string.Format("Unable to read from device ({0})", err.ToString("X04"))); } } } bool getResult = true; if (overlapTimeout != NativeInterface.WAIT_INFINITE) { getResult = false; var result = NativeInterface.WaitForSingleObject(_overlapped.EventHandle, overlapTimeout); switch (result) { case NativeInterface.WAIT_OBJECT_0: { status = HidReadResult.ReadStatus.Success; getResult = true; break; } case NativeInterface.WAIT_TIMEOUT: { status = HidReadResult.ReadStatus.WaitTimedOut; break; } case NativeInterface.WAIT_FAILED: { status = HidReadResult.ReadStatus.WaitFail; break; } default: { status = HidReadResult.ReadStatus.NoDataRead; break; } } } if (getResult) { var ret = NativeInterface.GetOverlappedResult(_handle, ref _overlapped, out bytesRead, true); if (ret && bytesRead > 0) { _readPending = false; status = HidReadResult.ReadStatus.Success; _pinnedBuffer.Free(); } else { status = HidReadResult.ReadStatus.NoDataRead; } } return(new HidReadResult(_buffer != null ? _buffer : null, status)); }
private void DoInterfaces(StringBuilder buffer, NativeFile file) { for (int i = 0; i < file.Interfaces.Count; ++i) { m_interface = file.Interfaces[i]; if (m_interface.Name != "NSOpenGLLayer") // NSOpenGLLayer relies on CAOpenGLLayer whichis in quartz, not appkit... { m_buffer = new StringBuilder(); if (i > 0) DoWrite(); if (m_objects.KnownType(m_interface.Name)) { DoWriteInterfaceHeader(); DoGenerateMethods(); DoWriteInterfaceTrailer(); buffer.Append(m_buffer.ToString()); } else Console.Error.WriteLine("Ignoring {0} ({1} isn't a known type)", m_interface, m_interface.Name); } } }
public static extern bool FillConsoleOutputCharacter(SafeHandle hConsoleOutput, char cCharacter, int nLength, NativeInterface.COORD dwWriteCoord, out int lpNumberOfCharsWritten);
private void OnDestroy() { NativeInterface.Quit(); }
public static extern bool GetConsoleScreenBufferInfo(SafeHandle hConsoleOutput, out NativeInterface.CONSOLE_SCREEN_BUFFER_INFO result);
public override void Pause() { NativeInterface.Pause(); }
public static extern bool SetConsoleCursorPosition(SafeHandle hConsoleOutput, NativeInterface.COORD dwCursorPosition);
public override void UpdateCamera(Camera _camera) { _camera.projectionMatrix = NativeInterface.GetCameraProjection(); if (!m_isBackgroundRendering) { return; } var handles = default(ARTextureHandles); //Preprocessor locked because 'GetARVideoTextureHandles' is not declared in all platforms #if !UNITY_EDITOR && UNITY_IOS handles = NativeInterface.GetARVideoTextureHandles(); #endif if (handles.textureY == IntPtr.Zero || handles.textureCbCr == IntPtr.Zero) { m_canRenderBackground = false; return; } m_canRenderBackground = true; IsRenderingBackground = m_isBackgroundRendering; Resolution currentResolution = Screen.currentResolution; //Texture Y if (m_videoTextureY == null) { m_videoTextureY = Texture2D.CreateExternalTexture( currentResolution.width, currentResolution.height, TextureFormat.R8, false, false, handles.textureY ); m_videoTextureY.filterMode = FilterMode.Bilinear; m_videoTextureY.wrapMode = TextureWrapMode.Repeat; m_clearMaterial.SetTexture("_textureY", m_videoTextureY); } //Texture CbCr if (m_videoTextureCbCr == null) { m_videoTextureCbCr = Texture2D.CreateExternalTexture( currentResolution.width, currentResolution.height, TextureFormat.RG16, false, false, handles.textureCbCr ); m_videoTextureCbCr.filterMode = FilterMode.Bilinear; m_videoTextureCbCr.wrapMode = TextureWrapMode.Repeat; m_clearMaterial.SetTexture("_textureCbCr", m_videoTextureCbCr); } m_videoTextureY.UpdateExternalTexture(handles.textureY); m_videoTextureCbCr.UpdateExternalTexture(handles.textureCbCr); m_clearMaterial.SetMatrix("_DisplayTransform", m_displayTransform); }
public T OverwriteHook <T>(T NewDelegate) where T : class { fixed(VCR_t *ThisFixed = &this) return(NativeInterface.OverwriteVCRHook <T>(ThisFixed, NewDelegate)); }
public bool CheckVersion(string xml) { XmlDocument doc = new XmlDocument(); if (doc == null) { return(false); } doc.LoadXml(xml); XmlElement ele = doc.DocumentElement; if (ele == null) { return(false); } XmlNode nodeVer = ele.SelectSingleNode("Net"); if (nodeVer == null) { return(false); } string resftp = nodeVer.Attributes["resftp"].Value; string runftp = nodeVer.Attributes["runftp"].Value; string clientUrl = nodeVer.Attributes["clienturl"].Value; if (nodeVer.Attributes["ftpport"] != null) { ServerSetting.ResFtpPort = ushort.Parse(nodeVer.Attributes["ftpport"].Value); } ServerSetting.SetRunFTP(runftp); ServerSetting.ServerList.Clear(); for (int i = 0; i < nodeVer.ChildNodes.Count; ++i) { XmlNode node = nodeVer.ChildNodes[i]; if (node.Name == "IP") { ServerIPData sid = new ServerIPData(); sid.IP = node.FirstChild.Value; sid.Port = ushort.Parse(node.Attributes["port"].Value); ServerSetting.ServerList.Add(sid); } else if (node.Name == "FTP") { ServerIPData rfd = new ServerIPData(); rfd.IP = node.FirstChild.Value; rfd.Port = ushort.Parse(node.Attributes["port"].Value); rfd.ISP = byte.Parse(node.Attributes["dx"].Value); m_ResFtpList.Add(rfd); } } ServerSetting.SERVICES_URL = "";// ele.SelectSingleNode("Services").FirstChild.Value; XmlNode reporterNode = ele.SelectSingleNode("Reporter"); if (reporterNode != null) { ServerSetting.ReporterIP = reporterNode.FirstChild.Value; ServerSetting.ReporterPort = ushort.Parse(reporterNode.Attributes["port"].Value); } XmlNode ShareNode = ele.SelectSingleNode("Share"); if (ShareNode != null) { string wxid = "", wxpwd = "", sinaid = "", sinapwd = "", qqid = "", qqpwd = ""; XmlNode xn = ShareNode.ChildNodes[0]; if (xn != null) { wxid = xn.Attributes["id"].Value; wxpwd = xn.Attributes["pwd"].Value; } xn = ShareNode.ChildNodes[1]; if (xn != null) { sinaid = xn.Attributes["id"].Value; sinapwd = xn.Attributes["pwd"].Value; } xn = ShareNode.ChildNodes[2]; if (xn != null) { qqid = xn.Attributes["id"].Value; qqpwd = xn.Attributes["pwd"].Value; } NativeInterface.InitShare(wxid, wxpwd, sinaid, sinapwd, qqid, qqpwd); xn = ShareNode.ChildNodes[3]; if (xn != null) { ServerSetting.ShareWebUrl = xn.Attributes["weburl"].Value; ServerSetting.ShareTxt = xn.Attributes["txt"].Value; ServerSetting.ShareImgUrl = xn.Attributes["imgurl"].Value; } } //读取现有的资源,进行比较 XmlNode clientNode = ele.SelectSingleNode("Client"); string clientVer = clientNode.FirstChild.Value;; uint clientCrc = uint.Parse(clientNode.Attributes["crc"].Value); uint clientSize = uint.Parse(clientNode.Attributes["size"].Value); if (clientNode.Attributes["resver"] != null) { ServerSetting.RES_VERSION = uint.Parse(clientNode.Attributes["resver"].Value); } if (clientNode.Attributes["ping"] != null) { ServerSetting.SHOW_PING = uint.Parse(clientNode.Attributes["ping"].Value) != 0; } if (clientNode.Attributes["extrabtn"] != null) { ServerSetting.ShowExtraBtn = uint.Parse(clientNode.Attributes["extrabtn"].Value) != 0; } if (clientNode.Attributes["ftp_newftp"] != null) { FTPClient.USE_NEW_FTP = byte.Parse(clientNode.Attributes["ftp_newftp"].Value); } if (clientNode.Attributes["showgame"] != null) { ServerSetting.ShowGame = byte.Parse(clientNode.Attributes["showgame"].Value) != 0; } if (clientNode.Attributes["ftp_chunkcount"] != null) { FTPClient.MAX_CHUNK_COUNT = byte.Parse(clientNode.Attributes["ftp_chunkcount"].Value); } if (clientNode.Attributes["ftp_chunksize"] != null) { FTPClient.CHUNK_SIZE = int.Parse(clientNode.Attributes["ftp_chunksize"].Value); } if (clientNode.Attributes["thirdbtn"] != null) { ServerSetting.ShowHallThirdBtn = int.Parse(clientNode.Attributes["thirdbtn"].Value) != 0; } if (clientNode.Attributes["exchange"] != null) { ServerSetting.ShowExchange = int.Parse(clientNode.Attributes["exchange"].Value) != 0; } if (clientNode.Attributes["showjbp"] != null) { ServerSetting.ShowJBP = int.Parse(clientNode.Attributes["showjbp"].Value) != 0; } if (clientNode.Attributes["showmatch"] != null) { ServerSetting.ShowMatch = int.Parse(clientNode.Attributes["showmatch"].Value) != 0; } if (clientNode.Attributes["showthirdlogin"] != null) { ServerSetting.ShowThirdLoginBtn = int.Parse(clientNode.Attributes["showthirdlogin"].Value) != 0; } m_State = UpdateState.UPDATE_COMPLETE; //检查客户端版本号 if (clientVer == null) { return(false); } uint ver = Utility.VersionToUint(clientVer); if (ver > ServerSetting.ClientVer) { //clientUrl = ReplaceFTPAddress(clientUrl); //版本更新 if (RuntimeInfo.GetPlatform() == PlatformType.Android) { if (CheckClientFile(clientCrc)) { //文件已经下载完成。 //NativeInterface.DownNewClientVersion(GetClientPath()); } else { //下载资源文件 DownResData drd = new DownResData(); drd.ResType = ResType.MAX; drd.ResUrl = clientUrl; drd.ResCrc = clientCrc; drd.ResSize = clientSize; m_DownList.Add(drd); m_State = UpdateState.UPDATE_DOWNLOAD_RES; m_AllDownloadBytes += clientSize; } m_bNewClient = true; } else if (RuntimeInfo.GetPlatform() == PlatformType.Windows) { m_WinSizeList = new int[5]; for (int i = 0; i < 5; ++i) { string str = "winsize" + (i + 1).ToString(); if (clientNode.Attributes[str] != null) { m_WinSizeList[i] = int.Parse(clientNode.Attributes[str].Value); } } DownResData drd = new DownResData(); drd.ResType = ResType.MAX; drd.ResUrl = clientUrl; drd.ResCrc = clientCrc; drd.ResSize = clientSize; m_DownList.Add(drd); m_State = UpdateState.UPDATE_DOWNLOAD_RES; m_AllDownloadBytes += clientSize; m_bNewClient = true; } else { NativeInterface.DownNewClientVersion(clientUrl); m_State = UpdateState.UPDATE_NEW_CLIENT; return(true); } } for (int i = 0; i < (int)ResManager.RES_NUM; ++i) { ResType rt = (ResType)i; XmlNode node = ele.SelectSingleNode(rt.ToString()); DownResData vd = new DownResData(); vd.ResCrc = uint.Parse(node.Attributes["crc"].Value); vd.ResUnzipSize = uint.Parse(node.Attributes["unzipsize"].Value); if (ResManager.Instance.VersionMgr.CheckVerAndCrc(rt, vd.ResCrc, vd.ResUnzipSize)) { //下载资源文件 vd.ResType = rt; vd.ResUrl = resftp + node.Attributes["url"].Value; vd.ResSize = uint.Parse(node.Attributes["size"].Value); m_DownList.Add(vd); m_AllDownloadBytes += vd.ResSize; } } //保存当前的RES_VERSION if (m_DownList.Count > 0) { m_State = UpdateState.UPDATE_DOWNLOAD_RES; return(true); } else { return(true); } }
private void Intellua_SelectionChanged(object sender, EventArgs e) { if (!Parse) { return; } ShowCalltip(); const string lbracket = "([{"; const string rbracket = ")]}"; int pos = CurrentPos; int style = Styles.GetStyleAt(pos - 1); int start, end; start = end = -1; Byte[] str = RawText; Stack <char> stk = new Stack <char>(); for (int p = pos - 1; p >= 0; p--) { // if (Styles.GetStyleAt(p) != style) continue; if (p >= str.Length) { continue; } if (str[p] > 127) { continue; } char c = Convert.ToChar(str[p]); if (rbracket.Contains(c)) { stk.Push(c); } if (lbracket.Contains(c)) { if (stk.Count == 0) { start = p; break; } char pc = stk.Pop(); if ((pc == ')' && c != '(') || (pc == ']' && c != '[') || (pc == '}' && c != '{')) { break; } } } stk.Clear(); for (int p = pos; p < str.Length; p++) { // if (Styles.GetStyleAt(p) != style) continue; if (str[p] > 127) { continue; } char c = Convert.ToChar(str[p]); if (lbracket.Contains(c)) { stk.Push(c); } if (rbracket.Contains(c)) { if (stk.Count == 0) { end = p; break; } char pc = stk.Pop(); if ((pc != ')' && c == '(') || (pc != ']' && c == '[') || (pc != '}' && c == '{')) { break; } } } if (start >= 0 && end >= 0) { char c = Convert.ToChar(str[start]); char pc = Convert.ToChar(str[end]); if ((pc != ')' && c == '(') || (pc != ']' && c == '[') || (pc != '}' && c == '{')) { start = -1; } } if (start != -1) { //start = Encoding.GetByteCount(Text.ToCharArray(), 0, start+1)-1; } if (end != -1) { //end = Encoding.GetByteCount(Text.ToCharArray(), 0, end + 1) - 1; } if (start == -1) { if (end != -1) { NativeInterface.BraceBadLight(end); } else { NativeInterface.BraceHighlight(-1, -1); } } else if (end == -1) { if (start != -1) { NativeInterface.BraceBadLight(start); } else { NativeInterface.BraceHighlight(-1, -1); } } else { NativeInterface.BraceHighlight(start, end); } }
public void Execute(State.ExecutionContext context, ulong address) { if (Interlocked.Increment(ref _threadCount) == 1) { IsReadyForTranslation.WaitOne(); Debug.Assert(_jumpTable == null); _jumpTable = new JumpTable(_allocator); if (Ptc.State == PtcState.Enabled) { Ptc.LoadTranslations(_funcs, _memory, _jumpTable); Ptc.MakeAndSaveTranslations(_funcs, _memory, _jumpTable); } PtcProfiler.Start(); Ptc.Disable(); // Simple heuristic, should be user configurable in future. (1 for 4 core/ht or less, 2 for 6 core+ht etc). // All threads are normal priority except from the last, which just fills as much of the last core as the os lets it with a low priority. // If we only have one rejit thread, it should be normal priority as highCq code is performance critical. // TODO: Use physical cores rather than logical. This only really makes sense for processors with hyperthreading. Requires OS specific code. int unboundedThreadCount = Math.Max(1, (Environment.ProcessorCount - 6) / 3); int threadCount = Math.Min(4, unboundedThreadCount); for (int i = 0; i < threadCount; i++) { bool last = i != 0 && i == unboundedThreadCount - 1; Thread backgroundTranslatorThread = new Thread(TranslateStackedSubs) { Name = "CPU.BackgroundTranslatorThread." + i, Priority = last ? ThreadPriority.Lowest : ThreadPriority.Normal }; backgroundTranslatorThread.Start(); } } Statistics.InitializeTimer(); NativeInterface.RegisterThread(context, _memory, this); do { address = ExecuteSingle(context, address); }while (context.Running && address != 0); NativeInterface.UnregisterThread(); if (Interlocked.Decrement(ref _threadCount) == 0) { _backgroundTranslatorEvent.Set(); ClearJitCache(); ResetPools(); _jumpTable.Dispose(); _jumpTable = null; } }
public IEnumerator CaptureScreenAndShare(object uiTexture) { bool toFriend = m_bToFriend; Rect rect; if (uiTexture is UIPanel) { rect = Utility.GetUIScreenRect((UIPanel)uiTexture); } else { rect = Utility.GetUIScreenRect((UIWidget)uiTexture); } yield return(new WaitForEndOfFrame()); Texture2D cutImage = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.RGB24, false); cutImage.ReadPixels(rect, 0, 0, false); cutImage.Apply(); const int MAX_WIDTH = 1920; const int MAX_HEIGHT = (int)(MAX_WIDTH / 1.7777777f); const int JPG_QUALITY = 100; const float Scaling = 0.8f; const int MAX_SIZE = 1024 * 1024 * 1; const int MIN_SIZE = 1024 * 32; if (cutImage.width > MAX_WIDTH || cutImage.height > MAX_HEIGHT) { float x = (float)MAX_WIDTH / cutImage.width; float y = (float)MAX_HEIGHT / cutImage.height; cutImage = Utility.ScaleTexture(cutImage, Mathf.Max(x, y)); } byte[] byt = cutImage.EncodeToJPG(JPG_QUALITY); //保存原图 while (byt.Length > MAX_SIZE) //最大1M { //图片太大,继续缩放 cutImage = Utility.ScaleTexture(cutImage, Scaling); byt = cutImage.EncodeToJPG(JPG_QUALITY); } string imgstr = "cutimage.jpg"; string path = RuntimeInfo.GetLocalPath(imgstr); System.IO.File.WriteAllBytes(path, byt); /* * //保存缩略图 * while (byt.Length > MIN_SIZE) //最大32 k * { * //图片太大,继续缩放 * cutImage = Utility.ScaleTexture(cutImage, Scaling); * byt = cutImage.EncodeToJPG(JPG_QUALITY); * } * string path = RuntimeInfo.GetLocalPath(imgstr); * System.IO.File.WriteAllBytes(path, byt); */ NativeInterface.BeginShare(toFriend, ServerSetting.ShareTxt, path); yield break; }
public void GetInterfaceInformation(int interfaceIndex, out NativeInterface.USB_INTERFACE_DESCRIPTOR descriptor, out List<NativeInterface.WINUSB_PIPE_INFORMATION> pipes) { pipes = new List<NativeInterface.WINUSB_PIPE_INFORMATION>(); bool success = NativeInterface.WinUsb_QueryInterfaceSettings(_InterfaceHandle(interfaceIndex), 0, out descriptor); if (!success) { throw new Win32Exception("Failed to get WinUSB device interface descriptor."); } IntPtr interfaceHandle = _InterfaceHandle(interfaceIndex); for (byte pipeIdx = 0; pipeIdx < descriptor.bNumEndpoints; pipeIdx++) { NativeInterface.WINUSB_PIPE_INFORMATION pipeInfo; success = NativeInterface.WinUsb_QueryPipe(interfaceHandle, 0, pipeIdx, out pipeInfo); pipes.Add(pipeInfo); if (!success) { throw new Win32Exception("Failed to get WinUSB device pipe information."); } } }
//主要初始化函数 System.Collections.IEnumerator MainInitProcedure(object obj) { //SceneObjMgr.Instance.LoadSceneObj(); yield return(new WaitForEndOfFrame()); m_State = ServerSetting.Init(); if (!m_State) { LogMgr.Log("资源加载失败:ServerSetting"); } yield return(new WaitForEndOfFrame()); m_State = LocalSetting.Init(); if (!m_State) { LogMgr.Log("资源加载失败:LocalSetting"); } yield return(new WaitForEndOfFrame()); m_State = FishResManager.Instance.Init(); if (!m_State) { LogMgr.Log("资源加载失败:FishResManager"); } yield return(new WaitForEndOfFrame()); m_State = PathManager.Instance.Init(); if (!m_State) { LogMgr.Log("资源加载失败:PathManager"); } yield return(new WaitForEndOfFrame()); m_State = GlobalEffectMgr.Instance.Init(); if (!m_State) { LogMgr.Log("资源加载失败:GlobalEffectMgr"); } yield return(new WaitForEndOfFrame()); m_State = GlobalAudioMgr.Instance.Init(); if (!m_State) { LogMgr.Log("资源加载失败:GlobalAudioMgr"); } yield return(new WaitForEndOfFrame()); m_State = GlobalHallUIMgr.Instance.Init(); if (!m_State) { LogMgr.Log("资源加载失败:GlobalHallUIMgr"); } while (IsCompletion == false) { if (m_State == false) { NativeInterface.ShowMsgAndExit("res_load_err", 212); SceneMain.Instance.Shutdown(); yield break; } yield return(new WaitForEndOfFrame()); } LogicManager.Instance.InitCompletion(); LogicManager.Instance.Forward(null); yield break; }
public void SetPipePolicy(int ifaceIndex, byte pipeID, NativeInterface.POLICY_TYPE policyType, uint value) { bool success = NativeInterface.WinUsb_SetPipePolicy(_InterfaceHandle(ifaceIndex), pipeID, (uint)policyType, 4, ref value); if (!success) { throw new Win32Exception("Failed to set WinUSB pipe policy."); } }
/// <summary> /// Get the number of triangles in the rest pose, no subdivision /// </summary> /// <returns>Number of triangles</returns> public int GetRestFaceCount() => NativeInterface.GetRestFaceCount(this._cppMesh);