示例#1
0
 private Extern.INPUT GetKeyEvent(Extern.VirtualKeyShort key, Extern.ScanCodeShort scan)
 {
     return new SharpClap.Extern.INPUT()
                                 {
                                     type = Extern.INPUT_KEYBOARD,
                                     U =
                                         new Extern.InputUnion()
                                             {
                                                 ki
                                                     =
                                                     new Extern
                                                     .
                                                     KEYBDINPUT
                                                     (
                                                     )
                                                         {
                                                             wScan
                                                                 =
                                                                 scan,
                                                             wVk
                                                                 =
                                                                 key
                                                         }
                                             }
                                 };
 }
示例#2
0
        //#if TRUE
        static void Main(string[] args)
        {
            StringBuilder sb      = new StringBuilder(1024);
            Win32Helper   helper  = new Win32Helper();
            IntPtr        windows = Extern.FindWindow(null, "tsmgg12");

            GetClassName(windows, sb, sb.Capacity);
            Console.WriteLine(String.Format("main: {0:X8}:{1}", windows.ToInt32(), sb));
            sb.Remove(0, sb.Length);
            List <IntPtr> list = GetChildWindows(windows);

            list.ForEach(delegate(IntPtr ip){
                //Console.WriteLine(ip);
                GetClassName(ip, sb, sb.Capacity);
                Console.WriteLine(String.Format("sub:  {0:X8}:{1}", ip.ToInt32(), sb));
                sb.Remove(0, sb.Length);
                Extern.SendMessage(ip, Const.WM_GETTEXT, IntPtr.Zero, sb);
                Console.WriteLine(String.Format("text: {0:X8}:{1}", ip.ToInt32(), sb));
                sb.Remove(0, sb.Length);
            });
            Extern.SendMessage(new IntPtr(6359544), Const.WM_GETTEXT, IntPtr.Zero, sb);
            Console.WriteLine(String.Format("aaaa: {0:X8}:{1}", 6359544, sb));
            sb.Remove(0, sb.Length);

            //IntPtr textboxHandle = Extern.FindWindowEx(windows, IntPtr.Zero, "TextBoxClass", null);
            //Console.WriteLine(String.Format("{0:X8}", textboxHandle));
            //string message = "Hello World!";

            //Extern.SendMessage(textboxHandle, Const.WM_SETTEXT, IntPtr.Zero, message);
            //windows.ForEach(delegate(IntPtr window)
            //{
            //    Console.WriteLine(window);
            //});
            Console.ReadKey();
        }
示例#3
0
        /// <inheritdoc />
        public override void VisitExtern(Extern reference)
        {
            int linelength;

            indentationlevel--;
            if (indentationlevel < 0)
            {
                indentationlevel = 0;
            }

            if (reference.ExternSymbol != null)
            {
                string identifier = reference.ExternSymbol.Identifier;
                if (identifier == null)
                {
                    throw new NotSupportedException("Symbols without identifiers are not supported.");
                }
                Writer.Write("extern {0}", reference.ExternSymbol.Identifier);
                linelength = reference.ExternSymbol.Identifier.Length + 7;
            }
            else
            {
                linelength = WriteCommentString("extern <unkown>", -1, 0, -1);
            }

            WriteCommentOf(reference, linelength);

            indentationlevel++;
        }
示例#4
0
        public Extern.ScanCodeShort GuessScanCode(Extern.VirtualKeyShort key)
        {
            Extern.ScanCodeShort guessScanCodeShort;
            Extern.ScanCodeShort.TryParse(key.ToString(), true, out guessScanCodeShort);

            return guessScanCodeShort;
        }
示例#5
0
        public void Close()
        {
            if (_remote != null)
            {
                _remote.Close();
                _remote.Disconnect();
                return;
            }

            if (FileHandle == null)
            {
                return;
            }

            switch (PlatformId)
            {
            case PlatformID.Win32NT:
                (FileHandle as SafeFileHandle)?.Close();
                break;

            case PlatformID.Linux:
                Extern.close((int)FileHandle);
                break;

            case PlatformID.FreeBSD:
                FreeBSD.Extern.cam_close_device((IntPtr)FileHandle);
                break;
            }

            FileHandle = null;
        }
 /// <summary>
 /// Delete an Extern.
 /// </summary>
 /// <param name="externObject"></param>
 void DestroyExtern(Extern externObject)
 {
     if (externObject == null)
     {
         throw new ArgumentNullException("externObject cannot be null!");
     }
     ExternFactory_DestroyExtern(NativePointer, externObject.NativePointer);
 }
 /** Copy both the Extern and the derived SphereCollider properties.
  */
 public void CopyAttributesTo(Extern externObject)
 {
     if (externObject == null)
     {
         throw new ArgumentNullException("externObject cannot be null!");
     }
     SphereColliderExtern_CopyAttributesTo(nativePtr, externObject.NativePointer);
 }
