public override void OnAnchorUploadComplete(bool successful, XString failureReason)
 {
     Profile.BeginRange("OnAnchorUploadComplete");
     if (this.AnchorUploadedEvent != null)
     {
         this.AnchorUploadedEvent(successful, failureReason);
     }
     Profile.EndRange();
 }
 public override void OnCreateFailed(XString reason)
 {
     Profile.BeginRange("OnCreateFailed");
     if (this.CreateFailedEvent != null)
     {
         this.CreateFailedEvent(reason);
     }
     Profile.EndRange();
 }
 public override void OnAnchorsDownloaded(bool successful, AnchorDownloadRequest request, XString failureReason)
 {
     Profile.BeginRange("OnAnchorsDownloaded");
     if (this.AnchorsDownloadedEvent != null)
     {
         this.AnchorsDownloadedEvent(successful, request, failureReason);
     }
     Profile.EndRange();
 }
 public override void OnStringElementChanged(long elementID, XString newValue)
 {
     Profile.BeginRange("OnStringElementChanged");
     if (this.StringChangedEvent != null)
     {
         this.StringChangedEvent(elementID, newValue);
     }
     Profile.EndRange();
 }
Ejemplo n.º 5
0
 public virtual void SetName(XString name)
 {
     SharingClientPINVOKE.UserPresenceManager_SetName(swigCPtr, XString.getCPtr(name));
 }
 public virtual void SetUserName(XString name) {
   SharingClientPINVOKE.SharingManager_SetUserName(swigCPtr, XString.getCPtr(name));
 }
 public virtual DoubleElement CreateDoubleElement(XString name, double value) {
   global::System.IntPtr cPtr = SharingClientPINVOKE.ObjectElement_CreateDoubleElement(swigCPtr, XString.getCPtr(name), value);
   DoubleElement ret = (cPtr == global::System.IntPtr.Zero) ? null : new DoubleElement(cPtr, true);
   return ret; 
 }
 public virtual void Write(XString value) {
   SharingClientPINVOKE.NetworkOutMessage_Write__SWIG_6(swigCPtr, XString.getCPtr(value));
 }
        /// <summary>
        /// Called when anchor download operations complete.
        /// </summary>
        private void RoomManagerListener_AnchorsDownloaded(bool successful, AnchorDownloadRequest request, XString failureReason)
        {
            // If we downloaded anchor data successfully we should import the data.
            if (successful)
            {
                int dataSize = request.GetDataSize();

                if (SharingStage.Instance.ShowDetailedLogs)
                {
                    Debug.LogFormat("Anchor Manager: Anchor size: {0} bytes.", dataSize.ToString());
                }

                if (AnchorDebugText != null)
                {
                    AnchorDebugText.text += string.Format("\nAnchor size: {0} bytes.", dataSize.ToString());
                }

                rawAnchorData = new byte[dataSize];

                request.GetData(rawAnchorData, dataSize);
                currentState = ImportExportState.DataReady;
            }
            else
            {
                if (AnchorDebugText != null)
                {
                    AnchorDebugText.text += string.Format("\nAnchor DL failed " + failureReason);
                }

                // If we failed, we can ask for the data again.
                Debug.LogWarning("Anchor Manager: Anchor DL failed " + failureReason);
#if UNITY_WSA && !UNITY_EDITOR
                MakeAnchorDataRequest();
#endif
            }
        }
Ejemplo n.º 10
0
 public void SetRemoteAddress(XString remoteNameOrIP)
 {
     SharingClientPINVOKE.DirectPairConnector_SetRemoteAddress(swigCPtr, XString.getCPtr(remoteNameOrIP));
 }
Ejemplo n.º 11
0
        public virtual bool DownloadAnchor(Room room, XString anchorName)
        {
            bool ret = SharingClientPINVOKE.RoomManager_DownloadAnchor(swigCPtr, Room.getCPtr(room), XString.getCPtr(anchorName));

            return(ret);
        }
Ejemplo n.º 12
0
    public void Handle_CopyData(ref Message m)
    {
        XLog.Log($"Begin Request: {RequestNumber}");
        RequestNumber++;
        var cdsRequest = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));

        var request         = "";
        var requestEncoding = Persistence.RequestEncoding;

        XLog.Log($"RequestEncoding: {requestEncoding}");
        if (requestEncoding == IdexEncoding.Ansi)
        {
            request = Marshal.PtrToStringAnsi(cdsRequest.lpData);
        }
        else
        {
            request = Marshal.PtrToStringUni(cdsRequest.lpData);
        }

        XLog.Log($"ClaimMarkerInRequest: {Persistence.ClaimMarkerInRequest}");
        if (Persistence.ClaimMarkerInRequest)
        {
            if (XString.StartsWith(request, Marker))
            {
                XLog.Log($"Eliminate Marker: {Marker}");
                request = request.Substring(Marker.Length).Trim();
            }
            else
            {
                XLog.Log($"Marker is expected but not present. Request is denied.");
                return;
            }
        }

        XLog.Log($"Parse Request");
        string requestServerId = "";
        string requestClientId = "";
        var    requestLines    = XString.SplitIntoLines(request);

        if (requestLines.Length >= 3)
        {
            for (int i = 0; i < 3; i++)
            {
                string requestLine = requestLines[i];
                string left, right;
                XString.ParseAssoc(requestLine, out left, out right);
                if (XString.Eq(left, "ServerId") || XString.Eq(left, "sid"))
                {
                    requestServerId = right;
                }
                else if (XString.Eq(left, "ClientId") || XString.Eq(left, "cid"))
                {
                    requestClientId = right;
                }
            }
        }

        XLog.Log($"Identify client");
        IntPtr clientHandle = IntPtr.Zero;

        if (requestClientId != "")
        {
            XLog.Log($"ClientId: {requestClientId}");
            clientHandle = Native.FindWindow(null, requestClientId);
        }
        if (clientHandle == IntPtr.Zero)
        {
            XLog.Log($"Cannot find client");
            return;
        }
        XLog.Log($"ClientHandle: {clientHandle}");

        var response = "";

        foreach (var actionLine in requestLines)
        {
            if (XString.StartsWith(actionLine, "o ", "g ", "s "))
            {
                var actionPrefix = actionLine.Substring(0, 2).Trim();
                var actionBody   = actionLine.Substring(2).Trim();
                if (XString.Eq(actionPrefix, "o"))
                {
                    XLog.Log($"Execute action: {actionPrefix} {actionBody}");
                    response += actionBody;
                }
                else if (XString.Eq(actionPrefix, "g"))
                {
                    if (Persistence.SupportGetOps)
                    {
                        XLog.Log($"Execute action: {actionPrefix} {actionBody}");
                        var result = Ide.TryGetOp(actionBody);
                        response += result;
                    }
                }
                else if (XString.Eq(actionPrefix, "s"))
                {
                    if (Persistence.SupportSetOps)
                    {
                        XLog.Log($"Execute action: {actionPrefix} {actionBody}");
                        string left, right;
                        XString.ParseAssoc(actionBody, out left, out right);
                        Ide.TrySetOp(left, right);
                    }
                }
            }
            else if (XString.StartsWith(actionLine, "Document."))
            {
                string rest         = actionLine.Substring(9);
                int    openBracket  = rest.IndexOf('(');
                string functionName = rest.Substring(0, openBracket);
                rest = rest.Substring(openBracket + 1);
                int closingBracket = rest.IndexOf(')');
                rest = rest.Substring(0, closingBracket);
                var args = rest.Split(',');
                if (XString.Eq(functionName
                               , "SetSelectedRange"))
                {
                    int startIndex = int.Parse(args[0]);
                    int endIndex   = int.Parse(args[1]);
                    Ide.Document_SetSelectedRange(startIndex, endIndex);
                }
                else if (XString.Eq(functionName
                                    , "GetSelectedRange"))
                {
                    int startIndex = 0;
                    int endIndex   = 0;
                    Ide.Document_GetSelectedRange(out startIndex, out endIndex);
                    response += startIndex + "," + endIndex;
                }
                else if (XString.Eq(functionName
                                    , "GetSelectedText"))
                {
                    string text = Ide.Document_GetSelectedText();
                    response += text;
                }
                else if (XString.Eq(functionName
                                    , "ReplaceSelectedText"))
                {
                    Ide.Document_ReplaceSelectedText();
                }
                else if (XString.Eq(functionName
                                    , "DeleteSelectedText"))
                {
                    Ide.Document_DeleteSelectedText();
                }
                else if (XString.Eq(functionName
                                    , "GetLineIndexByChar"
                                    ))
                {
                    int charIndex = int.Parse(args[0]);
                    int lineIndex = Ide.Document_GetLineIndexByChar(charIndex);
                    response += lineIndex.ToString();
                }
                else if (XString.Eq(functionName
                                    , "GetLine"
                                    ))
                {
                    int    lineIndex   = int.Parse(args[0]);
                    string lineContent = Ide.Document_GetLine(lineIndex);
                    response += lineContent.ToString();
                }
                else if (XString.Eq(functionName
                                    , "SelectLine"
                                    ))
                {
                    int lineIndex = int.Parse(args[0]);
                    Ide.Document_SelectLine(lineIndex);
                }
                else if (XString.Eq(functionName
                                    , "GetLineLength"
                                    ))
                {
                    int charIndex = int.Parse(args[0]);
                    int charCount = Ide.Document_GetLineLength(charIndex);
                    response += charCount.ToString();
                }
                else if (XString.Eq(functionName
                                    , "GetCharIndexByLine"
                                    ))
                {
                    int lineIndex = int.Parse(args[0]);
                    int charIndex = Ide.Document_GetCharIndexByLine(lineIndex);
                    response += charIndex.ToString();
                }
                else if (XString.Eq(functionName
                                    , "GetTextLength"
                                    ))
                {
                    int charCount = Ide.Document_GetTextLength();
                    response += charCount.ToString();
                }
                else if (XString.Eq(functionName
                                    , "GetText"
                                    ))
                {
                    string chars = Ide.Document_GetText();
                    response += chars;
                }
                else if (XString.Eq(functionName
                                    , "ScrollToEnd"
                                    ))
                {
                    Ide.Document_ScrollToEnd();
                }
                else if (XString.Eq(functionName
                                    , "GetCaretLineIndex"
                                    ))
                {
                    response += Ide.Document_GetCaretLineIndex();
                }
                else if (XString.Eq(functionName
                                    , "GetCaretColumnIndex"
                                    ))
                {
                    response += Ide.Document_GetCaretColumnIndex();
                }
                else if (XString.Eq(functionName
                                    , "GetSelectedStartLineIndex"
                                    ))
                {
                    response += Ide.Document_GetSelectedStartLineIndex();
                }
                else if (XString.Eq(functionName
                                    , "GetSelectedEndLineIndex"
                                    ))
                {
                    response += Ide.Document_GetSelectedEndLineIndex();
                }
                else if (XString.Eq(functionName
                                    , "GetSelectedRangeCount"
                                    ))
                {
                    response += Ide.Document_GetSelectedRangeCount();
                }
                else if (XString.Eq(functionName
                                    , "GetSelectedStartCharIndex"
                                    ))
                {
                    response += Ide.Document_GetSelectedStartCharIndex();
                }
                else if (XString.Eq(functionName
                                    , "GetSelectedEndCharIndex"
                                    ))
                {
                    response += Ide.Document_GetSelectedEndCharIndex();
                }
                else if (XString.Eq(functionName
                                    , "GetOpenDocuments"
                                    ))
                {
                    response += Ide.Document_GetOpenDocuments();
                }
            }
            else if (XString.StartsWith(actionLine, "SolutionExplorer."))
            {
                string   functionName = null;
                string[] args         = null;
                ParseActionLine(actionLine, "SolutionExplorer.",
                                out functionName, out args);

                if (XString.Eq(functionName
                               , "GetSelectedItems"
                               ))
                {
                    response += Ide.SolutionExplorer_GetSelectedItems();
                }
                else if (XString.Eq(functionName
                                    , "GetSelectedItemCount"
                                    ))
                {
                    response += Ide.SolutionExplorer_GetSelectedItemCount();
                }
            }
            else if (XString.StartsWith(actionLine, "Base."))
            {
                string   functionName = null;
                string[] args         = null;
                ParseActionLine(actionLine, "Base.",
                                out functionName, out args);

                if (XString.Eq(functionName
                               , "GetServerId"
                               ))
                {
                    response += Ide.Base_GetServerId();
                }
                else if (XString.Eq(functionName
                                    , "SetServerId"
                                    ))
                {
                    string serverId = args[0];
                    Ide.Base_SetServerId(serverId);
                }
                else if (XString.Eq(functionName
                                    , "GetServerHandle"
                                    ))
                {
                    response += Ide.Base_GetServerHandle();
                }
            }
            else if (XString.StartsWith(actionLine, "Output."))
            {
                string   functionName = null;
                string[] args         = null;
                ParseActionLine(actionLine, "Output.",
                                out functionName, out args);

                if (XString.Eq(functionName
                               , "WriteCR"
                               ))
                {
                    response += Ide.Output_WriteCR();
                }
                else if (XString.Eq(functionName
                                    , "WriteLF"
                                    ))
                {
                    response += Ide.Output_WriteLF();
                }
                else if (XString.Eq(functionName
                                    , "WriteCRLF"
                                    ))
                {
                    response += Ide.Output_WriteCRLF();
                }
                else if (XString.Eq(functionName
                                    , "WriteHT"
                                    ))
                {
                    response += Ide.Output_WriteHT();
                }
                else if (XString.Eq(functionName
                                    , "WriteSP"
                                    ))
                {
                    response += Ide.Output_WriteSP();
                }
                else if (XString.Eq(functionName
                                    , "Write"
                                    ))
                {
                    string text = args[0].Trim('"');
                    response += Ide.Output_Write(text);
                }
            }
        }

        XLog.Log($"IncludeMarkerInResponse: {Persistence.IncludeMarkerInResponse}");
        if (Persistence.IncludeMarkerInResponse)
        {
            response += Marker + "\r\n";
        }

        var responseEncoding = Persistence.ResponseEncoding;

        XLog.Log($"ResponseEncoding: {responseEncoding}");
        var sizeInBytes     = (response.Length + 1) * 2;
        var responsePointer = IntPtr.Zero;

        try
        {
            if (responseEncoding == IdexEncoding.Ansi)
            {
                responsePointer = Marshal.StringToCoTaskMemAnsi(response);
            }
            else
            {
                responsePointer = Marshal.StringToCoTaskMemUni(response);
            }

            var cds = new COPYDATASTRUCT();
            cds.cbData = sizeInBytes;
            cds.lpData = responsePointer;
            Native.SendMessage(clientHandle, WM_COPYDATA, IntPtr.Zero, ref cds);
            int errorCode = Marshal.GetLastWin32Error();
            if (errorCode != 0)
            {
                XLog.Log($"SendMessage Code: {errorCode}");
            }
        }
        finally
        {
            XLog.Log($"Free native objects");
            if (responseEncoding == IdexEncoding.Ansi)
            {
                Marshal.ZeroFreeCoTaskMemAnsi(responsePointer);
            }
            else
            {
                Marshal.ZeroFreeCoTaskMemUnicode(responsePointer);
            }
        }
        XLog.Log($"End Request");
    }
