public UnmanagedImage Clone()
        {
            IntPtr         imageData = Marshal.AllocHGlobal((int)(this.stride * this.height));
            UnmanagedImage image     = new UnmanagedImage(imageData, this.width, this.height, this.stride, this.pixelFormat)
            {
                mustBeDisposed = true
            };

            SystemTools.CopyUnmanagedMemory(imageData, this.imageData, this.stride * this.height);
            return(image);
        }
        public static UnmanagedImage Create(int width, int height, System.Drawing.Imaging.PixelFormat pixelFormat)
        {
            int num = 0;

            switch (pixelFormat)
            {
            case System.Drawing.Imaging.PixelFormat.Format8bppIndexed:
                num = 1;
                break;

            case System.Drawing.Imaging.PixelFormat.Format32bppPArgb:
            case System.Drawing.Imaging.PixelFormat.Format32bppRgb:
            case System.Drawing.Imaging.PixelFormat.Format32bppArgb:
                num = 4;
                break;

            case System.Drawing.Imaging.PixelFormat.Format24bppRgb:
                num = 3;
                break;

            case System.Drawing.Imaging.PixelFormat.Format16bppGrayScale:
                num = 2;
                break;

            case System.Drawing.Imaging.PixelFormat.Format48bppRgb:
                num = 6;
                break;

            case System.Drawing.Imaging.PixelFormat.Format64bppPArgb:
            case System.Drawing.Imaging.PixelFormat.Format64bppArgb:
                num = 8;
                break;

            default:
                throw new UnsupportedImageFormatException("Can not create image with specified pixel format.");
            }
            if ((width <= 0) || (height <= 0))
            {
                throw new InvalidImagePropertiesException("Invalid image size specified.");
            }
            int stride = width * num;

            if ((stride % 4) != 0)
            {
                stride += 4 - (stride % 4);
            }
            IntPtr dst = Marshal.AllocHGlobal((int)(stride * height));

            SystemTools.SetUnmanagedMemory(dst, 0, stride * height);
            return(new UnmanagedImage(dst, width, height, stride, pixelFormat)
            {
                mustBeDisposed = true
            });
        }
Exemplo n.º 3
0
        private static Bitmap CloneImage(BitmapData sourceData)
        {
            int        width      = sourceData.Width;
            int        height     = sourceData.Height;
            Bitmap     bitmap     = new Bitmap(width, height, sourceData.PixelFormat);
            BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, bitmap.PixelFormat);

            SystemTools.CopyUnmanagedMemory(bitmapData.Scan0, sourceData.Scan0, height * sourceData.Stride);
            bitmap.UnlockBits(bitmapData);
            return(bitmap);
        }
