下載下方Fix tool,即可解決因不正常移除所留下的垃圾資料與設定,其所造成新版本的安裝檔嘗試要移除舊版本而找不到相關安裝/移除程式
UserCredential credential;
using( var stream = new FileStream(System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "client_secrets.json"), FileMode.Open, FileAccess.Read) )
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { YouTubeService.Scope.Youtube, YouTubeService.Scope.YoutubeUpload },
"user",
CancellationToken.None,
new FileDataStore(System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "YoutubeCredential"))
);
}
youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = Assembly.GetExecutingAssembly().GetName().Name
});
var video = new Video();
video.Snippet = new VideoSnippet();
video.Snippet.Title = videoName;
video.Snippet.Description = videoName;
video.Snippet.Tags = new string[] { "LowRes", processingTag };
video.Snippet.CategoryId = conf.configMapper.ey_sec.ey_youtube_category;//"22"; See https://developers.google.com/youtube/v3/docs/videoCategories/list
video.Status = new VideoStatus();
video.Status.PrivacyStatus = conf.configMapper.ey_sec.ey_youtube_privacy; //"unlisted" or "private" or "public"
var filePath = target; // Replace with path to actual movie file.
try
{
using( var fileStream = new FileStream(filePath, FileMode.Open) )
{
var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", fileStream, "video/*");
const int KB = 0x400;
var minimumChunkSize = 256 * KB;
videosInsertRequest.ProgressChanged += videosInsertRequest_ProgressChanged;
videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived;
videosInsertRequest.ChunkSize = minimumChunkSize * 32;
await videosInsertRequest.UploadAsync();
}
}
catch(Exception ex)
{
logtext.Out("[YouTube Exception] " + ex.Message + ex.StackTrace);
}
var my_video_request = youtubeService.Videos.List("snippet, status");
my_video_request.Id = oldVideoID; // the Youtube video id of the video you want to update
my_video_request.MaxResults = 1;
var my_video_response = await my_video_request.ExecuteAsync();
if( my_video_response.Items.Count == 0 )
{
return;
}
var video = my_video_response.Items[0];
video.Snippet.Tags.Add(oldVersionTag);
if( video.Status.UploadStatus == "rejected" )
{
logtext.Out("[YouTube Info] Video upload status : " + video.Status.UploadStatus);
logtext.Out("[YouTube Info] Video upload reject reason : " + video.Status.RejectionReason);
}
// and tell the changes we want to youtube
var my_update_request = youtubeService.Videos.Update(video, "snippet, status");
my_update_request.Execute();
try
{
var my_video_request = youtubeService.Videos.List("snippet, status");
my_video_request.Id = oldVideoID; // the Youtube video id of the video you want to update
my_video_request.MaxResults = 1;
var my_video_response = await my_video_request.ExecuteAsync();
if( my_video_response.Items.Count != 0 )
{
logtext.Out("[Info ] Old VideoID [" + oldVideoID + "] is valid, then delete it.");
var my_update_request = youtubeService.Videos.Delete(oldVideoID);
my_update_request.Execute();
}
}
catch(Exception ex)
{
logtext.Out("[YouTube Exception] " + ex.Message + ex.StackTrace);
}
try
{
var channelsListRequest = youtubeService.Channels.List("contentDetails");
channelsListRequest.Mine = true;
var channelsListResponse = channelsListRequest.Execute();
foreach( var channel in channelsListResponse.Items )
{
var uploadsListId = channel.ContentDetails.RelatedPlaylists.Uploads;
var nextPageToken = "";
while( nextPageToken != null )
{
var playlistItemsListRequest = youtubeService.PlaylistItems.List("snippet");
playlistItemsListRequest.PlaylistId = uploadsListId;
playlistItemsListRequest.MaxResults = 50;
playlistItemsListRequest.PageToken = nextPageToken;
var playlistItemsListResponse = playlistItemsListRequest.Execute();
foreach( var playlistItem in playlistItemsListResponse.Items )
{
string id = playlistItem.Snippet.ResourceId.VideoId;
videoIDList.Add(id);
}
nextPageToken = playlistItemsListResponse.NextPageToken;
}
}
}
catch( Exception ex )
{
logtext.Out("[Exception] " + ex.Message + ex.StackTrace);
}
public static bool CheckFileInUse(Logs logtext, string filePath, int timeout)
{
if( !EFCS.FileExist(logtext, filePath, Conf.RUNNING_NO_CMD_MESSAGE) )
return false;
DateTime lastAT = System.IO.File.GetLastAccessTime(filePath);
DateTime createT = System.IO.File.GetCreationTime(filePath);
DateTime lastWT = System.IO.File.GetLastWriteTime(filePath);
DateTime nowT = DateTime.Now;
if( (nowT - lastAT).TotalSeconds < 0 ||
(nowT - createT).TotalSeconds < 0 ||
(nowT - lastWT).TotalSeconds < 0 )
{
System.IO.File.SetCreationTime(filePath, DateTime.Now);
System.IO.File.SetLastAccessTime(filePath, DateTime.Now);
System.IO.File.SetLastWriteTime(filePath, DateTime.Now);
}
lastAT = System.IO.File.GetLastAccessTime(filePath);
createT = System.IO.File.GetCreationTime(filePath);
lastWT = System.IO.File.GetLastWriteTime(filePath);
nowT = DateTime.Now;
if( (nowT - lastAT).TotalSeconds < timeout ||
(nowT - createT).TotalSeconds < timeout ||
(nowT - lastWT).TotalSeconds < timeout )
{
logtext.Out("[Info ] [" + filePath + "] creation/modification time interval < " + timeout + " secs");
return true;
}
return false;
}
此外,另增加了File Lock檢查
public static bool CheckLock(Logs logtext, string _strSourceFileName)
{
int i = 0;
bool bResult = true;
while( i < 20 )//Retry 20次
{
try
{
using( Stream stream = System.IO.File.Open(_strSourceFileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite) )
{
if( stream != null )
{
logtext.Out("[Info ] [" + _strSourceFileName + "] is ready.");
bResult = false;
break;
}
}
}
catch( FileNotFoundException ex )
{
logtext.Out("[Info ] [" + _strSourceFileName + "] is not ready. (" + ex.Message + ")");
bResult = true;
}
catch( IOException ex )
{
logtext.Out("[Info ] [" + _strSourceFileName + "] is not ready. (" + ex.Message + ")");
bResult = true;
}
catch( UnauthorizedAccessException ex )
{
logtext.Out("[Info ] [" + _strSourceFileName + "] is not ready. (" + ex.Message + ")");
bResult = true;
}
finally
{
i++;
System.Threading.Thread.Sleep(500);
}
}
return bResult;
}
find . -type f -size 0k -exec chmod 777 {} ;
find . -type f ! -perm 777;
namespace [專案名]
{
public class NHibernateHelper
{
private static ISessionFactory _sessionFactory;
private static ISessionFactory SessionFactory
{
get
{
if (_sessionFactory == null)
{
var configuration = new Configuration();
configuration.Configure();
_sessionFactory = configuration.BuildSessionFactory();
}
return _sessionFactory;
}
}
public static ISession OpenSession()
{
return SessionFactory.OpenSession();
}
}
}
<!--Start Code-->
<choose></choose>
<when condition="$(Platform) == 'x64'"></when>
<itemgroup></itemgroup><br />
<reference include="System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=AMD64"></reference>
<specificversion>False</specificversion>
<hintpath>..SQLiteX64System.Data.SQLite.DLL</hintpath>
<otherwise></otherwise>
<itemgroup></itemgroup>
<reference include="System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"></reference>
<specificversion>False</specificversion>
<hintpath>..SQLiteX86System.Data.SQLite.DLL</hintpath>
<!--End Code-->
copy "$(SolutionDir)xxx.xml" "$(TargetDir)xxx.xml"