コード例 #1
0
        public void start(string startupPath, string args = "", SynapseModuleMode Mode = SynapseModuleMode.Production)
        {
            string targetDir = Mode == SynapseModuleMode.Production ? startupPath + "\\Prod\\" + TECHNICALNAME : startupPath + "\\Dev\\" + TECHNICALNAME;

            //to be removed when DB is updated
            PATH = PATH.Substring(PATH.LastIndexOf("\\"));
            string file = null;

            if (File.Exists(PATH))
            {
                file = PATH;
            }
            if (File.Exists(targetDir + "\\" + PATH))
            {
                file = targetDir + "\\" + PATH;
            }
            else
            {
                SynapseCore.Controls.SynapseForm.SynapseLogger.Debug("Not exist " + startupPath + "\\" + PATH);
            }
            if (file != null)
            {
                SynapseCore.Controls.SynapseForm.SynapseLogger.Debug("starting " + file);
                System.Diagnostics.Process proc = new System.Diagnostics.Process();
                proc.EnableRaisingEvents        = false;
                proc.StartInfo.WindowStyle      = System.Diagnostics.ProcessWindowStyle.Normal;
                proc.StartInfo.FileName         = file;
                proc.StartInfo.WorkingDirectory = Path.GetFullPath(file);
                //proc.StartInfo.Arguments = filename;
                proc.StartInfo.Arguments = args;
                proc.Start();
                //proc.WaitForExit();
            }
        }
コード例 #2
0
ファイル: NKMD.cs プロジェクト: clienthax/EveryFileExplorer
        public NKMD(byte[] Data)
        {
            EndianBinaryReader er = new EndianBinaryReader(new MemoryStream(Data), Endianness.LittleEndian);

            try
            {
                Header = new NKMDHeader(er);
                foreach (var v in Header.SectionOffsets)
                {
                    er.BaseStream.Position = Header.HeaderSize + v;
                    String sig = er.ReadString(Encoding.ASCII, 4);
                    er.BaseStream.Position -= 4;
                    switch (sig)
                    {
                    case "OBJI": ObjectInformation = new OBJI(er); break;

                    case "PATH": Path = new PATH(er); break;

                    case "POIT": Point = new POIT(er); break;

                    case "STAG": Stage = new STAG(er); break;

                    case "KTPS": KartPointStart = new KTPS(er); break;

                    case "KTPJ": KartPointJugem = new KTPJ(er, Header.Version); break;

                    case "KTP2": KartPointSecond = new KTP2(er); break;

                    case "KTPC": KartPointCannon = new KTPC(er); break;

                    case "KTPM": KartPointMission = new KTPM(er); break;

                    default:
                        //throw new Exception("Unknown Section: " + sig);
                        continue;
                        //goto cont;
                    }
                }
cont:
                if (KartPointCannon == null)
                {
                    KartPointCannon = new KTPC();
                }
                if (KartPointMission == null)
                {
                    KartPointMission = new KTPM();
                }
            }
            catch (SignatureNotCorrectException e)
            {
                MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                er.Close();
            }
        }
コード例 #3
0
 public void MakePATH()
 {
     foreach (string pair in pathAll)
     {
         string[] tab = pair.Split(' ');
         PATH.Add(tab[0]);
         PATH.Add(tab[1]);
     }
 }
コード例 #4
0
ファイル: SHELL32.cs プロジェクト: CaveSystems/cave-windows
        /// <summary>
        /// Retrieves the path of a special folder
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string GetSpecialFolderPath(PATH path)
        {
            var result = new StringBuilder(260);

            if (SHGetSpecialFolderPath(IntPtr.Zero, result, (int)path, false))
            {
                return(result.ToString());
            }
            return(null);
        }
コード例 #5
0
        //se a pasta não existir, ela é criada :
        public Agenda()
        {
            string pasta = PATH.Split('/') [0];

            if (!Directory.Exists(pasta))
            {
                Directory.CreateDirectory(pasta);
            }
            //PATH - arquivo, caso ele tambem não exista, ele é criado da mesma forma q a pasta, com o !
            if (!File.Exists(PATH))
            {
                File.Create(PATH).Close();
            }
        }
コード例 #6
0
ファイル: MapAStar.cs プロジェクト: fchsg/UnityBattleTank
    public PATH Calc(int x0, int z0, int x1, int z1)
    {
        PATH path = new PATH();

        path.start = new COORD(x0, z0);
        path.end   = new COORD(x1, z1);

        if (x0 == x1 && z0 == z1)
        {
            path.success = true;
            return(path);
        }

        ++_currentTicket;

        _candidates.Clear();
        CollectCandidates(x0, z0, x1, z1, null);

        while (_candidates.Count > 0)
        {
            NODE n = _candidates[0];
            _candidates.RemoveAt(0);

            int dist = Mathf.Abs(n.x - x1) + Mathf.Abs(n.z - z1);
            if (dist <= 1)
            {
                while (n != null)
                {
                    path.nodes.Insert(0, n);
                    n = n.previousNode;
                }

                path.success = true;
                return(path);
            }
            else
            {
                CollectCandidates(n.x, n.z, x1, z1, n);
            }
        }

        path.success = false;
        return(path);
    }