示例#8
0
        public void AddsSymbol()
        {
            var instr = new Extern("test");
            Assert.AreEqual("test", instr.ExternSymbol.Identifier);

            Assert.IsEmpty(instr.Construct(Context).ToList());
            Assert.IsTrue(Context.SymbolTable["test"].IsExtern);
        }
示例#9
0
        public void AddsSymbol()
        {
            var instr = new Extern("test");

            Assert.AreEqual("test", instr.ExternSymbol.Identifier);

            Assert.IsEmpty(instr.Construct(Context).ToList());
            Assert.IsTrue(Context.SymbolTable["test"].IsExtern);
        }
示例#10
0
        // TODO implement loading from config.ini file
        public void Load()
        {
            Extern.IsWindowsLaptop().Match(boolean =>
            {
                this.StartInFullscreen       = boolean;
                this.UseStickyCameraMovement = boolean;
            });

            this.CenterTilemapRotationOnSource = false;
        }
示例#11
0
文件: LlvmVisitor.cs 项目: ionlang/ir
        public Construct VisitExtern(Extern node)
        {
            // Ensure prototype is set.
            if (node.Prototype == null)
            {
                throw new Exception("Unexpected external definition's prototype to be null");
            }

            // Create the argument buffer list.
            List <LlvmType> arguments = new List <LlvmType>();

            // TODO: What about reference? Arguments must be named for extern?
            foreach ((Kind kind, Reference reference) in node.Prototype.Arguments)
            {
                // Visit the kind.
                this.VisitKind(kind);

                // Pop the type off the stack.
                LlvmType argumentType = this.typeStack.Pop();

                // Append onto the arguments list.
                arguments.Add(argumentType);
            }

            // Visit the prototype's return kind.
            this.Visit(node.Prototype.ReturnKind);

            // Pop the return type off the stack.
            LlvmType returnType = this.typeStack.Pop();

            // Emit the function type.
            LlvmType type = LlvmFactory.Function(returnType, arguments.ToArray(), node.Prototype.HasInfiniteArguments);

            // Emit the external definition to context and capture the LLVM value reference.
            LlvmValue @extern = this.module.CreateFunction(node.Prototype.Identifier, type);

            // Determine if should be registered on the symbol table.
            if (!this.module.ContainsFunction(node.Prototype.Identifier))
            {
                // Register the external definition as a function in the symbol table.
                this.module.RegisterFunction((LlvmFunction)@extern);
            }
            // Otherwise, throw an error.
            else
            {
                throw new Exception($"Warning: Extern definition '{node.Prototype.Identifier}' being re-defined");
            }

            // Push the resulting value onto the stack.
            this.valueStack.Push(@extern);

            // Return the node.
            return(node);
        }
示例#12
0
        public Extern.ScanCodeShort[] GuessScanCodes(Extern.VirtualKeyShort[] keys)
        {
            List<Extern.ScanCodeShort> scanCodes = new List<Extern.ScanCodeShort>();

            foreach(Extern.VirtualKeyShort key in keys)
            {
                scanCodes.Add(GuessScanCode(key));
            }

            return scanCodes.ToArray();
        }
示例#13
0
        public static void PlayNote(uint nFrequence, uint nDuration)
        {
            // Play note
            Play(nFrequence);

            // Wait for duration
            //timer_wait(nDuration);
            Extern.udelay(nDuration);

            // Stop sound
            Stop();
        }
示例#14
0
        /// <summary> Get the text for the window pointed to by hWnd </summary>
        public static string GetWindowText(IntPtr hWnd)
        {
            int size = Extern.GetWindowTextLength(hWnd);

            if (size > 0)
            {
                var builder = new StringBuilder(size + 1);
                Extern.GetWindowText(hWnd, builder, builder.Capacity);
                return(builder.ToString());
            }

            return(String.Empty);
        }
