Beispiel #1
0
        public override void ToXml(XmlWriter writer)
        {
            writer.WriteStartElement("directional");

            writer.WriteStartElement("direction");
            writer.WriteAttributeString("x", direction.X.ToString());
            writer.WriteAttributeString("y", direction.Y.ToString());
            writer.WriteAttributeString("z", direction.Z.ToString());
            writer.WriteEndElement();

            KnownColor kClr = Clr.ToKnownColor();

            if (kClr != 0)
            {
                writer.WriteElementString("clr", kClr.ToString());
            }
            else
            {
                writer.WriteStartElement("clr");
                writer.WriteAttributeString("r", Clr.R.ToString());
                writer.WriteAttributeString("g", Clr.G.ToString());
                writer.WriteAttributeString("b", Clr.B.ToString());
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
 private void DoWireUp()
 {
     V.ConnectTo(_flop7.V)
     .ConnectTo(_flop6.V)
     .ConnectTo(_flop5.V)
     .ConnectTo(_flop4.V)
     .ConnectTo(_flop3.V)
     .ConnectTo(_flop2.V)
     .ConnectTo(_flop1.V)
     .ConnectTo(_flop0.V);
     Clr.ConnectTo(_flop7.Clr)
     .ConnectTo(_flop6.Clr)
     .ConnectTo(_flop5.Clr)
     .ConnectTo(_flop4.Clr)
     .ConnectTo(_flop3.Clr)
     .ConnectTo(_flop2.Clr)
     .ConnectTo(_flop1.Clr)
     .ConnectTo(_flop0.Clr);
     Clk.ConnectTo(_flop7.Clk)
     .ConnectTo(_flop6.Clk)
     .ConnectTo(_flop5.Clk)
     .ConnectTo(_flop4.Clk)
     .ConnectTo(_flop3.Clk)
     .ConnectTo(_flop2.Clk)
     .ConnectTo(_flop1.Clk)
     .ConnectTo(_flop0.Clk);
     Pre.ConnectTo(_flop7.Pre)
     .ConnectTo(_flop6.Pre)
     .ConnectTo(_flop5.Pre)
     .ConnectTo(_flop4.Pre)
     .ConnectTo(_flop3.Pre)
     .ConnectTo(_flop2.Pre)
     .ConnectTo(_flop1.Pre)
     .ConnectTo(_flop0.Pre);
 }
            internal SolverContext Monitor(Func <Solver, SearchMonitor> monitor)
            {
                var m = monitor(Solver);

                Clr.Add(m);
                Monitors.Add(m);
                return(this);
            }
            internal SolverContext Expression <T>(Func <Solver, T> expr)
                where T : IntExpr
            {
                var x = expr(Solver);

                Expressions.Add(x);
                Clr.Add(x);
                return(this);
            }
            internal SolverContext Constrain(Func <Solver, Constraint> constrain)
            {
                var c = constrain(Solver);

                Solver.Add(c);
                Constraints.Add(c);
                Clr.Add(c);
                return(this);
            }
Beispiel #6
0
        public override void Run()
        {
            var textEditor = new TestEditor();
            var clr        = new Clr();
            var compiler   = new Compiler();

            var ide = new VisualStudioFacade(textEditor, compiler, clr);

            var programmer = new Programmer(ide);
        }
Beispiel #7
0
        /// <summary>
        /// Initializes the <see cref="HawkeyeApplication"/> class.
        /// </summary>
        static HawkeyeApplication()
        {
            applicationInfo = new HawkeyeApplicationInfo();

            var clrVersion = typeof(int).Assembly.GetName().Version;
            currentClr = clrVersion.Major == 4 ? Clr.Net4 : Clr.Net2;
            currentBitness = IntPtr.Size == 8 ? Bitness.x64 : Bitness.x86;

            Shell = new Shell();
        }
Beispiel #8
0
        public bool Open(string dumpFilename)
        {
            Target = null;
            Clr    = null;

            Target = DataTarget.LoadCrashDump(dumpFilename);
            Target.SymbolLocator.SymbolPath = _sympath;

            // try to load the runtime
            // --------------------------------------------------------------------------
            // 1. from an explicit mscordacwks file in the same folder as the dump file
            // 2. via default symbol cache otherwise
            try
            {
                Clr = Target.ClrVersions[0].CreateRuntime(Path.Combine(Path.GetDirectoryName(dumpFilename), "mscordacwks.dll"));
            }
            catch (Exception x)
            {
                Debug.WriteLine("Error loading SOS...");
                Debug.WriteLine(x.Message);
            }

            if (Clr == null)
            {
                try
                {
                    Clr = Target.ClrVersions[0].CreateRuntime();
                }
                catch (Exception x)
                {
                    Debug.WriteLine("Error loading SOS...");
                    Debug.WriteLine(x.Message);
                    Target = null;
                    Clr    = null;
                    throw;
                }
            }

            if (Clr == null)
            {
                Target = null;
                return(false);
            }
            else
            {
                // special case for mini dumps
                if (Clr.GetThreadPool() == null)
                {
                    throw new InvalidOperationException("Impossible to get CLR information: might be a mini-dump...");
                }
            }

            _dumpFilename = dumpFilename;
            return(true);
        }
Beispiel #9
0
        /// <summary>
        /// Initializes the <see cref="HawkeyeApplication"/> class.
        /// </summary>
        static HawkeyeApplication()
        {
            applicationInfo = new HawkeyeApplicationInfo();

            var clrVersion = typeof(int).Assembly.GetName().Version;

            currentClr     = clrVersion.Major == 4 ? Clr.Net4 : Clr.Net2;
            currentBitness = IntPtr.Size == 8 ? Bitness.x64 : Bitness.x86;

            Shell = new Shell();
        }
Beispiel #10
0
        public static void Start()
        {
            var textEditor = new TextEditor();
            var compiller  = new Compiller();
            var clr        = new Clr();

            var ide = new VisualStudioFacade(textEditor, compiller, clr);

            var programmer = new Programmer();

            programmer.CreateApplication(ide);
        }
Beispiel #11
0
 private void DoWireUp()
 {
     V.ConnectTo(_latch.V).ConnectTo(_adder.V).ConnectTo(_ram.V).ConnectTo(_counter.V);
     // Clk is done in this order on purpose; otherwise, the latch input
     // gets changed before it's done its job.  This mimics propagation delay.
     Clk.ConnectTo(_latch.Clk).ConnectTo(_counter.Clk);
     Clr.ConnectTo(_latch.Clr).ConnectTo(_counter.Clr);
     WireUpCounterOutToRAMAddress();
     WireUpRAMOuttoAdderA();
     WireUpAdderOutToLatchIn();
     WireUpLatchOutToAdderB();
 }
Beispiel #12
0
        private static string GetBootstrap(Clr clr, Bitness bitness)
        {
            string bitnessVersion;

            switch (bitness)
            {
            case Bitness.x86:
                bitnessVersion = "x86";
                break;

            case Bitness.x64:
                bitnessVersion = "x64";
                break;

            default: throw new ArgumentException($"Bitness Value {bitness} is invalid.", nameof(bitness));
            }

            string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // Very special case: Hawkeye is x86 and the spied process is x64: we can't know for sure
            // whether the process is .NET 2 or 4 or none.
            // So, we must simply re-run Hawkeye.exe (which is compiled as Any Cpu and therefore
            // will run as x64 in a x64 environment) passing it the handle of the spied window so that another
            // detection is achieved, this time from a x64 process.
            // Note that because we run Hawkeye.exe, we won't inject anything.
            if (clr == Clr.Undefined && HawkeyeApplication.CurrentBitness == Bitness.x86 && bitness == Bitness.x64)
            {
                return(Path.Combine(directory, "Hawkeye.exe"));
            }

            string clrVersion = string.Empty;

            switch (clr)
            {
            case Clr.Net2:
                clrVersion = "N2";
                break;

            case Clr.Net4:
                clrVersion = "N4";
                break;

            default:
                throw new ArgumentException(
                          $"Clr Value {clr} is invalid.", nameof(clr));
            }

            string exe = $"HawkeyeBootstrap{clrVersion}{bitnessVersion}.exe";

            return(Path.Combine(directory, exe));
        }
Beispiel #13
0
        static Platform()
        {
#if UNITY_IPHONE
            _os      = OS.IOS;
            _runtime = Clr.Unity;
#elif UNITY_ANDROID
            _os      = OS.Android;
            _runtime = Clr.Unity;
#else
            if (RuntimeInformation.FrameworkDescription.ToLower().StartsWith(".net native"))
            {
                _runtime = Clr.DotNetNative;
            }
            else if (RuntimeInformation.FrameworkDescription.ToLower().StartsWith(".net core"))
            {
                _runtime = Clr.DotNet;
            }
            else if (RuntimeInformation.FrameworkDescription.ToLower().StartsWith(".net ")) // "e.g. .NET 5.0.6
            {
                _runtime = Clr.DotNet;
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _os = OS.Windows;
            }
            else if (Emgu.Util.Toolbox.FindAssembly("Mono.Android.dll") != null)
            {
                _os      = OS.Android;
                _runtime = Clr.Mono;
            }
            else if (Emgu.Util.Toolbox.FindAssembly("Xamarin.iOS.dll") != null)
            {
                _os      = OS.IOS;
                _runtime = Clr.Mono;
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                _os = OS.MacOS;
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                _os = OS.Linux;
            }
            else
            {
                _os      = OS.Unknown;
                _runtime = Clr.Unknown;
            }
#endif
        }
Beispiel #14
0
        static Platform()
        {
#if UNITY_IPHONE
            _os      = OS.IOS;
            _runtime = Clr.Unity;
#elif UNITY_ANDROID
            _os      = OS.Android;
            _runtime = Clr.Unity;
#else
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _os = OS.Windows;
                if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Native",
                                                                       StringComparison.OrdinalIgnoreCase) ||
                    RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase))
                {
                    _runtime = Clr.NetFxCore;
                }
                else
                {
                    _runtime = Clr.DotNet;
                }
            }
            else if (Emgu.Util.Toolbox.FindAssembly("Mono.Android.dll") != null)
            {
                _os      = OS.Android;
                _runtime = Clr.Mono;
            }
            else if (Emgu.Util.Toolbox.FindAssembly("Xamarin.iOS.dll") != null)
            {
                _os      = OS.IOS;
                _runtime = Clr.Mono;
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                _os      = OS.MacOS;
                _runtime = Clr.Mono;
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                _os      = OS.Linux;
                _runtime = Clr.Mono;
            }
            else
            {
                _os      = OS.Unknown;
                _runtime = Clr.Unknown;
            }
#endif
        }
Beispiel #15
0
 static void Main(string[] args)
 {
     Printer.SayHello();
     Clr.SetCyan();
     Printer.WriteLine($"This library uses {Frmt.Bold}Shell.NET!");
     Reset.All();
     Printer.WriteLine(string.Format("{0}{4}C#{5} in {2}{4}Linux{5} is pretty {3}{4}cool!{5}",
                                     Clr.Magenta,
                                     Clr.White,
                                     Clr.Green,
                                     Clr.Yellow,
                                     Frmt.Bold,
                                     Reset.Code
                                     ));
 }
Beispiel #16
0
        // 線形補間
        //  len: 補間の長さ
        //  sec: 補間時間(秒)
        //  deltaCallback< sec, t, dt, delta >
        //   sec  : 経過秒
        //   t    : 経過補間係数(0~1)
        //   dt   : 前回からの差分時間
        //   delta: 差分値
        static public Result linear(Color len, float sec, System.Func <float, float, float, Color, bool> deltaCallback, System.Action finishCallback = null)
        {
            if (sec <= 0.0f)
            {
                deltaCallback(0.0f, 1.0f, 0.0f, len);
                return(null);
            }
            float preSec = 0.0f;
            var   res    = new Clr(() => {
                return(updateTime(ref preSec, sec, deltaCallback, finishCallback, (_, _dt) => {
                    return len / sec * _dt;
                }));
            });

            DeltaLerpUpdater.getInstance().add(res);
            return(res);
        }