コード例 #7
0
ファイル: SynapseModule.cs プロジェクト: WFR79/EngieEducation
        public string getModuleExecutablePath(string startupPath, SynapseModuleMode Mode = SynapseModuleMode.Production)
        {
            string targetDir = Mode == SynapseModuleMode.Production ? startupPath + "\\Prod\\" + TECHNICALNAME : startupPath + "\\Dev\\" + TECHNICALNAME;

            //to be removed when DB is updated
            PATH = PATH.Substring(PATH.LastIndexOf("\\"));
            string file = null;

            if (File.Exists(PATH))
            {
                file = PATH;
            }
            if (File.Exists(targetDir + "\\" + PATH))
            {
                file = targetDir + "\\" + PATH;
            }
            else
            {
                SynapseCore.Controls.SynapseForm.SynapseLogger.Debug("Not exist " + targetDir + "\\" + PATH);
            }

            return(file);
        }
コード例 #8
0
 public MKDSRouteViewer(PATH Routes, POIT Points)
 {
     this.Routes = Routes;
     this.Points = Points;
     InitializeComponent();
 }
コード例 #9
0
 public bool isPathSeted()
 {
     return(!PATH.Equals(""));
 }
コード例 #10
0
 public MKDSRouteLineRenderGroup(PATH Paths, POIT Points, Color LineColor)
 {
     this.Paths     = Paths;
     this.Points    = Points;
     this.LineColor = LineColor;
 }
コード例 #11
0
ファイル: SysN.cs プロジェクト: bclnet/DroidNet
 public static bool GetPath(PATH type, out string path) => throw new NotImplementedException();
コード例 #12
0
 public MKDSRouteViewer(PATH Routes, POIT Points)
 {
     this.Routes = Routes;
     this.Points = Points;
     InitializeComponent();
 }
コード例 #13
0
 public MKDSRouteLineRenderGroup(PATH Paths, POIT Points, Color LineColor)
 {
     this.Paths = Paths;
     this.Points = Points;
     this.LineColor = LineColor;
 }
コード例 #14
0
        private PATH SortPolyLine(PATH pth)
        {
            int    index = 0;
            int    count = 0;
            double mid_x = 0.0;
            double mid_y = 0.0;
            PATH   ret   = new PATH();

            ret.CopyFrom(pth);
            List <Point> ls_src  = new List <Point>();
            List <Point> ls_th   = new List <Point>();
            List <Point> ls_cent = new List <Point>();
            List <int>   ls_tp   = new List <int>();

            foreach (Point tmp in ret.throughPoints)
            {
                ls_src.Add(new Point(tmp.X, tmp.Y));
                count++;
            }
            //闭合多线段去除重合终点
            if ((ls_src[count - 1].X == ls_src[0].X) && (ls_src[count - 1].Y == ls_src[0].Y))
            {
                ls_src.RemoveAt(count - 1);
                ret.centerPoints.RemoveAt(count - 1);
                ret.types.RemoveAt(count - 1);
                //找到直线的位置
                List <int> idx = new List <int>();
                List <int> idy = new List <int>();
                for (int i = 0; i < ls_src.Count - 2; i++)
                {
                    if (ret.types[i] == 0)
                    {
                        if (Math.Round(ls_src[i].Y, 4) == Math.Round(ls_src[i + 1].Y, 4))
                        {
                            idy.Add(i);
                        }
                        if (Math.Round(ls_src[i].X, 4) == Math.Round(ls_src[i + 1].X, 4))
                        {
                            idx.Add(i);
                        }
                    }
                }
                //找到最大直线的位置
                double maxLen = 0.0;
                foreach (int id in idx)
                {
                    double tmplen = Math.Abs(ls_src[id].X - ls_src[id + 1].X);
                    if (tmplen > maxLen)
                    {
                        maxLen = tmplen;
                        index  = id;
                    }
                }
                foreach (int id in idy)
                {
                    double tmplen = Math.Abs(ls_src[id].Y - ls_src[id + 1].Y);
                    if (tmplen > maxLen)
                    {
                        maxLen = tmplen;
                        index  = id;
                    }
                }
                //在直线中插入两个分割点
                mid_x = (ls_src[index].X + ls_src[index + 1].X) / 2;
                mid_y = (ls_src[index].Y + ls_src[index + 1].Y) / 2;
                ls_th.Add(new Point(mid_x, mid_y));
                ls_cent.Add(new Point(0.0, 0.0));
                ls_tp.Add(0);
                for (int i = index + 1; i < ls_src.Count; i++)
                {
                    ls_th.Add(new Point(ls_src[i].X, ls_src[i].Y));
                    ls_cent.Add(ret.centerPoints[i]);
                    ls_tp.Add(ret.types[i]);
                }
                for (int i = 0; i <= index; i++)
                {
                    ls_th.Add(new Point(ls_src[i].X, ls_src[i].Y));
                    ls_cent.Add(ret.centerPoints[i]);
                    ls_tp.Add(ret.types[i]);
                }
                ls_th.Add(new Point(mid_x, mid_y));
                ls_cent.Add(new Point(0.0, 0.0));
                ls_tp.Add(0);
            }
            else
            {
                for (int i = 0; i < ls_src.Count; i++)
                {
                    ls_th.Add(new Point(ls_src[i].X, ls_src[i].Y));
                    ls_cent.Add(ret.centerPoints[i]);
                    ls_tp.Add(ret.types[i]);
                }
            }
            //折线多点排序分割完成
            ret.throughPoints.Clear();
            ret.centerPoints.Clear();
            ret.types.Clear();
            foreach (Point tmp in ls_th)
            {
                ret.throughPoints.Add(tmp);
            }
            foreach (var tmp in ls_cent)
            {
                ret.centerPoints.Add(tmp);
            }
            foreach (var tmp in ls_tp)
            {
                ret.types.Add(tmp);
            }
            return(ret);
        }