コード例 #1
0
        public void StoreCustomData(PcFile pcfile, LibraryPackageInfo pinfo)
        {
            TargetFramework commonFramework        = null;
            bool            inconsistentFrameworks = false;

            foreach (PackageAssemblyInfo pi in pinfo.Assemblies)
            {
                TargetFrameworkMoniker targetFramework = Runtime.SystemAssemblyService.GetTargetFrameworkForAssembly(Runtime.SystemAssemblyService.CurrentRuntime, pi.File);
                if (commonFramework == null)
                {
                    commonFramework = Runtime.SystemAssemblyService.GetTargetFramework(targetFramework);
                    if (commonFramework == null)
                    {
                        inconsistentFrameworks = true;
                    }
                }
                else if (targetFramework != null)
                {
                    TargetFramework newfx = Runtime.SystemAssemblyService.GetTargetFramework(targetFramework);
                    if (newfx == null)
                    {
                        inconsistentFrameworks = true;
                    }
                    else
                    {
                        if (newfx.CanReferenceAssembliesTargetingFramework(commonFramework))
                        {
                            commonFramework = newfx;
                        }
                        else if (!commonFramework.CanReferenceAssembliesTargetingFramework(newfx))
                        {
                            inconsistentFrameworks = true;
                        }
                    }
                }
                if (inconsistentFrameworks)
                {
                    break;
                }
            }
            if (inconsistentFrameworks)
            {
                LoggingService.LogError("Inconsistent target frameworks found in " + pcfile);
            }
            if (commonFramework != null)
            {
                pinfo.SetData("targetFramework", commonFramework.Id.ToString());
            }
            else
            {
                pinfo.SetData("targetFramework", "FxUnknown");
            }
        }
コード例 #2
0
ファイル: FileUtil.cs プロジェクト: AddBean/WIN32-Airjoy
        /**
         * @param dir表示需要指定的盘符
         *
         */
        public static String getDirInTray(String path)
        {
            DirectoryInfo TheFolder = new DirectoryInfo(path);

            List <PcFile> list = new List <PcFile>();

            // 获取指定盘符下的所有文件夹列表。
            DirectoryInfo[] dir = TheFolder.GetDirectories();
            // 如果该目录下面为空,则该目录的此方法执行
            if (dir == null)
            {
                return("");
            }// 通过循环将所遍历所有文件夹
            for (int i = 0; i < dir.Length; i++)
            {
                PcFile pcFile = new PcFile();
                pcFile.directory  = true;  //标示为路径;
                pcFile.file       = false; //不是文件;
                pcFile.fileName   = dir[i].Name;
                pcFile.filePath   = dir[i].FullName;
                pcFile.freeSpace  = "0";
                pcFile.length     = 0;
                pcFile.parentPath = dir[i].Parent.FullName;
                pcFile.parent     = dir[i].Parent.Name;
                pcFile.totalSpace = "0";
                list.Add(pcFile);
            }

            // 获取指定盘符下的所有文件列表。
            FileInfo[] files = TheFolder.GetFiles();
            // 如果该目录下面为空,则该目录的此方法执行
            if (files == null)
            {
                return("");
            }// 通过循环将所遍历所有文件
            for (int i = 0; i < files.Length; i++)
            {
                PcFile pcFile = new PcFile();
                pcFile.directory  = false; //标示为路径;
                pcFile.file       = true;  //不是文件;
                pcFile.fileName   = files[i].Name;
                pcFile.filePath   = files[i].FullName;
                pcFile.freeSpace  = "0";
                pcFile.length     = files[i].Length;
                pcFile.parentPath = files[i].Directory.FullName;
                pcFile.parent     = files[i].Directory.Name;
                pcFile.totalSpace = "0";
                list.Add(pcFile);
            }
            return(jsonToString(list));
        }