Exemplo n.º 4
0
 private void Transfer()
 {
     AssetLoader.Log("Transfer -> {0}", dstFile);
     try {
         SystemTools.NeedDirectory(Path.GetDirectoryName(dstFile));
         stream = new FileStream(dstFile, FileMode.Create, FileAccess.Write);
         stream.BeginWrite(srcBytes, 0, srcBytes.Length, new AsyncCallback(onWritten), Path.GetFileName(dstFile));
     } catch (System.Exception e) {
         LogMgr.E(e.ToString());
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Sets the ground level.
        /// </summary>
        /// <param name="_transform">Transform.</param>
        /// <param name="_offset">Offset.</param>
        public static void SetGroundLevel(Transform _transform, float _offset)
        {
            SystemTools.EnableColliders(_transform, false);
            float _ground_level = GetGroundLevel(_transform.position, _offset);

            _transform.position = new Vector3(
                _transform.position.x,
                _ground_level + _offset,
                _transform.position.z);
            SystemTools.EnableColliders(_transform, true);
        }
Exemplo n.º 6
0
        protected unsafe override void ProcessFilter(UnmanagedImage source, UnmanagedImage destination, Rectangle rect)
        {
            int   num      = System.Drawing.Image.GetPixelFormatSize(source.PixelFormat) / 8;
            int   left     = rect.Left;
            int   top      = rect.Top;
            int   num2     = left + rect.Width;
            int   num3     = top + rect.Height;
            int   stride   = source.Stride;
            int   stride2  = destination.Stride;
            int   num4     = stride2 - rect.Width * num;
            int   maxValue = radius * 2 + 1;
            byte *ptr      = (byte *)source.ImageData.ToPointer();
            byte *ptr2     = (byte *)destination.ImageData.ToPointer();

            if (stride == stride2)
            {
                SystemTools.CopyUnmanagedMemory(ptr2, ptr, stride * source.Height);
            }
            else
            {
                int count = source.Width * num;
                int i     = 0;
                for (int height = source.Height; i < height; i++)
                {
                    SystemTools.CopyUnmanagedMemory(ptr2 + (long)stride2 * (long)i, ptr + (long)stride * (long)i, count);
                }
            }
            ptr2 += top * stride2 + left * num;
            for (int j = top; j < num3; j++)
            {
                for (int k = left; k < num2; k++)
                {
                    int num5 = k + rand.Next(maxValue) - radius;
                    int num6 = j + rand.Next(maxValue) - radius;
                    if (num5 >= left && num6 >= top && num5 < num2 && num6 < num3)
                    {
                        byte *ptr3 = ptr + (long)num6 * (long)stride + (long)num5 * (long)num;
                        int   num7 = 0;
                        while (num7 < num)
                        {
                            *ptr2 = *ptr3;
                            num7++;
                            ptr2++;
                            ptr3++;
                        }
                    }
                    else
                    {
                        ptr2 += num;
                    }
                }
                ptr2 += num4;
            }
        }
Exemplo n.º 7
0
        public void Adapt(LookDataObject _look)
        {
            if (Owner == null || _look == null || _look.Enabled == false)
            {
                return;
            }

            //if( m_LastLook.GetHashCode != _look )

            SystemTools.EnableRenderer(Owner.transform, !_look.UseInvisibility);
        }
Exemplo n.º 8
0
 public AppDbContext(DbContextOptions options, string[] colname) : base(options)
 {
     colName = colname;          //получение наименований столбцов = названиям датчиков в строке
     try
     {
         Database.EnsureCreated();
     }
     catch (Exception e)
     {
         SystemTools.WriteLog($"Ошибка при открытии базы данных: {e.Message}");
     }
 }
Exemplo n.º 9
0
        public int ProcessCommission(string[] data)
        {
            int i = 0;

            foreach (string SaleID in data)
            {
                int      TotalCommission = GetCommission(SaleID);
                string   BusinessID      = GetBusinessID(SaleID);
                DateTime LastUpdated     = DateTime.Now;
                var      Validation      = GetCurrentCommision(BusinessID);
                int      NewBalance;
                if (Validation.ValidChecker.Length > 1)
                {
                    string[] validChecker = SystemTools.Decrypt(Validation.ValidChecker.ToString().Trim()).Split(',');
                    DateTime validDate    = Convert.ToDateTime(validChecker[0]);
                    int      validAmount  = int.Parse(validChecker[1]);

                    if (validAmount != Convert.ToInt32(Validation.AvailableBalance) && validDate != Validation.DateUpdated)
                    {
                        return(99);
                    }
                    NewBalance = validAmount + TotalCommission;
                }
                else
                {
                    NewBalance = 0 + TotalCommission;
                }

                string NewValidChecker = SystemTools.EncryptPass(LastUpdated.ToString("yyyy-MM-dd HH:mm:ss") + "," + NewBalance);
                try
                {
                    using (SqlConnection con = new SqlConnection(VendorConn))
                    {
                        con.Open();
                        using (SqlCommand com = new SqlCommand("UPDATE tbl_comm set actual_bal=actual_bal-@TotalCommission,available_bal=@NewBalance,ValidChecker=@NewValidChecker,DateUpdated=@DateUpdated WHERE business_id=@BusinessID", con))
                        {
                            com.Parameters.AddWithValue("@TotalCommission", TotalCommission);
                            com.Parameters.AddWithValue("@NewBalance", NewBalance);
                            com.Parameters.AddWithValue("@NewValidChecker", NewValidChecker);
                            com.Parameters.AddWithValue("@DateUpdated", LastUpdated);
                            com.Parameters.AddWithValue("@BusinessID", BusinessID);
                            i = com.ExecuteNonQuery();
                        }
                    }
                    SQLExecutor("Update tbl_sales_details set status=1 where sale_id='" + SaleID + "'");
                }
                catch (Exception ex)
                {
                }
            }
            return(i);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Ignore the specified _mask.
        /// </summary>
        /// <param name="_mask">Mask.</param>
        public LayerMask Ignore(LayerMask _mask)
        {
            foreach (string _name in m_Layers)
            {
                int _layer = LayerMask.NameToLayer(_name);
                if (_layer != -1 && SystemTools.IsInLayerMask(_layer, _mask))
                {
                    _mask |= (1 >> _layer);
                }
            }

            return(_mask);
        }
 public void ApplyInPlace(UnmanagedImage image, Rectangle rect)
 {
     this.CheckSourceFormat(image.PixelFormat);
     rect.Intersect(new Rectangle(0, 0, image.Width, image.Height));
     if ((rect.Width | rect.Height) != 0)
     {
         int    size = image.Stride * image.Height;
         IntPtr dst  = MemoryManager.Alloc(size);
         SystemTools.CopyUnmanagedMemory(dst, image.ImageData, size);
         this.ProcessFilter(new UnmanagedImage(dst, image.Width, image.Height, image.Stride, image.PixelFormat), image, rect);
         MemoryManager.Free(dst);
     }
 }
Exemplo n.º 12
0
        public void CopyVersionDirectories(string ver)
        {
            var root = SystemTools.GetIsWindows() ? string.Format(@"{0}\versions\{1}\moddir", GameRootPath, ver) : string.Format("{0}/versions/{1}/moddir", GameRootPath, ver);

            if (!Directory.Exists(root))
            {
                return;
            }
            foreach (var dir in new DirectoryInfo(root).EnumerateDirectories())
            {
                CopyDirectory(dir.FullName, (SystemTools.GetIsWindows() ? string.Format(@"{0}\{1}", GameRootPath, dir.Name) : string.Format("{0}/{1}", GameRootPath, dir.Name)));
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Clone the unmanaged images.
        /// </summary>
        ///
        /// <returns>Returns clone of the unmanaged image.</returns>
        ///
        /// <remarks><para>The method does complete cloning of the object.</para></remarks>
        ///
        public UnmanagedImage Clone()
        {
            // allocate memory for the image
            IntPtr newImageData = System.Runtime.InteropServices.Marshal.AllocHGlobal(stride * height);

            UnmanagedImage newImage = new UnmanagedImage(newImageData, width, height, stride, pixelFormat);

            newImage.mustBeDisposed = true;

            SystemTools.CopyUnmanagedMemory(newImageData, imageData, stride * height);

            return(newImage);
        }
Exemplo n.º 14
0
 public void CopyVersionDirectory(string directoryName, string versionId)
 {
     if (SystemTools.GetIsWindows())
     {
         CopyDirectory(string.Format(@"{0}\versions\{2}\{1}", GameRootPath, directoryName, versionId),
                       string.Format(@"{0}\{1}", GameRootPath, directoryName));
     }
     else
     {
         CopyDirectory(string.Format("{0}/versions/{2}/{1}", GameRootPath, directoryName, versionId),
                       string.Format("{0}/{1}", GameRootPath, directoryName));
     }
 }
        public static unsafe void FillRectangle(UnmanagedImage image, System.Drawing.Rectangle rectangle, Color color)
        {
            CheckPixelFormat(image.PixelFormat);
            int num    = Image.GetPixelFormatSize(image.PixelFormat) / 8;
            int width  = image.Width;
            int height = image.Height;
            int stride = image.Stride;
            int x      = rectangle.X;
            int y      = rectangle.Y;
            int num7   = (rectangle.X + rectangle.Width) - 1;
            int num8   = (rectangle.Y + rectangle.Height) - 1;

            if (((x < width) && (y < height)) && ((num7 >= 0) && (num8 >= 0)))
            {
                int   num9  = Math.Max(0, x);
                int   num10 = Math.Min(width - 1, num7);
                int   num11 = Math.Max(0, y);
                int   num12 = Math.Min(height - 1, num8);
                byte *dst   = (byte *)((image.ImageData.ToPointer() + (num11 * stride)) + (num9 * num));
                if (image.PixelFormat == PixelFormat.Format8bppIndexed)
                {
                    byte filler = (byte)(((0.2125 * color.R) + (0.7154 * color.G)) + (0.0721 * color.B));
                    int  count  = (num10 - num9) + 1;
                    for (int i = num11; i <= num12; i++)
                    {
                        SystemTools.SetUnmanagedMemory(dst, filler, count);
                        dst += stride;
                    }
                }
                else
                {
                    byte r     = color.R;
                    byte g     = color.G;
                    byte b     = color.B;
                    int  num19 = stride - (((num10 - num9) + 1) * num);
                    for (int j = num11; j <= num12; j++)
                    {
                        int num21 = num9;
                        while (num21 <= num10)
                        {
                            dst[2] = r;
                            dst[1] = g;
                            dst[0] = b;
                            num21++;
                            dst += num;
                        }
                        dst += num19;
                    }
                }
            }
        }
Exemplo n.º 16
0
        public async Task ItCanGetStatistics()
        {
            var mockCommandRunner = new Mock <ITpLinkCommandRunner>();

            mockCommandRunner
            .Setup(x => x.SendSecuredCommand(It.Is <string>(s => s.StartsWith("/userRpm/SystemStatisticRpm.htm"))))
            .ReturnsAsync(ReadTestAssetContent("SystemStatisticRpm.html"));

            var systemToolsCommands = new SystemTools(mockCommandRunner.Object);

            var result = await systemToolsCommands.GetStatisticsAsync();

            Assert.True(result.Any());
        }
Exemplo n.º 17
0
        public Form1()
        {
            Control.CheckForIllegalCrossThreadCalls = false;//关闭跨线程访问检测
            InitializeComponent();
            LogsHandle.LogsAddMessage("Welcome To ||| Computer Room Client |||");
            LogsHandle.LogsAddMessage("Welcome To ||| Computer Room Client |||");
            LogsHandle.LogsAddMessage("Welcome To ||| Computer Room Client |||");

            #region SetSystem

            SystemTools.StartSystemWorkFlow();

            #endregion
        }
        public static UnmanagedImage FromManagedImage(BitmapData imageData)
        {
            System.Drawing.Imaging.PixelFormat pixelFormat = imageData.PixelFormat;
            if (((((pixelFormat != System.Drawing.Imaging.PixelFormat.Format8bppIndexed) && (pixelFormat != System.Drawing.Imaging.PixelFormat.Format16bppGrayScale)) && ((pixelFormat != System.Drawing.Imaging.PixelFormat.Format24bppRgb) && (pixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppRgb))) && (((pixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppArgb) && (pixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppPArgb)) && ((pixelFormat != System.Drawing.Imaging.PixelFormat.Format48bppRgb) && (pixelFormat != System.Drawing.Imaging.PixelFormat.Format64bppArgb)))) && (pixelFormat != System.Drawing.Imaging.PixelFormat.Format64bppPArgb))
            {
                throw new UnsupportedImageFormatException("Unsupported pixel format of the source image.");
            }
            IntPtr         ptr   = Marshal.AllocHGlobal((int)(imageData.Stride * imageData.Height));
            UnmanagedImage image = new UnmanagedImage(ptr, imageData.Width, imageData.Height, imageData.Stride, pixelFormat);

            SystemTools.CopyUnmanagedMemory(ptr, imageData.Scan0, imageData.Stride * imageData.Height);
            image.mustBeDisposed = true;
            return(image);
        }
Exemplo n.º 19
0
 public IEnumerable <Version> GetAllVersions()
 {
     try
     {
         lock (_locatingVersion)
         {
             return(new DirectoryInfo(GameRootPath + (SystemTools.GetIsWindows() ? @"\versions" : @"/versions")).EnumerateDirectories()
                    .Select(dir => GetVersionInternal(dir.Name)).Where(item => item != null));
         }
     }
     catch
     {
         return(new Version[0]);
     }
 }
Exemplo n.º 20
0
        private string GetEnvironmentInfo()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("\r\n==========环境信息==========");
            builder.Append("\r\nCPU信息:" + SystemTools.GetProcessorInfo());
            builder.Append("\r\n内存信息: 总大小:" + SystemTools.GetTotalMemory().ToString() + "MB/可用大小:" + SystemTools.GetRunmemory().ToString() + "MB");
            builder.Append("\r\n显卡信息:" + SystemTools.GetVideoCardInfo());
            builder.Append("\r\n操作系统:" + Environment.OSVersion.Platform);
            builder.Append("\r\n版本号:" + Environment.OSVersion.VersionString);
            builder.Append("\r\n系统位数:" + SystemTools.GetSystemArch());
            builder.Append("\r\n程序运行命令行:" + Environment.CommandLine);
            builder.Append("\r\n程序工作目录:" + Environment.CurrentDirectory);
            return(builder.ToString());
        }
Exemplo n.º 21
0
        private void GenerateNativeTypesAndAst()
        {
            var files = options.SchemaInputDirs.SelectMany(dir =>
                                                           Directory.GetFiles(dir, "*.schema", SearchOption.AllDirectories));
            var inputPaths = options.SchemaInputDirs.Select(dir => $"--schema_path={dir}");

            SystemTools.EnsureDirectoryEmpty(options.JsonDirectory);

            var arguments = new[]
            {
                $@"--ast_json_out={options.JsonDirectory}"
            }.Union(inputPaths).Union(files).ToList();

            SystemTools.RunRedirected(options.SchemaCompilerPath, arguments);
        }
Exemplo n.º 22
0
        protected unsafe override void ProcessFilter(UnmanagedImage image)
        {
            int num    = System.Drawing.Image.GetPixelFormatSize(image.PixelFormat) / 8;
            int width  = image.Width;
            int height = image.Height;
            int num2   = System.Math.Max(0, region.X);
            int num3   = System.Math.Max(0, region.Y);

            if (num2 >= width || num3 >= height)
            {
                return;
            }
            int num4 = System.Math.Min(width, region.Right);
            int num5 = System.Math.Min(height, region.Bottom);

            if (num4 <= num2 || num5 <= num3)
            {
                return;
            }
            int   stride = image.Stride;
            byte *ptr    = (byte *)image.ImageData.ToPointer() + (long)num3 * (long)stride + (long)num2 * (long)num;

            if (image.PixelFormat == PixelFormat.Format8bppIndexed)
            {
                int count = num4 - num2;
                for (int i = num3; i < num5; i++)
                {
                    SystemTools.SetUnmanagedMemory(ptr, fillGray, count);
                    ptr += stride;
                }
                return;
            }
            int num6 = stride - (num4 - num2) * num;

            for (int j = num3; j < num5; j++)
            {
                int num7 = num2;
                while (num7 < num4)
                {
                    ptr[2] = fillRed;
                    ptr[1] = fillGreen;
                    *ptr = fillBlue;
                    num7++;
                    ptr += num;
                }
                ptr += num6;
            }
        }
Exemplo n.º 23
0
        private string BuildSplittedArchive(ArchiveTemplate template, int fileIndex, ref int sourcePageIndex)
        {
            // Create the subBuffer
            string subBufferPath = Path.Combine(template.PathToBuffer, $"{template.ComicName}_{(fileIndex + 1).ToString().PadLeft(template.IndexSize, '0')}");

            _logger.Log($"Create the subFolder {subBufferPath}");
            int             pagesAdded = 0;
            List <FileInfo> pagesToAdd = new List <FileInfo>();

            for (int currentPageIndex = sourcePageIndex; (pagesAdded < template.PagesPerFile) && (currentPageIndex < template.Pages.Count); ++currentPageIndex)
            {
                if (template.Pages[currentPageIndex].Extension != ".xml")
                {
                    pagesToAdd.Add(template.Pages[currentPageIndex]);
                    ++pagesAdded;
                }
                sourcePageIndex = currentPageIndex + 1;
            }
            if (fileIndex == template.NumberOfSplittedFiles - 1)
            {
                for (int i = sourcePageIndex; i < template.Pages.Count; ++i)
                {
                    if (template.Pages[i].Extension != ".xml")
                    {
                        pagesToAdd.Add(template.Pages[i]);
                    }
                }
            }
            bool ok = MovePicturesToSubBuffer(subBufferPath, pagesToAdd, template.ComicName, fileIndex == 0, template.ImageCompression);

            if (!ok)
            {
                SystemTools.CleanDirectory(subBufferPath, _logger);
                return("");
            }
            if (!string.IsNullOrWhiteSpace(template.CoverPath))
            {
                if (fileIndex != 0)
                {
                    CopyCoverToSubBuffer(template.CoverPath, subBufferPath, fileIndex + 1, (int)template.NumberOfSplittedFiles);
                }
            }
            if (Settings.Instance.IncludeMetadata)
            {
                CopyMetaDataToSubBuffer(template.MetadataFiles, subBufferPath);
            }
            return(subBufferPath);
        }
        /// <summary>
        /// Handles the behaviour settings.
        /// </summary>
        public static void Print(ICECreatureControl _control)
        {
            if (!_control.Display.ShowBehaviour)
            {
                return;
            }

            ICEEditorStyle.SplitterByIndent(0);

            ICEEditorLayout.BeginHorizontal();
            _control.Display.FoldoutBehaviours = ICEEditorLayout.Foldout(_control.Display.FoldoutBehaviours, "Behaviours");
            if (ICEEditorLayout.SaveButton("Saves behaviours to file"))
            {
                CreatureEditorIO.SaveBehaviourToFile(_control.Creature.Behaviour, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton("Loads behavious form file"))
            {
                _control.Creature.Behaviour = CreatureEditorIO.LoadBehaviourFromFile(_control.Creature.Behaviour);
            }
            if (ICEEditorLayout.ResetButton("Removes all behaviours"))
            {
                _control.Creature.Behaviour.Reset();
            }
            ICEEditorLayout.ListFoldoutButtons(_control.Creature.Behaviour.BehaviourModes);
            ICEEditorLayout.EndHorizontal(Info.BEHAVIOUR);

            if (_control.Display.FoldoutBehaviours == false)
            {
                return;
            }

            EditorGUI.indentLevel++;
            for (int i = 0; i < _control.Creature.Behaviour.BehaviourModes.Count; i++)
            {
                if (DrawBehaviourMode(_control, _control.Creature.Behaviour.BehaviourModes[i]))
                {
                    return;
                }
            }
            EditorGUI.indentLevel--;

            m_BehaviourKey = (!SystemTools.IsValid(m_BehaviourKey) ? "NEW" : m_BehaviourKey);
            if (ICEEditorLayout.DrawListAddLine("Add behaviour mode by key", ref m_BehaviourKey))
            {
                _control.Creature.Behaviour.AddBehaviourModeNumbered(m_BehaviourKey);
                m_BehaviourKey = "";
            }
        }
Exemplo n.º 25
0
        private async void mainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            #region 无JAVA提示
            if (App.handler.Java == null)
            {
                var result = await this.ShowMessageAsync(App.GetResourceString("String.Message.NoJava"),
                                                         App.GetResourceString("String.Message.NoJava2"),
                                                         MessageDialogStyle.AffirmativeAndNegative,
                                                         new MetroDialogSettings()
                {
                    AffirmativeButtonText = App.GetResourceString("String.Base.Yes"),
                    NegativeButtonText    = App.GetResourceString("String.Base.Cancel"),
                    DefaultButtonFocus    = MessageDialogResult.Affirmative
                });

                if (result == MessageDialogResult.Affirmative)
                {
                    var arch = SystemTools.GetSystemArch();
                    switch (arch)
                    {
                    case ArchEnum.x32:
                        App.downloader.SetDownloadTasks(new DownloadTask("32位JAVA安装包", @"https://bmclapi.bangbang93.com/java/jre_x86.exe", "jre_x86.exe"));
                        App.downloader.StartDownload();
                        await new DownloadWindow().ShowWhenDownloading();
                        System.Diagnostics.Process.Start("Explorer.exe", "jre_x86.exe");
                        break;

                    case ArchEnum.x64:
                        App.downloader.SetDownloadTasks(new DownloadTask("64位JAVA安装包", @"https://bmclapi.bangbang93.com/java/jre_x64.exe", "jre_x64.exe"));
                        App.downloader.StartDownload();
                        await new DownloadWindow().ShowWhenDownloading();
                        System.Diagnostics.Process.Start("Explorer.exe", "jre_x64.exe");
                        break;

                    default:
                        break;
                    }
                }
            }
            #endregion

            #region 检查更新
            if (App.config.MainConfig.Launcher.CheckUpdate)
            {
                await CheckUpdate();
            }
            #endregion
        }
Exemplo n.º 26
0
        public void Check()
        {
            var x = _plantInfos.Any(pi => pi.Check());

            if (x)
            {
                Logger.Error("empty naturecube " + _zone.Id + " " + _area + " " + SystemTools.GetCallStack());
            }

            var checkSpawnAmount = _plantInfos.Count(plantInfo => plantInfo.spawn > 0) >= 10;

            if (!checkSpawnAmount)
            {
                Logger.Error("no spawn was found.  " + _zone.Id + " " + _area);
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Compares the specified name with the name of reference object.
        /// </summary>
        /// <returns><c>true</c>, if the compared names are identic, <c>false</c> otherwise.</returns>
        /// <param name="_name">Name.</param>
        public bool CompareByName(string _name)
        {
            if (string.IsNullOrEmpty(_name) || ReferenceGameObject == null)
            {
                return(false);
            }

            if (ReferenceGameObject.name == SystemTools.CleanName(_name))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 28
0
        private static Bitmap CloneImage(BitmapData sourceData)
        {
            int width  = sourceData.Width;
            int height = sourceData.Height;

            Bitmap destination = new Bitmap(width, height, sourceData.PixelFormat);

            BitmapData destinationData = destination.LockBits(
                new Rectangle(0, 0, width, height),
                ImageLockMode.ReadWrite, destination.PixelFormat);

            SystemTools.CopyUnmanagedMemory(destinationData.Scan0, sourceData.Scan0, height * sourceData.Stride);

            destination.UnlockBits(destinationData);

            return(destination);
        }
Exemplo n.º 29
0
        public static UnmanagedImage FromManagedImage(BitmapData imageData)
        {
            PixelFormat pixelFormat = imageData.PixelFormat;

            if (pixelFormat != PixelFormat.Format8bppIndexed && pixelFormat != PixelFormat.Format16bppGrayScale && pixelFormat != PixelFormat.Format24bppRgb && pixelFormat != PixelFormat.Format32bppRgb && pixelFormat != PixelFormat.Format32bppArgb && pixelFormat != PixelFormat.Format32bppPArgb && pixelFormat != PixelFormat.Format48bppRgb && pixelFormat != PixelFormat.Format64bppArgb && pixelFormat != PixelFormat.Format64bppPArgb)
            {
                throw new UnsupportedImageFormatException("Unsupported pixel format of the source image.");
            }
            IntPtr dst = Marshal.AllocHGlobal(imageData.Stride * imageData.Height);

            GC.AddMemoryPressure(imageData.Stride * imageData.Height);
            UnmanagedImage unmanagedImage = new UnmanagedImage(dst, imageData.Width, imageData.Height, imageData.Stride, pixelFormat);

            SystemTools.CopyUnmanagedMemory(dst, imageData.Scan0, imageData.Stride * imageData.Height);
            unmanagedImage.mustBeDisposed = true;
            return(unmanagedImage);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Compares the specified _object with the reference object.
        /// </summary>
        /// <param name="_object">Object.</param>
        public bool Compare(GameObject _object)
        {
            if (_object == null || ReferenceGameObject == null)
            {
                return(false);
            }

            //( GroupByTag && ! string.IsNullOrEmpty( _object.tag ) && ReferenceGameObject.CompareTag( _object.tag ) ) ||
            if (SystemTools.CleanName(ReferenceGameObject.name) == SystemTools.CleanName(_object.name))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }