示例#1
0
 public static void GetPerspective(Structures.MyPoint[] Points, Structures.MyPolygon[] Polygons)
 {
     const double Zk = 200;
       const double Zpl = 10;
       int Length = Polygons.Length;
       double Perspective = 0;
       for (int i = 0; i < Length; i++)
       {
     Perspective = (Zk - Zpl) / (Zk - Points[Polygons[i].FP - 1].Z);
     Points[Polygons[i].FP - 1] = new Structures.MyPoint(
       Points[Polygons[i].FP - 1].X * Perspective,
       Points[Polygons[i].FP - 1].Y * Perspective,
       Points[Polygons[i].FP - 1].Z * Perspective);
     Perspective = (Zk - Zpl) / (Zk - Points[Polygons[i].SP - 1].Z);
     Points[Polygons[i].TP - 1] = new Structures.MyPoint(
       Points[Polygons[i].SP - 1].X * Perspective,
       Points[Polygons[i].SP - 1].Y * Perspective,
       Points[Polygons[i].SP - 1].Z * Perspective);
     Perspective = (Zk - Zpl) / (Zk - Points[Polygons[i].TP - 1].Z);
     Points[Polygons[i].TP - 1] = new Structures.MyPoint(
       Points[Polygons[i].TP - 1].X * Perspective,
       Points[Polygons[i].TP - 1].Y * Perspective,
       Points[Polygons[i].TP - 1].Z * Perspective);
     if (Polygons[i].Type == 4)
     {
       Perspective = (Zk - Zpl) / (Zk - Points[Polygons[i].FrP - 1].Z);
       Points[Polygons[i].FrP - 1] = new Structures.MyPoint(
     Points[Polygons[i].FrP - 1].X * Perspective,
     Points[Polygons[i].FrP - 1].Y * Perspective,
     Points[Polygons[i].FrP - 1].Z * Perspective);
     }
       }
 }