Ejemplo n.º 13
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(XString obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 14
0
        public bool IsEqual(XString otherStr)
        {
            bool ret = SharingClientPINVOKE.XString_IsEqual(swigCPtr, XString.getCPtr(otherStr));

            return(ret);
        }
Ejemplo n.º 15
0
// man what a friggin mess just to deal with ANY
// kind of mangled input and spit out some kinda lines
// uhmm...
        static XString FilterLines(ref object scratch, XString buffer)
        {
            //*data = (struct my_scratch_data*)scratch[0];
            my_scratch_data data = scratch as my_scratch_data;
            int             total_length;
            int             n;
            int             thisskip;

            if (data == null)
            {
                data          = new my_scratch_data();
                data.skip     = 0;
                data.linebuf  = null;
                data.lastread = false;
                scratch       = data;
            }
            thisskip = data.skip; // skip N characters in first buffer.
            if (buffer != null)
            {
                data.lastread = false;
                data.linebuf.Add(buffer);
            }
            else if (buffer == null)
            {
                if (data.lastread)
                {
                    XString final = null;
                    if (data.linebuf != null)
                    {
                        final = new XString(data.linebuf.firstseg.Text.Substring(data.skip));
                    }
                    data.linebuf = null;
                    scratch      = null;
#if LOG_LINES_READ
                    Log.log("Returning buffer [%s]", GetText(final));
#endif
                    return(final);
                }
            }

            buffer       = data.linebuf;
            total_length = 0;
            while (buffer != null)
            {
                // full new buffer, which may or may not add to prior segments...
                int    end      = 0;
                int    length   = buffer.firstseg.Text.Length;
                String chardata = buffer.firstseg.Text;
                //Log.log(  "Considering buffer %s" , GetText( buffer ) + data.skip );
                if ((length - thisskip) == 0)
                {
                    //buffer
                    buffer.Remove(buffer.firstseg);
                }
                else
                {
                    for (n = thisskip; n < length; n++)
                    {
                        if (chardata[n] == '\n' ||
                            chardata[n] == '\r')
                        {
                            if (chardata[n] == '\n')
                            {
                                end = 1;
                                n++;         // include this character.
                                //Log.log( "BLANK LINE - CONSUMED" );
                                break;
                            }
                            if (end > 0)      // \r\r is two lines too
                            {
                                break;
                            }
                            end = 1;
                        }
                        else if (end > 0)
                        {
                            // any other character... after a \r.. don't include the character.
                            break;
                        }
                    }
                }
                total_length += n - thisskip;
                if (end > 0)
                {
                    // new character, trim at -1 from here...
                    result = SegCreate(total_length);
                    int ofs;
                    buffer   = data.linebuf;
                    thisskip = data.skip;
                    n        = thisskip;
                    ofs      = 0;
                    while (ofs < total_length)
                    {
                        int len = GetTextSize(buffer);
                        if (len > (len - thisskip))
                        {
                            len = len - thisskip;
                        }
                        if (len > (total_length - ofs))
                        {
                            len = total_length - ofs;
                        }

                        MemCpy(GetText(result) + ofs
                               , GetText(buffer) + thisskip
                               , sizeof(TEXTCHAR) * len);
                        ofs += len;
                        n   += len;
                        if (ofs < total_length)
                        {
                            n        = 0;
                            thisskip = 0;
                            buffer   = NEXTLINE(buffer);
                        }
                    }
                    if (buffer)
                    {
                        data.skip = n;
                        LineRelease(SegBreak(buffer));
                        data.linebuf = buffer;
                    }
                    else
                    {
                        data.skip = 0;
                    }
                    GetText(result)[total_length] = 0;
                    //Log.log( "Considering buffer %s", GetText( result ) );
#ifdef LOG_LINES_READ
                    Log.log("Returning buffer [%s]", GetText(result));
#endif
                    return(result);
                }
                else
                {
                    //Log.log( "Had no end within the buffer, waiting for another..." );
                }
                thisskip = 0; // no more skips.
                buffer   = NEXTLINE(buffer);
            }
            data.lastread = TRUE;
            return(NULL);
        }
Ejemplo n.º 16
0
        public virtual bool CreateSession(XString sessionName, SessionType type)
        {
            bool ret = SharingClientPINVOKE.SessionManager_CreateSession__SWIG_1(swigCPtr, XString.getCPtr(sessionName), (int)type);

            return(ret);
        }
Ejemplo n.º 17
0
 public virtual bool UploadAnchor(Room room, XString anchorName, byte[] data, int dataSize)
 {
     global::System.Runtime.InteropServices.GCHandle pinHandle_data = global::System.Runtime.InteropServices.GCHandle.Alloc(data, global::System.Runtime.InteropServices.GCHandleType.Pinned); try {
         {
             bool ret = SharingClientPINVOKE.RoomManager_UploadAnchor(swigCPtr, Room.getCPtr(room), XString.getCPtr(anchorName), (global::System.IntPtr)pinHandle_data.AddrOfPinnedObject(), dataSize);
             return(ret);
         }
     } finally { pinHandle_data.Free(); }
 }
Ejemplo n.º 18
0
 public override void UpdateFromRemote(XString remoteValue)
 {
     value = remoteValue.GetString();
 }
Ejemplo n.º 19
0
        public virtual Room CreateRoom(XString roomName, long roomID, bool keepOpenWhenEmpty)
        {
            global::System.IntPtr cPtr = SharingClientPINVOKE.RoomManager_CreateRoom(swigCPtr, XString.getCPtr(roomName), roomID, keepOpenWhenEmpty);
            Room ret = (cPtr == global::System.IntPtr.Zero) ? null : new Room(cPtr, true);

            return(ret);
        }
Ejemplo n.º 20
0
 public virtual bool DownloadAnchor(Room room, XString anchorName) {
   bool ret = SharingClientPINVOKE.RoomManager_DownloadAnchor(swigCPtr, Room.getCPtr(room), XString.getCPtr(anchorName));
   return ret;
 }
 public override void OnAnchorsDownloaded(bool successful, AnchorDownloadRequest request, XString failureReason)
 {
     Profile.BeginRange("OnAnchorsDownloaded");
     if (this.AnchorsDownloadedEvent != null)
     {
         this.AnchorsDownloadedEvent(successful, request, failureReason);
     }
     Profile.EndRange();
 }
Ejemplo n.º 22
0
 public bool IsEqual(XString otherStr) {
   bool ret = SharingClientPINVOKE.XString_IsEqual(swigCPtr, XString.getCPtr(otherStr));
   return ret;
 }
Ejemplo n.º 23
0
        private VirtualMachineRunResult Run(int CodeStart, int CodeLen, int Cycle)
        {
            //обработка аргументов
            if (Cycle != 0 && MRAM[_ActionCell] == 0)
            {
                return(VirtualMachineRunResult.RanSuccessfully);
            }
            if (CodeStart == 0 && CodeLen == 0 && Cycle == 0)
            {
                Thread.CurrentThread.Name     = this.ParentIDE.Title + " Running Thread";
                Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
            }
            //
            int  A = 0, L = 0, Z = 0;
            byte D = 0;
            VirtualMachineRunningErrorReaction Reaction = VirtualMachineRunningErrorReaction.Undefined;

            do
            {
                for (A = CodeStart; A < CodeStart + CodeLen; A++)
                {
                    CURR_STEP : _NextSymbol = A;
                    if (_NextSymbol != A)
                    {
                        A = _NextSymbol - 1; continue;
                    }
                    if (_Status == VirtualMachineRunningStatus.Breaking)
                    {
                        return(VirtualMachineRunResult.Broken);
                    }
                    switch (MRAM[A])
                    {
                    case 62:     // >
                        Z = _ActionCell + 1;
                        if (Z <= _CaretBound)
                        {
                            _ActionCell = Z;
                        }
                        else if (_RoundCaretRange)
                        {
                            _ActionCell = 0;
                        }
                        else
                        {
                            Error?.Invoke(this, VirtualMachineRunningErrorId.CellPointerOutOfRange, out Reaction);
                            if (Reaction == VirtualMachineRunningErrorReaction.TryAgain)
                            {
                                goto CURR_STEP;
                            }
                        }
                        break;

                    case 60:     // <
                        Z = _ActionCell - 1;
                        if (Z >= 0)
                        {
                            _ActionCell = Z;
                        }
                        else if (_RoundCaretRange)
                        {
                            _ActionCell = _CaretBound + Z + 1;
                        }
                        else
                        {
                            Error?.Invoke(this, VirtualMachineRunningErrorId.CellPointerOutOfRange, out Reaction);
                            if (Reaction == VirtualMachineRunningErrorReaction.TryAgain)
                            {
                                goto CURR_STEP;
                            }
                        }
                        break;

                    case 43:     // +
                        Z = MRAM[_ActionCell] + 1;
                        if (Z <= 255)
                        {
                            MRAM[_ActionCell] = (byte)Z;
                        }
                        else if (_RoundValueRange)
                        {
                            MRAM[_ActionCell] = (byte)(0 + Z - 255 - 1);
                        }
                        else
                        {
                            Error?.Invoke(this, VirtualMachineRunningErrorId.CellValueOutOfRange, out Reaction);
                            if (Reaction == VirtualMachineRunningErrorReaction.TryAgain)
                            {
                                goto CURR_STEP;
                            }
                        }
                        break;

                    case 45:     // -
                        Z = MRAM[_ActionCell] - 1;
                        if (Z >= 0)
                        {
                            MRAM[_ActionCell] = (byte)Z;
                        }
                        else if (_RoundValueRange)
                        {
                            MRAM[_ActionCell] = (byte)(255 - 0 + Z + 1);
                        }
                        else
                        {
                            Error?.Invoke(this, VirtualMachineRunningErrorId.CellValueOutOfRange, out Reaction);
                            if (Reaction == VirtualMachineRunningErrorReaction.TryAgain)
                            {
                                goto CURR_STEP;
                            }
                        }
                        break;

                    case 46:     // .
                        _ActionOutputPort.Output(MRAM[_ActionCell]);
                        break;

                    case 44:     // ,
                        MRAM[ActionCell] = _ActionInputPort.Input();
                        break;

                    case 91:     // [
                        L = XString.FindClosing(MRAM, A + 1, CodeLen - (A - CodeStart) - 1, '[', ']', "", "'" + (char)(34), "'" + (char)(34)) - A - 1;
                        Run(A + 1, L, -1);
                        A += L + 1;
                        break;

                    case 93:     // ]
                        MessageBox.Show(": Неожиданный символ " + (char)(34) + "]" + (char)(34) + " в позиции " + A.ToString() + (char)(10) + (char)(10) + "Завершение цикла без его начала", "Сообщение BF Machine", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        break;
                    }
                }
                D += 1;
                if (D > _InterruptingPeriod)
                {
                    Application.DoEvents();
                    D = 0;
                }
            } while ((Cycle != 0) && (MRAM[_ActionCell] != 0));

            return(VirtualMachineRunResult.RanSuccessfully);
        }
 public virtual IntArrayElement CreateIntArrayElement(XString name) {
   global::System.IntPtr cPtr = SharingClientPINVOKE.ObjectElement_CreateIntArrayElement(swigCPtr, XString.getCPtr(name));
   IntArrayElement ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntArrayElement(cPtr, true);
   return ret; 
 }
Ejemplo n.º 25
0
        public virtual ObjectElement CreateObjectElement(XString name, XString objectType)
        {
            global::System.IntPtr cPtr = SharingClientPINVOKE.ObjectElement_CreateObjectElement__SWIG_1(swigCPtr, XString.getCPtr(name), XString.getCPtr(objectType));
            ObjectElement         ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ObjectElement(cPtr, true);

            return(ret);
        }
 public virtual void SetName(XString name) {
   SharingClientPINVOKE.UserPresenceManager_SetName(swigCPtr, XString.getCPtr(name));
 }
Ejemplo n.º 27
0
        public virtual FloatArrayElement CreateFloatArrayElement(XString name)
        {
            global::System.IntPtr cPtr = SharingClientPINVOKE.ObjectElement_CreateFloatArrayElement(swigCPtr, XString.getCPtr(name));
            FloatArrayElement     ret  = (cPtr == global::System.IntPtr.Zero) ? null : new FloatArrayElement(cPtr, true);

            return(ret);
        }
Ejemplo n.º 28
0
 public virtual void OnStringElementChanged(long elementID, XString newValue)
 {
     if (SwigDerivedClassHasMethod("OnStringElementChanged", swigMethodTypes5))
     {
         SharingClientPINVOKE.ObjectElementListener_OnStringElementChangedSwigExplicitObjectElementListener(swigCPtr, elementID, XString.getCPtr(newValue));
     }
     else
     {
         SharingClientPINVOKE.ObjectElementListener_OnStringElementChanged(swigCPtr, elementID, XString.getCPtr(newValue));
     }
 }
Ejemplo n.º 29
0
        public virtual Element GetElement(XString name)
        {
            global::System.IntPtr cPtr = SharingClientPINVOKE.ObjectElement_GetElement__SWIG_1(swigCPtr, XString.getCPtr(name));
            Element ret = (cPtr == global::System.IntPtr.Zero) ? null : new Element(cPtr, true);

            return(ret);
        }
Ejemplo n.º 30
0
    /// <summary>
    /// Called when anchor download operations complete.
    /// </summary>
    private void RoomManagerCallbacks_AnchorsDownloaded(bool successful, AnchorDownloadRequest request, XString failureReason)
    {
        // If we downloaded anchor data successfully we should import the data.
        if (successful)
        {
            int datasize = request.GetDataSize();
            Debug.Log(datasize + " bytes ");
            rawAnchorData = new byte[datasize];

            request.GetData(rawAnchorData, datasize);
            currentState = ImportExportState.DataReady;
        }
        else
        {
            // If we failed, we can ask for the data again.
            Debug.Log("Anchor DL failed " + failureReason);
            MakeAnchorDataRequest();
        }
    }
Ejemplo n.º 31
0
        public virtual StringElement CreateStringElement(XString name, XString value)
        {
            global::System.IntPtr cPtr = SharingClientPINVOKE.ObjectElement_CreateStringElement(swigCPtr, XString.getCPtr(name), XString.getCPtr(value));
            StringElement         ret  = (cPtr == global::System.IntPtr.Zero) ? null : new StringElement(cPtr, true);

            return(ret);
        }
 public virtual void OnStringElementChanged(long elementID, XString newValue) {
   if (SwigDerivedClassHasMethod("OnStringElementChanged", swigMethodTypes5)) SharingClientPINVOKE.ObjectElementListener_OnStringElementChangedSwigExplicitObjectElementListener(swigCPtr, elementID, XString.getCPtr(newValue)); else SharingClientPINVOKE.ObjectElementListener_OnStringElementChanged(swigCPtr, elementID, XString.getCPtr(newValue));
 }
Ejemplo n.º 33
0
    public static object GetOp(string right)
    {
        if (XString.Eq(right
                       , "NL"
                       , "NewLine"
                       ))
        {
            var result = "\r\n";
            return(result);
        }
        else if (XString.Eq(right
                            , "CR"
                            , "CarriageReturn"
                            ))
        {
            var result = "\r";
            return(result);
        }
        else if (XString.Eq(right
                            , "LF"
                            , "LineFeed"
                            ))
        {
            var result = "\n";
            return(result);
        }
        else if (XString.Eq(right
                            , "HT"
                            , "Tab"
                            ))
        {
            var result = "\t";
            return(result);
        }
        else if (XString.Eq(right
                            , "SP"
                            , "Space"
                            ))
        {
            var result = " ";
            return(result);
        }
        else if (XString.Eq(right
                            , "CO"
                            , "Comma"
                            ))
        {
            var result = ",";
            return(result);
        }
        else if (XString.Eq(right
                            , "SC"
                            , "SemiColon"
                            ))
        {
            var result = ";";
            return(result);
        }
        else if (XString.Eq(right
                            , "FS"
                            , "FullStop"
                            ))
        {
            var result = ".";
            return(result);
        }
        else if (XString.Eq(right
                            , "SO"
                            , "Solidus"
                            ))
        {
            var result = "/";
            return(result);
        }
        else if (XString.Eq(right
                            , "RS"
                            , "ReverseSolidus"
                            ))
        {
            var result = "\\";
            return(result);
        }
        else if (XString.Eq(right
                            , "a.text"
                            , "ActiveDocument.Selection.Text"
                            ))
        {
            var selection = ActiveDocument_GetSelection();
            return(selection.Text);
        }
        else if (XString.Eq(right
                            , "a.line"
                            , "ActiveDocument.Selection.CurrentLine"
                            ))
        {
            var selection = ActiveDocument_GetSelection();
            return(selection.CurrentLine.ToString());
        }
        else if (XString.Eq(right
                            , "a.col"
                            , "ActiveDocument.Selection.CurrentColumn"
                            ))
        {
            var selection = ActiveDocument_GetSelection();
            return(selection.CurrentColumn.ToString());
        }
        else if (XString.Eq(right
                            , "a.topline"
                            , "ActiveDocument.Selection.TopLine"
                            ))
        {
            var selection = ActiveDocument_GetSelection();
            return(selection.TopLine.ToString());
        }
        else if (XString.Eq(right
                            , "a.bottomline"
                            , "ActiveDocument.Selection.BottomLine"
                            ))
        {
            var selection = ActiveDocument_GetSelection();
            return(selection.BottomLine.ToString());
        }
        else if (XString.Eq(right
                            , "a.rangecount"
                            , "ActiveDocument.Selection.TextRangesCount"
                            ))
        {
            var selection = ActiveDocument_GetSelection();
            return(selection.TextRanges.Count.ToString());
        }
        else if (XString.Eq(right
                            , "a.topchar"
                            , "ActiveDocument.Selection.TopCharOffset"
                            ))
        {
            var selection = ActiveDocument_GetSelection();
            return(selection.TopPoint.AbsoluteCharOffset.ToString());
        }
        else if (XString.Eq(right
                            , "a.bottomchar"
                            , "ActiveDocument.Selection.BottomCharOffset"
                            ))
        {
            var selection = ActiveDocument_GetSelection();
            return(selection.BottomPoint.AbsoluteCharOffset.ToString());
        }

        //else if (XString.Eq(right
        //, "test"
        //, "Line_GetLineIndexByCharIndex"
        //))
        //{
        //    var tdoc2 = Dte.ActiveDocument.Object("TextDocument") as TextDocument;
        //    var ep2 = tdoc2.CreateEditPoint();
        //    ep2.MoveToAbsoluteOffset(1);
        //    var line = ep2.Line;
        //}

        else if (XString.Eq(right
                            , "s.items"
                            , "SolutionExplorer.Selection.Items"
                            ))
        {
            var result = Ide.SolutionExplorer_GetItems();
            return(result);
        }
        else if (XString.Eq(right
                            , "s.itemcount"
                            , "SolutionExplorer.Selection.ItemCount"
                            ))
        {
            var result = Ide.SolutionExplorer_GetItemCount();
            return(result);
        }
        else if (XString.Eq(right
                            , "docs"
                            , "Editor.OpenDocuments"))
        {
            var result = OpenDocuments_Get();
            return(result);
        }
        else if (XString.Eq(right
                            , "doccount"
                            , "Editor.OpenDocumentCount"))
        {
            var result = OpenDocumentCount_Get();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.Id"
                            ))
        {
            return(ServerWindow.Text);
        }
        else if (XString.Eq(right
                            , "Server.State"
                            ))
        {
            var result = ServerManager.ServerState.ToString();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.Handle"
                            ))
        {
            var result = ServerWindow.Handle.ToString();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.Class"
                            ))
        {
            var result = ServerWindow.GetWindowClassName();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.LogEnabled"
                            ))
        {
            var result = XLog.Enabled ? "1" : "0";
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.LogfileExists"
                            ))
        {
            var result = XLog.Exists ? "1" : "0";
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.LogFile"
                            ))
        {
            var result = XLog.LogFile.ToString();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.Marker"
                            ))
        {
            var result = Persistence.Marker.ToString();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.Version"
                            ))
        {
            var result = Persistence.Version.ToString();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.SupportGetOps"
                            ))
        {
            var result = Persistence.SupportGetOps ? "1" : "0";
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.SupportSetOps"
                            ))
        {
            var result = Persistence.SupportSetOps ? "1" : "0";
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.RequestEncoding"
                            ))
        {
            var result = Persistence.RequestEncoding.ToString();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.ResponseEncoding"
                            ))
        {
            var result = Persistence.ResponseEncoding.ToString();
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.ClaimMarkerInRequest"
                            ))
        {
            var result = Persistence.ClaimMarkerInRequest ? "1" : "0";
            return(result);
        }
        else if (XString.Eq(right
                            , "Server.IncludeMarkerInResponse"
                            ))
        {
            var result = Persistence.IncludeMarkerInResponse ? "1" : "0";
            return(result);
        }
        return("");
    }
Ejemplo n.º 34
0
 public DirectPairConnector(XString remoteNameOrIP, ushort port) : this(SharingClientPINVOKE.new_DirectPairConnector__SWIG_2(XString.getCPtr(remoteNameOrIP), port), true)
 {
 }
Ejemplo n.º 35
0
 private global::System.IntPtr SwigDirectorGetAddress(int index)
 {
     return(XString.getCPtr(GetAddress(index)).Handle);
 }
 /// <summary>
 /// Called when the primitive value has changed from a remote action.
 /// </summary>
 /// <param name="remoteValue">Remote Value</param>
 public virtual void UpdateFromRemote(XString remoteValue)
 {
 }
Ejemplo n.º 37
0
 public virtual void SetServerConnectionInfo(XString address, uint port)
 {
     SharingClientPINVOKE.SharingManager_SetServerConnectionInfo(swigCPtr, XString.getCPtr(address), port);
 }
 public override void OnCreateFailed(XString reason)
 {
     LogWriteLine("********* SESSION CREATE FAILED: " + reason.GetString() + " ******");
     CreateFailed?.Invoke(reason);
 }
Ejemplo n.º 39
0
 public virtual void SetUserName(XString name)
 {
     SharingClientPINVOKE.SharingManager_SetUserName(swigCPtr, XString.getCPtr(name));
 }
Ejemplo n.º 40
0
 public virtual Room CreateRoom(XString roomName, long roomID, bool keepOpenWhenEmpty) {
   global::System.IntPtr cPtr = SharingClientPINVOKE.RoomManager_CreateRoom(swigCPtr, XString.getCPtr(roomName), roomID, keepOpenWhenEmpty);
   Room ret = (cPtr == global::System.IntPtr.Zero) ? null : new Room(cPtr, true);
   return ret; 
 }
 public DirectPairConnector(XString remoteNameOrIP, ushort port) : this(SharingClientPINVOKE.new_DirectPairConnector__SWIG_2(XString.getCPtr(remoteNameOrIP), port), true) {
 }
Ejemplo n.º 42
0
 public unsafe bool UploadAnchor(Room room, XString anchorName, byte[] data, int dataSize) {
   fixed ( byte* swig_ptrTo_data = data ) {
   {
     bool ret = SharingClientPINVOKE.RoomManager_UploadAnchor(swigCPtr, Room.getCPtr(room), XString.getCPtr(anchorName), (global::System.IntPtr)swig_ptrTo_data, dataSize);
     return ret;
   }
   }
 }
 public void SetRemoteAddress(XString remoteNameOrIP) {
   SharingClientPINVOKE.DirectPairConnector_SetRemoteAddress(swigCPtr, XString.getCPtr(remoteNameOrIP));
 }
Ejemplo n.º 44
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(XString obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Ejemplo n.º 45
0
 public virtual void SetValue(XString newString)
 {
     SharingClientPINVOKE.StringElement_SetValue(swigCPtr, XString.getCPtr(newString));
 }
 public virtual Element GetElement(XString name) {
   global::System.IntPtr cPtr = SharingClientPINVOKE.ObjectElement_GetElement__SWIG_1(swigCPtr, XString.getCPtr(name));
   Element ret = (cPtr == global::System.IntPtr.Zero) ? null : new Element(cPtr, true);
   return ret; 
 }
Ejemplo n.º 47
0
        void ScanPath(String path)
        {
            FileStream file = new FileStream(path, FileMode.Open);
            //StringReader sr = new StringReader(
            StreamReader sr = new StreamReader(file);

            String s;

            while (!sr.EndOfStream)
            {
                XString parsed_string;
                s = sr.ReadLine();

                parsed_string = new XString(s, "()\"=,", " ", true, true);
                if (parsed_string.Count > 0)
                {
                    if ((String)(parsed_string[0]) == "Project")
                    {
                        int    n;
                        String project = null;
                        for (n = 0; (12 + n) < parsed_string.Count; n++)
                        {
                            String newseg = (String)(parsed_string[12 + n]);
                            project = project + newseg;
                            if ((newseg != "..") &&
                                (newseg != "\\..") &&
                                (newseg != "\\") &&
                                (newseg != "/"))
                            {
                                break;
                            }
                        }

                        projects.Add(ConcatPath(Environment.CurrentDirectory, project));
                    }
                }
            }
            sr.Close();

            foreach (String zfile in projects)
            {
                XString zfile_path = new XString(zfile, "/\\", null, false, false);
                zfile_path.RemoveAt(zfile_path.Count - 1);
                zfile_path.RemoveAt(zfile_path.Count - 1);
                bool        updated = false;
                XmlDocument xd      = new XmlDocument();
                try
                {
                    xd.Load(zfile);
                }
                catch
                {
                    continue;
                }
                XPathNavigator xn = xd.CreateNavigator();
                xn.MoveToFirst();
                String target_framework = null;
                bool   okay;
                okay = xn.MoveToFirstChild();
                while (xn.NodeType == XPathNodeType.Comment)
                {
                    okay = xn.MoveToNext();
                }
                for (okay = xn.MoveToFirstChild(); okay; okay = xn.MoveToNext())
                {
retry:
                    if (xn.Name == "ItemGroup")
                    {
                        bool found_outpath     = false;
                        bool found_intermed_1  = false;
                        bool found_intermed_2  = false;
                        bool found_base_output = false;
                        bool found_framework   = false;
                        bool ok2;
                        bool ever_ok2 = false;

                        bool found_condition = false;

                        ever_ok2 = false;
                        for (ok2 = xn.MoveToFirstChild(); ok2; ok2 = xn.MoveToNext())
                        {
                            ever_ok2 = true;
                            if (xn.Name == "ProjectReference")
                            {
                                bool ever_ok3 = false;
                                for (bool ok3 = xn.MoveToFirstAttribute(); ok3; ok3 = xn.MoveToNextAttribute())
                                {
                                    ever_ok3 = true;
                                    if (xn.Name == "Include")
                                    {
                                        String fullpath = ConcatPath(zfile_path, xn.Value);
                                        if (!projects.Contains(fullpath))
                                        {
                                            listBox1.Items.Add(zfile + " references " + xn.Value);
                                        }
                                    }
                                }
                                if (ever_ok3)
                                {
                                    xn.MoveToParent();
                                }
                            }
                        }
                        if (ever_ok2)
                        {
                            xn.MoveToParent();
                        }
                    }
                }
                //else
                //    listBox1.Items.Add( "Ignore:"+file );
                listBox1.Refresh();
            }
        }
 public virtual ObjectElement CreateObjectElement(XString name, User owner) {
   global::System.IntPtr cPtr = SharingClientPINVOKE.ObjectElement_CreateObjectElement__SWIG_0(swigCPtr, XString.getCPtr(name), User.getCPtr(owner));
   ObjectElement ret = (cPtr == global::System.IntPtr.Zero) ? null : new ObjectElement(cPtr, true);
   return ret; 
 }
 public virtual void OnAnchorsDownloaded(bool successful, AnchorDownloadRequest request, XString failureReason) {
   if (SwigDerivedClassHasMethod("OnAnchorsDownloaded", swigMethodTypes5)) SharingClientPINVOKE.RoomManagerListener_OnAnchorsDownloadedSwigExplicitRoomManagerListener(swigCPtr, successful, AnchorDownloadRequest.getCPtr(request), XString.getCPtr(failureReason)); else SharingClientPINVOKE.RoomManagerListener_OnAnchorsDownloaded(swigCPtr, successful, AnchorDownloadRequest.getCPtr(request), XString.getCPtr(failureReason));
 }
 public virtual bool CreateSession(XString sessionName) {
   bool ret = SharingClientPINVOKE.SessionManager_CreateSession(swigCPtr, XString.getCPtr(sessionName));
   return ret;
 }
 public virtual void OnAnchorUploadComplete(bool successful, XString failureReason) {
   if (SwigDerivedClassHasMethod("OnAnchorUploadComplete", swigMethodTypes6)) SharingClientPINVOKE.RoomManagerListener_OnAnchorUploadCompleteSwigExplicitRoomManagerListener(swigCPtr, successful, XString.getCPtr(failureReason)); else SharingClientPINVOKE.RoomManagerListener_OnAnchorUploadComplete(swigCPtr, successful, XString.getCPtr(failureReason));
 }
 public virtual void SetValue(XString newString) {
   SharingClientPINVOKE.StringElement_SetValue(swigCPtr, XString.getCPtr(newString));
 }
Ejemplo n.º 53
0
 public virtual void OnCreateFailed(XString reason)
 {
     if (SwigDerivedClassHasMethod("OnCreateFailed", swigMethodTypes1))
     {
         SharingClientPINVOKE.SessionManagerListener_OnCreateFailedSwigExplicitSessionManagerListener(swigCPtr, XString.getCPtr(reason));
     }
     else
     {
         SharingClientPINVOKE.SessionManagerListener_OnCreateFailed(swigCPtr, XString.getCPtr(reason));
     }
 }
 public virtual void OnCreateFailed(XString reason) {
   if (SwigDerivedClassHasMethod("OnCreateFailed", swigMethodTypes1)) SharingClientPINVOKE.SessionManagerListener_OnCreateFailedSwigExplicitSessionManagerListener(swigCPtr, XString.getCPtr(reason)); else SharingClientPINVOKE.SessionManagerListener_OnCreateFailed(swigCPtr, XString.getCPtr(reason));
 }
 public virtual void SetServerConnectionInfo(XString address, uint port) {
   SharingClientPINVOKE.SharingManager_SetServerConnectionInfo(swigCPtr, XString.getCPtr(address), port);
 }