示例#15
0
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            RhinoApp.WriteLine("The {0} command is under construction.", EnglishName);

            var point = Core.Extern.GetTestPoint().ToPoint3d();

            doc.Objects.AddPoint(point);

            doc.Views.Redraw();

            var path  = "D:\\Downloads\\bremen-latest.osm.pbf";
            var count = Extern.ReadPBF(path);

            return(Result.Success);
        }
示例#16
0
    public static void ConnectTo(string ip, int port)
    {
        sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        sock.Connect(ip, port);
        int handle = 0;
        var form1  = Form.ActiveForm as FormMain;

        if (form1 != null)
        {
            handle = form1.GetHandle;
        }
        if (handle == 0)
        {
            FormMain.PerformActionOnMainForm(form => form.memo.Text += "An error occured: Error code WS_01_ASYNC_HANDLE");
            return;
        }
        Extern.WSAAsyncSelect(sock.Handle.ToInt32(), handle, Values.MESSAGE_ASYNC, Values.FD_READ | Values.FD_CLOSE);
    }
示例#17
0
        public static void MoveWindow(IntPtr hwnd)
        {
            WINDOWINFO pwi;

            Extern.GetWindowInfo(hwnd, out pwi);
            Rectangle resolution = Screen.PrimaryScreen.Bounds;

#if DEBUG
            Console.WriteLine(String.Format("Screen {0},{1},{2},{3}", resolution.Left.ToString(), resolution.Right.ToString(), resolution.Top.ToString(), resolution.Bottom.ToString()));
            Console.WriteLine(String.Format("Window {0},{1},{2},{3}", pwi.rcClient.left.ToString(), pwi.rcClient.right.ToString(), pwi.rcClient.top.ToString(), pwi.rcClient.bottom.ToString()));
#endif
            int left   = resolution.Right - resolution.Left - pwi.rcClient.right + pwi.rcClient.left;
            int bottom = resolution.Bottom - resolution.Top - pwi.rcClient.bottom + pwi.rcClient.top;
#if DEBUG
            Console.WriteLine("Move Window {0}, {1}", left, bottom);
#endif
            Extern.SetWindowPos(hwnd, 0, left, 0, 350, resolution.Bottom - 50, Const.SWP_NOZORDER | Const.SWP_NOSIZE | Const.SWP_SHOWWINDOW);
        }
示例#18
0
        /// <summary> Find all windows that match the given filter </summary>
        /// <param name="filter"> A delegate that returns true for windows
        ///    that should be returned and false for windows that should
        ///    not be returned </param>
        public static IEnumerable <IntPtr> FindWindows(EnumWindowsProc filter)
        {
            IntPtr        found   = IntPtr.Zero;
            List <IntPtr> windows = new List <IntPtr>();

            Extern.EnumWindows(delegate(IntPtr wnd, IntPtr param)
            {
                if (filter(wnd, param))
                {
                    // only add the windows that pass the filter
                    windows.Add(wnd);
                }

                // but return true here so that we iterate all windows
                return(true);
            }, IntPtr.Zero);

            return(windows);
        }
示例#19
0
        public void Close()
        {
            if (FileHandle == null)
            {
                return;
            }

            switch (PlatformId)
            {
            case PlatformID.Win32NT:
                Extern.CloseHandle((SafeFileHandle)FileHandle);
                break;

            case PlatformID.Linux:
                Linux.Extern.close((int)FileHandle);
                break;

            case PlatformID.FreeBSD:
                FreeBSD.Extern.cam_close_device((IntPtr)FileHandle);
                break;
            }
        }
示例#20
0
 public static IntPtr XP_GetModuleHandle(IntPtr ModuleName)
 {
     return(Extern.XP_GetModuleHandle(ModuleName));
 }
 public void VisitExtern(Extern reference)
 {
     Contract.Requires <ArgumentNullException>(reference != null);
 }
示例#22
0
 public PressKey(Extern.VirtualKeyShort[] keys, Extern.ScanCodeShort[] scans)
 {
     keyShort = keys;
     scanShort = scans;
 }
示例#23
0
 public static Int32 XP_GetModuleFileName(IntPtr hModule,
                                          StringBuilder ModuleName, Int32 cch)
 {
     return(Extern.XP_GetModuleFileName(hModule, ModuleName, cch));
 }