示例#2
0
        public SetRefDefinition(Structures.TupleDefinition tupleDefinition, ADBBaseObject[] myParameters)
        {
            System.Diagnostics.Debug.Assert(tupleDefinition != null);

            this.TupleDefinition = tupleDefinition;
            this.Parameters = myParameters;
        }
        /// <summary>
        /// The build registry interface document.
        /// </summary>
        /// <param name="buildFrom">
        /// The build from.
        /// </param>
        /// <param name="action">
        /// The action.
        /// </param>
        /// <returns>
        /// The <see cref="RegistryInterface"/>.
        /// </returns>
        public RegistryInterface BuildRegistryInterfaceDocument(ISdmxObjects buildFrom, DatasetAction action)
        {
            var rid = new RegistryInterface();
            RegistryInterfaceType rit = rid.Content;
            V21Helper.Header = rit;
            var structureRequestType = new SubmitStructureRequestType();
            rit.SubmitStructureRequest = structureRequestType;
            switch (action.EnumType)
            {
                case DatasetActionEnumType.Append:
                    structureRequestType.action = ActionTypeConstants.Append;
                    break;
                case DatasetActionEnumType.Replace:
                    structureRequestType.action = ActionTypeConstants.Replace;
                    break;
                case DatasetActionEnumType.Delete:
                    structureRequestType.action = ActionTypeConstants.Delete;
                    break;
                case DatasetActionEnumType.Information:
                    structureRequestType.action = ActionTypeConstants.Information;
                    break;
            }

            var structures = new Structures();
            structureRequestType.Structures = structures;
            this._structureXmlBuilder.PopulateStructureType(buildFrom, structures.Content);

            return rid;
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MovieImageScraperActionContext"/> class.
 /// </summary>
 /// <param name="dbMovie">The movie.</param>
 /// <param name="scrapeType">The type of scrape to perform.</param>
 /// <param name="askIfMultipleResults">if set to <c>true</c> ask the user to select a movie if multiple results are found.</param>
 public MovieImageScraperActionContext(
     Structures.DBMovie dbMovie,
     ImageScrapeType imageScrapeType,
     ScrapeType scrapeType,
     bool askIfMultipleResults)
     : base(imageScrapeType, scrapeType, askIfMultipleResults)
 {
     this.dbMovie = dbMovie;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MovieInfoScraperActionContext"/> class.
 /// </summary>
 /// <param name="dbMovie">The movie.</param>
 /// <param name="scrapeType">The type of scrape to perform.</param>
 /// <param name="askIfMultipleResults">if set to <c>true</c> ask the user to select a movie if multiple results are found.</param>
 /// <param name="options">The global scraper options.</param>
 public MovieInfoScraperActionContext(
     Structures.DBMovie dbMovie,
     ScrapeType scrapeType,
     bool askIfMultipleResults,
     Structures.ScrapeOptions options)
     : base(scrapeType, askIfMultipleResults)
 {
     this.dbMovie = dbMovie;
     this.options = options;
 }
示例#6
0
 public SelectDefinition(List<TypeReferenceDefinition> myTypeList, List<Tuple<AExpressionDefinition, string, SelectValueAssignment>> mySelectedElements, BinaryExpressionDefinition myWhereExpressionDefinition,
     List<IDChainDefinition> myGroupByIDs, BinaryExpressionDefinition myHaving, ulong? myLimit, ulong? myOffset, Structures.OrderByDefinition myOrderByDefinition, long myResolutionDepth)
 {
     TypeList = myTypeList;
     SelectedElements = mySelectedElements;
     WhereExpressionDefinition = myWhereExpressionDefinition;
     GroupByIDs = myGroupByIDs;
     Having = myHaving;
     Limit = myLimit;
     Offset = myOffset;
     OrderByDefinition = myOrderByDefinition;
     ResolutionDepth = myResolutionDepth;
 }
示例#7
0
 public static Structures.MyPoint VectorMultiply(Structures.MyPoint Vector, Matrix Matrix)
 {
     double[] Out = new double[4];
       Out[0] = Vector.X * Matrix.MatrixArr[0, 0] + Vector.Y * Matrix.MatrixArr[1, 0] + Vector.Z * Matrix.MatrixArr[2, 0] + Matrix.MatrixArr[3, 0];
       Out[1] = Vector.X * Matrix.MatrixArr[0, 1] + Vector.Y * Matrix.MatrixArr[1, 1] + Vector.Z * Matrix.MatrixArr[2, 1] + Matrix.MatrixArr[3, 1];
       Out[2] = Vector.X * Matrix.MatrixArr[0, 2] + Vector.Y * Matrix.MatrixArr[1, 2] + Vector.Z * Matrix.MatrixArr[2, 2] + Matrix.MatrixArr[3, 2];
       Out[3] = Vector.X * Matrix.MatrixArr[0, 3] + Vector.Y * Matrix.MatrixArr[1, 3] + Vector.Z * Matrix.MatrixArr[2, 3] + Matrix.MatrixArr[3, 3];
       if (Out[3] != 1)
       {
     Out[0] /= Out[3];
     Out[1] /= Out[3];
     Out[2] /= Out[3];
     Out[3] = 1;
       }
       return new Structures.MyPoint(Out[0], Out[1], Out[2]);
 }
示例#8
0
 private MetaDataStream GetHeap(NETHeader netheader, int headeroffset, Structures.METADATA_STREAM_HEADER rawHeader, string name)
 {
     switch (name)
     {
         case "#~":
         case "#-":
             return new TablesHeap(netheader, headeroffset, rawHeader, name);
         case "#Strings":
             return new StringsHeap(netheader, headeroffset, rawHeader, name);
         case "#US":
             return new UserStringsHeap(netheader, headeroffset, rawHeader, name);
         case "#GUID":
             return new GuidHeap(netheader, headeroffset, rawHeader, name);
         case "#Blob":
             return new BlobHeap(netheader, headeroffset, rawHeader, name);
         default:
             throw new ArgumentException("Metadatastream is not recognized as a valid heap.");
     }
 }
示例#9
0
 private MetaDataStream GetHeap(NETHeader netheader, int headeroffset, Structures.METADATA_STREAM_HEADER rawHeader, string name)
 {
     switch (name)
     {
         case "#~":
         case "#-":
             return new TablesHeap(netheader, headeroffset, rawHeader, name);
         case "#Strings":
             return new StringsHeap(netheader, headeroffset, rawHeader, name);
         case "#US":
             return new UserStringsHeap(netheader, headeroffset, rawHeader, name);
         case "#GUID":
             return new GuidHeap(netheader, headeroffset, rawHeader, name);
         case "#Blob":
             return new BlobHeap(netheader, headeroffset, rawHeader, name);
         default:
             return new MetaDataStream(netheader, headeroffset, rawHeader, name);
     }
 }
        protected override System.Data.DataTable GetData(HttpContext context, String query, int rows, Structures.Languages lang)
        {
            Pokedex.Pokedex pokedex = AppStateHelper.Pokedex(context.Application);
            String iso = Format.ToIso639_1(lang);
            query = query.ToLowerInvariant();
            int natDex = 0;
            Int32.TryParse(query, out natDex);
            int limit = 0;
            if (context.Request.QueryString["limit"] != null)
            {
                limit = Convert.ToInt32(context.Request.QueryString["limit"]);
                if (natDex > limit) return null;
            }

            Func<KeyValuePair<int, Species>, bool> filter;
            if (natDex > 0)
                filter = pair => pair.Key == natDex;
            else
                filter = pair => pair.Key <= limit && pair.Value.Name[iso].ToLowerInvariant().Contains(query);

            IEnumerable<Species> data;
            data = pokedex.Species.Where(filter).OrderBy(pair => pair.Key).Take(rows).Select(pair => pair.Value);

            DataTable dt = new DataTable();
            dt.Columns.Add("Text", typeof(String));
            dt.Columns.Add("Value", typeof(int));
            dt.Columns.Add("html", typeof(String));

            foreach (Species s in data)
            {
                String name = s.Name[iso];
                String html = "<img src=\"" + Common.ResolveUrl(WebFormat.SpeciesImageSmall(s)) +
                    "\" alt=\"" + Common.HtmlEncode(name) +
                    "\" class=\"sprite speciesSmall\" width=\"40px\" height=\"32px\" />" +
                    String.Format("{0} (#{1})",
                    Common.HtmlEncode(name),
                    s.NationalDex);

                dt.Rows.Add(name, s.NationalDex, html);
            }

            return dt;
        }
示例#11
0
 public static extern void GetWindowRect(IntPtr hWnd, ref Structures.User32.RECT rect);
示例#12
0
 public static extern int FillRect(IntPtr hdc, ref Structures.User32.RECT rect, ref IntPtr hbr);
示例#13
0
 public static extern bool GetMonitorInfo([In()] IntPtr hMonitor, ref Structures.User32.MONITORINFOEX lpmi);
示例#14
0
 /// <summary>
 /// Get verdict name form given verdict number
 /// </summary>
 /// <param name="ver">Verdict number</param>
 /// <returns>Verdict name</returns>
 public static string GetVerdict(Structures.Verdict ver)
 {
     switch (ver)
     {
         case Structures.Verdict.SubError: return "Submission Error";
         case Structures.Verdict.CannotBeJudge: return "Can't Be Judged";
         case Structures.Verdict.CompileError: return "Compile Error";
         case Structures.Verdict.RestrictedFunction: return "Restricted Function";
         case Structures.Verdict.RuntimeError: return "Runtime Error";
         case Structures.Verdict.OutputLimit: return "Output Limit Exceeded";
         case Structures.Verdict.TimLimit: return "Time Limit Exceeded";
         case Structures.Verdict.MemoryLimit: return "Memory Limit Exceeded";
         case Structures.Verdict.WrongAnswer: return "Wrong Answer";
         case Structures.Verdict.PresentationError: return "Presentation Error";
         case Structures.Verdict.Accepted: return "Accepted";
         default: return "- In Queue -";
     }
 }
示例#15
0
 public static extern bool EnumDisplayMonitors([In()] IntPtr hdc, ref Structures.User32.RECT lprcClip, [In()] Delegates.MonitorEnumProc lpfnEnum, [In()] IntPtr dwData);
示例#16
0
 /// <summary>
 /// Get color for given verdict
 /// </summary>
 /// <param name="ver">Verdict number to get color</param>
 /// <returns>Color for the given verdict </returns>
 public static System.Drawing.Color GetVerdictColor(Structures.Verdict ver)
 {
     switch (ver)
     {
         case Structures.Verdict.SubError: return System.Drawing.Color.DarkGoldenrod;
         case Structures.Verdict.CannotBeJudge: return System.Drawing.Color.DarkGray;
         case Structures.Verdict.CompileError: return System.Drawing.Color.Red;
         case Structures.Verdict.RestrictedFunction: return System.Drawing.Color.SlateBlue;
         case Structures.Verdict.RuntimeError: return System.Drawing.Color.Green;
         case Structures.Verdict.OutputLimit: return System.Drawing.Color.Brown;
         case Structures.Verdict.TimLimit: return System.Drawing.Color.Teal;
         case Structures.Verdict.MemoryLimit: return System.Drawing.Color.SlateGray;
         case Structures.Verdict.WrongAnswer: return System.Drawing.Color.Maroon;
         case Structures.Verdict.PresentationError: return System.Drawing.Color.RoyalBlue;
         case Structures.Verdict.Accepted: return System.Drawing.Color.Blue;
         default: return System.Drawing.Color.Black;
     }
 }
示例#17
0
 public static extern bool Thread32First(IntPtr hSnapshot, ref Structures.THREADENTRY32 lpte);
示例#18
0
文件: Helper.cs 项目: renjithgk/fedup
 internal static extern bool AdjustTokenPrivileges(IntPtr TokenHandle, [MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges, ref Structures.TOKEN_PRIVILEGES NewState, UInt32 BufferLength, IntPtr PreviousState, IntPtr ReturnLength);
示例#19
0
        public static extern bool TranslateMessage(
			ref Structures.User32.MSG lpMsg
		);
示例#20
0
 public static extern bool InvalidateRect([In()] IntPtr hWnd, ref Structures.User32.RECT lpRect, [In()] bool bErase);
示例#21
0
        public static extern IntPtr RegisterClassEx(
			ref Structures.User32.WNDCLASSEX lpwcx
		);
示例#22
0
文件: MyDrawing.cs 项目: Mexahoid/CSF
        private static void DrawPolygon(Structures.MyPolygon Pol)
        {
            using (Graphics g = Graphics.FromImage(Canvas))
              {
            g.SmoothingMode = SmoothingMode.HighQuality;
            int R;
            int G;
            int B;
            double MC = Math.Abs(Pol.CameraCoeff);
            if (Pol.LightCoeff >= 0)  //!
            {
              R = (int)((255 * Pol.LightCoeff + 240 * Pol.CameraDist) / 2);
              G = (int)((255 * Pol.LightCoeff + 150 * Pol.CameraDist) / 2);
              B = (int)((255 * Pol.LightCoeff + 20 * Pol.CameraDist) / 2);
              /*}
              else
              {
            R = (int)(24 * MC);
            G = (int)(15 * MC);
            B = (int)(2 * MC);
              }*/

              SolidBrush Br = new SolidBrush(Color.FromArgb(R, G, B));
              Structures.MyPoint[] Points = MainData.Item1;

              Point P0 = IJ(Points[Pol.FP - 1]);
              Point P1 = IJ(Points[Pol.SP - 1]);
              Point P2 = IJ(Points[Pol.TP - 1]);
              if (Pol.Type == 3)
            g.FillPolygon(Br, new Point[] { P0, P1, P2 });
              else
              {
            Point P3 = IJ(Points[Pol.FrP - 1]);
            g.FillPolygon(Br, new Point[] { P0, P1, P2, P3 });
              }

              if (Normasl)
              {
            g.DrawLine(Pens.Red, IJ(Points[Pol.FP - 1]), IJ(new Structures.MyPoint(Pol.Vector[0], Pol.Vector[1], Pol.Vector[2])));
              }
            }
              }
        }
示例#23
0
        public static extern bool DispatchMessage(
			ref Structures.User32.MSG lpMsg
		);
示例#24
0
文件: MyDrawing.cs 项目: Mexahoid/CSF
 private static Point IJ(Structures.MyPoint P)
 {
     double Xn = (P.X - fxc) * Math.Cos(Alf) - (P.Y - fyc) * Math.Sin(Alf);
       double Yn = ((P.X - fxc) * Math.Sin(Alf) + (P.Y - fyc) * Math.Cos(Alf)) * Math.Cos(Bet) - (P.Z - fzc) * Math.Sin(Bet);
       double Zn = ((P.X - fxc) * Math.Sin(Alf) + (P.Y - fyc) * Math.Cos(Alf)) * Math.Sin(Bet) + (P.Z - fzc) * Math.Cos(Bet);
       Xn = Xn / (Zn * -0.2 + 1);
       Yn = Yn / (Zn * -0.2 + 1);
       int X = (int)Math.Round(I2 * (Xn - Xmin) / (Xmax - Xmin));
       int Y = Convert.ToInt32(J2 * (Yn - Ymax) / (Ymin - Ymax));
       return new Point(X, Y);
 }
示例#25
0
文件: Helper.cs 项目: renjithgk/fedup
 internal static extern int LookupPrivilegeValue(string lpSystemName, string lpName, ref Structures.LUID lpLuid);
示例#26
0
文件: MyDrawing.cs 项目: Mexahoid/CSF
 private static void DrawEdge(Structures.MyPolygon Pol)
 {
     using (Graphics g = Graphics.FromImage(Canvas))
       {
     g.SmoothingMode = SmoothingMode.HighQuality;
     Structures.MyPoint[] Points = MainData.Item1;
     Point P0 = IJ(Points[Pol.FP - 1]);
     Point P1 = IJ(Points[Pol.SP - 1]);
     Point P2 = IJ(Points[Pol.TP - 1]);
     if (Pol.Type == 3)
       g.DrawPolygon(Pens.White, new Point[] { P0, P1, P2 });
     else
     {
       Point P3 = IJ(Points[Pol.FrP - 1]);
       g.DrawPolygon(Pens.White, new Point[] { P0, P1, P2, P3 });
     }
       }
 }
示例#27
0
 public static extern bool Thread32Next(IntPtr hSnapshot, out Structures.THREADENTRY32 lpte);
示例#28
0
 private void GetMaxZ(Structures.MyPolygon Pol)
 {
     double Z1 = points[Pol.firstPoint - 1].z;
       double Z2 = points[Pol.secondPoint - 1].z;
       double Z3 = points[Pol.thirdPoint - 1].z;
       double[] Arr = new double[] { Z1, Z2, Z3 };
       if (Pol.Type == 4)
       {
     double Z4 = points[Pol.fourthPoint - 1].z;
     Arr = new double[] { Z1, Z2, Z3, Z4 };
       }
       Array.Sort(Arr);
       Pol.MaxZ = Pol.Type == 4 ? Arr[3] : Arr[2];
 }
示例#29
0
 //
 // User Rank
 //
 /// <summary>
 /// Set rank-list of a user 
 /// </summary>
 /// <param name="urank">User rank to save</param>
 public static void SetUserRank(Structures.UserRanklist urank)
 {
     string data = JsonConvert.SerializeObject(urank);
     SetValue(urank.username, data, "User Rank", RegistryValueKind.String);
 }
示例#30
0
        private double[] _GetEquation(Structures.MyPolygon Pol)
        {
            Structures.MyPoint Z1 = points[Pol.firstPoint - 1];
              Structures.MyPoint Z2 = points[Pol.secondPoint - 1];
              Structures.MyPoint Z3 = points[Pol.thirdPoint - 1];

              double x1 = Convert.ToDouble(Z1.x);
              double y1 = Convert.ToDouble(Z1.y);
              double z1 = Convert.ToDouble(Z1.z);
              double x2 = Convert.ToDouble(Z2.x);
              double y2 = Convert.ToDouble(Z2.y);
              double z2 = Convert.ToDouble(Z2.z);
              double x3 = Convert.ToDouble(Z3.x);
              double y3 = Convert.ToDouble(Z3.y);
              double z3 = Convert.ToDouble(Z3.z);

              double a = y1 * (z2 - z3) + y2 * (z3 - z1) + y3 * (z1 - z2);
              double b = z1 * (x2 - x3) + z2 * (x3 - x1) + z3 * (x1 - x2);
              double c = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
              double d = -(x1 * (y2 * z3 - y3 * z2) + x2 * (y3 * z1 - y1 * z3) + x3 * (y1 * z2 - y2 * z1));
             /* while (Math.Abs(a) < 0.1 && Math.Abs(b) < 0.1 && Math.Abs(c) < 0.1 && Math.Abs(d) < 0.1)
              {
              a *= 10;
              b *= 10;
              c *= 10;
              d *= 10;
              }*/
              double[] Equation = new double[4] { a, b, c, d };
              return Equation;
        }