コード例 #3
0
ファイル: FileUtil.cs プロジェクト: AddBean/WIN32-Airjoy
        /// <summary>
        /// 获取桌面
        /// </summary>
        /// <returns></returns>
        public static PcFile getDesk()
        {
            string dir    = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            PcFile pcFile = new PcFile();

            pcFile.directory  = false; //标示为路径;
            pcFile.file       = false; //不是文件;
            pcFile.fileName   = "桌面";
            pcFile.filePath   = dir;
            pcFile.freeSpace  = " ";
            pcFile.length     = 0;
            pcFile.parentPath = "null";
            pcFile.parent     = "null";
            pcFile.totalSpace = " ";
            return(pcFile);
        }
コード例 #4
0
        protected override void ParsePackageInfo(PcFile file, PackageInfo pinfo)
        {
            string rootPath     = file.GetVariable("MonoAddinsRoot");
            string regPath      = file.GetVariable("MonoAddinsRegistry");
            string addinsPath   = file.GetVariable("MonoAddinsInstallPath");
            string databasePath = file.GetVariable("MonoAddinsCachePath");
            string testCmd      = file.GetVariable("MonoAddinsTestCommand");

            if (string.IsNullOrEmpty(rootPath) || string.IsNullOrEmpty(regPath))
            {
                return;
            }
            pinfo.SetData("MonoAddinsRoot", rootPath);
            pinfo.SetData("MonoAddinsRegistry", regPath);
            pinfo.SetData("MonoAddinsInstallPath", addinsPath);
            pinfo.SetData("MonoAddinsCachePath", databasePath);
            pinfo.SetData("MonoAddinsTestCommand", testCmd);
        }
コード例 #5
0
ファイル: FileUtil.cs プロジェクト: AddBean/WIN32-Airjoy
        /**
         * 获取硬盘的盘符
         *
         * @return
         */
        public static String getDriver()
        {
            List <PcFile> disks = new List <PcFile>();

            DriveInfo[] dr = DriveInfo.GetDrives();
            disks.Add(getDesk());
            disks.Add(getMyDocuments());
            foreach (DriveInfo dd in dr)
            {
                if (dd.DriveType == DriveType.CDRom)  //过滤掉是光驱的 磁盘
                {
                }
                else
                {
                    try{
                        PcFile pcFile = new PcFile();
                        pcFile.directory  = false; //标示为路径;
                        pcFile.file       = false; //不是文件;
                        pcFile.fileName   = dd.VolumeLabel;
                        pcFile.filePath   = dd.Name;
                        pcFile.freeSpace  = FormetFileSize(dd.TotalFreeSpace);
                        pcFile.length     = 0;
                        pcFile.parentPath = "null";
                        pcFile.parent     = "null";
                        pcFile.totalSpace = FormetFileSize(dd.TotalSize);
                        disks.Add(pcFile);
                    }
                    catch (Exception error)
                    {
                        Log.WriteLogInf("EVENT-ERROR-Diskinf", "读取磁盘失败:" + error.Message); //log记录;
                    }
                }
            }

            string s = jsonToString(disks);

            getDirInTray("C:\\");
            return(jsonToString(disks));
        }
コード例 #6
0
 // In the implementation of this method, the host application can extract
 // information from the pc file and store it in the PackageInfo object
 public void StoreCustomData(PcFile pcfile, LibraryPackageInfo pkg)
 {
 }
コード例 #7
0
ファイル: SetupService.cs プロジェクト: NALSS/Telegraph
 protected override void ParsePackageInfo(PcFile file, PackageInfo pinfo)
 {
     string rootPath = file.GetVariable ("MonoAddinsRoot");
     string regPath = file.GetVariable ("MonoAddinsRegistry");
     string testCmd = file.GetVariable ("MonoAddinsTestCommand");
     if (string.IsNullOrEmpty (rootPath) || string.IsNullOrEmpty (regPath))
         return;
     pinfo.SetData ("MonoAddinsRoot", rootPath);
     pinfo.SetData ("MonoAddinsRegistry", regPath);
     pinfo.SetData ("MonoAddinsTestCommand", testCmd);
 }
コード例 #8
0
ファイル: PcFileCacheTest.cs プロジェクト: nlhepler/mono
			public void StoreCustomData (PcFile pcfile, PackageInfo pkg)
			{
			}