示例#24
0
        /// <inheritdoc />
        public override void VisitExtern(Extern reference)
        {
            int linelength;
            indentationlevel--;
            if (indentationlevel < 0) indentationlevel = 0;

            if (reference.ExternSymbol != null)
            {
                string identifier = reference.ExternSymbol.Identifier;
                if (identifier == null)
                    throw new NotSupportedException("Symbols without identifiers are not supported.");
                Writer.Write("extern {0}", reference.ExternSymbol.Identifier);
                linelength = reference.ExternSymbol.Identifier.Length + 7;
            }
            else
            {
                linelength = WriteCommentString("extern <unkown>", -1, 0, -1);
            }

            WriteCommentOf(reference, linelength);

            indentationlevel++;
        }
示例#25
0
        public void GenerateSampleData(bool writeToStorage)
        {
            #region define persons (7)
            Teacher t1 = new Teacher()
            {
                FirstName = "Jean",
                LastName  = "David",
                Age       = 35,
                Gender    = Constants.Gender.Masculin
            };

            Teacher t2 = new Teacher()
            {
                FirstName = "Jeanne",
                LastName  = "Paris",
                Age       = 31,
                Gender    = Constants.Gender.Feminin
            };

            Teacher t3 = new Teacher()
            {
                FirstName = "Arthur",
                LastName  = "Pratt",
                Age       = 42,
                Gender    = Constants.Gender.Autre
            };

            Student s1 = new Student()
            {
                FirstName  = "Perceval",
                LastName   = "Caillet",
                Age        = 19,
                Gender     = Constants.Gender.Masculin,
                Student_ID = "pcaillet"
            };

            Student s2 = new Student()
            {
                FirstName  = "Iris",
                LastName   = "Fouqueault",
                Age        = 21,
                Gender     = Constants.Gender.Feminin,
                Student_ID = "ifouqueault"
            };

            Student s3 = new Student()
            {
                FirstName  = "Emmeline",
                LastName   = "Tournot",
                Age        = 20,
                Gender     = Constants.Gender.Feminin,
                Student_ID = "etournot"
            };

            Extern e1 = new Extern()
            {
                FirstName = "Jacques",
                LastName  = "Sabatier",
                Age       = 28,
                Gender    = Constants.Gender.Masculin
            };
            #endregion

            #region define courses (3)
            Course c1 = new Course()
            {
                Name     = "Anglais",
                Teachers = new List <Teacher>()
                {
                    t1
                }
            };
            Course c2 = new Course()
            {
                Name     = "Géographie",
                Teachers = new List <Teacher>()
                {
                    t2
                }
            };
            Course c3 = new Course()
            {
                Name     = "Programmation",
                Teachers = new List <Teacher>()
                {
                    t3
                }
            };
            #endregion

            #region define formYear (1)
            FormYear f1 = new FormYear()
            {
                GradeName = Constants.GradeYear.Y1,
                Courses   = new List <Course>()
                {
                    c1, c2, c3
                }
            };
            #endregion

            #region define promotions (1)
            Promotion p1 = new Promotion()
            {
                GraduationYear = 2022,
                Grade          = f1,
                Students       = new List <Student>()
                {
                    s1, s2, s3
                },
                Name = "Bernoulli"
            };
            #endregion

            #region define projects (2)
            Project proj1 = new Project()
            {
                Topic        = "Projet de programmation",
                StartDate    = new DateTime(2020, 05, 01),
                EndDate      = new DateTime(2020, 06, 01),
                Deliverables = new List <Deliverable>()
                {
                    new Deliverable()
                    {
                        Type        = DeliverableType.SoftwareApplication,
                        Information = "Je veux une application pour trier mes chaussettes"
                    },
                    new Deliverable()
                    {
                        Type        = DeliverableType.Report,
                        Information = "Dis moi tout ce que tu sais à propos du Cloud Computing"
                    }
                },
                Courses = new List <Course>()
                {
                    c3
                },
                Promotions = new List <Promotion>()
                {
                    p1
                },
                Contributors = new Dictionary <Role, Person>()
                {
                    {
                        Role.ProjetManager,
                        s1
                    },
                    {
                        Role.Developer,
                        s2
                    },
                    {
                        Role.Secretary,
                        s3
                    },
                    {
                        Role.Tutor,
                        t3
                    },
                }
            };
            Project proj2 = new Project()
            {
                Topic        = "Projet d'anglais",
                StartDate    = new DateTime(2020, 01, 01),
                EndDate      = new DateTime(2020, 04, 01),
                Deliverables = new List <Deliverable>()
                {
                    new Deliverable()
                    {
                        Type        = DeliverableType.Report,
                        Information = "Explain what cognitive sciences are"
                    }
                },
                Courses = new List <Course>()
                {
                    c1
                },
                Promotions = new List <Promotion>()
                {
                    p1
                },
                Contributors = new Dictionary <Role, Person>()
                {
                    {
                        Role.ProjetManager,
                        s1
                    },
                    {
                        Role.QualityManager,
                        s2
                    },
                    {
                        Role.HFManager,
                        s3
                    }
                }
            };
            #endregion

            #region define users (2)
            User u1 = new User()
            {
                Privilege    = Privilege.Administrator,
                Name         = "admin",
                PasswordHash = SHA.GenerateSHA512String("password")
            };
            User u2 = new User()
            {
                Privilege    = Privilege.Spectator,
                Name         = "spect",
                PasswordHash = SHA.GenerateSHA512String("password")
            };
            #endregion

            foreach (var pers in new List <Person>()
            {
                t1, t2, t3, s1, s2, s3, e1
            })
            {
                DB[DBTable.Person].AddEntry(pers);
            }

            DB[DBTable.FormYear].AddEntry(f1);

            DB[DBTable.Courses].AddEntry(c1);
            DB[DBTable.Courses].AddEntry(c2);
            DB[DBTable.Courses].AddEntry(c3);

            DB[DBTable.Promotion].AddEntry(p1);

            DB[DBTable.Project].AddEntry(proj1);
            DB[DBTable.Project].AddEntry(proj2);

            DB[DBTable.User].AddEntry(u1);
            DB[DBTable.User].AddEntry(u2);

            // write on storage
            if (writeToStorage)
            {
                DB.Persist();
            }
        }