Beispiel #17
0
        public static string GetLabel(this Clr clr)
        {
            switch (clr)
            {
            case Clr.None: return(string.Empty);

            case Clr.Undefined: return("?");

            case Clr.Unsupported: return("??");

            case Clr.Net2: return(".net 2");

            case Clr.Net4: return(".net 4");
            }

            return("???");
        }
            internal SolverContext CreateDecisionBuilder(Func <IEnumerable <IntExpr>, IntVarVector> filter,
                                                         Func <Solver, IntVarVector, DecisionBuilder> create)
            {
                var vector = filter(Expressions);

                Clr.Add(vector);

                if (DecisionBuilder != null)
                {
                    Assert.That(Clr.Remove(DecisionBuilder), Is.True);
                    DecisionBuilder.Dispose();
                }

                DecisionBuilder = create(Solver, vector);
                Clr.Add(DecisionBuilder);

                return(this);
            }
        public void PrintTypes(string typeFilter = "", int limit = 0)
        {
            _console.WriteLine(String.Format("{0} \t {1} \t {2}", "Total size", "Count", "Name")
                               , ConsoleColor.DarkYellow);
            IEnumerable <TypeStat> types = Clr.GetTypesOnHeap(typeFilter);

            if (limit != 0)
            {
                types = types.Take(limit);
            }

            foreach (var typeStat in types)
            {
                _console.WriteLine(String.Format("{0} \t {1} \t {2}",
                                                 BytesToString(typeStat.Size), typeStat.Count, typeStat.Name),
                                   ConsoleColor.White);
            }
        }
Beispiel #20
0
        private void DoWireUp()
        {
            // inputs
            V.ConnectTo(_nor3Qnot.V)
            .ConnectTo(_nor3Q.V)
            .ConnectTo(_nor3D.V)
            .ConnectTo(_nor3Clk.V)
            .ConnectTo(_nor3Pre.V)
            .ConnectTo(_nor3Clr.V)
            .ConnectTo(_not.V);
            Clr.ConnectTo(_nor3Q.A).ConnectTo(_nor3Clr.A);
            Pre.ConnectTo(_nor3Qnot.B).ConnectTo(_nor3D.B).ConnectTo(_nor3Pre.B);
            _not.Output.ConnectTo(_nor3Pre.C).ConnectTo(_nor3Clk.B);
            _nor3D.O.ConnectTo(_nor3Clr.B).ConnectTo(_nor3Clk.C);

            // internals
            _nor3Clr.O.ConnectTo(_nor3Pre.A);
            _nor3Pre.O.ConnectTo(_nor3Clr.C).ConnectTo(_nor3Clk.A).ConnectTo(_nor3Q.B);
            _nor3Clk.O.ConnectTo(_nor3D.A).ConnectTo(_nor3Qnot.C);
            _nor3Q.O.ConnectTo(_nor3Qnot.A);
            _nor3Qnot.O.Changed += _ => _nor3Clk.B.V = _not.Output.V;   // not sure why this is needed...
            _nor3Qnot.O.ConnectTo(_nor3Q.C);
        }
Beispiel #21
0
 public static DetachedCriteria SetFetchMode <T>(this DetachedCriteria criteria, Expression <Func <T, object> > expression, FetchMode fetchmode)
 {
     return(criteria.SetFetchMode(Clr <T> .Name(expression), fetchmode));
 }
Beispiel #22
0
 public VisualStudioFacade(TextEditor te, Compiller compil, Clr clr)
 {
     _textEditor = te;
     _compiller  = compil;
     _clr        = clr;
 }
Beispiel #23
0
 /// <summary>Creates new facet which specifies that the given type has EPM.</summary>
 /// <param name="entityPropertyMappingType">The type of EPM used for the resource type.</param>
 /// <returns>The new facet</returns>
 public static NodeFacet EntityPropertyMapping(EntityPropertyMappingType entityPropertyMappingType)
 {
     return(new NodeFacet(EntityPropertyMappingFacetName, Clr.Value <int>((int)entityPropertyMappingType)));
 }
Beispiel #24
0
 public Message(string[] text)
 {
     Text = text;
     Color = new Clr(40, 160, 240);
 }
 public VisualStudioFacade(TestEditor textEditor, Compiler compiler, Clr clr)
 {
     _textEditor = textEditor;
     _compiler   = compiler;
     _clr        = clr;
 }
Beispiel #26
0
        private static string GetBootstrap(Clr clr, Bitness bitness)
        {
            var bitnessVersion = string.Empty;
            switch (bitness)
            {
                case Bitness.x86: bitnessVersion = "x86"; break;
                case Bitness.x64: bitnessVersion = "x64"; break;
                default: throw new ArgumentException(string.Format(
                    "Bitness Value {0} is invalid.", bitness), "bitness");
            }

            var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // Very special case: Hawkeye is x86 and the spied process is x64: we can't know for sure
            // whether the process is .NET 2 or 4 or none.
            // So, we must simply re-run Hawkeye.exe (which is compiled as Any Cpu and therefore
            // will run as x64 in a x64 environment) passing it the handle of the spied window so that another
            // detection is achieved, this time from a x64 process.
            // Note that because we run Hawkeye.exe, we won't inject anything.
            if (clr == Clr.Undefined && HawkeyeApplication.CurrentBitness == Bitness.x86 && bitness == Bitness.x64)
                return Path.Combine(directory, "Hawkeye.exe");

            var clrVersion = string.Empty;
            switch (clr)
            {
                case Clr.Net2: clrVersion = "N2"; break;
                case Clr.Net4: clrVersion = "N4"; break;
                default: throw new ArgumentException(
                    string.Format("Clr Value {0} is invalid.", clr), "clr");
            }

            var exe = string.Format("HawkeyeBootstrap{0}{1}.exe", clrVersion, bitnessVersion);
            return Path.Combine(directory, exe);
        }
