コード例 #1
0
        private void AddItemToWatch(SourceFileItem sourceFileItem)
        {
            // string sourceFile = @"F:\Projekte\coop\XGame\_devFolder\Work\Shapes\Stairway.fbx";
            // string destinationFolder = @"F:\Projekte\coop\XGame\data\assets";

            //var test_sourceFileItem = new SourceFileItem()
            //{
            //    SourceFilePath = sourceFile,
            //    DestinationFolder = destinationFolder,
            //    DestinationFileName = sestinationFileName,// "Stairway.MESH",
            //    FileType = FileType.fbx,
            //    Watch = true
            //};

            //   _FileItems.Add(test_sourceFileItem);

            FileItemWatcher watcher = new FileItemWatcher()
            {
                SourceFileItem = sourceFileItem
            };

            if (string.IsNullOrEmpty(sourceFileItem.SourceFilePath))
            {
                MessageBox.Show("Cannot watch this file:" + sourceFileItem.SourceFilePath);
                return;
            }

            watcher.Path   = Path.GetDirectoryName(sourceFileItem.SourceFilePath);
            watcher.Filter = Path.GetFileName(sourceFileItem.SourceFilePath);

            /* Watch for changes in LastAccess and LastWrite times, and
             * the renaming of files or directories. */
            watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
                                   | NotifyFilters.FileName | NotifyFilters.DirectoryName;
            // Only watch text files.
            //  watcher.Filter = "*.txt";

            // Add event handlers.
            watcher.Changed += new FileSystemEventHandler(OnChanged);
            watcher.Created += new FileSystemEventHandler(OnCreated);
            watcher.Deleted += new FileSystemEventHandler(OnDeleted);
            watcher.Renamed += new RenamedEventHandler(OnRenamed);

            // Begin watching.
            watcher.EnableRaisingEvents = true;
        }
コード例 #2
0
        public static void Execute(SourceFileItem sourceFileItem)
        {
            if (sourceFileItem.FileType == FileType.fbx)
            {
                FBXFileConverter test = new FBXFileConverter();
                test.Convert(sourceFileItem.SourceFilePath, sourceFileItem.DestinationFolder, sourceFileItem.DestinationFileName);
            }
            else if (sourceFileItem.FileType == FileType.fbx_Animation)
            {
                //     FBXFileConverter test = new FBXFileConverter();
                //     test.Convert(fileItemWatcher.SourceFilePath, fileItemWatcher.DestinationFolder, fileItemWatcher.DestinationFileName);
                //FBXFileConverter test = new FBXFileConverter();
                //test.Convert(sourceFileItem.SourceFilePath, sourceFileItem.DestinationFolder, sourceFileItem.DestinationFileName);
                //string fbxfilename = @"F:\Projekte\coop\XGame\_devFolder\Work\Character\[email protected]";
                //string skeletonfilename = @"F:\Projekte\coop\XGame\data\assets\TestModel.SKELETON";
                //string meshfilename = @"F:\Projekte\coop\XGame\data\assets\TestModel.MESH";

                string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(sourceFileItem.DestinationFileName);

                if (!sourceFileItem.SourceFilePath.Contains("@"))
                {
                    (VEFModule.UnityContainer.Resolve(typeof(ILoggerService), "") as ILoggerService).Log("Filename contains no @animationName", LogCategory.Error, LogPriority.Medium);
                    return;
                }

                string animName = Path.GetFileNameWithoutExtension(sourceFileItem.SourceFilePath).Split('@')[1];

                string logfilename = "log.txt";
                //     string animname = "WalkBase";
                int start = Int32.MinValue; int stop = Int32.MaxValue; float rate = 0;

                DLL_FBXToOgre tmp = new DLL_FBXToOgre();
                tmp.Test_AddFBXAnimationToExisting(sourceFileItem.SourceFilePath,
                                                   Path.Combine(sourceFileItem.DestinationFolder, fileNameWithoutExtension + ".SKELETON"),
                                                   Path.Combine(sourceFileItem.DestinationFolder, fileNameWithoutExtension + ".MESH"),
                                                   logfilename,
                                                   animName, start, stop, rate);
            }
            else if (sourceFileItem.FileType == FileType.Script)
            {
            }
        }