Beispiel #1
0
        static void Main(string[] args)
        {
            var reg_prt = new System.Text.RegularExpressions.Regex(@"(.+)\.prt(?:.\d+)?$");
            var reg_asm = new System.Text.RegularExpressions.Regex(@"(.+)\.asm(?:.\d+)?$");

            Console.WriteLine(GetFileWithoutExt("GB5781"));
            Console.WriteLine(GetFileWithoutExt("GB5781.prt"));
            Console.WriteLine(GetFileWithoutExt("GB5781.prt.23"));
            Console.WriteLine(GetFileWithoutExt("M12X30_GB5781.asm"));
            Console.WriteLine(GetFileWithoutExt("M12X30_GB5781.asm.677"));

            Console.WriteLine(Path.GetFileNameWithoutExtension("GB5781"));
            Console.WriteLine(Path.GetFileNameWithoutExtension("GB5781.prt.1"));
            Console.WriteLine(Path.GetFileNameWithoutExtension("M12X30_GB5781.asm.1"));
            Console.Read();
            return;

            //var t = getTime();
            if (DateTime.Now >= new DateTime(2014, 8, 1))
            {
                Console.WriteLine("dayu");
            }

            //AssociateFieldConllection collent = new AssociateFieldConllection();
            //collent.Add(new Associatefield("MaterialCode", "MODEL_NAME", true, 0, 0, false, "物料编码", true));
            //collent.Add(new Associatefield("MaterialSpec", "SPEC", false, 0, 0, false, "物料规格", false));
            //collent.Add(new Associatefield("MaterialSubstance", "MATERIAL", false, 0, 0, false, "物料材质", false));
            //collent.Add(new Associatefield("MaterialName", "DESCRIPTION", false, 0, 0, false, "物料名称", false));
            //collent.Add(new Associatefield("MaterialDrawNumber", "DRAWNO", false, 0, 0, false, "图号", false));

            //CreoOperate op = new CreoOperate();

            //op.AppTypeName = "PROE";
            //op.IntegType = Proway.PLM.Document.IntegrationType.PROE;
            //op.CategoryId = "affba405-d687-488b-8bb7-05e9a8a986ed";
            //op.WorkId = "";
            //op.CurOperatePosition =  Proway.PLM.Document.OperatePosition.CheckIn;
            //op.FolderId = "60C4C5B7-0107-4F41-9147-F8904FAC6728";
            //op.FileTypeId = "4be5f1a4-db00-4aa4-88cf-a8a5c48a88bf";
            //op.UserId = "FFB0AC2D-C1B5-49E2-89B2-F4058523DF18";
            //op.IsCreateCopy = false;
            //op.IsOperateBOM = true;
            //op.IndexFields = collent;

            ////op.CheckDoc(BOMJSON);

            //Dictionary<string,object> dic = new Dictionary<string,object>();

            //BOMHelp.Write(dic, _.MultiConfiguration, true);

            //var aa = dic.GetValue(_.MultiConfiguration, false);

            //Console.WriteLine(aa);


            //Console.WriteLine(OSHelp.IsVistaAndSubsequentVersion);
            //Console.WriteLine(OSHelp.IsWin7);

            //AccessControl.FileInfoAccessControl(@"c:\111.txt");
            //AccessControl.DirectoryInfoAccessControl(@"c:\111");

            //var regk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Wow6432Node\\PTC");
            //Console.WriteLine(regk == null);

            //CreoClient creo = new CreoClient();
            //var aa = creo.GetBom();

            //测试版本
            //Console.WriteLine(OSHelp.GetExcutePlatform(@"D:\github\learn\Creo\CreoTest\Creo.Setup\pubilc\PLM64.dll").ToString());
            //Console.WriteLine(OSHelp.GetExcutePlatform(@"D:\github\learn\Creo\CreoTest\Creo.Setup\pubilc\PLM.dll").ToString());

            //Console.WriteLine(OSHelp.GetExcutePlatform(@"C:\Program Files\Kingdee\K3PLM\Integration\Proe\PLM.dll").ToString());

            foreach (var item in FileAndDirectoryManager.SearchFile(@"D:\MyWork\PTC\Creo 2.0\Common Files\M060\",
                                                                    new string[] { "i486_nt\\obj", "x86e_win64\\obj" }, "xtop.exe"))
            {
                Console.WriteLine(item);
            }

            if (UACHelp.IsRunAsAdmin())
            {
                Console.WriteLine("管理员启动");
            }
            else
            {
                Console.WriteLine("非管理员启动");
            }

            //CreoSetup setup = new CreoSetup();
            //setup.SourceDefaultDir = @"D:\Program Files\kingdee\K3PLM\Integration\Integration Setup\Resources";
            //setup.UserDefaultDir = @"C:\Program Files\Kingdee\K3PLM\Integration";

            //setup.CopyMenuFile();

            //ProcessStartInfo proc = new ProcessStartInfo();
            //proc.UseShellExecute = true;
            //proc.WorkingDirectory = Environment.CurrentDirectory;
            //proc.FileName = Application.ExecutablePath;
            //proc.Verb = "runas"; //使用管理员启动

            //string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ptc\\output.txt";
            //DocumentProperty docprop1 = DocumentProperty.LoadXml(path, Encoding.Default);
            //Console.WriteLine(docprop1.Count);

            //CreoClient cc = new CreoClient();
            //Console.WriteLine(cc.GetCurrentFileName());
            //Console.WriteLine(cc.GetCurrentFilePath());
            //Console.WriteLine(cc.GetCurrentFullPath());

            //var bom = cc.GetBom();

            //var aa = bom.Count;

            Console.Read();

            return;

#if false
            DocumentProperty docprop = new DocumentProperty();

            int index = 1;

            var partprop = getPartData("00" + index, index, "asm");
            docprop.Add(partprop);

            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "3" }, { "count", "1" }
            });
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "5" }, { "count", "2" }
            });
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "6" }, { "count", "1" }
            });
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "7" }, { "count", "1" }
            });

            partprop.ObjectRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "2" }
            });

            index++;
            partprop = getPartData("00" + index, index, "drw");//2
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//3
            partprop.ObjectRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "4" }
            });
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "drw");//4
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//5
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//6
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "asm");//7
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "8" }, { "count", "1" }
            });
            partprop.ChildRelation.Add(new Dictionary <string, string>()
            {
                { "fileid", "9" }, { "count", "10" }
            });
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//8
            docprop.Add(partprop);

            index++;
            partprop = getPartData("00" + index, index, "prt");//9
            docprop.Add(partprop);

            docprop.SaveXml(@"c:\123.txt");
#endif
        }