Beispiel #27
0
 /// <summary>Creates new facet which specifies that a given type has SDP on.</summary>
 /// <param name="pageSize">The size of the page in SDP.</param>
 /// <returns>The new facet.</returns>
 public static NodeFacet ServerDrivenPaging(int pageSize)
 {
     return(new NodeFacet(ServerDrivenPagingFacetName, Clr.Value(pageSize)));
 }
Beispiel #28
0
        /// <summary>
        /// Retrieve a "Colors" shade of a color using the Clr enum
        /// </summary>
        /// <param name="clr">The color to retrieve</param>
        /// <returns></returns>
        public static Xamarin.Forms.Color FromEnum(Clr clr)
        {
            string val = clr.ToString();

            return((Xamarin.Forms.Color)Xamarin.Forms.Application.Current.Resources[val]);
        }
Beispiel #29
0
 public static SqlString Column <T>(this SqlString s, Expression <Func <T, object> > exp)
 {
     return(s.Append(Clr <T> .Name(exp).ToLower()));
 }
Beispiel #30
0
        public CrossMethod(string callname)
        {
            CallName = callname;

            var values = callname.Split(new string[] { "::", ",", "(", ")", " " },
                                        StringSplitOptions.RemoveEmptyEntries);
            var         returnType = values[0];
            var         typeName   = values[1];
            var         methodName = values[2];
            var         type       = Extensions.GetTypeByName(typeName);
            List <Type> args       = new List <Type>();

            for (int i = 3; i < values.Length; i++)
            {
                args.Add(Extensions.GetTypeByName(values[i]));
            }
            var methodInfo = type.GetMethod(methodName, args.ToArray());

#if BRIDGE
            if (methodInfo == null)
            {
                methodInfo = type.GetMethodInfo(methodName, args.ToArray());
            }
#endif
            if (methodInfo == null)
            {
                ConstructorInfo coninfo = null;


#if !BRIDGE
                coninfo = type.GetConstructor(args.ToArray());
#endif
                if (coninfo != null)
                {
                    ArgCount   = coninfo.GetParameters().Length;
                    HaseResult = true;
                    Clr        = new Clr(1, ArgCount, HaseResult, 1);
                    CreatDelegate(coninfo);
                    return;
                }
                else
                {
#if BRIDGE
                    if (methodName == ".ctor")
                    {
                        //这个无法找到构造函数,只能直接构造了
                        ArgCount   = 0;
                        HaseResult = true;
                        Clr        = new Clr(1, ArgCount, HaseResult, 1);

                        var tasktype = typeof(ObjectBuild <>).MakeGenericType(type);
                        CrossMethodDelegate = Activator.CreateInstance(tasktype) as ICrossMethodDelegate;
                        return;
                    }
#endif
                    throw new NotSupportedException(callname + " methodInfo or coninfo Mast Be Not Null!");
                }
            }

            if (methodInfo != null)
            {
                ArgCount   = methodInfo.GetParameters().Length;
                HaseResult = methodInfo.ReturnType != typeof(void);
#if BRIDGE
                if (methodName == "ctor" || methodName == ".ctor")
                {
                    HaseResult = true;
                }
#endif
                if (!methodInfo.IsStatic)
                {
                    ArgCount++;
                }
                Clr = new Clr(1, ArgCount, HaseResult, 1);
                CreatDelegate(methodInfo);
            }
            //构建CLR
        }
Beispiel #31
0
 public static DetachedCriteria CreateCriteria <T>(this DetachedCriteria criteria, Expression <Func <T, object> > expression)
 {
     return(criteria.CreateCriteria(Clr <T> .Name(expression)));
 }
Beispiel #32
0
 public Message(string[] text)
 {
     Text  = text;
     Color = new Clr(40, 160, 240);
 }
 public ExcludeClrAttribute(Clr cl, string msg)
 {
 }