示例#26
0
        private void CompileExternal(Extern external)
        {
            var symName = GetSymbolName(external);

            result.Externals.Add(new X86Extern(symName, external.Type is Type.Proc));
        }
示例#27
0
        private Extern[] ReadExtern()
        {
            if (!CanRead) throw Abort("extern: 名前が必要です。");

            var module = ReadString();
            if (module == null) throw Abort("extern: モジュール名が必要です。");

            var reft = new string[1];
            reft[0] = Peek();
            var ct1 = CheckCallType(CallType.CDecl, reft);
            reft[0] = Peek();
            var sfx1 = CheckSuffix(null, reft);
            var br1 = Read();
            var loop = false;
            if (br1 == "{") loop = true; else Rewind();

            var list = new ArrayList();
            for (; ; )
            {
                var si = SrcInfo;
                var refname = new string[1];
                refname[0] = Read();
                var ct2 = CheckCallType(ct1, refname);
                var sfx2 = CheckSuffix(sfx1, refname);
                var name = refname[0];
                if (!Tokenizer.IsWord(name))
                {
                    //Rewind();
                    throw Abort("extern: 名前が不適切です: {0}", name);
                }
                string alias = null;
                if (sfx2 != null) alias = name + sfx2;

                var ex = Extern.New(parent, name, module.Value, alias);
                ex.SrcInfo = si;
                ex.CallType = ct2;
                if (Peek() == "(") ReadArgs("extern", ex);

                var comma = Read();
                if (comma == ":")
                {
                    var ftype = Read();
                    if (!Tokenizer.IsWord(ftype))
                    {
                        //Rewind();
                        throw Abort("extern: 型が不適切です: {0}", ftype);
                    }
                    ex.SetReturnType(Types.GetVarType(this.parent, ftype));
                }
                else
                    Rewind();

                if (!parent.AddFunction(ex))
                    throw Abort("extern: {0}: 定義が重複しています。", name);
                list.Add(ex);

                if (!loop) break;
                Check("extern", ";");
                var br2 = Read();
                if (br2 == "}") break;
                Rewind();
            }
            var ret = new Extern[list.Count];
            for (int i = 0; i < ret.Length; i++)
                ret[i] = list[i] as Extern;
            return ret;
        }
示例#28
0
 public abstract void VisitExtern(Extern reference);
示例#29
0
 /// <inheritdoc />
 public virtual void VisitExtern(Extern constructable)
 {         /* No implementation. */
 }
示例#30
0
 public PressKey(Extern.VirtualKeyShort[] keys)
 {
     keyShort = keys;
     scanShort = GuessScanCodes(keys);
 }